[Home]

Summary:ASTERISK-00272: [patch] Request App: SayTime
Reporter:John Todd (jtodd)Labels:
Date Opened:2003-09-14 19:05:03Date Closed:2004-09-25 02:21:17
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_sayunixtime.c
( 1) app_sayunixtime.c
Description:A request for a short application that says a date and time in a configurable manner.

****** ADDITIONAL INFORMATION ******

application: SayTime

[Synopsis]:
 Says the date given in the specified format and timezone

[Description]
 SayTime([time[|[format][|[zone][|options]]]):  Takes the given time (UNIX seconds) and announces it in "long" form which is understandable to the listener, with optional formatting and timezone data.  Standard language localization is honored.  If the keyword "now" is used, use the current time as the time argument.

  If no format is specified, the default format is "HABd".  For a short example of format options, see voicemail.conf.

  Timezones are those used by strftime (examples: see /usr/share/zoneinfo).  Default timezone is whatever the system is set to use.

  The "b" option treats the application as a "background" application, meaning that the user can press DTMF keys during playback and they will be interpreted as they are with the Background application.  Common usage would be for being able to "skip" over a date announcement with a keypress.

Example: SayTime(now)
 if 19:44 GMT, and the system timezone was GMT, would say: "Nineteen fourty-four, Saturday, September fourteenth"

Example:  SayTime(1063529070|IMp|US/Eastern)
 would say: "Four forty-four PM"

Example:  SayTime(1063529070)
 would say (on a machine set to GMT): "Nineteen fourty-four, Saturday, September fourteenth"

Example:  SayTime(1063529070||US/Eastern|b)
 would say "Sixteen forty-four, Saturday, September fourteenth" but would allow the user to hit a digit to escape from the date readback
Comments:By: John Todd (jtodd) 2003-09-15 13:55:44

From: Tilghman Lesher <tilghman@mail.jeffandtilghman.com>
To: asterisk-dev@lists.digium.com
Subject: Re: [Asterisk-Dev] PATCH: added SAY TIME to AGI Interface
Reply-To: asterisk-dev@lists.digium.com
Date: Mon, 15 Sep 2003 01:28:39 -0500

On Sunday 14 September 2003 15:50, John Todd wrote:
> Here is my idea (modify as anyone sees fit):
>
> application: SayTime
>
> [Synopsis]:
>    Says the date given in the specified format and timezone
>
> [Description]
>    SayTime(time[|[format][|[zone][|options]]):  Takes the given time
> (UNIX seconds) and announces it in "long" form which is
> understandable to the listener, with optional formatting and timezone
> data.  Standard language localization is honored.
>
>     If no format is specified, the default format is "HABd".  For a
> short example of format options, see voicemail.conf.

Given that the default format in voicemailmain2 is "q", that should also
be the default format here.

>     Timezones are those used by strftime (examples: see
> /usr/share/zoneinfo).  Default timezone is whatever the system is set
> to use.

aka pass a NULL.

>     The "b" option treats the application as a "background"
> application, meaning that the user can press DTMF keys during
> playback and they will be interpreted as they are with the Background
> application.  Common usage would be for being able to "skip" over a
> date announcement with a keypress.

Actually, it should already be this way (I think).  Any DTMF should
interrupt the playback.

> Example:  SayTime(1063529070|IMp|US/Eastern)
>    would say: "Four forty-four PM"
>
> Example:  SayTime(1063529070)
>    would say (on a machine set to GMT): "Nineteen fourty-four,
> Saturday, September fourteenth"
>
> Example:  SayTime(1063529070||US/Eastern|b)
>    would say "Sixteen forty-four, Saturday, September fourteenth" but
> would allow the user to hit a digit to escape from the date readback

-Tilghman

By: John Todd (jtodd) 2003-09-15 13:57:59

On Tilghman's notes:
1) OK, I'm fine with "q" as the default value, if that's what's built into say.c

2) I am uncertain if the default behavior should accept DTMF - I am still in favor of having that as a specifiable switch when calling the app.  Often one may have circumstances where the playback should not be in "Background" mode, and having that behavior by default opens up lots of security problems, or requires a lot more context separations to "isolate" the application from possible unintentional jumping.

By: John Todd (jtodd) 2003-09-28 00:08:52

This does work as advertised, and is really cool.  Thanks, Tilghman!  Mark, this is ready for addition, as far as I can see, and is very useful for those of us that store timestamps with the ${EPOCH} variable.  Tested with a variety of formats, but it should pretty much hinge on the internal say.c stuff for timezones/time methods.

By: John Todd (jtodd) 2003-09-29 02:41:08

As far as I can tell, this is ready for CVS integration.

By: otmar (otmar) 2003-09-30 05:01:15

Just a a comment: voicemail2 has its own routines for announcing the date of a message. Could we do some code-sharing between these two applications?

By: Tilghman Lesher (tilghman) 2003-09-30 15:46:11

We're way ahead of you.  That code is shared in say.c and committed two weeks ago.

By: Mark Spencer (markster) 2003-09-30 17:58:59

Added to CVS, thanks!