small tweak

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5801 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-04 20:30:59 +00:00
parent f82e478cb5
commit 9ec90012fb
1 changed files with 13 additions and 10 deletions

View File

@ -535,6 +535,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
peer_channels[i] = switch_core_session_get_channel(new_session); peer_channels[i] = switch_core_session_get_channel(new_session);
assert(peer_channels[i] != NULL); assert(peer_channels[i] != NULL);
if (var_event) {
switch_event_header_t *header;
/* install the vars from the {} params */
for (header = var_event->headers; header; header = header->next) {
switch_channel_set_variable(peer_channels[i], header->name, header->value);
}
}
if (!table) { if (!table) {
table = &originate_state_handlers; table = &originate_state_handlers;
} }
@ -825,16 +833,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
done: done:
*cause = SWITCH_CAUSE_UNALLOCATED; *cause = SWITCH_CAUSE_UNALLOCATED;
if (var_event) {
if (peer_channel && !caller_channel) { /* install the vars from the {} params */
switch_event_header_t *header;
for (header = var_event->headers; header; header = header->next) {
switch_channel_set_variable(peer_channel, header->name, header->value);
}
}
switch_event_destroy(&var_event);
}
if (status == SWITCH_STATUS_SUCCESS) { if (status == SWITCH_STATUS_SUCCESS) {
if (caller_channel) { if (caller_channel) {
switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted"); switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted");
@ -918,5 +916,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
*bleg = NULL; *bleg = NULL;
} }
if (var_event) {
switch_event_destroy(&var_event);
}
return status; return status;
} }