33 #include "asterisk/file.h"
75 #define LOOPBACK_COMMON \
78 char *newexten=(char *)exten, *newcontext=(char *)context; \
79 int newpriority=priority; \
80 char *newpattern=NULL; \
81 loopback_subst(buf, sizeof(buf), exten, context, priority, data); \
82 loopback_parse(&newexten, &newcontext, &newpriority, &newpattern, buf); \
83 ast_log(LOG_DEBUG, "Parsed into %s @ %s priority %d\n", newexten, newcontext, newpriority); \
84 if (!strcasecmp(newcontext, context)) return -1
92 snprintf(tmp,
sizeof(tmp),
"%d", priority);
111 static void loopback_parse(
char **newexten,
char **newcontext,
int *priority,
char **newpattern,
char *buf)
115 *newpattern = strchr(buf,
'/');
117 *(*newpattern)++ =
'\0';
118 con = strchr(buf,
'@');
121 pri = strchr(con,
':');
123 pri = strchr(buf,
':');
129 sscanf(pri,
"%30d", priority);
170 .description =
"Loopback Dialplan Switch",
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch) ...
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
static int loopback_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
struct ast_var_t * ast_var_assign(const char *name, const char *value)
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_matchmore(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
Configuration File Parser.
void ast_unregister_switch(struct ast_switch *sw)
Unregister an alternative switch.
static char * loopback_subst(char *buf, int buflen, const char *exten, const char *context, int priority, const char *data)
I/O Management (derived from Cheops-NG)
void ast_var_delete(struct ast_var_t *var)
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
static void loopback_parse(char **newexten, char **newcontext, int *priority, char **newpattern, char *buf)
General Asterisk PBX channel definitions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Asterisk internal frame definitions.
Scheduler Routines (derived from cheops)
A set of macros to manage forward-linked lists.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
Core PBX routines and definitions.
static int loopback_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static int unload_module(void)
static int load_module(void)
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
int ast_register_switch(struct ast_switch *sw)
Register an alternative dialplan switch.
int ast_extension_match(const char *pattern, const char *extension)
Determine if a given extension matches a given pattern (in NXX format)
int ast_spawn_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid, int *found, int combined_find_spawn)
Launch a new extension (i.e. new stack)
Support for logging to various files, console and syslog Configuration in file logger.conf.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
Standard Command Line Interface.
static struct ast_switch loopback_switch
static char context[AST_MAX_CONTEXT]
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
Persistant data storage (akin to *doze registry)
void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count)
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.