diff options
author | Mark Spencer <markster@digium.com> | 2004-12-31 00:29:29 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-12-31 00:29:29 +0000 |
commit | 9d49aa6573ab167b8795e31b0b41f2ca6ff12dbe (patch) | |
tree | 71fcbd7917a6de409da7615bea0dd84187a40c5c /apps/app_senddtmf.c | |
parent | 1b3af961434d2b144528d9342b9b4ce5259ab048 (diff) |
Merge anthm's senddtmf chagnes (bug #3193)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_senddtmf.c')
-rwxr-xr-x | apps/app_senddtmf.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c index f60ee65ea..c908ec7e9 100755 --- a/apps/app_senddtmf.c +++ b/apps/app_senddtmf.c @@ -31,7 +31,7 @@ static char *app = "SendDTMF"; static char *synopsis = "Sends arbitrary DTMF digits"; static char *descrip = -" SendDTMF(digits): Sends DTMF digits on a channel. \n" +" SendDTMF(digits[|timeout_ms]): Sends DTMF digits on a channel. \n" " Accepted digits: 0-9, *#abcd\n" " Returns 0 on success or -1 on a hangup.\n"; @@ -43,15 +43,24 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) { int res = 0; struct localuser *u; - char *digits = data; + char *digits = NULL, *to = NULL; + int timeout = 250; - if (!digits || ast_strlen_zero(digits)) { + if (data && !ast_strlen_zero(data) && (digits = ast_strdupa((char *)data))) { + if((to = strchr(digits,'|'))) { + *to = '\0'; + to++; + timeout = atoi(to); + } + LOCAL_USER_ADD(u); + if(timeout <= 0) + timeout = 250; + + res = ast_dtmf_stream(chan,NULL,digits,timeout); + LOCAL_USER_REMOVE(u); + } else { ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#aAbBcCdD)\n"); - return -1; } - LOCAL_USER_ADD(u); - res = ast_dtmf_stream(chan,NULL,digits,250); - LOCAL_USER_REMOVE(u); return res; } |