]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4674 add loopback_export for a list of channel vars to pass from loopback-a to...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 2 Oct 2012 16:02:42 +0000 (11:02 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 2 Oct 2012 16:02:42 +0000 (11:02 -0500)
src/mod/endpoints/mod_loopback/mod_loopback.c

index e2a2c3daab0c29034ce045eb9423033facd906a4..e8a8ab8c18ea80e5331c8cce4c64543ee810845c 100644 (file)
@@ -992,6 +992,24 @@ 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 ((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]);
+                                                       switch_event_add_header_string(clone, SWITCH_STACK_BOTTOM, argv[i], val);
+                                               }
+                                       }
+                               }
+                       }
+
                        switch_channel_set_private(channel, "__loopback_vars__", clone);
                }