mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-26 22:30:28 +00:00 
			
		
		
		
	check input for errors. Bug #435
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -30,8 +30,9 @@ static char *app = "SendDTMF"; | |||||||
| static char *synopsis = "Sends arbitrary DTMF digits"; | static char *synopsis = "Sends arbitrary DTMF digits"; | ||||||
|  |  | ||||||
| static char *descrip =  | static char *descrip =  | ||||||
| "  SendDTMF(digits): Sends DTMF digits on a channel.  Returns 0 on success" | "  SendDTMF(digits): Sends DTMF digits on a channel. \n" | ||||||
| "or -1 on a hangup.\n"; | "  Accepted digits: 0-9, *#abcd\n" | ||||||
|  | " Returns 0 on success or -1 on a hangup.\n"; | ||||||
|  |  | ||||||
| STANDARD_LOCAL_USER; | STANDARD_LOCAL_USER; | ||||||
|  |  | ||||||
| @@ -45,7 +46,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) | |||||||
| 	struct ast_frame f; | 	struct ast_frame f; | ||||||
| 	int x; | 	int x; | ||||||
| 	if (!digits || !strlen(digits)) { | 	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; | 		return -1; | ||||||
| 	} | 	} | ||||||
| 	LOCAL_USER_ADD(u); | 	LOCAL_USER_ADD(u); | ||||||
| @@ -54,6 +55,10 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) | |||||||
| 		f.frametype = AST_FRAME_DTMF; | 		f.frametype = AST_FRAME_DTMF; | ||||||
| 		f.subclass = digits[x]; | 		f.subclass = digits[x]; | ||||||
| 		f.src = "app_senddtmf"; | 		f.src = "app_senddtmf"; | ||||||
|  | 		res = ast_write(chan, &f); | ||||||
|  | 		 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); |                   res = ast_write(chan, &f); | ||||||
| 		  if (res) | 		  if (res) | ||||||
| 			break; | 			break; | ||||||
| @@ -62,6 +67,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) | |||||||
| 		  if (res) | 		  if (res) | ||||||
| 			break; | 			break; | ||||||
| 	       } | 	       } | ||||||
|  | 	} | ||||||
| 	if (!res) | 	if (!res) | ||||||
| 		if (option_verbose > 2) | 		if (option_verbose > 2) | ||||||
| 			ast_verbose(VERBOSE_PREFIX_3 "Sent digit string '%s' on %s\n", digits, chan->name); | 			ast_verbose(VERBOSE_PREFIX_3 "Sent digit string '%s' on %s\n", digits, chan->name); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user