From 9ec90012fb50700f01cdd1e47af65057247c34d0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 4 Oct 2007 20:30:59 +0000 Subject: [PATCH] small tweak git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5801 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_ivr_originate.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c53ba0ec4b..e6c65f4b95 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -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); 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) { table = &originate_state_handlers; } @@ -825,16 +833,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess done: *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 (caller_channel) { 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; } + + if (var_event) { + switch_event_destroy(&var_event); + } + return status; }