diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-03-30 07:00:49 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-03-30 07:00:49 +0000 |
commit | 40b6716991672d06b6cb1788a103d536bc6441e1 (patch) | |
tree | fa5877bfa683db723ebb58bb81fce978565ad76c /res/res_agi.c | |
parent | 47c004373a2c8612d275dc5312574108608723fa (diff) |
Add say date to AGi (bug #3768)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5305 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rwxr-xr-x | res/res_agi.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index 415c0edd5..3930d67e9 100755 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -613,6 +613,24 @@ static int handle_sayalpha(struct ast_channel *chan, AGI *agi, int argc, char *a return RESULT_FAILURE; } +static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, char *argv[]) +{ + int res; + int num; + if (argc != 4) + return RESULT_SHOWUSAGE; + if (sscanf(argv[2], "%i", &num) != 1) + return RESULT_SHOWUSAGE; + res = ast_say_date(chan, num, argv[3], chan->language); + if (res == 1) + return RESULT_SUCCESS; + fdprintf(agi->fd, "200 result=%d\n", res); + if (res >= 0) + return RESULT_SUCCESS; + else + return RESULT_FAILURE; +} + static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *argv[]) { int res; @@ -1355,6 +1373,14 @@ static char usage_sayalpha[] = " being pressed, or the ASCII numerical value of the digit if one was pressed or\n" " -1 on error/hangup.\n"; +static char usage_saydate[] = +" Usage: SAY DATE <date> <escape digits>\n" +" Say a given date, returning early if any of the given DTMF digits are\n" +" received on the channel. <date> is number of seconds elapsed since 00:00:00\n" +" on January 1, 1970, Coordinated Universal Time (UTC). Returns 0 if playback\n" +" 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_saytime[] = " Usage: SAY TIME <time> <escape digits>\n" " Say a given time, returning early if any of the given DTMF digits are\n" @@ -1429,6 +1455,7 @@ static agi_command commands[MAX_COMMANDS] = { { { "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", "date", NULL }, handle_saydate, "Says a given date", usage_saydate }, { { "say", "time", NULL }, handle_saytime, "Says a given time", usage_saytime }, { { "send", "image", NULL }, handle_sendimage, "Sends images to channels supporting it", usage_sendimage }, { { "send", "text", NULL }, handle_sendtext, "Sends text to channels supporting it", usage_sendtext }, |