Skeleton application. More...
#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
Go to the source code of this file.
Enumerations | |
enum | { OPTION_A = (1 << 0), OPTION_B = (1 << 1), OPTION_C = (1 << 2) } |
enum | { OPTION_ARG_B = 0, OPTION_ARG_C = 1, OPTION_ARG_ARRAY_SIZE = 2 } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | app_exec (struct ast_channel *chan, void *data) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info __MODULE_INFO_SECTION | __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Skeleton (sample) Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } |
static char * | app = "Skel" |
static struct ast_app_option | app_opts [128] = { [ 'a' ] = { .flag = OPTION_A }, [ 'b' ] = { .flag = OPTION_B , .arg_index = OPTION_ARG_B + 1 }, [ 'c' ] = { .flag = OPTION_C , .arg_index = OPTION_ARG_C + 1 },} |
static struct ast_module_info * | ast_module_info = &__mod_info |
enum { ... } | option_args |
enum { ... } | option_flags |
Skeleton application.
This is a skeleton for development of an Asterisk application
Definition in file app_skel.c.
anonymous enum |
Definition at line 77 of file app_skel.c.
{ OPTION_A = (1 << 0), OPTION_B = (1 << 1), OPTION_C = (1 << 2), } option_flags;
anonymous enum |
Definition at line 83 of file app_skel.c.
{ OPTION_ARG_B = 0, OPTION_ARG_C = 1, /* This *must* be the last value in this enum! */ OPTION_ARG_ARRAY_SIZE = 2, } option_args;
static void __reg_module | ( | void | ) | [static] |
Definition at line 153 of file app_skel.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 153 of file app_skel.c.
static int app_exec | ( | struct ast_channel * | chan, |
void * | data | ||
) | [static] |
Definition at line 97 of file app_skel.c.
References app_opts, AST_APP_ARG, ast_app_parse_options(), AST_DECLARE_APP_ARGS, ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, dummy(), LOG_NOTICE, LOG_WARNING, OPTION_A, OPTION_ARG_ARRAY_SIZE, OPTION_ARG_B, OPTION_ARG_C, OPTION_B, OPTION_C, and parse().
Referenced by load_module().
{ int res = 0; struct ast_flags flags; char *parse, *opts[OPTION_ARG_ARRAY_SIZE]; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(dummy); AST_APP_ARG(options); ); if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "%s requires an argument (dummy[,options])\n", app); return -1; } /* Do our thing here */ /* We need to make a copy of the input string if we are going to modify it! */ parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); if (args.argc == 2) { ast_app_parse_options(app_opts, &flags, opts, args.options); } if (!ast_strlen_zero(args.dummy)) { ast_log(LOG_NOTICE, "Dummy value is : %s\n", args.dummy); } if (ast_test_flag(&flags, OPTION_A)) { ast_log(LOG_NOTICE, "Option A is set\n"); } if (ast_test_flag(&flags, OPTION_B)) { ast_log(LOG_NOTICE, "Option B is set with : %s\n", opts[OPTION_ARG_B] ? opts[OPTION_ARG_B] : "<unspecified>"); } if (ast_test_flag(&flags, OPTION_C)) { ast_log(LOG_NOTICE, "Option C is set with : %s\n", opts[OPTION_ARG_C] ? opts[OPTION_ARG_C] : "<unspecified>"); } return res; }
static int load_module | ( | void | ) | [static] |
Definition at line 147 of file app_skel.c.
References app_exec(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, and ast_register_application_xml.
{ return ast_register_application_xml(app, app_exec) ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; }
static int unload_module | ( | void | ) | [static] |
Definition at line 142 of file app_skel.c.
References ast_unregister_application().
{ return ast_unregister_application(app); }
struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Skeleton (sample) Application" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
Definition at line 153 of file app_skel.c.
char* app = "Skel" [static] |
Definition at line 75 of file app_skel.c.
struct ast_app_option app_opts[128] = { [ 'a' ] = { .flag = OPTION_A }, [ 'b' ] = { .flag = OPTION_B , .arg_index = OPTION_ARG_B + 1 }, [ 'c' ] = { .flag = OPTION_C , .arg_index = OPTION_ARG_C + 1 },} [static] |
Definition at line 94 of file app_skel.c.
Referenced by app_exec().
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 153 of file app_skel.c.
enum { ... } option_args |
Referenced by handle_options().
enum { ... } option_flags |