diff --git a/src/switch_core_session.c b/src/switch_core_session.c index a3022dde27..8081171c6a 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -447,7 +447,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } if (channel) { - const char *export_vars, *val; + const char *val; switch_codec_t *vid_read_codec = NULL, *read_codec = switch_core_session_get_read_codec(session); const char *max_forwards = switch_core_session_sprintf(session, "%d", forwardval); @@ -475,28 +475,6 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session)); switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(*new_session)); - /* A comma (,) separated list of variable names that should ne propagated from originator to originatee */ - if ((export_vars = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE))) { - char *cptmp = switch_core_session_strdup(session, export_vars); - int argc; - char *argv[256]; - - if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { - int x; - - for (x = 0; x < argc; x++) { - const char *vval; - if ((vval = switch_channel_get_variable(channel, argv[x]))) { - char *vvar = argv[x]; - if (!strncasecmp(vvar, "nolocal:", 8)) { - vvar += 8; - } - switch_channel_set_variable(peer_channel, vvar, vval); - } - } - } - } - if ((val = switch_channel_get_variable(channel, SWITCH_PROCESS_CDR_VARIABLE))) { switch_channel_set_variable(peer_channel, SWITCH_PROCESS_CDR_VARIABLE, val); } diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 417ff2d217..ff8d0b699c 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1193,6 +1193,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess int local_clobber = 0; const char *cancel_key = NULL; const char *holding = NULL; + const char *export_vars = NULL; oglobals.ringback_ok = 1; @@ -1322,6 +1323,29 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + /* A comma (,) separated list of variable names that should ne propagated from originator to originatee */ + if ((export_vars = switch_channel_get_variable(caller_channel, SWITCH_EXPORT_VARS_VARIABLE))) { + char *cptmp = switch_core_session_strdup(session, export_vars); + int argc; + char *argv[256]; + + if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { + int x; + + for (x = 0; x < argc; x++) { + const char *vval; + if ((vval = switch_channel_get_variable(caller_channel, argv[x]))) { + char *vvar = argv[x]; + if (!strncasecmp(vvar, "nolocal:", 8)) { + vvar += 8; + } + switch_event_del_header(var_event, vvar); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, vvar, vval); + } + } + } + } + if (vars) { /* Parse parameters specified from the dialstring */ char *var_array[1024] = { 0 }; int var_count = 0;