static switch_call_cause_t cause = SWITCH_CAUSE_NONE;
unsigned int timelimit = 60;
switch_channel_t *new_channel = NULL;
- switch_event_t *params = NULL;
+ switch_event_t *params = NULL, *var_event_orig = var_event;
char stupid[128] = "";
const char *skip = NULL, *var = NULL;
if (!strcasecmp(var, "dial-string")) {
dest = val;
- break;
+ } else if (!strncasecmp(var, "dial-var-", 9)) {
+ if (!var_event) {
+ switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
+ } else {
+ switch_event_del_header(var_event, var + 9);
+ }
+ switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
}
}
}
if (!strcasecmp(var, "dial-string")) {
dest = val;
- break;
+ } else if (!strncasecmp(var, "dial-var-", 9)) {
+ if (!var_event) {
+ switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
+ } else {
+ switch_event_del_header(var_event, var + 9);
+ }
+ switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
}
}
}
if (!strcasecmp(var, "dial-string")) {
dest = val;
- break;
+ } else if (!strncasecmp(var, "dial-var-", 9)) {
+ if (!var_event) {
+ switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
+ } else {
+ switch_event_del_header(var_event, var + 9);
+ }
+ switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
}
}
}
if (params) {
switch_event_destroy(¶ms);
}
+
+ if (var_event && var_event_orig != var_event) {
+ switch_event_destroy(&var_event);
+ }
switch_safe_free(user);
}
}
+ if (vars) { /* Parse parameters specified from the dialstring */
+ char *var_array[1024] = { 0 };
+ int var_count = 0;
+ if ((var_count = switch_separate_string(vars, ',', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) {
+ int x = 0;
+ for (x = 0; x < var_count; x++) {
+ char *inner_var_array[2] = { 0 };
+ int inner_var_count;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "variable string %d = [%s]\n", x, var_array[x]);
+ if ((inner_var_count =
+ switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) {
+ switch_event_del_header(var_event, inner_var_array[0]);
+ switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]);
+ }
+ }
+ }
+ }
+
if (oglobals.session) {
switch_event_header_t *hi;
const char *cdr_total_var;
}
- /* Copy all the applicable channel variables into the event */
+ /* Copy all the missing applicable channel variables from A-leg into the event */
if ((hi = switch_channel_variable_first(caller_channel))) {
for (; hi; hi = hi->next) {
int ok = 0;
ok = 1;
}
- if (ok) {
+ if (ok && !switch_event_get_header(var_event, hi->name)) {
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, (char *) hi->name, (char *) hi->value);
}
}
*/
}
- if (vars) { /* Parse parameters specified from the dialstring */
- char *var_array[1024] = { 0 };
- int var_count = 0;
- if ((var_count = switch_separate_string(vars, ',', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) {
- int x = 0;
- for (x = 0; x < var_count; x++) {
- char *inner_var_array[2] = { 0 };
- int inner_var_count;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "variable string %d = [%s]\n", x, var_array[x]);
- if ((inner_var_count =
- switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) {
- switch_event_del_header(var_event, inner_var_array[0]);
- switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]);
- }
- }
- }
- }
-
if (caller_channel) { /* ringback is only useful when there is an originator */
ringback_data = NULL;