aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_agi.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-03 00:54:16 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-03 00:54:16 +0000
commitddca191dd31cb7fdb3076a34ddbc9389127e3208 (patch)
treec0f02df20bee0b5575cee77409b55f0e9bdb91f1 /apps/app_agi.c
parent75a0cc8b77f46f8e6017b158d60c24abfd73aa89 (diff)
Add SayPhonetic and SayAlpha applications (bug #793)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2864 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_agi.c')
-rwxr-xr-xapps/app_agi.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/app_agi.c b/apps/app_agi.c
index 98021fecf..14fa27e49 100755
--- a/apps/app_agi.c
+++ b/apps/app_agi.c
@@ -385,10 +385,12 @@ static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, char *
{
int res;
int num;
+
if (argc != 4)
return RESULT_SHOWUSAGE;
if (sscanf(argv[2], "%i", &num) != 1)
return RESULT_SHOWUSAGE;
+
res = ast_say_digit_str_full(chan, argv[2], argv[3], chan->language, agi->audio, agi->ctrl);
if (res == 1) /* New command */
return RESULT_SUCCESS;
@@ -417,6 +419,23 @@ static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *ar
return RESULT_FAILURE;
}
+static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+{
+ int res;
+
+ if (argc != 4)
+ return RESULT_SHOWUSAGE;
+
+ res = ast_say_phonetic_str_full(chan, argv[2], argv[3], chan->language, agi->audio, agi->ctrl);
+ if (res == 1) /* New command */
+ return RESULT_SUCCESS;
+ fdprintf(agi->fd, "200 result=%d\n", res);
+ if (res >= 0)
+ return RESULT_SUCCESS;
+ else
+ return RESULT_FAILURE;
+}
+
static int handle_getdata(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
{
int res;
@@ -1031,6 +1050,13 @@ static char usage_saytime[] =
" completes without a digit being pressed, or the ASCII numerical value of the\n"
" digit if one was pressed or -1 on error/hangup.\n";
+static char usage_sayphonetic[] =
+" Usage: SAY PHONETIC <string> <escape digits>\n"
+" Say a given character string with phonetics, returning early if any of the given DTMF digits\n"
+" are received on the channel. Returns 0 if playback completes without a digit\n"
+" being pressed, or the ASCII numerical value of the digit if one was pressed or\n"
+" -1 on error/hangup.\n";
+
static char usage_getdata[] =
" Usage: GET DATA <file to be streamed> [timeout] [max digits]\n"
" Stream the given file, and recieve DTMF data. Returns the digits recieved\n"
@@ -1080,6 +1106,7 @@ static agi_command commands[] = {
{ { "send", "image", NULL }, handle_sendimage, "Sends images to channels supporting it", usage_sendimage },
{ { "say", "digits", NULL }, handle_saydigits, "Says a given digit string", usage_saydigits },
{ { "say", "number", NULL }, handle_saynumber, "Says a given number", usage_saynumber },
+ { { "say", "phonetic", NULL }, handle_sayphonetic, "Says a given character string with phonetics", usage_sayphonetic },
{ { "say", "time", NULL }, handle_saytime, "Says a given time", usage_saytime },
{ { "get", "data", NULL }, handle_getdata, "Gets data on a channel", usage_getdata },
{ { "set", "context", NULL }, handle_setcontext, "Sets channel context", usage_setcontext },