Mon Jun 27 16:51:00 2011

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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .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 202 of file app_saycounted.c.

static void __unreg_module ( void   )  [static]

Definition at line 202 of file app_saycounted.c.

static int load_module ( void   )  [static]

Definition at line 186 of file app_saycounted.c.

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

00187 {
00188    int res;
00189    res = ast_register_application_xml("SayCountedNoun", saycountednoun_exec);
00190    res |= ast_register_application_xml("SayCountedAdj", saycountedadj_exec);
00191    return res;
00192 }

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

Definition at line 148 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(), rpt_tele::chan, LOG_WARNING, and parse().

Referenced by load_module().

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

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

Definition at line 118 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(), rpt_tele::chan, LOG_WARNING, and parse().

Referenced by load_module().

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

static int unload_module ( void   )  [static]

Definition at line 194 of file app_saycounted.c.

References ast_unregister_application().

00195 {
00196    int res;
00197    res = ast_unregister_application("SayCountedNoun");
00198    res |= ast_unregister_application("SayCountedAdj");
00199    return res;
00200 }


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 = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 202 of file app_saycounted.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 202 of file app_saycounted.c.


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