]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9264: FS-10976: fix detect_audio, detect_silence and wait_for_silence_function...
authorDragos Oancea <dragos@signalwire.com>
Tue, 26 Mar 2019 22:39:04 +0000 (22:39 +0000)
committerAndrey Volk <andywolk@gmail.com>
Thu, 25 Jul 2019 20:22:08 +0000 (00:22 +0400)
(thanks Sergey KHripchenko and Hervé Déprez for pointing these out)

src/mod/applications/mod_dptools/mod_dptools.c

index 082a8f81c5b82c8cf6a4a29e184aaa6d6409e023..50601be2fca43d524f93c3ae1bee391d12f7abbe 100644 (file)
@@ -4570,7 +4570,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function)
        char *lbuf = NULL;
 
        if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
-               && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 3) {
+               && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) {
                thresh = atoi(argv[0]);
                silence_hits = atoi(argv[1]);
                listen_hits = atoi(argv[2]);
@@ -4592,7 +4592,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function)
 #define DETECT_AUDIO_SYNTAX "<threshold> <audio_hits> <timeout_ms> [<file>]"
 SWITCH_STANDARD_APP(detect_audio_function)
 {
-       char *argv[5] = { 0 };
+       char *argv[4] = { 0 };
        uint32_t thresh, audio_hits, timeout_ms = 0;
        int argc;
        char *lbuf = NULL;
@@ -4603,12 +4603,8 @@ SWITCH_STANDARD_APP(detect_audio_function)
                audio_hits = atoi(argv[1]);
                timeout_ms = atoi(argv[2]);
 
-               if (argv[3]) {
-                       timeout_ms = switch_atoui(argv[3]);
-               }
-
                if (thresh > 0 && audio_hits > 0) {
-                       switch_ivr_detect_audio(session, thresh, audio_hits, timeout_ms, argv[4]);
+                       switch_ivr_detect_audio(session, thresh, audio_hits, timeout_ms, argv[3]);
                        return;
                }
 
@@ -4620,7 +4616,7 @@ SWITCH_STANDARD_APP(detect_audio_function)
 #define DETECT_SILENCE_SYNTAX "<threshold> <silence_hits> <timeout_ms> [<file>]"
 SWITCH_STANDARD_APP(detect_silence_function)
 {
-       char *argv[5] = { 0 };
+       char *argv[4] = { 0 };
        uint32_t thresh, silence_hits, timeout_ms = 0;
        int argc;
        char *lbuf = NULL;
@@ -4631,12 +4627,8 @@ SWITCH_STANDARD_APP(detect_silence_function)
                silence_hits = atoi(argv[1]);
                timeout_ms = atoi(argv[2]);
 
-               if (argv[3]) {
-                       timeout_ms = switch_atoui(argv[3]);
-               }
-
                if (thresh > 0 && silence_hits > 0) {
-                       switch_ivr_detect_silence(session, thresh, silence_hits, timeout_ms, argv[4]);
+                       switch_ivr_detect_silence(session, thresh, silence_hits, timeout_ms, argv[3]);
                        return;
                }