SayUnixTime application. More...
#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/say.h"
#include "asterisk/app.h"
Go to the source code of this file.
Functions | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Say time") | |
static int | load_module (void) |
static int | sayunixtime_exec (struct ast_channel *chan, const char *data) |
static int | unload_module (void) |
Variables | |
static char * | app_datetime = "DateTime" |
static char * | app_sayunixtime = "SayUnixTime" |
SayUnixTime application.
Definition in file app_sayunixtime.c.
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Say time" | ||||
) |
static int load_module | ( | void | ) | [static] |
Definition at line 136 of file app_sayunixtime.c.
References ast_register_application_xml, and sayunixtime_exec().
00137 { 00138 int res; 00139 00140 res = ast_register_application_xml(app_sayunixtime, sayunixtime_exec); 00141 res |= ast_register_application_xml(app_datetime, sayunixtime_exec); 00142 00143 return res; 00144 }
static int sayunixtime_exec | ( | struct ast_channel * | chan, | |
const char * | data | |||
) | [static] |
Definition at line 96 of file app_sayunixtime.c.
References ast_channel::_state, args, ast_answer(), AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, ast_get_time_t(), ast_say_date_with_format, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, format, and parse().
Referenced by load_module().
00097 { 00098 AST_DECLARE_APP_ARGS(args, 00099 AST_APP_ARG(timeval); 00100 AST_APP_ARG(timezone); 00101 AST_APP_ARG(format); 00102 ); 00103 char *parse; 00104 int res = 0; 00105 time_t unixtime; 00106 00107 if (!data) 00108 return 0; 00109 00110 parse = ast_strdupa(data); 00111 00112 AST_STANDARD_APP_ARGS(args, parse); 00113 00114 ast_get_time_t(args.timeval, &unixtime, time(NULL), NULL); 00115 00116 if (chan->_state != AST_STATE_UP) 00117 res = ast_answer(chan); 00118 00119 if (!res) 00120 res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY, 00121 chan->language, args.format, args.timezone); 00122 00123 return res; 00124 }
static int unload_module | ( | void | ) | [static] |
Definition at line 126 of file app_sayunixtime.c.
References ast_unregister_application().
00127 { 00128 int res; 00129 00130 res = ast_unregister_application(app_sayunixtime); 00131 res |= ast_unregister_application(app_datetime); 00132 00133 return res; 00134 }
char* app_datetime = "DateTime" [static] |
Definition at line 94 of file app_sayunixtime.c.
char* app_sayunixtime = "SayUnixTime" [static] |
Definition at line 93 of file app_sayunixtime.c.