diff options
author | jeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-03-24 03:48:18 +0000 |
---|---|---|
committer | jeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-03-24 03:48:18 +0000 |
commit | b1a191b50ac29186e71d8f4ba68d043334313270 (patch) | |
tree | f4e5fd6d98ca08ffbc39b94180a026b10f4f0c0b /apps/app_senddtmf.c | |
parent | 98f7b7bd9b026b57126801206afdf363176b01b5 (diff) |
check input for errors. Bug #435
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2543 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_senddtmf.c')
-rwxr-xr-x | apps/app_senddtmf.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c index 87b6cdcff..c2ca2c2f3 100755 --- a/apps/app_senddtmf.c +++ b/apps/app_senddtmf.c @@ -30,8 +30,9 @@ static char *app = "SendDTMF"; static char *synopsis = "Sends arbitrary DTMF digits"; static char *descrip = -" SendDTMF(digits): Sends DTMF digits on a channel. Returns 0 on success" -"or -1 on a hangup.\n"; +" SendDTMF(digits): Sends DTMF digits on a channel. \n" +" Accepted digits: 0-9, *#abcd\n" +" Returns 0 on success or -1 on a hangup.\n"; STANDARD_LOCAL_USER; @@ -45,7 +46,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) struct ast_frame f; int x; if (!digits || !strlen(digits)) { - ast_log(LOG_WARNING, "SendDTMF requires an argument (digits)\n"); + ast_log(LOG_WARNING, "SendDTMF requires an argument (digits or *#abcd)\n"); return -1; } LOCAL_USER_ADD(u); @@ -55,12 +56,17 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) f.subclass = digits[x]; f.src = "app_senddtmf"; res = ast_write(chan, &f); - if (res) + if (strchr("0123456789*#abcd",digits[x])==NULL) { + ast_log(LOG_WARNING, "Illegal DTMF character in string. (0-9*#abcd allowed)\n"); + } else { + res = ast_write(chan, &f); + if (res) break; - /* Wait 250ms */ - res = ast_safe_sleep(chan, 250); - if (res) + /* Wait 250ms */ + res = ast_safe_sleep(chan, 250); + if (res) break; + } } if (!res) if (option_verbose > 2) |