Loopback PBX Module. More...
#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/config.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 __MODULE_INFO_SECTION | __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Loopback Switch" , .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_switch | loopback_switch |
Loopback PBX Module.
Definition in file pbx_loopback.c.
#define LOOPBACK_COMMON |
Definition at line 72 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 184 of file pbx_loopback.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 184 of file pbx_loopback.c.
static int load_module | ( | void | ) | [static] |
Definition at line 177 of file pbx_loopback.c.
References AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, and ast_register_switch().
{ if (ast_register_switch(&loopback_switch)) return AST_MODULE_LOAD_FAILURE; return AST_MODULE_LOAD_SUCCESS; }
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 135 of file pbx_loopback.c.
References ast_canmatch_extension(), ast_extension_match(), and LOOPBACK_COMMON.
{ LOOPBACK_COMMON; res = ast_canmatch_extension(chan, newcontext, newexten, newpriority, callerid); if (newpattern && !ast_extension_match(newpattern, exten)) res = 0; return res; }
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 144 of file pbx_loopback.c.
References ast_spawn_extension(), and LOOPBACK_COMMON.
{ int found; LOOPBACK_COMMON; res = ast_spawn_extension(chan, newcontext, newexten, newpriority, callerid, &found, 0); return res; }
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 126 of file pbx_loopback.c.
References ast_exists_extension(), ast_extension_match(), and LOOPBACK_COMMON.
{ LOOPBACK_COMMON; res = ast_exists_extension(chan, newcontext, newexten, newpriority, callerid); if (newpattern && !ast_extension_match(newpattern, exten)) res = 0; return res; }
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 152 of file pbx_loopback.c.
References ast_extension_match(), ast_matchmore_extension(), and LOOPBACK_COMMON.
{ LOOPBACK_COMMON; res = ast_matchmore_extension(chan, newcontext, newexten, newpriority, callerid); if (newpattern && !ast_extension_match(newpattern, exten)) res = 0; return res; }
static void loopback_parse | ( | char ** | newexten, |
char ** | newcontext, | ||
int * | priority, | ||
char ** | newpattern, | ||
char * | buf | ||
) | [static] |
Definition at line 105 of file pbx_loopback.c.
References ast_strlen_zero(), and buf.
{ char *con; char *pri; *newpattern = strchr(buf, '/'); if (*newpattern) *(*newpattern)++ = '\0'; con = strchr(buf, '@'); if (con) { *con++ = '\0'; pri = strchr(con, ':'); } else pri = strchr(buf, ':'); if (!ast_strlen_zero(buf)) *newexten = buf; if (!ast_strlen_zero(con)) *newcontext = con; if (!ast_strlen_zero(pri)) sscanf(pri, "%30d", priority); }
static char* loopback_subst | ( | char * | buf, |
int | buflen, | ||
const char * | exten, | ||
const char * | context, | ||
int | priority, | ||
const char * | data | ||
) | [static] |
Definition at line 83 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(), buf, and pbx_substitute_variables_varshead().
{ struct ast_var_t *newvariable; struct varshead headp; char tmp[80]; snprintf(tmp, sizeof(tmp), "%d", priority); AST_LIST_HEAD_INIT_NOLOCK(&headp); newvariable = ast_var_assign("EXTEN", exten); AST_LIST_INSERT_HEAD(&headp, newvariable, entries); newvariable = ast_var_assign("CONTEXT", context); AST_LIST_INSERT_HEAD(&headp, newvariable, entries); newvariable = ast_var_assign("PRIORITY", tmp); AST_LIST_INSERT_HEAD(&headp, newvariable, entries); /* Substitute variables */ pbx_substitute_variables_varshead(&headp, data, buf, buflen); /* free the list */ while ((newvariable = AST_LIST_REMOVE_HEAD(&headp, entries))) ast_var_delete(newvariable); return buf; }
static int unload_module | ( | void | ) | [static] |
Definition at line 171 of file pbx_loopback.c.
References ast_unregister_switch().
{ ast_unregister_switch(&loopback_switch); return 0; }
struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Loopback Switch" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static] |
Definition at line 184 of file pbx_loopback.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 184 of file pbx_loopback.c.
struct ast_switch loopback_switch [static] |
Definition at line 161 of file pbx_loopback.c.