Fri Nov 12 12:02:21 2010

Asterisk developer's documentation


func_dialplan.c File Reference

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"
Include dependency graph for func_dialplan.c:

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 __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "0901e4e500243c855563a2d78b0c03e4" , .load = load_module, .unload = unload_module, }
static struct ast_module_infoast_module_info = &__mod_info
static struct ast_custom_function isexten_function

Detailed Description

Dialplan group functions check if a dialplan entry exists.

Author:
Gregory Nietsky AKA irroot <gregory@networksentry.co.za>
Russell Bryant <russell@digium.com>

Definition in file func_dialplan.c.


Function Documentation

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_strlen_zero(), ast_channel::cid, ast_callerid::cid_num, ast_channel::context, context, exten, LOG_ERROR, and parse().

00055 {
00056    char *parse;
00057    AST_DECLARE_APP_ARGS(args,
00058       AST_APP_ARG(context);
00059       AST_APP_ARG(exten);
00060       AST_APP_ARG(priority);
00061    );
00062 
00063    strcpy(buf, "0");
00064 
00065    if (ast_strlen_zero(data)) {
00066       ast_log(LOG_ERROR, "DIALPLAN_EXISTS() requires an argument\n");
00067       return -1;
00068    }
00069 
00070    parse = ast_strdupa(data);
00071    AST_STANDARD_APP_ARGS(args, parse);
00072 
00073    if (!ast_strlen_zero(args.priority)) {
00074       int priority_num;
00075       if (sscanf(args.priority, "%30d", &priority_num) == 1 && priority_num > 0) {
00076          int res;
00077          res = ast_exists_extension(chan, args.context, args.exten, priority_num, 
00078             chan->cid.cid_num);
00079          if (res)
00080             strcpy(buf, "1");
00081       } else {
00082          int res;
00083          res = ast_findlabel_extension(chan, args.context, args.exten, 
00084             args.priority, chan->cid.cid_num);
00085          if (res > 0)
00086             strcpy(buf, "1");
00087       }
00088    } else if (!ast_strlen_zero(args.exten)) {
00089       int res;
00090       res = ast_exists_extension(chan, args.context, args.exten, 1, 
00091          chan->cid.cid_num);
00092       if (res)
00093          strcpy(buf, "1");
00094    } else if (!ast_strlen_zero(args.context)) {
00095       if (ast_context_find(args.context))
00096          strcpy(buf, "1");
00097    } else {
00098       ast_log(LOG_ERROR, "Invalid arguments provided to DIALPLAN_EXISTS\n");
00099       return -1;
00100    }
00101    
00102    return 0;
00103 }

static int load_module ( void   )  [static]

Definition at line 115 of file func_dialplan.c.

References ast_custom_function_register.

00116 {
00117    return ast_custom_function_register(&isexten_function);
00118 }

static int unload_module ( void   )  [static]

Definition at line 110 of file func_dialplan.c.

References ast_custom_function_unregister().

00111 {
00112    return ast_custom_function_unregister(&isexten_function);
00113 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .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 = "0901e4e500243c855563a2d78b0c03e4" , .load = load_module, .unload = unload_module, } [static]

Definition at line 120 of file func_dialplan.c.

Definition at line 120 of file func_dialplan.c.

Initial value:
 {
   .name = "DIALPLAN_EXISTS",
   .read = isexten_function_read,
}

Definition at line 105 of file func_dialplan.c.


Generated by  doxygen 1.6.2