Fri Jul 24 00:41:14 2009

Asterisk developer's documentation


app_sayunixtime.c File Reference

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

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 , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, }
static char * app_datetime = "DateTime"
static char * app_sayunixtime = "SayUnixTime"
static struct ast_module_infoast_module_info = &__mod_info
static char * datetime_descrip
static char * sayunixtime_descrip
static char * sayunixtime_synopsis = "Says a specified time in a custom format"


Detailed Description

SayUnixTime application.

Author:
Tilghman Lesher <app_sayunixtime__200309@the-tilghman.com>

Definition in file app_sayunixtime.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 112 of file app_sayunixtime.c.

static void __unreg_module ( void   )  [static]

Definition at line 112 of file app_sayunixtime.c.

static int load_module ( void   )  [static]

Definition at line 102 of file app_sayunixtime.c.

References ast_register_application, and sayunixtime_exec().

static int sayunixtime_exec ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 62 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_say_date_with_format, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, chan, format, ast_channel::language, and parse().

Referenced by load_module().

00063 {
00064    AST_DECLARE_APP_ARGS(args,
00065       AST_APP_ARG(timeval);
00066       AST_APP_ARG(timezone);
00067       AST_APP_ARG(format);
00068    );
00069    char *parse;
00070    int res = 0;
00071    time_t unixtime;
00072    
00073    if (!data)
00074       return 0;
00075 
00076    parse = ast_strdupa(data);
00077 
00078    AST_STANDARD_APP_ARGS(args, parse);
00079 
00080    ast_get_time_t(args.timeval, &unixtime, time(NULL), NULL);
00081 
00082    if (chan->_state != AST_STATE_UP)
00083       res = ast_answer(chan);
00084 
00085    if (!res)
00086       res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY,
00087                       chan->language, args.format, args.timezone);
00088 
00089    return res;
00090 }

static int unload_module ( void   )  [static]

Definition at line 92 of file app_sayunixtime.c.

References ast_unregister_application().

00093 {
00094    int res;
00095    
00096    res = ast_unregister_application(app_sayunixtime);
00097    res |= ast_unregister_application(app_datetime);
00098    
00099    return res;
00100 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static]

Definition at line 112 of file app_sayunixtime.c.

char* app_datetime = "DateTime" [static]

Definition at line 40 of file app_sayunixtime.c.

char* app_sayunixtime = "SayUnixTime" [static]

Definition at line 39 of file app_sayunixtime.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 112 of file app_sayunixtime.c.

char* datetime_descrip [static]

Definition at line 52 of file app_sayunixtime.c.

char* sayunixtime_descrip [static]

Definition at line 44 of file app_sayunixtime.c.

char* sayunixtime_synopsis = "Says a specified time in a custom format" [static]

Definition at line 42 of file app_sayunixtime.c.


Generated on Fri Jul 24 00:41:14 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7