### Eclipse Workspace Patch 1.0 #P asterisk-trunk Index: include/asterisk/file.h =================================================================== --- include/asterisk/file.h (revision 286867) +++ include/asterisk/file.h (working copy) @@ -44,6 +44,7 @@ #define AST_MAX_FORMATS 10 /*! Convenient for waiting */ +#define AST_DIGIT_NONE "" #define AST_DIGIT_ANY "0123456789#*ABCD" #define AST_DIGIT_ANYNUM "0123456789" Index: apps/app_sayunixtime.c =================================================================== --- apps/app_sayunixtime.c (revision 286867) +++ apps/app_sayunixtime.c (working copy) @@ -42,16 +42,23 @@ Says a specified time in a custom format. - + time, in seconds since Jan 1, 1970. May be negative. Defaults to now. - + timezone, see /usr/share/zoneinfo for a list. Defaults to machine default. - + a format the time is to be said in. See voicemail.conf. Defaults to ABdY "digits/at" IMp + + + + + Uses some of the sound files stored in /var/lib/asterisk/sounds to construct a phrase @@ -86,6 +93,20 @@ ***/ +enum { + OPT_JUMP = (1 << 0), +}; + +enum { + OPT_ARG_JUMP = 0, + /* note: this entry _MUST_ be the last one in the enum */ + OPT_ARG_ARRAY_SIZE, +}; + +AST_APP_OPTIONS(sayunixtime_exec_options, BEGIN_OPTIONS + AST_APP_OPTION_ARG('j', OPT_JUMP, OPT_ARG_JUMP), +END_OPTIONS ); + static char *app_sayunixtime = "SayUnixTime"; static char *app_datetime = "DateTime"; @@ -95,10 +116,15 @@ AST_APP_ARG(timeval); AST_APP_ARG(timezone); AST_APP_ARG(format); + AST_APP_ARG(options); ); char *parse; int res = 0; time_t unixtime; + //New default behavior is do not jump on key pressed + const char * haltondigits = AST_DIGIT_NONE; + struct ast_flags64 opts = { 0, }; + char *opt_args[OPT_ARG_ARRAY_SIZE]; if (!data) return 0; @@ -107,13 +133,21 @@ AST_STANDARD_APP_ARGS(args, parse); + //check if we had the 'j' jump flag in option list + if (!ast_strlen_zero(args.options)) { + ast_app_parse_options64(sayunixtime_exec_options, &opts, opt_args, args.options); + if (ast_test_flag64(&opts, OPT_JUMP)){ + haltondigits = AST_DIGIT_ANY; + } + } + ast_get_time_t(args.timeval, &unixtime, time(NULL), NULL); if (chan->_state != AST_STATE_UP) res = ast_answer(chan); if (!res) - res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY, + res = ast_say_date_with_format(chan, unixtime, haltondigits, chan->language, args.format, args.timezone); return res;