add hits to tone detect

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10435 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2008-11-18 02:05:11 +00:00
parent f617384fca
commit bd03bfb066
4 changed files with 45 additions and 13 deletions
@@ -1148,14 +1148,15 @@ SWITCH_STANDARD_API(transfer_function)
return SWITCH_STATUS_SUCCESS;
}
#define TONE_DETECT_SYNTAX "<uuid> <key> <tone_spec> [<flags> <timeout> <app> <args>]"
#define TONE_DETECT_SYNTAX "<uuid> <key> <tone_spec> [<flags> <timeout> <app> <args> <hits>]"
SWITCH_STANDARD_API(tone_detect_session_function)
{
char *argv[7] = { 0 };
char *argv[8] = { 0 };
int argc;
char *mydata = NULL;
time_t to = 0;
switch_core_session_t *rsession;
int hits = 1;
if (!cmd) {
stream->write_function(stream, "-USAGE: %s\n", TONE_DETECT_SYNTAX);
@@ -1193,7 +1194,14 @@ SWITCH_STANDARD_API(tone_detect_session_function)
}
}
switch_ivr_tone_detect_session(rsession, argv[1], argv[2], argv[3], to, argv[5], argv[6]);
if (argv[7]) {
hits = atoi(argv[7]);
if (hits < 0) {
hits = 1;
}
}
switch_ivr_tone_detect_session(rsession, argv[1], argv[2], argv[3], to, hits, argv[5], argv[6]);
stream->write_function(stream, "+OK Enabling tone detection '%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
done:
+11 -3
View File
@@ -1189,7 +1189,7 @@ SWITCH_STANDARD_APP(stop_dtmf_session_generate_function)
SWITCH_STANDARD_APP(fax_detect_session_function)
{
switch_ivr_tone_detect_session(session, "fax", "1100.0", "r", 0, NULL, NULL);
switch_ivr_tone_detect_session(session, "fax", "1100.0", "r", 0, 1, NULL, NULL);
}
SWITCH_STANDARD_APP(system_session_function)
@@ -1202,10 +1202,11 @@ SWITCH_STANDARD_APP(system_session_function)
SWITCH_STANDARD_APP(tone_detect_session_function)
{
char *argv[6] = { 0 };
char *argv[7] = { 0 };
int argc;
char *mydata = NULL;
time_t to = 0;
int hits = 1;
if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID ARGS!\n");
@@ -1235,9 +1236,16 @@ SWITCH_STANDARD_APP(tone_detect_session_function)
}
}
if (argv[7]) {
hits = atoi(argv[7]);
if (hits < 0) {
hits = 1;
}
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enabling tone detection '%s' '%s'\n", argv[0], argv[1]);
switch_ivr_tone_detect_session(session, argv[0], argv[1], argv[2], to, argv[4], argv[5]);
switch_ivr_tone_detect_session(session, argv[0], argv[1], argv[2], to, hits, argv[4], argv[5]);
}
SWITCH_STANDARD_APP(stop_fax_detect_session_function)