Realtime PBX Module. More...
#include "asterisk.h"
#include <signal.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/term.h"
#include "asterisk/manager.h"
#include "asterisk/cli.h"
#include "asterisk/lock.h"
#include "asterisk/linkedlists.h"
#include "asterisk/chanvars.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/utils.h"
#include "asterisk/astdb.h"
#include "asterisk/app.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | cache_entry |
Macros | |
#define | EXT_DATA_SIZE 256 |
#define | MODE_CANMATCH 2 |
#define | MODE_MATCH 0 |
#define | MODE_MATCHMORE 1 |
Enumerations | |
enum | option_flags { OPTION_A = (1 << 0), OPTION_B = (1 << 1), OPTION_C = (1 << 2), OPTION_WAIT = (1 << 0), OPTION_PATTERNS_DISABLED = (1 << 0) } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | cache_cmp (void *obj, void *arg, int flags) |
static int | cache_hash (const void *obj, const int flags) |
static void * | cleanup (void *unused) |
static struct ast_variable * | dup_vars (struct ast_variable *v) |
static void | free_entry (void *obj) |
static int | load_module (void) |
static int | purge_old_fn (void *obj, void *arg, int flags) |
static int | realtime_canmatch (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static struct ast_variable * | realtime_common (const char *context, const char *exten, int priority, const char *data, int mode) |
static int | realtime_exec (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static int | realtime_exists (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static int | realtime_matchmore (struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data) |
static struct ast_variable * | realtime_switch_common (const char *table, const char *context, const char *exten, int priority, int mode, struct ast_flags flags) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Realtime 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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static struct ast_module_info * | ast_module_info = &__mod_info |
struct ao2_container * | cache |
pthread_t | cleanup_thread = 0 |
static struct ast_switch | realtime_switch |
static struct ast_app_option | switch_opts [128] = { [ 'p' ] = { .flag = OPTION_PATTERNS_DISABLED }, } |
Realtime PBX Module.
Definition in file pbx_realtime.c.
#define EXT_DATA_SIZE 256 |
Definition at line 60 of file pbx_realtime.c.
Referenced by realtime_exec().
#define MODE_CANMATCH 2 |
Definition at line 58 of file pbx_realtime.c.
Referenced by realtime_canmatch(), and realtime_switch_common().
#define MODE_MATCH 0 |
Definition at line 56 of file pbx_realtime.c.
Referenced by realtime_common(), realtime_exec(), realtime_exists(), and realtime_switch_common().
#define MODE_MATCHMORE 1 |
Definition at line 57 of file pbx_realtime.c.
Referenced by realtime_matchmore(), and realtime_switch_common().
enum option_flags |
Enumerator | |
---|---|
OPTION_A | |
OPTION_B | |
OPTION_C | |
OPTION_WAIT | |
OPTION_PATTERNS_DISABLED |
Definition at line 62 of file pbx_realtime.c.
|
static |
Definition at line 423 of file pbx_realtime.c.
|
static |
Definition at line 423 of file pbx_realtime.c.
|
static |
Definition at line 87 of file pbx_realtime.c.
References CMP_MATCH, cache_entry::context, cache_entry::exten, f, and cache_entry::priority.
Referenced by load_module().
|
static |
Definition at line 81 of file pbx_realtime.c.
References ast_str_case_hash(), cache_entry::exten, and cache_entry::priority.
Referenced by load_module().
|
static |
Definition at line 125 of file pbx_realtime.c.
References ao2_callback, ao2_container_count(), ast_tvnow(), OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, and purge_old_fn().
Referenced by _sip_tcp_helper_thread(), ast_rtp_dtmf_end_with_duration(), ast_sockaddr_resolve(), build_user(), handle_uri(), load_module(), and realtime_peer().
|
static |
Definition at line 96 of file pbx_realtime.c.
References ast_variable_new(), ast_variables_destroy(), ast_variable::file, ast_variable::name, ast_variable::next, and ast_variable::value.
Referenced by realtime_common().
|
static |
Definition at line 112 of file pbx_realtime.c.
References ast_variables_destroy(), and cache_entry::var.
Referenced by realtime_common().
|
static |
Definition at line 408 of file pbx_realtime.c.
References ao2_container_alloc, AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, ast_pthread_create, ast_register_switch(), cache_cmp(), cache_hash(), and cleanup().
|
static |
Definition at line 118 of file pbx_realtime.c.
References ast_tvdiff_ms(), CMP_MATCH, and cache_entry::when.
Referenced by cleanup().
|
static |
Definition at line 289 of file pbx_realtime.c.
References ast_variables_destroy(), MODE_CANMATCH, and realtime_common().
|
static |
Definition at line 219 of file pbx_realtime.c.
References ao2_alloc, ao2_find, ao2_link, ao2_ref, ast_app_parse_options(), ast_copy_string(), AST_MAX_EXTENSION, ast_strdupa, ast_strlen_zero(), ast_tvnow(), ast_variables_destroy(), cache_entry::context, dup_vars(), cache_entry::exten, free_entry(), MODE_MATCH, OBJ_POINTER, cache_entry::priority, realtime_switch_common(), S_OR, switch_opts, table, cache_entry::var, var, and cache_entry::when.
Referenced by realtime_canmatch(), realtime_exec(), realtime_exists(), and realtime_matchmore().
|
static |
Definition at line 299 of file pbx_realtime.c.
References app, ast_alloca, ast_compat_pbx_realtime, ast_log(), ast_strdupa, ast_strlen_zero(), ast_variables_destroy(), ast_verb, COLOR_BRCYAN, COLOR_BRMAGENTA, ast_channel::context, EVENT_FLAG_DIALPLAN, EXT_DATA_SIZE, ast_channel::exten, LOG_NOTICE, LOG_WARNING, manager_event, MODE_MATCH, ast_variable::name, ast_channel::name, ast_variable::next, pbx_exec(), pbx_findapp(), pbx_substitute_variables_helper(), ast_channel::priority, realtime_common(), S_OR, term_color(), ast_channel::uniqueid, and ast_variable::value.
|
static |
Definition at line 279 of file pbx_realtime.c.
References ast_variables_destroy(), MODE_MATCH, and realtime_common().
|
static |
Definition at line 377 of file pbx_realtime.c.
References ast_variables_destroy(), MODE_MATCHMORE, and realtime_common().
|
static |
Definition at line 160 of file pbx_realtime.c.
References ast_category_browse(), ast_category_detach_variables(), ast_category_get(), ast_config_destroy(), ast_copy_string(), ast_extension_close(), ast_extension_match(), ast_load_realtime(), ast_load_realtime_multientry(), AST_MAX_EXTENSION, ast_test_flag, match(), MODE_CANMATCH, MODE_MATCH, MODE_MATCHMORE, OPTION_PATTERNS_DISABLED, SENTINEL, and var.
Referenced by realtime_common().
|
static |
Definition at line 397 of file pbx_realtime.c.
References ao2_ref, and ast_unregister_switch().
|
static |
Definition at line 423 of file pbx_realtime.c.
|
static |
Definition at line 423 of file pbx_realtime.c.
struct ao2_container* cache |
Definition at line 78 of file pbx_realtime.c.
pthread_t cleanup_thread = 0 |
Definition at line 79 of file pbx_realtime.c.
|
static |
Definition at line 387 of file pbx_realtime.c.
|
static |
Definition at line 68 of file pbx_realtime.c.
Referenced by realtime_common().