From fb1d45b4bbaea4b483124f48435425d5576e91cf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 28 Mar 2012 12:43:13 -0500 Subject: [PATCH] FS-4049 try this --- src/switch_ivr_originate.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 0337f1275b..df34ebf9b9 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -96,6 +96,7 @@ typedef struct { typedef struct { switch_core_session_t *session; + switch_core_session_t *osession; int32_t idx; uint32_t hups; char *file; @@ -1770,6 +1771,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess oglobals.error_file = NULL; switch_core_new_memory_pool(&oglobals.pool); + if ((flags & SOF_ENTERPRISE)) { + if (session) { + oglobals.osession = session; + session = NULL; + } + } + if (caller_profile_override) { oglobals.caller_profile_override = switch_caller_profile_dup(oglobals.pool, caller_profile_override); } else if (session) { @@ -1780,6 +1788,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + if (session) { const char *to_var, *bypass_media = NULL, *proxy_media = NULL; caller_channel = switch_core_session_get_channel(session); @@ -2452,7 +2461,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } - reason = switch_core_session_outgoing_channel(oglobals.session, originate_var_event, chan_type, + reason = switch_core_session_outgoing_channel(oglobals.osession, originate_var_event, chan_type, new_profile, &new_session, NULL, myflags, cancel_cause); switch_event_destroy(&originate_var_event); @@ -2711,11 +2720,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess soft_holding = switch_channel_get_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE); } - if ((flags & SOF_ENTERPRISE)) { - session = oglobals.session = NULL; - caller_channel = NULL; - } - while ((!caller_channel || switch_channel_ready(caller_channel) || switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) && check_channel_status(&oglobals, originate_status, and_argc)) {