Mon Jun 27 16:51:00 2011

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, const char *data)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static char * app_datetime = "DateTime"
static char * app_sayunixtime = "SayUnixTime"
static struct ast_module_infoast_module_info = &__mod_info


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 142 of file app_sayunixtime.c.

static void __unreg_module ( void   )  [static]

Definition at line 142 of file app_sayunixtime.c.

static int load_module ( void   )  [static]

Definition at line 132 of file app_sayunixtime.c.

References ast_register_application_xml, and sayunixtime_exec().

00133 {
00134    int res;
00135    
00136    res = ast_register_application_xml(app_sayunixtime, sayunixtime_exec);
00137    res |= ast_register_application_xml(app_datetime, sayunixtime_exec);
00138    
00139    return res;
00140 }

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

Definition at line 92 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, rpt_tele::chan, format, ast_channel::language, and parse().

Referenced by load_module().

00093 {
00094    AST_DECLARE_APP_ARGS(args,
00095       AST_APP_ARG(timeval);
00096       AST_APP_ARG(timezone);
00097       AST_APP_ARG(format);
00098    );
00099    char *parse;
00100    int res = 0;
00101    time_t unixtime;
00102    
00103    if (!data)
00104       return 0;
00105 
00106    parse = ast_strdupa(data);
00107 
00108    AST_STANDARD_APP_ARGS(args, parse);
00109 
00110    ast_get_time_t(args.timeval, &unixtime, time(NULL), NULL);
00111 
00112    if (chan->_state != AST_STATE_UP)
00113       res = ast_answer(chan);
00114 
00115    if (!res)
00116       res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY,
00117                       chan->language, args.format, args.timezone);
00118 
00119    return res;
00120 }

static int unload_module ( void   )  [static]

Definition at line 122 of file app_sayunixtime.c.

References ast_unregister_application().

00123 {
00124    int res;
00125    
00126    res = ast_unregister_application(app_sayunixtime);
00127    res |= ast_unregister_application(app_datetime);
00128    
00129    return res;
00130 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 142 of file app_sayunixtime.c.

char* app_datetime = "DateTime" [static]

Definition at line 90 of file app_sayunixtime.c.

char* app_sayunixtime = "SayUnixTime" [static]

Definition at line 89 of file app_sayunixtime.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 142 of file app_sayunixtime.c.


Generated on Mon Jun 27 16:51:00 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7