Dialplan group functions check if a dialplan entry exists. More...
#include "asterisk.h"#include "asterisk/module.h"#include "asterisk/channel.h"#include "asterisk/pbx.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 | isexten_function_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
| 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 = "Dialplan Context/Extension/Priority Checking Functions" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static struct ast_custom_function | isexten_function |
Dialplan group functions check if a dialplan entry exists.
Definition in file func_dialplan.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 120 of file func_dialplan.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 120 of file func_dialplan.c.
| static int isexten_function_read | ( | struct ast_channel * | chan, |
| const char * | cmd, | ||
| char * | data, | ||
| char * | buf, | ||
| size_t | len | ||
| ) | [static] |
Definition at line 53 of file func_dialplan.c.
References AST_APP_ARG, ast_context_find(), AST_DECLARE_APP_ARGS, ast_exists_extension(), ast_findlabel_extension(), ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_channel::cid, ast_callerid::cid_num, ast_channel::context, context, exten, LOG_ERROR, and parse().
{
char *parse;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(context);
AST_APP_ARG(exten);
AST_APP_ARG(priority);
);
strcpy(buf, "0");
if (ast_strlen_zero(data)) {
ast_log(LOG_ERROR, "DIALPLAN_EXISTS() requires an argument\n");
return -1;
}
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
if (!ast_strlen_zero(args.priority)) {
int priority_num;
if (sscanf(args.priority, "%30d", &priority_num) == 1 && priority_num > 0) {
int res;
res = ast_exists_extension(chan, args.context, args.exten, priority_num,
chan->cid.cid_num);
if (res)
strcpy(buf, "1");
} else {
int res;
res = ast_findlabel_extension(chan, args.context, args.exten,
args.priority, chan->cid.cid_num);
if (res > 0)
strcpy(buf, "1");
}
} else if (!ast_strlen_zero(args.exten)) {
int res;
res = ast_exists_extension(chan, args.context, args.exten, 1,
chan->cid.cid_num);
if (res)
strcpy(buf, "1");
} else if (!ast_strlen_zero(args.context)) {
if (ast_context_find(args.context))
strcpy(buf, "1");
} else {
ast_log(LOG_ERROR, "Invalid arguments provided to DIALPLAN_EXISTS\n");
return -1;
}
return 0;
}
| static int load_module | ( | void | ) | [static] |
Definition at line 115 of file func_dialplan.c.
References ast_custom_function_register.
{
return ast_custom_function_register(&isexten_function);
}
| static int unload_module | ( | void | ) | [static] |
Definition at line 110 of file func_dialplan.c.
References ast_custom_function_unregister().
{
return ast_custom_function_unregister(&isexten_function);
}
struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Dialplan Context/Extension/Priority Checking Functions" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
Definition at line 120 of file func_dialplan.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 120 of file func_dialplan.c.
struct ast_custom_function isexten_function [static] |
{
.name = "DIALPLAN_EXISTS",
.read = isexten_function_read,
}
Definition at line 105 of file func_dialplan.c.