From d4f2046712c9fd3ad958f5d9b2abcc26561577de Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 27 Jan 2009 14:34:10 +0000 Subject: [PATCH] FSSCRIPTS-14 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11505 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- scripts/aadir/aadir.js | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 47 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/scripts/aadir/aadir.js b/scripts/aadir/aadir.js index 0fc26d0322..3a27997202 100644 --- a/scripts/aadir/aadir.js +++ b/scripts/aadir/aadir.js @@ -57,7 +57,7 @@ function load_directory () re = /[^A-Z0-9\s]/gi; - for each (var variables in xdir.user.variables) { + for each (var variables in xdir.groups.group.users.user.variables) { name = ""; number = ""; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 07bff10657..3ad74d9121 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4282,7 +4282,54 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } } + if (sip->sip_replaces) { + nua_handle_t *bnh; + if ((bnh = nua_handle_by_replaces(nua, sip->sip_replaces))) { + sofia_private_t *b_private = NULL; + if ((b_private = nua_handle_magic(bnh))) { + switch_core_session_t *b_session = NULL; + if ((b_session = switch_core_session_locate(b_private->uuid))) { + switch_channel_t *b_channel = switch_core_session_get_channel(b_session); + const char *uuid; + int one_leg = 1; + if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + one_leg = 0; + } else { + uuid = switch_core_session_get_uuid(b_session); + } + + if (uuid) { + switch_core_session_t *c_session = NULL; + int do_conf = 0; + + if ((c_session = switch_core_session_locate(uuid))) { + switch_channel_t *c_channel = switch_core_session_get_channel(c_session); + if (!one_leg && !switch_channel_test_flag(b_channel, CF_HOLD)) { + char *ext = switch_core_session_sprintf(b_session, "conference:%s", uuid); + switch_channel_set_flag(c_channel, CF_REDIRECT); + switch_ivr_session_transfer(b_session, ext, "inline", NULL); + switch_ivr_session_transfer(c_session, ext, "inline", NULL); + switch_channel_clear_flag(c_channel, CF_REDIRECT); + do_conf = 1; + } + switch_core_session_rwunlock(c_session); + } + + if (do_conf) { + destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s", uuid); + } else { + destination_number = switch_core_session_sprintf(b_session, "answer,intercept:%s", uuid); + } + + dialplan = "inline"; + } + switch_core_session_rwunlock(b_session); + } + } + nua_handle_unref(bnh); + } + } check_decode(displayname, session); tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),