From b8a9e7558fb6c6e817222c09e346d91ca085776c Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Wed, 30 Mar 2005 07:00:49 +0000 Subject: [PATCH] Add say date to AGi (bug #3768) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5305 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_agi.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/res/res_agi.c b/res/res_agi.c index 415c0edd5f..3930d67e9d 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 \n" +" Say a given date, returning early if any of the given DTMF digits are\n" +" received on the channel. 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