]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4674 moved higher up into the init state to catch vars set during originate
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 19 Oct 2012 17:16:44 +0000 (13:16 -0400)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 19 Oct 2012 17:16:44 +0000 (13:16 -0400)
src/mod/endpoints/mod_loopback/mod_loopback.c
src/switch_core_media_bug.c

index f5a2046fb6bbd882360564c40cf2de2b5eff5b0d..8835cc05a15a88f4dc03e2dfc20b1b61ec60c081 100644 (file)
@@ -227,6 +227,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
        char name[128];
        switch_caller_profile_t *caller_profile;
        switch_event_t *vars = NULL;
+       const char *var;
 
        tech_pvt = switch_core_session_get_private(session);
        switch_assert(tech_pvt != NULL);
@@ -296,6 +297,29 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
                        switch_event_destroy(&vars);
                }
 
+               if ((var = switch_channel_get_variable(channel, "loopback_export"))) {
+                       int argc = 0;
+                       char *argv[128] = { 0 };
+                       char *dup = switch_core_session_strdup(session, var);
+
+                       if ((argc = switch_split(dup, ',', argv))) {
+                               int i;
+                               for (i = 0; i < argc; i++) {
+                                       
+                                       if (!zstr(argv[i])) {
+                                               const char *val = switch_channel_get_variable(channel, argv[i]);
+
+                                               if(!zstr(val)) {
+                                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer variable [%s]=[%s] %s -> %s\n",
+                                                                                         argv[i], val, switch_channel_get_name(channel), switch_channel_get_name(tech_pvt->other_channel));
+                                                                                         
+                                                       switch_channel_set_variable(tech_pvt->other_channel, argv[i], val);
+                                               }
+                                       }
+                               }
+                       }
+               }
+
                if (switch_test_flag(tech_pvt, TFLAG_APP)) {
                        switch_set_flag(b_tech_pvt, TFLAG_APP);
                        switch_clear_flag(tech_pvt, TFLAG_APP);
@@ -996,24 +1020,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                }
 
                if (switch_event_dup(&clone, var_event) == SWITCH_STATUS_SUCCESS) {
-                       const char *var;
-                       
-                       if (ochannel && (var = switch_channel_get_variable(ochannel, "loopback_export"))) {
-                               int argc = 0;
-                               char *argv[128] = { 0 };
-                               char *dup = switch_core_session_strdup(session, var);
-
-                               if ((argc = switch_split(dup, ',', argv))) {
-                                       int i;
-                                       for (i = 0; i < argc; i++) {
-                                               if (!zstr(argv[i])) {
-                                                       const char *val = switch_channel_get_variable(ochannel, argv[i]);
-                                                       switch_event_add_header_string(clone, SWITCH_STACK_BOTTOM, argv[i], val);
-                                               }
-                                       }
-                               }
-                       }
-
                        switch_channel_set_private(channel, "__loopback_vars__", clone);
                }
 
index 19462b98b41be48ac4c0bec2cddac164de1fb74b..f5c57721ad51c9b6ffb14e9438350d6692d953a5 100644 (file)
@@ -572,7 +572,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch
                switch_thread_rwlock_unlock(orig_session->bug_rwlock);
 
                for(i = 0; i < x; i++) {
-                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(orig_session), SWITCH_LOG_CRIT, "Transfering %s from %s to %s\n", list[i],
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(orig_session), SWITCH_LOG_DEBUG, "Transfering %s from %s to %s\n", list[i],
                                                          switch_core_session_get_name(orig_session), switch_core_session_get_name(new_session));
                        switch_ivr_stop_record_session(orig_session, list[i]);
                        switch_ivr_record_session(new_session, list[i], stop_times[i], NULL);