MODAPP-271

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13247 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2009-05-07 02:05:16 +00:00
parent 3ac7d028cb
commit 418d602728
2 changed files with 46 additions and 24 deletions

View File

@ -2307,7 +2307,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
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;
@ -2357,7 +2357,13 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
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);
}
}
}
@ -2369,7 +2375,13 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
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);
}
}
}
@ -2381,7 +2393,13 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
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);
}
}
}
@ -2489,6 +2507,10 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
if (params) {
switch_event_destroy(&params);
}
if (var_event && var_event_orig != var_event) {
switch_event_destroy(&var_event);
}
switch_safe_free(user);

View File

@ -1006,6 +1006,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
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;
@ -1020,7 +1038,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
/* 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;
@ -1052,7 +1070,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
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);
}
}
@ -1071,24 +1089,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
*/
}
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;