]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3252 try latest patch with new option to set sip_execute_on_image to 't38_gateway...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 19 Apr 2011 15:50:09 +0000 (10:50 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 19 Apr 2011 15:50:09 +0000 (10:50 -0500)
src/mod/applications/mod_spandsp/mod_spandsp.c

index d9b9ff084a6de674098673bd7a7602f8db44d3d2..ecb660eabba6fe901052ebf079c22cd3ceb28d60 100644 (file)
@@ -80,23 +80,34 @@ SWITCH_STANDARD_APP(t38_gateway_function)
     switch_channel_t *channel = switch_core_session_get_channel(session);
     time_t timeout = switch_epoch_time_now(NULL) + 20;
     const char *var;
+    int argc = 0;
+    char *argv[2] = { 0 };
+    char *dupdata;
+    const char *direction = argv[0], *flags = argv[1];
+    
+    dupdata = switch_core_session_strdup(session, data);
+    argc = switch_split(dupdata, ' ', argv);
 
-    if (zstr(data) || strcasecmp(data, "self")) {
-        data = "peer";
+    if (zstr(direction) || strcasecmp(direction, "self")) {
+        direction = "peer";
     }
+    
+    switch_channel_set_variable(channel, "t38_leg", direction);
 
-    switch_channel_set_variable(channel, "t38_leg", data);
-
-    if ((var = switch_channel_get_variable(channel, "t38_gateway_detect_timeout"))) {
-        long to = atol(var);
-        if (to > -1) {
-            timeout = (time_t) (switch_epoch_time_now(NULL) + to);
-        } else {
-            switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s invalid timeout value.\n", switch_channel_get_name(channel));
+    if (!zstr(flags) && !strcasecmp(flags, "nocng")) {
+        t38_gateway_start(session, direction, NULL);
+    } else {
+        if ((var = switch_channel_get_variable(channel, "t38_gateway_detect_timeout"))) {
+            long to = atol(var);
+            if (to > -1) {
+                timeout = (time_t) (switch_epoch_time_now(NULL) + to);
+            } else {
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s invalid timeout value.\n", switch_channel_get_name(channel));
+            }
         }
+
+        switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start);        
     }
-    
-       switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, data, NULL, t38_gateway_start);
 }
 
 /**