#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/options.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 | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | load_module (void) |
static int | sayunixtime_exec (struct ast_channel *chan, void *data) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Say time" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } |
static char * | app_datetime = "DateTime" |
static char * | app_sayunixtime = "SayUnixTime" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static char * | datetime_descrip |
static char * | sayunixtime_descrip |
static char * | sayunixtime_synopsis = "Says a specified time in a custom format" |
Definition in file app_sayunixtime.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 126 of file app_sayunixtime.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 126 of file app_sayunixtime.c.
static int load_module | ( | void | ) | [static] |
Definition at line 116 of file app_sayunixtime.c.
References ast_register_application(), and sayunixtime_exec().
00117 { 00118 int res; 00119 00120 res = ast_register_application(app_sayunixtime, sayunixtime_exec, sayunixtime_synopsis, sayunixtime_descrip); 00121 res |= ast_register_application(app_datetime, sayunixtime_exec, sayunixtime_synopsis, datetime_descrip); 00122 00123 return res; 00124 }
static int sayunixtime_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 69 of file app_sayunixtime.c.
References ast_channel::_state, ast_answer(), AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, ast_get_time_t(), ast_module_user_add, ast_module_user_remove, ast_say_date_with_format, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_module_user::chan, format, ast_channel::language, and parse().
Referenced by load_module().
00070 { 00071 AST_DECLARE_APP_ARGS(args, 00072 AST_APP_ARG(timeval); 00073 AST_APP_ARG(timezone); 00074 AST_APP_ARG(format); 00075 ); 00076 char *parse; 00077 int res = 0; 00078 struct ast_module_user *u; 00079 time_t unixtime; 00080 00081 if (!data) 00082 return 0; 00083 00084 parse = ast_strdupa(data); 00085 00086 u = ast_module_user_add(chan); 00087 00088 AST_STANDARD_APP_ARGS(args, parse); 00089 00090 ast_get_time_t(args.timeval, &unixtime, time(NULL), NULL); 00091 00092 if (chan->_state != AST_STATE_UP) 00093 res = ast_answer(chan); 00094 00095 if (!res) 00096 res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY, 00097 chan->language, args.format, args.timezone); 00098 00099 ast_module_user_remove(u); 00100 00101 return res; 00102 }
static int unload_module | ( | void | ) | [static] |
Definition at line 104 of file app_sayunixtime.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00105 { 00106 int res; 00107 00108 res = ast_unregister_application(app_sayunixtime); 00109 res |= ast_unregister_application(app_datetime); 00110 00111 ast_module_user_hangup_all(); 00112 00113 return res; 00114 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Say time" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 126 of file app_sayunixtime.c.
char* app_datetime = "DateTime" [static] |
Definition at line 47 of file app_sayunixtime.c.
char* app_sayunixtime = "SayUnixTime" [static] |
Definition at line 46 of file app_sayunixtime.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 126 of file app_sayunixtime.c.
char* datetime_descrip [static] |
Definition at line 59 of file app_sayunixtime.c.
char* sayunixtime_descrip [static] |
Definition at line 51 of file app_sayunixtime.c.
char* sayunixtime_synopsis = "Says a specified time in a custom format" [static] |
Definition at line 49 of file app_sayunixtime.c.