Mon Oct 8 12:39:08 2012

Asterisk developer's documentation


app_saycounted.c File Reference

Applications to decline words according to current language. More...

#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/say.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 saycountedadj_exec (struct ast_channel *chan, const char *data)
static int saycountednoun_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 = "Decline words according to channel language" , .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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static struct ast_module_infoast_module_info = &__mod_info


Detailed Description

Applications to decline words according to current language.

Author:
David Chappell <David.Chappell@trincoll.edu>

Definition in file app_saycounted.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 208 of file app_saycounted.c.

static void __unreg_module ( void   )  [static]

Definition at line 208 of file app_saycounted.c.

static int load_module ( void   )  [static]

Definition at line 192 of file app_saycounted.c.

References ast_register_application_xml, saycountedadj_exec(), and saycountednoun_exec().

00193 {
00194    int res;
00195    res = ast_register_application_xml("SayCountedNoun", saycountednoun_exec);
00196    res |= ast_register_application_xml("SayCountedAdj", saycountedadj_exec);
00197    return res;
00198 }

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

Definition at line 154 of file app_saycounted.c.

References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log(), ast_say_counted_adjective(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), LOG_WARNING, and parse().

Referenced by load_module().

00155 {
00156    char *parse;
00157    int number;
00158    AST_DECLARE_APP_ARGS(args,
00159       AST_APP_ARG(number);
00160       AST_APP_ARG(adjective);
00161       AST_APP_ARG(gender);
00162    );
00163 
00164    if (ast_strlen_zero(data)) {
00165       ast_log(LOG_WARNING, "SayCountedAdj requires two or three arguments (<number>,<adjective>[,<gender>])\n");
00166       return -1;
00167    }
00168 
00169    parse = ast_strdupa(data);
00170    AST_STANDARD_APP_ARGS(args, parse);
00171 
00172    if (args.argc < 2) {
00173       ast_log(LOG_WARNING, "SayCountedAdj requires at least two arguments\n");
00174       return -1;
00175    }
00176 
00177    if (sscanf(args.number, "%d", &number) != 1) {
00178       ast_log(LOG_WARNING, "First argument must be a number between 0 and 2,147,483,647.\n");
00179       return -1;
00180    }
00181 
00182    if (!ast_strlen_zero(args.gender)) {
00183       if (strchr("cCfFmMnN", args.gender[0])) {
00184          ast_log(LOG_WARNING, "SayCountedAdj gender option must be one of 'f', 'm', 'c', or 'n'.\n");
00185          return -1;
00186       }
00187    }
00188 
00189    return ast_say_counted_adjective(chan, number, args.adjective, args.gender);
00190 }

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

Definition at line 124 of file app_saycounted.c.

References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log(), ast_say_counted_noun(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), LOG_WARNING, and parse().

Referenced by load_module().

00125 {
00126    char *parse;
00127    int number;
00128    AST_DECLARE_APP_ARGS(args,
00129       AST_APP_ARG(number);
00130       AST_APP_ARG(noun);
00131    );
00132 
00133    if (ast_strlen_zero(data)) {
00134       ast_log(LOG_WARNING, "SayCountedNoun requires two arguments (<number>,<noun>)\n");
00135       return -1;
00136    }
00137 
00138    parse = ast_strdupa(data);
00139    AST_STANDARD_APP_ARGS(args, parse);
00140 
00141    if (args.argc != 2) {
00142       ast_log(LOG_WARNING, "SayCountedNoun requires two arguments\n");
00143       return -1;
00144    }
00145 
00146    if (sscanf(args.number, "%d", &number) != 1) {
00147       ast_log(LOG_WARNING, "First argument must be a number between 0 and 2,147,483,647.\n");
00148       return -1;
00149    }
00150 
00151    return ast_say_counted_noun(chan, number, args.noun);
00152 }

static int unload_module ( void   )  [static]

Definition at line 200 of file app_saycounted.c.

References ast_unregister_application().

00201 {
00202    int res;
00203    res = ast_unregister_application("SayCountedNoun");
00204    res |= ast_unregister_application("SayCountedAdj");
00205    return res;
00206 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Decline words according to channel language" , .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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 208 of file app_saycounted.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 208 of file app_saycounted.c.


Generated on Mon Oct 8 12:39:08 2012 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7