Fri Jul 24 00:41:45 2009

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"

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 = "a9c98e5d177805051735cb5b0b16b0a0" , .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 106 of file func_dialplan.c.

static void __unreg_module ( void   )  [static]

Definition at line 106 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 36 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(), chan, ast_channel::cid, ast_callerid::cid_num, ast_channel::context, context, exten, LOG_ERROR, and parse().

00038 {
00039    char *parse;
00040    AST_DECLARE_APP_ARGS(args,
00041       AST_APP_ARG(context);
00042       AST_APP_ARG(exten);
00043       AST_APP_ARG(priority);
00044    );
00045 
00046    strcpy(buf, "0");
00047 
00048    if (ast_strlen_zero(data)) {
00049       ast_log(LOG_ERROR, "DIALPLAN_EXISTS() requires an argument\n");
00050       return -1;
00051    }
00052 
00053    parse = ast_strdupa(data);
00054    AST_STANDARD_APP_ARGS(args, parse);
00055 
00056    if (!ast_strlen_zero(args.priority)) {
00057       int priority_num;
00058       if (sscanf(args.priority, "%d", &priority_num) == 1 && priority_num > 0) {
00059          int res;
00060          res = ast_exists_extension(chan, args.context, args.exten, priority_num, 
00061             chan->cid.cid_num);
00062          if (res)
00063             strcpy(buf, "1");
00064       } else {
00065          int res;
00066          res = ast_findlabel_extension(chan, args.context, args.exten, 
00067             args.priority, chan->cid.cid_num);
00068          if (res > 0)
00069             strcpy(buf, "1");
00070       }
00071    } else if (!ast_strlen_zero(args.exten)) {
00072       int res;
00073       res = ast_exists_extension(chan, args.context, args.exten, 1, 
00074          chan->cid.cid_num);
00075       if (res)
00076          strcpy(buf, "1");
00077    } else if (!ast_strlen_zero(args.context)) {
00078       if (ast_context_find(args.context))
00079          strcpy(buf, "1");
00080    } else {
00081       ast_log(LOG_ERROR, "Invalid arguments provided to DIALPLAN_EXISTS\n");
00082       return -1;
00083    }
00084    
00085    return 0;
00086 }

static int load_module ( void   )  [static]

Definition at line 101 of file func_dialplan.c.

References ast_custom_function_register, and isexten_function.

00102 {
00103    return ast_custom_function_register(&isexten_function);
00104 }

static int unload_module ( void   )  [static]

Definition at line 96 of file func_dialplan.c.

References ast_custom_function_unregister(), and isexten_function.

00097 {
00098    return ast_custom_function_unregister(&isexten_function);
00099 }


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

Definition at line 106 of file func_dialplan.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 106 of file func_dialplan.c.

struct ast_custom_function isexten_function [static]

Definition at line 88 of file func_dialplan.c.

Referenced by load_module(), and unload_module().


Generated on Fri Jul 24 00:41:45 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7