]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
small tweak
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 4 Oct 2007 20:30:59 +0000 (20:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 4 Oct 2007 20:30:59 +0000 (20:30 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5801 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_originate.c

index c53ba0ec4b5541c48d6415abf3a556158b0817a7..e6c65f4b95ff2505939017f6dac996dd5f98c580 100644 (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);
                                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;
 }