summaryrefslogtreecommitdiff
path: root/pbx.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-04-29 02:30:14 +0000
committerMark Spencer <markster@digium.com>2004-04-29 02:30:14 +0000
commit5192a1a054cbc856287be45b4152e4519efedccd (patch)
tree30fe504429e2388014832e4f050836d223fc2b59 /pbx.c
parent7e79c52808ea32ac2f70887e04cd155ba3df2f7b (diff)
Add support for French, Danish, Portuguese, Spanish, Italian, and Dutch numbers
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/pbx.c b/pbx.c
index 01aa0f6c2..85e5e0103 100755
--- a/pbx.c
+++ b/pbx.c
@@ -287,7 +287,7 @@ static struct pbx_builtin {
{ "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_gotoif(struct ast_channel *chan, void *data)
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)