提交 dc1e8512 authored 作者: Dragos Oancea's avatar Dragos Oancea 提交者: Andrey Volk

FS-9264: FS-10976: fix detect_audio, detect_silence and wait_for_silence_function dialplan apps

(thanks Sergey KHripchenko and Hervé Déprez for pointing these out)
上级 d4a0040c
...@@ -4570,7 +4570,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function) ...@@ -4570,7 +4570,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function)
char *lbuf = NULL; char *lbuf = NULL;
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) 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]); thresh = atoi(argv[0]);
silence_hits = atoi(argv[1]); silence_hits = atoi(argv[1]);
listen_hits = atoi(argv[2]); listen_hits = atoi(argv[2]);
...@@ -4592,7 +4592,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function) ...@@ -4592,7 +4592,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function)
#define DETECT_AUDIO_SYNTAX "<threshold> <audio_hits> <timeout_ms> [<file>]" #define DETECT_AUDIO_SYNTAX "<threshold> <audio_hits> <timeout_ms> [<file>]"
SWITCH_STANDARD_APP(detect_audio_function) SWITCH_STANDARD_APP(detect_audio_function)
{ {
char *argv[5] = { 0 }; char *argv[4] = { 0 };
uint32_t thresh, audio_hits, timeout_ms = 0; uint32_t thresh, audio_hits, timeout_ms = 0;
int argc; int argc;
char *lbuf = NULL; char *lbuf = NULL;
...@@ -4603,12 +4603,8 @@ SWITCH_STANDARD_APP(detect_audio_function) ...@@ -4603,12 +4603,8 @@ SWITCH_STANDARD_APP(detect_audio_function)
audio_hits = atoi(argv[1]); audio_hits = atoi(argv[1]);
timeout_ms = atoi(argv[2]); timeout_ms = atoi(argv[2]);
if (argv[3]) {
timeout_ms = switch_atoui(argv[3]);
}
if (thresh > 0 && audio_hits > 0) { 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; return;
} }
...@@ -4620,7 +4616,7 @@ SWITCH_STANDARD_APP(detect_audio_function) ...@@ -4620,7 +4616,7 @@ SWITCH_STANDARD_APP(detect_audio_function)
#define DETECT_SILENCE_SYNTAX "<threshold> <silence_hits> <timeout_ms> [<file>]" #define DETECT_SILENCE_SYNTAX "<threshold> <silence_hits> <timeout_ms> [<file>]"
SWITCH_STANDARD_APP(detect_silence_function) SWITCH_STANDARD_APP(detect_silence_function)
{ {
char *argv[5] = { 0 }; char *argv[4] = { 0 };
uint32_t thresh, silence_hits, timeout_ms = 0; uint32_t thresh, silence_hits, timeout_ms = 0;
int argc; int argc;
char *lbuf = NULL; char *lbuf = NULL;
...@@ -4631,12 +4627,8 @@ SWITCH_STANDARD_APP(detect_silence_function) ...@@ -4631,12 +4627,8 @@ SWITCH_STANDARD_APP(detect_silence_function)
silence_hits = atoi(argv[1]); silence_hits = atoi(argv[1]);
timeout_ms = atoi(argv[2]); timeout_ms = atoi(argv[2]);
if (argv[3]) {
timeout_ms = switch_atoui(argv[3]);
}
if (thresh > 0 && silence_hits > 0) { 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; return;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论