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 committed 2009-11-06 16:11:26 +00:00
1 parent e6e5f61069
commit 64482b06d2
2 files changed
+25 -23

No files matched your search

+24
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;