#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/options.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/frame.h"
#include "asterisk/cli.h"
#include "asterisk/lock.h"
#include "asterisk/md5.h"
#include "asterisk/linkedlists.h"
#include "asterisk/chanvars.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/utils.h"
#include "asterisk/crypto.h"
#include "asterisk/astdb.h"
Go to the source code of this file.
Defines | |
#define | LOOPBACK_COMMON |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | load_module (void) |
static int | loopback_canmatch (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static int | loopback_exec (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static int | loopback_exists (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static int | loopback_matchmore (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static void | loopback_parse (char **newexten, char **newcontext, int *priority, char **newpattern, char *buf) |
static char * | loopback_subst (char *buf, int buflen, const char *exten, const char *context, int priority, const char *data) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Loopback Switch" , .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_switch | loopback_switch |
Definition in file pbx_loopback.c.
#define LOOPBACK_COMMON |
Definition at line 80 of file pbx_loopback.c.
Referenced by loopback_canmatch(), loopback_exec(), loopback_exists(), and loopback_matchmore().
static void __reg_module | ( | void | ) | [static] |
Definition at line 191 of file pbx_loopback.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 191 of file pbx_loopback.c.
static int load_module | ( | void | ) | [static] |
Definition at line 185 of file pbx_loopback.c.
References ast_register_switch(), and loopback_switch.
00186 { 00187 ast_register_switch(&loopback_switch); 00188 return 0; 00189 }
static int loopback_canmatch | ( | struct ast_channel * | chan, | |
const char * | context, | |||
const char * | exten, | |||
int | priority, | |||
const char * | callerid, | |||
const char * | data | |||
) | [static] |
Definition at line 144 of file pbx_loopback.c.
References ast_canmatch_extension(), ast_extension_match(), and LOOPBACK_COMMON.
00145 { 00146 LOOPBACK_COMMON; 00147 res = ast_canmatch_extension(chan, newcontext, newexten, newpriority, callerid); 00148 if (newpattern && !ast_extension_match(newpattern, exten)) 00149 res = 0; 00150 return res; 00151 }
static int loopback_exec | ( | struct ast_channel * | chan, | |
const char * | context, | |||
const char * | exten, | |||
int | priority, | |||
const char * | callerid, | |||
const char * | data | |||
) | [static] |
Definition at line 153 of file pbx_loopback.c.
References ast_spawn_extension(), and LOOPBACK_COMMON.
00154 { 00155 LOOPBACK_COMMON; 00156 res = ast_spawn_extension(chan, newcontext, newexten, newpriority, callerid); 00157 return res; 00158 }
static int loopback_exists | ( | struct ast_channel * | chan, | |
const char * | context, | |||
const char * | exten, | |||
int | priority, | |||
const char * | callerid, | |||
const char * | data | |||
) | [static] |
Definition at line 135 of file pbx_loopback.c.
References ast_exists_extension(), ast_extension_match(), and LOOPBACK_COMMON.
00136 { 00137 LOOPBACK_COMMON; 00138 res = ast_exists_extension(chan, newcontext, newexten, newpriority, callerid); 00139 if (newpattern && !ast_extension_match(newpattern, exten)) 00140 res = 0; 00141 return res; 00142 }
static int loopback_matchmore | ( | struct ast_channel * | chan, | |
const char * | context, | |||
const char * | exten, | |||
int | priority, | |||
const char * | callerid, | |||
const char * | data | |||
) | [static] |
Definition at line 160 of file pbx_loopback.c.
References ast_extension_match(), ast_matchmore_extension(), and LOOPBACK_COMMON.
00161 { 00162 LOOPBACK_COMMON; 00163 res = ast_matchmore_extension(chan, newcontext, newexten, newpriority, callerid); 00164 if (newpattern && !ast_extension_match(newpattern, exten)) 00165 res = 0; 00166 return res; 00167 }
static void loopback_parse | ( | char ** | newexten, | |
char ** | newcontext, | |||
int * | priority, | |||
char ** | newpattern, | |||
char * | buf | |||
) | [static] |
Definition at line 114 of file pbx_loopback.c.
References ast_strlen_zero().
00115 { 00116 char *con; 00117 char *pri; 00118 *newpattern = strchr(buf, '/'); 00119 if (*newpattern) 00120 *(*newpattern)++ = '\0'; 00121 con = strchr(buf, '@'); 00122 if (con) { 00123 *con++ = '\0'; 00124 pri = strchr(con, ':'); 00125 } else 00126 pri = strchr(buf, ':'); 00127 if (!ast_strlen_zero(buf)) 00128 *newexten = buf; 00129 if (!ast_strlen_zero(con)) 00130 *newcontext = con; 00131 if (!ast_strlen_zero(pri)) 00132 sscanf(pri, "%30d", priority); 00133 }
static char* loopback_subst | ( | char * | buf, | |
int | buflen, | |||
const char * | exten, | |||
const char * | context, | |||
int | priority, | |||
const char * | data | |||
) | [static] |
Definition at line 91 of file pbx_loopback.c.
References AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_HEAD, AST_LIST_REMOVE_HEAD, ast_var_assign(), ast_var_delete(), and pbx_substitute_variables_varshead().
00092 { 00093 struct ast_var_t *newvariable; 00094 struct varshead headp; 00095 char tmp[80]; 00096 00097 snprintf(tmp, sizeof(tmp), "%d", priority); 00098 memset(buf, 0, buflen); 00099 AST_LIST_HEAD_INIT_NOLOCK(&headp); 00100 newvariable = ast_var_assign("EXTEN", exten); 00101 AST_LIST_INSERT_HEAD(&headp, newvariable, entries); 00102 newvariable = ast_var_assign("CONTEXT", context); 00103 AST_LIST_INSERT_HEAD(&headp, newvariable, entries); 00104 newvariable = ast_var_assign("PRIORITY", tmp); 00105 AST_LIST_INSERT_HEAD(&headp, newvariable, entries); 00106 /* Substitute variables */ 00107 pbx_substitute_variables_varshead(&headp, data, buf, buflen); 00108 /* free the list */ 00109 while ((newvariable = AST_LIST_REMOVE_HEAD(&headp, entries))) 00110 ast_var_delete(newvariable); 00111 return buf; 00112 }
static int unload_module | ( | void | ) | [static] |
Definition at line 179 of file pbx_loopback.c.
References ast_unregister_switch(), and loopback_switch.
00180 { 00181 ast_unregister_switch(&loopback_switch); 00182 return 0; 00183 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Loopback Switch" , .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 191 of file pbx_loopback.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 191 of file pbx_loopback.c.
struct ast_switch loopback_switch [static] |