[Asterisk-cvs] asterisk channel.c,1.104,1.105 pbx.c,1.115,1.116 say.c,1.18,1.19

markster at lists.digium.com markster at lists.digium.com
Wed Apr 28 22:23:33 CDT 2004


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

Modified Files:
	channel.c pbx.c say.c 
Log Message:
Add support for French, Danish, Portuguese, Spanish, Italian, and Dutch numbers


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- channel.c	27 Apr 2004 21:21:57 -0000	1.104
+++ channel.c	29 Apr 2004 02:30:14 -0000	1.105
@@ -2350,12 +2350,12 @@
 		res=ast_streamfile(chan,"vm-youhave",chan->language);
 		res = ast_waitstream(chan, "");
 		if(min) {
-			res = ast_say_number(chan,min, AST_DIGIT_ANY, chan->language);
+			res = ast_say_number(chan,min, AST_DIGIT_ANY, chan->language, (char *) NULL);
 			res=ast_streamfile(chan,"minutes",chan->language);
 			res = ast_waitstream(chan, "");
 		}
 		if(sec) {
-			res = ast_say_number(chan,sec, AST_DIGIT_ANY, chan->language);
+			res = ast_say_number(chan,sec, AST_DIGIT_ANY, chan->language, (char *) NULL);
 			res=ast_streamfile(chan,"seconds",chan->language);
 			res = ast_waitstream(chan, "");
 		}

Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- pbx.c	26 Apr 2004 03:02:49 -0000	1.115
+++ pbx.c	29 Apr 2004 02:30:14 -0000	1.116
@@ -287,7 +287,7 @@
 
 	{ "SayNumber", pbx_builtin_saynumber,
 "Say Number",
-"  SayNumber(digits): Says the passed number\n" },
+"  SayNumber(digits[,gender]): Says the passed number\n" },
 
 	{ "SayDigits", pbx_builtin_saydigits,
 "Say Digits",
@@ -4568,9 +4568,29 @@
 static int pbx_builtin_saynumber(struct ast_channel *chan, void *data)
 {
 	int res = 0;
-	if (data && atoi((char *)data) )
-		res = ast_say_number(chan, atoi((char *)data), "", chan->language);
-	return res;
+	char tmp[256];
+	char *number = (char *) NULL;
+	char *options = (char *) NULL;
+
+	
+	if (!data || !strlen((char *)data)) {
+                ast_log(LOG_WARNING, "SayNumber requires an argument (number)\n");
+                return -1;
+        }
+        strncpy(tmp, (char *)data, sizeof(tmp)-1);
+        number=tmp;
+        strsep(&number, "|");
+        options = strsep(&number, "|");
+        if (options) { 
+		if ( strcasecmp(options, "f") && strcasecmp(options,"m") && 
+			strcasecmp(options, "c") && strcasecmp(options, "n") ) {
+                   ast_log(LOG_WARNING, "SayNumber gender option is either 'f', 'm', 'c' or 'n'\n");
+                   return -1;
+		}
+	}
+
+
+	return res = ast_say_number(chan, atoi((char *) tmp), "", chan->language, options);
 }
 
 static int pbx_builtin_saydigits(struct ast_channel *chan, void *data)

Index: say.c
===================================================================
RCS file: /usr/cvsroot/asterisk/say.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- say.c	28 Apr 2004 20:37:52 -0000	1.18
+++ say.c	29 Apr 2004 02:30:14 -0000	1.19
@@ -25,6 +25,10 @@
 #include "asterisk.h"
 #include <stdio.h>
 
+
+/* Forward declaration */
+static int wait_file(struct ast_channel *chan, char *ints, char *file, char *lang);
+
 int ast_say_digit_str(struct ast_channel *chan, char *fn2, char *ints, char *lang)
 {
 	/* XXX Merge with full version? XXX */
@@ -87,22 +91,95 @@
[...970 lines suppressed...]
 		if (!res)
 			res = ast_streamfile(chan, "digits/oclock", lang);
@@ -638,7 +1359,7 @@
 	if (!res)
 		res = ast_waitstream(chan, ints);
 	if (!res)
-		res = ast_say_number(chan, tm.tm_year + 1900, ints, lang);
+		res = ast_say_number(chan, tm.tm_year + 1900, ints, lang, (char *) NULL);
 	return res;
 }
 
@@ -665,7 +1386,7 @@
 				res = ast_waitstream(chan, ints);
 		}
 		if (!res)
-			res = ast_say_number(chan, tm.tm_mday, ints, lang);
+			res = ast_say_number(chan, tm.tm_mday, ints, lang, (char *) NULL);
 
 	} else if (daydiff) {
 		/* Just what day of the week */




More information about the svn-commits mailing list