[Asterisk-cvs] asterisk/apps app_senddtmf.c,1.7,1.8

markster at lists.digium.com markster at lists.digium.com
Thu Dec 30 19:34:50 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv29556/apps

Modified Files:
	app_senddtmf.c 
Log Message:
Merge anthm's senddtmf chagnes (bug #3193)


Index: app_senddtmf.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_senddtmf.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- app_senddtmf.c	22 Jun 2004 19:32:52 -0000	1.7
+++ app_senddtmf.c	31 Dec 2004 00:29:29 -0000	1.8
@@ -31,7 +31,7 @@
 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 @@
 {
 	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;
 }
 




More information about the svn-commits mailing list