get exported vars in originate thx moc

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15386 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-11-06 16:11:26 +00:00
parent e6e5f61069
commit 64482b06d2
2 changed files with 25 additions and 23 deletions

View File

@ -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);
}

View File

@ -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;