diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-29 02:30:14 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-29 02:30:14 +0000 |
commit | ea132fd13c83ef62851e74a5afa441960a0cca30 (patch) | |
tree | 30fe504429e2388014832e4f050836d223fc2b59 /pbx.c | |
parent | fefa0442a5925353c6c06c1e7ebcb4126a66a746 (diff) |
Add support for French, Danish, Portuguese, Spanish, Italian, and Dutch numbers
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2809 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-x | pbx.c | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -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) |