#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 | acf_isexten_exec (struct ast_channel *chan, const char *cmd, char *parse, char *buffer, size_t buflen) |
| 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 | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Dialplan Context/Extension/Priority Checking Functions" , .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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, } |
| static struct ast_custom_function | acf_isexten |
| static struct ast_module_info * | ast_module_info = &__mod_info |
| static struct ast_custom_function | isexten_function |
Definition in file func_dialplan.c.
| static void __reg_module | ( | void | ) | [static] |
Definition at line 192 of file func_dialplan.c.
| static void __unreg_module | ( | void | ) | [static] |
Definition at line 192 of file func_dialplan.c.
| static int acf_isexten_exec | ( | struct ast_channel * | chan, | |
| const char * | cmd, | |||
| char * | parse, | |||
| char * | buffer, | |||
| size_t | buflen | |||
| ) | [static] |
Definition at line 127 of file func_dialplan.c.
References args, AST_APP_ARG, ast_channel_caller(), ast_channel_context(), ast_copy_string(), AST_DECLARE_APP_ARGS, ast_exists_extension(), ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), context, LOG_WARNING, and S_COR.
00128 { 00129 int priority_int; 00130 AST_DECLARE_APP_ARGS(args, 00131 AST_APP_ARG(context); 00132 AST_APP_ARG(extension); 00133 AST_APP_ARG(priority); 00134 ); 00135 00136 AST_STANDARD_APP_ARGS(args, parse); 00137 00138 if (ast_strlen_zero(args.context)) { 00139 args.context = ast_strdupa(ast_channel_context(chan)); 00140 } 00141 00142 if (ast_strlen_zero(args.extension)) { 00143 ast_log(LOG_WARNING, "Syntax: VALID_EXTEN([<context>],<extension>[,<priority>]) - missing argument <extension>!\n"); 00144 return -1; 00145 } 00146 00147 if (ast_strlen_zero(args.priority)) { 00148 priority_int = 1; 00149 } else { 00150 priority_int = atoi(args.priority); 00151 } 00152 00153 if (ast_exists_extension(chan, args.context, args.extension, priority_int, 00154 S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) { 00155 ast_copy_string(buffer, "1", buflen); 00156 } else { 00157 ast_copy_string(buffer, "0", buflen); 00158 } 00159 00160 return 0; 00161 }
| static int isexten_function_read | ( | struct ast_channel * | chan, | |
| const char * | cmd, | |||
| char * | data, | |||
| char * | buf, | |||
| size_t | len | |||
| ) | [static] |
Definition at line 75 of file func_dialplan.c.
References args, AST_APP_ARG, ast_channel_caller(), ast_context_find(), AST_DECLARE_APP_ARGS, ast_exists_extension(), ast_findlabel_extension(), ast_log(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), context, exten, LOG_ERROR, parse(), and S_COR.
00077 { 00078 char *parse; 00079 AST_DECLARE_APP_ARGS(args, 00080 AST_APP_ARG(context); 00081 AST_APP_ARG(exten); 00082 AST_APP_ARG(priority); 00083 ); 00084 00085 strcpy(buf, "0"); 00086 00087 if (ast_strlen_zero(data)) { 00088 ast_log(LOG_ERROR, "DIALPLAN_EXISTS() requires an argument\n"); 00089 return -1; 00090 } 00091 00092 parse = ast_strdupa(data); 00093 AST_STANDARD_APP_ARGS(args, parse); 00094 00095 if (!ast_strlen_zero(args.priority)) { 00096 int priority_num; 00097 if (sscanf(args.priority, "%30d", &priority_num) == 1 && priority_num > 0) { 00098 int res; 00099 res = ast_exists_extension(chan, args.context, args.exten, priority_num, 00100 S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); 00101 if (res) 00102 strcpy(buf, "1"); 00103 } else { 00104 int res; 00105 res = ast_findlabel_extension(chan, args.context, args.exten, args.priority, 00106 S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); 00107 if (res > 0) 00108 strcpy(buf, "1"); 00109 } 00110 } else if (!ast_strlen_zero(args.exten)) { 00111 int res; 00112 res = ast_exists_extension(chan, args.context, args.exten, 1, 00113 S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)); 00114 if (res) 00115 strcpy(buf, "1"); 00116 } else if (!ast_strlen_zero(args.context)) { 00117 if (ast_context_find(args.context)) 00118 strcpy(buf, "1"); 00119 } else { 00120 ast_log(LOG_ERROR, "Invalid arguments provided to DIALPLAN_EXISTS\n"); 00121 return -1; 00122 } 00123 00124 return 0; 00125 }
| static int load_module | ( | void | ) | [static] |
Definition at line 181 of file func_dialplan.c.
References ast_custom_function_register.
00182 { 00183 int res = ast_custom_function_register(&isexten_function); 00184 res |= ast_custom_function_register(&acf_isexten); 00185 return res; 00186 }
| static int unload_module | ( | void | ) | [static] |
Definition at line 174 of file func_dialplan.c.
References ast_custom_function_unregister().
00175 { 00176 int res = ast_custom_function_unregister(&isexten_function); 00177 res |= ast_custom_function_unregister(&acf_isexten); 00178 return res; 00179 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Dialplan Context/Extension/Priority Checking Functions" , .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 = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, } [static] |
Definition at line 192 of file func_dialplan.c.
struct ast_custom_function acf_isexten [static] |
Initial value:
{
.name = "VALID_EXTEN",
.read = acf_isexten_exec,
}
Definition at line 169 of file func_dialplan.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 192 of file func_dialplan.c.
struct ast_custom_function isexten_function [static] |
Initial value:
{
.name = "DIALPLAN_EXISTS",
.read = isexten_function_read,
.read_max = 2,
}
Definition at line 163 of file func_dialplan.c.
1.5.6