Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Core PBX routines. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/paths.h"
#include <ctype.h>
#include <time.h>
#include <sys/time.h>
#include <sys/sysinfo.h>
#include "asterisk/lock.h"
#include "asterisk/cli.h"
#include "asterisk/pbx.h"
#include "asterisk/channel.h"
#include "asterisk/file.h"
#include "asterisk/callerid.h"
#include "asterisk/cdr.h"
#include "asterisk/config.h"
#include "asterisk/term.h"
#include "asterisk/manager.h"
#include "asterisk/ast_expr.h"
#include "asterisk/linkedlists.h"
#include "asterisk/say.h"
#include "asterisk/utils.h"
#include "asterisk/causes.h"
#include "asterisk/musiconhold.h"
#include "asterisk/app.h"
#include "asterisk/devicestate.h"
#include "asterisk/presencestate.h"
#include "asterisk/hashtab.h"
#include "asterisk/module.h"
#include "asterisk/indications.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/xmldoc.h"
#include "asterisk/astobj2.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/dial.h"
#include "asterisk/vector.h"
#include "pbx_private.h"
Go to the source code of this file.
Data Structures | |
struct | ast_autohint |
Structure for dial plan autohints. More... | |
struct | ast_context |
ast_context: An extension context More... | |
struct | ast_exten |
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own linked list of extensions - one item per priority. More... | |
struct | ast_hint |
Structure for dial plan hints. More... | |
struct | ast_hintdevice |
Structure for dial plan hint devices. More... | |
struct | ast_state_cb |
ast_state_cb: An extension state notify register item More... | |
struct | cfextension_states |
struct | dialplan_counters |
Counters for the show dialplan manager command. More... | |
struct | match_char |
match_char: forms a syntax tree for quick matching of extension patterns More... | |
struct | pattern_node |
struct | pbx_exception |
struct | pbx_outgoing |
Structure which contains information about an outgoing dial. More... | |
struct | scoreboard |
struct | store_hint |
struct | store_hints |
Macros | |
#define | ADVANCE(s) candidate_exten_advance(s) |
#define | BITS_PER 8 /* Number of bits per unit (byte). */ |
#define | EXT_DATA_SIZE 8192 |
#define | HASH_EXTENHINT_SIZE 563 |
#define | HINTDEVICE_DATA_LENGTH 16 |
#define | INC_DST_OVERFLOW_CHECK |
#define | MAX_EXTENBUF_SIZE 512 |
#define | MORE(s) (*candidate_exten_advance(s)) |
#define | NEW_MATCHER_CHK_MATCH |
#define | NEW_MATCHER_RECURSE |
#define | SAY_STUBS /* generate declarations and stubs for say methods */ |
#define | STATUS_NO_CONTEXT 1 |
#define | STATUS_NO_EXTENSION 2 |
#define | STATUS_NO_LABEL 4 |
#define | STATUS_NO_PRIORITY 3 |
#define | STATUS_SUCCESS 5 |
#define | SWITCH_DATA_LENGTH 256 |
#define | VAR_HARDTRAN 3 |
#define | VAR_NORMAL 1 |
#define | VAR_SOFTTRAN 2 |
Functions | |
void | __ast_context_destroy (struct ast_context *list, struct ast_hashtab *contexttab, struct ast_context *con, const char *registrar) |
static int | __ast_goto_if_exists (struct ast_channel *chan, const char *context, const char *exten, int priority, int async) |
static void | __ast_internal_context_destroy (struct ast_context *con) |
static enum ast_pbx_result | __ast_pbx_run (struct ast_channel *c, struct ast_pbx_args *args) |
static void | __init_extensionstate_buf (void) |
static void | __init_hintdevice_data (void) |
static void | __init_switch_data (void) |
static int | _extension_match_core (const char *pattern, const char *data, enum ext_match_t mode) |
static int | acf_exception_read (struct ast_channel *chan, const char *name, char *data, char *buf, size_t buflen) |
static int | action_extensionstatelist (struct mansession *s, const struct message *m) |
static struct match_char * | add_exten_to_pattern_tree (struct ast_context *con, struct ast_exten *e1, int findonly) |
static int | add_hintdevice (struct ast_hint *hint, const char *devicelist) |
add hintdevice structure and link it into the container. More... | |
static struct match_char * | add_pattern_node (struct ast_context *con, struct match_char *current, const struct pattern_node *pattern, int is_pattern, int already, struct match_char **nextcharptr) |
static int | add_priority (struct ast_context *con, struct ast_exten *tmp, struct ast_exten *el, struct ast_exten *e, int replace) |
add the extension in the priority chain. More... | |
static struct ao2_container * | alloc_device_state_info (void) |
static struct match_char * | already_in_tree (struct match_char *current, char *pat, int is_pattern) |
int | ast_active_calls (void) |
Retrieve the number of active calls. More... | |
int | ast_add_extension (const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar) |
Add and extension to an extension context. More... | |
int | ast_add_extension2 (struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar, const char *registrar_file, int registrar_line) |
Main interface to add extensions to the list for out context. More... | |
static int | ast_add_extension2_lockopt (struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar, const char *registrar_file, int registrar_line, int lock_context) |
Same as ast_add_extension2() but controls the context locking. More... | |
int | ast_add_extension2_nolock (struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar, const char *registrar_file, int registrar_line) |
Same as ast_add_extension2, but assumes you have already locked context. More... | |
static int | ast_add_extension_nolock (const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar) |
static int | ast_add_hint (struct ast_exten *e) |
Add hint to hint list, check initial extension state. More... | |
int | ast_async_goto (struct ast_channel *chan, const char *context, const char *exten, int priority) |
Set the channel to next execute the specified dialplan location. More... | |
int | ast_async_goto_by_name (const char *channame, const char *context, const char *exten, int priority) |
Set the channel to next execute the specified dialplan location. More... | |
int | ast_async_goto_if_exists (struct ast_channel *chan, const char *context, const char *exten, int priority) |
int | ast_async_parseable_goto (struct ast_channel *chan, const char *goto_string) |
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. More... | |
static int | ast_change_hint (struct ast_exten *oe, struct ast_exten *ne) |
Change hint for an extension. More... | |
int | ast_context_add_ignorepat (const char *context, const char *value, const char *registrar) |
Add an ignorepat. More... | |
int | ast_context_add_ignorepat2 (struct ast_context *con, const char *value, const char *registrar) |
int | ast_context_add_include (const char *context, const char *include, const char *registrar) |
Add a context include. More... | |
int | ast_context_add_include2 (struct ast_context *con, const char *value, const char *registrar) |
Add a context include. More... | |
int | ast_context_add_switch (const char *context, const char *sw, const char *data, int eval, const char *registrar) |
Add a switch. More... | |
int | ast_context_add_switch2 (struct ast_context *con, const char *value, const char *data, int eval, const char *registrar) |
Adds a switch (first param is a ast_context) More... | |
void | ast_context_destroy (struct ast_context *con, const char *registrar) |
Destroy a context (matches the specified context or ANY context if NULL) More... | |
int | ast_context_destroy_by_name (const char *context, const char *registrar) |
Destroy a context by name. More... | |
struct ast_context * | ast_context_find (const char *name) |
Find a context. More... | |
struct ast_context * | ast_context_find_or_create (struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar) |
Register a new context or find an existing one. More... | |
int | ast_context_ignorepats_count (const struct ast_context *con) |
const struct ast_ignorepat * | ast_context_ignorepats_get (const struct ast_context *con, int idx) |
int | ast_context_includes_count (const struct ast_context *con) |
const struct ast_include * | ast_context_includes_get (const struct ast_context *con, int idx) |
int | ast_context_remove_extension (const char *context, const char *extension, int priority, const char *registrar) |
Simply remove extension from context. More... | |
int | ast_context_remove_extension2 (struct ast_context *con, const char *extension, int priority, const char *registrar, int already_locked) |
This functionc locks given context, search for the right extension and fires out all peer in this extensions with given priority. If priority is set to 0, all peers are removed. After that, unlock context and return. More... | |
int | ast_context_remove_extension_callerid (const char *context, const char *extension, int priority, const char *callerid, int matchcallerid, const char *registrar) |
int | ast_context_remove_extension_callerid2 (struct ast_context *con, const char *extension, int priority, const char *callerid, int matchcallerid, const char *registrar, int already_locked) |
int | ast_context_remove_ignorepat (const char *context, const char *ignorepat, const char *registrar) |
Remove an ignorepat. More... | |
int | ast_context_remove_ignorepat2 (struct ast_context *con, const char *ignorepat, const char *registrar) |
int | ast_context_remove_include (const char *context, const char *include, const char *registrar) |
Remove included contexts. This function locks contexts list by &conlist, search for the right context structure, leave context list locked and call ast_context_remove_include2 which removes include, unlock contexts list and return ... More... | |
int | ast_context_remove_include2 (struct ast_context *con, const char *include, const char *registrar) |
Locks context, remove included contexts, unlocks context. When we call this function, &conlock lock must be locked, because when we giving *con argument, some process can remove/change this context and after that there can be segfault. More... | |
int | ast_context_remove_switch (const char *context, const char *sw, const char *data, const char *registrar) |
Remove a switch. More... | |
int | ast_context_remove_switch2 (struct ast_context *con, const char *sw, const char *data, const char *registrar) |
This function locks given context, removes switch, unlock context and return. More... | |
void | ast_context_set_autohints (struct ast_context *con, int enabled) |
Enable or disable autohints support on a context. More... | |
int | ast_context_switches_count (const struct ast_context *con) |
const struct ast_sw * | ast_context_switches_get (const struct ast_context *con, int idx) |
int | ast_context_verify_includes (struct ast_context *con) |
Verifies includes in an ast_contect structure. More... | |
enum ast_extension_states | ast_devstate_to_extenstate (enum ast_device_state devstate) |
Map devstate to an extension state. More... | |
int | ast_exists_extension (struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid) |
Determine whether an extension exists. More... | |
int | ast_explicit_goto (struct ast_channel *chan, const char *context, const char *exten, int priority) |
int | ast_extension_close (const char *pattern, const char *data, int needmore) |
int | ast_extension_cmp (const char *a, const char *b) |
Determine if one extension should match before another. More... | |
int | ast_extension_match (const char *pattern, const char *extension) |
Determine if a given extension matches a given pattern (in NXX format) More... | |
int | ast_extension_state (struct ast_channel *c, const char *context, const char *exten) |
Check extension state for an extension by using hint. More... | |
static int | ast_extension_state2 (struct ast_exten *e, struct ao2_container *device_state_info) |
Check state of extension by using hints. More... | |
const char * | ast_extension_state2str (int extension_state) |
Return extension_state as string. More... | |
static int | ast_extension_state3 (struct ast_str *hint_app, struct ao2_container *device_state_info) |
int | ast_extension_state_add (const char *context, const char *exten, ast_state_cb_type change_cb, void *data) |
Add watcher for extension states. More... | |
int | ast_extension_state_add_destroy (const char *context, const char *exten, ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data) |
Add watcher for extension states with destructor. More... | |
int | ast_extension_state_add_destroy_extended (const char *context, const char *exten, ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data) |
Add watcher for extended extension states with destructor. More... | |
int | ast_extension_state_add_extended (const char *context, const char *exten, ast_state_cb_type change_cb, void *data) |
Add watcher for extended extension states. More... | |
int | ast_extension_state_del (int id, ast_state_cb_type change_cb) |
Deletes a state change watcher by ID. More... | |
int | ast_extension_state_extended (struct ast_channel *c, const char *context, const char *exten, struct ao2_container **device_state_info) |
Check extended extension state for an extension by using hint. More... | |
int | ast_findlabel_extension (struct ast_channel *c, const char *context, const char *exten, const char *label, const char *callerid) |
Find the priority of an extension that has the specified label. More... | |
int | ast_findlabel_extension2 (struct ast_channel *c, struct ast_context *con, const char *exten, const char *label, const char *callerid) |
Find the priority of an extension that has the specified label. More... | |
const char * | ast_get_context_name (struct ast_context *con) |
const char * | ast_get_context_registrar (struct ast_context *c) |
const char * | ast_get_extension_app (struct ast_exten *e) |
void * | ast_get_extension_app_data (struct ast_exten *e) |
const char * | ast_get_extension_cidmatch (struct ast_exten *e) |
struct ast_context * | ast_get_extension_context (struct ast_exten *exten) |
int | ast_get_extension_data (char *buf, int bufsize, struct ast_channel *c, const char *context, const char *exten, int priority) |
Fill a string buffer with the data at a dialplan extension. More... | |
const char * | ast_get_extension_label (struct ast_exten *exten) |
int | ast_get_extension_matchcid (struct ast_exten *e) |
const char * | ast_get_extension_name (struct ast_exten *exten) |
int | ast_get_extension_priority (struct ast_exten *exten) |
const char * | ast_get_extension_registrar (struct ast_exten *e) |
const char * | ast_get_extension_registrar_file (struct ast_exten *e) |
Get name of configuration file used by registrar to register this extension. More... | |
int | ast_get_extension_registrar_line (struct ast_exten *e) |
Get line number of configuration file used by registrar to register this extension. More... | |
int | ast_get_hint (char *hint, int hintsize, char *name, int namesize, struct ast_channel *c, const char *context, const char *exten) |
Get hint for channel. More... | |
int | ast_goto_if_exists (struct ast_channel *chan, const char *context, const char *exten, int priority) |
int | ast_hashtab_compare_contexts (const void *ah_a, const void *ah_b) |
hashtable functions for contexts More... | |
unsigned int | ast_hashtab_hash_contexts (const void *obj) |
static struct ast_exten * | ast_hint_extension (struct ast_channel *c, const char *context, const char *exten) |
static struct ast_exten * | ast_hint_extension_nolock (struct ast_channel *c, const char *context, const char *exten) |
Find hint for given extension in context. More... | |
int | ast_hint_presence_state (struct ast_channel *c, const char *context, const char *exten, char **subtype, char **message) |
Uses hint and presence state callback to get the presence state of an extension. More... | |
int | ast_ignore_pattern (const char *context, const char *pattern) |
Checks to see if a number should be ignored. More... | |
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) More... | |
void | ast_merge_contexts_and_delete (struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar) |
Merge the temporary contexts into a global contexts list and delete from the global list the ones that are being added. More... | |
int | ast_parseable_goto (struct ast_channel *chan, const char *goto_string) |
void | ast_pbx_h_exten_run (struct ast_channel *chan, const char *context) |
Run the h exten from the given context. More... | |
int | ast_pbx_init (void) |
int | ast_pbx_outgoing_app (const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, const struct ast_assigned_ids *assignedids) |
Synchronously or asynchronously make an outbound call and execute an application on the channel. More... | |
int | ast_pbx_outgoing_app_predial (const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, const struct ast_assigned_ids *assignedids, const char *predial_callee) |
int | ast_pbx_outgoing_exten (const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, int early_media, const struct ast_assigned_ids *assignedids) |
Synchronously or asynchronously make an outbound call and send it to a particular extension. More... | |
int | ast_pbx_outgoing_exten_predial (const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, int early_media, const struct ast_assigned_ids *assignedids, const char *predial_callee) |
enum ast_pbx_result | ast_pbx_run (struct ast_channel *c) |
Execute the PBX in the current thread. More... | |
enum ast_pbx_result | ast_pbx_run_args (struct ast_channel *c, struct ast_pbx_args *args) |
Execute the PBX in the current thread. More... | |
enum ast_pbx_result | ast_pbx_start (struct ast_channel *c) |
Create a new thread and start the PBX. More... | |
int | ast_processed_calls (void) |
Retrieve the total number of calls processed through the PBX since last restart. More... | |
int | ast_rdlock_context (struct ast_context *con) |
Read locks a given context. More... | |
int | ast_rdlock_contexts (void) |
Read locks the context list. More... | |
static int | ast_remove_hint (struct ast_exten *e) |
Remove hint from extension. More... | |
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) More... | |
int | ast_str_get_hint (struct ast_str **hint, ssize_t hintsize, struct ast_str **name, ssize_t namesize, struct ast_channel *c, const char *context, const char *exten) |
Get hint for channel. More... | |
int | ast_unlock_context (struct ast_context *con) |
int | ast_unlock_contexts (void) |
Unlocks contexts. More... | |
struct ast_exten * | ast_walk_context_extensions (struct ast_context *con, struct ast_exten *exten) |
const struct ast_ignorepat * | ast_walk_context_ignorepats (const struct ast_context *con, const struct ast_ignorepat *ip) |
const struct ast_include * | ast_walk_context_includes (const struct ast_context *con, const struct ast_include *inc) |
const struct ast_sw * | ast_walk_context_switches (const struct ast_context *con, const struct ast_sw *sw) |
struct ast_context * | ast_walk_contexts (struct ast_context *con) |
struct ast_exten * | ast_walk_extension_priorities (struct ast_exten *exten, struct ast_exten *priority) |
int | ast_wrlock_context (struct ast_context *con) |
Write locks a given context. More... | |
int | ast_wrlock_contexts (void) |
Write locks the context list. More... | |
static int | autohint_cmp (void *obj, void *arg, int flags) |
static int | autohint_hash_cb (const void *obj, const int flags) |
static const char * | candidate_exten_advance (const char *str) |
static void | cli_match_char_tree (struct match_char *node, char *prefix, int fd) |
static int | collect_digits (struct ast_channel *c, int waittime, char *buf, int buflen, int pos) |
collect digits from the channel into the buffer. More... | |
static int | compare_char (const void *a, const void *b) |
static char * | complete_core_show_hint (const char *line, const char *word, int pos, int state) |
autocomplete for CLI command 'core show hint' More... | |
static char * | complete_show_dialplan_context (const char *line, const char *word, int pos, int state) |
static void | context_merge (struct ast_context **extcontexts, struct ast_hashtab *exttable, struct ast_context *context, const char *registrar) |
static void | context_merge_incls_swits_igps_other_registrars (struct ast_context *new, struct ast_context *old, const char *registrar) |
static void | context_table_create_autohints (struct ast_hashtab *table) |
static void | create_match_char_tree (struct ast_context *con) |
static void | decrease_call_count (void) |
static void | destroy_exten (struct ast_exten *e) |
static void | destroy_hint (void *obj) |
static void | destroy_pattern_tree (struct match_char *pattern_tree) |
static void | destroy_state_cb (void *doomed) |
static void | device_state_cb (void *unused, struct stasis_subscription *sub, struct stasis_message *msg) |
static void | device_state_info_dt (void *obj) |
static void | device_state_notify_callbacks (struct ast_hint *hint, struct ast_str **hint_app) |
static void | exception_store_free (void *data) |
static int | execute_state_callback (ast_state_cb_type cb, const char *context, const char *exten, void *data, enum ast_state_cb_update_reason reason, struct ast_hint *hint, struct ao2_container *device_state_info) |
static int | ext_cmp (const char *left, const char *right) |
static int | ext_cmp_exten (const char *left, const char *right) |
static int | ext_cmp_exten_partial (const char *left, const char *right) |
static int | ext_cmp_exten_strlen (const char *str) |
static int | ext_cmp_pattern (const char *left, const char *right) |
static int | ext_cmp_pattern_pos (const char **p, unsigned char *bitwise) |
helper functions to sort extension patterns in the desired way, so that more specific patterns appear first. More... | |
static int | ext_fluff_count (const char *exten) |
static unsigned int | ext_strncpy (char *dst, const char *src, size_t dst_size, int nofluff) |
static int | extension_match_core (const char *pattern, const char *data, enum ext_match_t mode) |
static int | extension_presence_state_helper (struct ast_exten *e, char **subtype, char **message) |
static int | extension_state_add_destroy (const char *context, const char *exten, ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data, int extended) |
static struct ast_context * | find_context (const char *context) |
lookup for a context with a given name, More... | |
static struct ast_context * | find_context_locked (const char *context) |
lookup for a context with a given name, More... | |
static int | find_hint_by_cb_id (void *obj, void *arg, int flags) |
Find Hint by callback id. More... | |
static struct ast_exten * | get_canmatch_exten (struct match_char *node) |
static void | get_device_state_causing_channels (struct ao2_container *c) |
static const char * | get_pattern_node (struct pattern_node *node, const char *src, int pattern, const char *extenbuf) |
static char * | handle_debug_dialplan (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Send ack once. More... | |
static int | handle_hint_change_message_type (struct stasis_message *msg, enum ast_state_cb_update_reason reason) |
static char * | handle_set_extenpatternmatchnew (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_show_dialplan (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_show_hint (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
handle_show_hint: CLI support for listing registered dial plan hint More... | |
static char * | handle_show_hints (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
handle_show_hints: CLI support for listing registered dial plan hints More... | |
static char * | handle_unset_extenpatternmatchnew (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | hashtab_compare_exten_labels (const void *ah_a, const void *ah_b) |
static int | hashtab_compare_exten_numbers (const void *ah_a, const void *ah_b) |
static int | hashtab_compare_extens (const void *ha_a, const void *ah_b) |
static unsigned int | hashtab_hash_extens (const void *obj) |
static unsigned int | hashtab_hash_labels (const void *obj) |
static unsigned int | hashtab_hash_priority (const void *obj) |
static int | hint_cmp (void *obj, void *arg, int flags) |
static int | hint_hash (const void *obj, const int flags) |
static int | hint_id_cmp (void *obj, void *arg, int flags) |
static int | hintdevice_cmp_multiple (void *obj, void *arg, int flags) |
static void | hintdevice_destroy (void *obj) |
static int | hintdevice_hash_cb (const void *obj, const int flags) |
static int | hintdevice_remove_cb (void *obj, void *arg, void *data, int flags) |
static int | increase_call_count (const struct ast_channel *c) |
Increase call count for channel. More... | |
static void | insert_in_next_chars_alt_char_list (struct match_char **parent_ptr, struct match_char *node) |
static int | internal_extension_state_extended (struct ast_channel *c, const char *context, const char *exten, struct ao2_container *device_state_info) |
int | load_pbx (void) |
static void | manager_dpsendack (struct mansession *s, const struct message *m) |
Send ack once. More... | |
static int | manager_show_dialplan (struct mansession *s, const struct message *m) |
Manager listing of dial plan. More... | |
static int | manager_show_dialplan_helper (struct mansession *s, const struct message *m, const char *actionidtext, const char *context, const char *exten, struct dialplan_counters *dpc, const struct ast_include *rinclude, int includecount, const char *includes[]) |
Show dialplan extensions XXX this function is similar but not exactly the same as the CLI's show dialplan. Must check whether the difference is intentional or not. More... | |
static int | matchcid (const char *cidpattern, const char *callerid) |
static void | new_find_extension (const char *str, struct scoreboard *score, struct match_char *tree, int length, int spec, const char *callerid, const char *label, enum ext_match_t action) |
static char * | parse_hint_device (struct ast_str *hint_args) |
static char * | parse_hint_presence (struct ast_str *hint_args) |
int | pbx_checkcondition (const char *condition) |
Evaluate a condition. More... | |
static void | pbx_destroy (struct ast_pbx *p) |
static enum ast_control_frame_type | pbx_dial_reason (enum ast_dial_result dial_result, int cause) |
Attempt to convert disconnect cause to old originate reason. More... | |
static int | pbx_extension_helper (struct ast_channel *c, struct ast_context *con, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action, int *found, int combined_find_spawn) |
The return value depends on the action: More... | |
struct ast_exten * | pbx_find_extension (struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action) |
static int | pbx_outgoing_attempt (const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, int early_media, const struct ast_assigned_ids *assignedids, const char *predial_callee) |
static void | pbx_outgoing_destroy (void *obj) |
Destructor for outgoing structure. More... | |
static void * | pbx_outgoing_exec (void *data) |
Internal function which dials an outgoing leg and sends it to a provided extension or application. More... | |
static void | pbx_outgoing_state_callback (struct ast_dial *dial) |
Internal dialing state callback which causes early media to trigger an answer. More... | |
int | pbx_parse_location (struct ast_channel *chan, char **contextp, char **extenp, char **prip, int *ipri, int *mode, char *rest) |
Parses a dialplan location into context, extension, priority. More... | |
static int | pbx_parseable_goto (struct ast_channel *chan, const char *goto_string, int async) |
int | pbx_set_autofallthrough (int newval) |
int | pbx_set_extenpatternmatchnew (int newval) |
void | pbx_set_overrideswitch (const char *newval) |
static void | pbx_shutdown (void) |
static void * | pbx_thread (void *data) |
static void | presence_state_cb (void *unused, struct stasis_subscription *sub, struct stasis_message *msg) |
static void | presence_state_notify_callbacks (struct ast_hint *hint, struct ast_str **hint_app, struct ast_presence_state_message *presence_state) |
static void | print_autohint_key (void *v_obj, void *where, ao2_prnt_fn *prnt) |
static void | print_ext (struct ast_exten *e, char *buf, int buflen) |
helper function to print an extension More... | |
static void | print_hintdevices_key (void *v_obj, void *where, ao2_prnt_fn *prnt) |
static void | print_hints_key (void *v_obj, void *where, ao2_prnt_fn *prnt) |
static void | print_statecbs_key (void *v_obj, void *where, ao2_prnt_fn *prnt) |
static int | publish_hint_change (struct ast_hint *hint, struct ast_exten *ne) |
Publish a hint changed event More... | |
static int | publish_hint_remove (struct ast_hint *hint) |
Publish a hint removed event More... | |
int | raise_exception (struct ast_channel *chan, const char *reason, int priority) |
static int | remove_hintdevice (struct ast_hint *hint) |
void | set_ext_pri (struct ast_channel *c, const char *exten, int pri) |
static int | show_debug_helper (int fd, const char *context, const char *exten, struct dialplan_counters *dpc, struct ast_include *rinclude, int includecount, const char *includes[]) |
static int | show_dialplan_helper (int fd, const char *context, const char *exten, struct dialplan_counters *dpc, const struct ast_include *rinclude, int includecount, const char *includes[]) |
static void | show_dialplan_helper_extension_output (int fd, char *buf1, char *buf2, struct ast_exten *exten) |
Writes CLI output of a single extension for show dialplan. More... | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (hint_change_message_type) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (hint_remove_message_type) | |
static int | statecbs_cmp (void *obj, void *arg, int flags) |
static int | testtime_write (struct ast_channel *chan, const char *cmd, char *var, const char *value) |
static struct ast_exten * | trie_find_next_match (struct match_char *node) |
static void | unload_pbx (void) |
void | unreference_cached_app (struct ast_app *app) |
static void | update_scoreboard (struct scoreboard *board, int length, int spec, struct ast_exten *exten, char last, const char *callerid, int deleted, struct match_char *node) |
void | wait_for_hangup (struct ast_channel *chan, const void *data) |
Variables | |
static int | autofallthrough = 1 |
static struct ao2_container * | autohints |
Container for autohint contexts. More... | |
static ast_mutex_t | conlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
Lock for the ast_context list. More... | |
static ast_mutex_t | context_merge_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
Lock to hold off restructuring of hints by ast_merge_contexts_and_delete. More... | |
static struct ast_context * | contexts |
static struct ast_hashtab * | contexts_table = NULL |
static int | countcalls |
static struct stasis_subscription * | device_state_sub |
Subscription for device state change events. More... | |
static struct ast_custom_function | exception_function |
static const struct ast_datastore_info | exception_store_info |
static int | extenpatternmatchnew = 0 |
static const struct cfextension_states | extension_states [] |
static struct ast_threadstorage | extensionstate_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_extensionstate_buf , .custom_init = NULL , } |
static struct ast_threadstorage | hintdevice_data = { .once = PTHREAD_ONCE_INIT , .key_init = __init_hintdevice_data , .custom_init = NULL , } |
static struct ao2_container * | hintdevices |
Container for hint devices. More... | |
static struct ao2_container * | hints |
static ast_mutex_t | maxcalllock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static char * | overrideswitch = NULL |
static struct ast_cli_entry | pbx_cli [] |
static struct stasis_subscription * | presence_state_sub |
Subscription for presence state change events. More... | |
static struct ao2_container * | statecbs |
static int | stateid = 1 |
static struct ast_threadstorage | switch_data = { .once = PTHREAD_ONCE_INIT , .key_init = __init_switch_data , .custom_init = NULL , } |
static struct ast_custom_function | testtime_function |
static int | totalcalls |
Core PBX routines.
Definition in file pbx.c.
#define ADVANCE | ( | s | ) | candidate_exten_advance(s) |
#define BITS_PER 8 /* Number of bits per unit (byte). */ |
#define EXT_DATA_SIZE 8192 |
The speed of extension handling will likely be among the most importantaspects of this PBX. The switching scheme as it exists right now isn't terribly bad (it's O(N+M), where N is the # of extensions and M is the avg # of priorities, but a constant search time here would be great ;-)
A new algorithm to do searching based on a 'compiled' pattern tree is introduced here, and shows a fairly flat (constant) search time, even for over 10000 patterns.
Also, using a hash table for context/priority name lookup can help prevent the find_extension routines from absorbing exponential cpu cycles as the number of contexts/priorities grow. I've previously tested find_extension with red-black trees, which have O(log2(n)) speed. Right now, I'm using hash tables, which do searches (ideally) in O(1) time. While these techniques do not yield much speed in small dialplans, they are worth the trouble in large dialplans.
#define INC_DST_OVERFLOW_CHECK |
#define MORE | ( | s | ) | (*candidate_exten_advance(s)) |
#define NEW_MATCHER_CHK_MATCH |
#define NEW_MATCHER_RECURSE |
void __ast_context_destroy | ( | struct ast_context * | list, |
struct ast_hashtab * | contexttab, | ||
struct ast_context * | con, | ||
const char * | registrar | ||
) |
Definition at line 8056 of file pbx.c.
References __ast_internal_context_destroy(), ast_context_ignorepats_count(), ast_context_includes_count(), ast_context_remove_extension_callerid2(), ast_context_switches_count(), ast_copy_string(), ast_debug, ast_free, ast_get_ignorepat_registrar(), ast_get_include_registrar(), ast_get_switch_registrar(), ast_hashtab_end_traversal(), ast_hashtab_next(), ast_hashtab_remove_this_object(), ast_hashtab_start_traversal, AST_MAX_EXTENSION, ast_unlock_context(), AST_VECTOR_GET, AST_VECTOR_REMOVE_ORDERED, ast_verb, ast_wrlock_context(), ast_exten::cidmatch, contexts, ast_exten::exten, ignorepat_free(), include_free(), ast_exten::matchcid, ast_exten::name, ast_context::name, ast_context::next, ast_sw::next, NULL, ast_exten::peer_table, ast_exten::priority, ast_exten::registrar, registrar, ast_context::root_table, sw_free(), and tmp().
Referenced by ast_context_destroy().
|
static |
Definition at line 8760 of file pbx.c.
References ast_async_goto(), ast_channel_caller(), ast_channel_context(), ast_channel_exten(), ast_exists_extension(), ast_explicit_goto(), AST_PBX_GOTO_FAILED, voicemailpwcheck::context, ast_channel::exten, NULL, priority, and S_COR.
Referenced by ast_async_goto_if_exists(), and ast_goto_if_exists().
|
static |
Definition at line 8015 of file pbx.c.
References ast_free, ast_hashtab_destroy(), ast_rwlock_destroy, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, destroy_exten(), destroy_pattern_tree(), el, ignorepat_free(), include_free(), ast_exten::next, NULL, ast_exten::peer, sw_free(), and tmp().
Referenced by __ast_context_destroy(), and ast_merge_contexts_and_delete().
|
static |
Definition at line 4306 of file pbx.c.
References args, ast_callid_threadassoc_add(), ast_calloc, ast_channel_caller(), ast_channel_callid(), ast_channel_callid_set(), ast_channel_clear_softhangup(), ast_channel_context(), ast_channel_exten(), ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_pbx(), ast_channel_pbx_set(), ast_channel_priority(), ast_channel_priority_set(), ast_channel_softhangup_internal_flag(), ast_channel_unlock, ast_channel_whentohangup(), ast_check_hangup(), ast_clear_flag, ast_copy_string(), ast_create_callid(), ast_debug, ast_exists_extension(), AST_FLAG_BRIDGE_HANGUP_RUN, AST_FLAG_IN_AUTOLOOP, ast_free, ast_hangup(), ast_log, ast_matchmore_extension(), AST_PBX_ERROR, AST_PBX_FAILED, ast_pbx_h_exten_run(), ast_pbx_hangup_handler_run(), AST_PBX_INCOMPLETE, AST_PBX_SUCCESS, ast_read_threadstorage_callid(), ast_set2_flag, ast_set_flag, ast_softhangup(), AST_SOFTHANGUP_APPUNLOAD, AST_SOFTHANGUP_ASYNCGOTO, AST_SOFTHANGUP_TIMEOUT, ast_spawn_extension(), ast_strlen_zero(), ast_test_flag, ast_verb, autofallthrough, c, collect_digits(), digit, ast_pbx::dtimeoutms, error(), indicate_busy(), indicate_congestion(), LOG_WARNING, NULL, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), pbx_destroy(), raise_exception(), ast_pbx::rtimeoutms, S_COR, set_ext_pri(), and status.
Referenced by ast_pbx_run_args(), and pbx_thread().
|
static |
Definition at line 2223 of file pbx.c.
References ast_log, ast_exten::data, E_MATCH, E_MATCH_MASK, E_MATCHMORE, end, ext_cmp_exten(), ext_cmp_exten_partial(), ext_cmp_exten_strlen(), ext_cmp_pattern(), LOG_NOTICE, and LOG_WARNING.
Referenced by extension_match_core().
|
static |
Definition at line 2832 of file pbx.c.
References ast_channel_datastore_find(), ast_copy_string(), buf, pbx_exception::context, ast_datastore::data, exception_store_info, pbx_exception::exten, NULL, pbx_exception::priority, and pbx_exception::reason.
|
static |
Definition at line 8344 of file pbx.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_exten::app, ast_extension_state2str(), ast_strlen_zero(), astman_append(), astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), ast_exten::exten, ast_hint::exten, ast_hint::laststate, ast_context::name, and ast_exten::parent.
Referenced by load_pbx().
|
static |
Definition at line 1663 of file pbx.c.
References add_pattern_node(), already_in_tree(), ARRAY_LEN, ast_copy_string(), ast_debug, ast_log, pattern_node::buf, buf, ast_exten::cidmatch, match_char::deleted, ast_exten::exten, match_char::exten, get_pattern_node(), LOG_ERROR, LOG_WARNING, ast_exten::matchcid, MAX_EXTENBUF_SIZE, ast_exten::name, match_char::next_char, NULL, and ast_context::pattern_tree.
Referenced by add_priority(), ast_add_extension2_lockopt(), ast_context_remove_extension_callerid2(), and create_match_char_tree().
|
static |
add hintdevice structure and link it into the container.
Definition at line 557 of file pbx.c.
References ao2_ref, ao2_t_alloc, ao2_t_link, ao2_t_ref, ast_free, ast_str_buffer(), ast_str_set(), ast_str_thread_get(), ast_strdup, AST_VECTOR_APPEND, ast_hint::devices, ast_hintdevice::hint, ast_hintdevice::hintdevice, hintdevice_data, hintdevice_destroy(), hintdevices, str, and strsep().
Referenced by ast_add_hint(), and ast_change_hint().
|
static |
Definition at line 1464 of file pbx.c.
References ast_calloc, pattern_node::buf, current, insert_in_next_chars_alt_char_list(), match_char::is_pattern, NULL, ast_context::pattern_tree, pattern_node::specif, match_char::specificity, and match_char::x.
Referenced by add_exten_to_pattern_tree().
|
static |
add the extension in the priority chain.
0 | on success. |
-1 | on failure. |
Definition at line 7067 of file pbx.c.
References add_exten_to_pattern_tree(), ast_add_hint(), ast_change_hint(), ast_free, ast_hashtab_insert_safe, ast_hashtab_remove_object_via_lookup(), ast_log, ast_exten::data, ast_exten::datad, el, ast_exten::label, LOG_ERROR, LOG_WARNING, ast_exten::name, ast_context::name, ast_exten::next, NULL, ast_exten::peer, ast_exten::peer_label_table, ast_exten::peer_table, ast_exten::priority, PRIORITY_HINT, replace(), ast_context::root, ast_context::root_table, tmp(), and match_char::x.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 3076 of file pbx.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_list, and NULL.
Referenced by ast_extension_state_extended(), and device_state_notify_callbacks().
|
static |
Definition at line 1402 of file pbx.c.
References match_char::alt_char, current, match_char::is_pattern, and match_char::x.
Referenced by add_exten_to_pattern_tree().
int ast_active_calls | ( | void | ) |
Retrieve the number of active calls.
Definition at line 4760 of file pbx.c.
References countcalls.
Referenced by ast_var_Config(), get_current_call_count(), handle_chanlist(), handle_showcalls(), and sysinfo_helper().
int ast_add_extension | ( | const char * | context, |
int | replace, | ||
const char * | extension, | ||
int | priority, | ||
const char * | label, | ||
const char * | callerid, | ||
const char * | application, | ||
void * | data, | ||
void(*)(void *) | datad, | ||
const char * | registrar | ||
) |
Add and extension to an extension context.
context | context to add the extension to |
replace | |
extension | extension to add |
priority | priority level of extension addition |
label | extension label |
callerid | pattern to match CallerID, or NULL to match any CallerID |
application | application to run on the extension with that priority level |
data | data to pass to the application |
datad | a pointer to a function that will deallocate data when needed or NULL if data does not need to be freed. |
registrar | who registered the extension |
datap
will be called and passed the data
pointer.0 | success |
-1 | failure |
Definition at line 6928 of file pbx.c.
References ast_add_extension2(), ast_unlock_contexts(), c, voicemailpwcheck::context, ast_context::data, find_context_locked(), NULL, priority, registrar, and replace().
Referenced by add_to_regcontext(), app_create(), ast_hint_presence_state(), ast_sip_persistent_endpoint_update_state(), AST_TEST_DEFINE(), create_test_dialplan(), device_state_cb(), extension_state_add_destroy(), handle_cli_dialplan_add_extension(), internal_extension_state_extended(), join_conference_bridge(), load_module(), register_extension(), register_peer_exten(), sla_build_station(), and sla_build_trunk().
int ast_add_extension2 | ( | struct ast_context * | con, |
int | replace, | ||
const char * | extension, | ||
int | priority, | ||
const char * | label, | ||
const char * | callerid, | ||
const char * | application, | ||
void * | data, | ||
void(*)(void *) | datad, | ||
const char * | registrar, | ||
const char * | registrar_file, | ||
int | registrar_line | ||
) |
Main interface to add extensions to the list for out context.
Add an extension to an extension context, this time with an ast_context *.
We sort extensions in order of matching preference, so that we can stop the search as soon as we find a suitable match. This ordering also takes care of wildcards such as '.' (meaning "one or more of any character") and '!' (which is 'earlymatch', meaning "zero or more of any character" but also impacts the return value from CANMATCH and EARLYMATCH.
The extension match rules defined in the devmeeting 2006.05.05 are quite simple: WE SELECT THE LONGEST MATCH. In detail, "longest" means the number of matched characters in the extension. In case of ties (e.g. _XXX and 333) in the length of a pattern, we give priority to entries with the smallest cardinality (e.g, [5-9] comes before [2-8] before the former has only 5 elements, while the latter has 7, etc. In case of same cardinality, the first element in the range counts. If we still have a tie, any final '!' will make this as a possibly less specific pattern.
EBUSY - can't lock EEXIST - extension with the same priority exist and no replace is set
Definition at line 7257 of file pbx.c.
References ast_add_extension2_lockopt(), priority, registrar, and replace().
Referenced by add_extensions(), ast_add_extension(), context_merge(), lua_register_hints(), manager_dialplan_extension_add(), pbx_load_config(), and pbx_load_users().
|
static |
Same as ast_add_extension2() but controls the context locking.
Does all the work of ast_add_extension2, but adds an arg to determine if context locking should be done.
Definition at line 7283 of file pbx.c.
References add_exten_to_pattern_tree(), add_priority(), ast_add_hint(), ast_calloc, ast_channel_context_set(), ast_channel_exten_set(), ast_channel_unref, ast_dummy_channel_alloc, AST_EXT_MATCHCID_OFF, AST_EXT_MATCHCID_ON, ast_free, ast_hashtab_create, ast_hashtab_insert_safe, ast_hashtab_lookup(), ast_hashtab_newsize_java(), ast_hashtab_remove_this_object(), ast_hashtab_resize_java(), ast_log, ast_strlen_zero(), ast_thread_inhibit_escalations(), ast_thread_inhibit_escalations_swap(), ast_unlock_context(), ast_wrlock_context(), c, ast_exten::cidmatch, ast_exten::data, ast_exten::datad, DEBUG_ATLEAST, el, errno, ext_cmp(), ext_fluff_count(), ext_strncpy(), ast_exten::exten, hashtab_compare_exten_labels(), hashtab_compare_exten_numbers(), hashtab_compare_extens(), hashtab_hash_extens(), hashtab_hash_labels(), hashtab_hash_priority(), ast_exten::label, LOG_DEBUG, LOG_ERROR, ast_exten::matchcid, ast_context::name, ast_exten::next, NULL, ast_context::pattern_tree, pbx_substitute_variables_helper(), priority, PRIORITY_HINT, registrar, ast_exten::registrar_file, ast_exten::registrar_line, replace(), ast_context::root, ast_context::root_table, tmp(), VAR_BUF_SIZE, and match_char::x.
Referenced by ast_add_extension2(), ast_add_extension2_nolock(), and ast_add_extension_nolock().
int ast_add_extension2_nolock | ( | struct ast_context * | con, |
int | replace, | ||
const char * | extension, | ||
int | priority, | ||
const char * | label, | ||
const char * | callerid, | ||
const char * | application, | ||
void * | data, | ||
void(*)(void *) | datad, | ||
const char * | registrar, | ||
const char * | registrar_file, | ||
int | registrar_line | ||
) |
Same as ast_add_extension2, but assumes you have already locked context.
Definition at line 7266 of file pbx.c.
References ast_add_extension2_lockopt(), priority, registrar, and replace().
Referenced by add_extension(), parking_add_extension(), and parking_duration_callback().
|
static |
Definition at line 6908 of file pbx.c.
References ast_add_extension2_lockopt(), c, voicemailpwcheck::context, ast_context::data, find_context(), NULL, priority, registrar, and replace().
Referenced by ast_merge_contexts_and_delete().
|
static |
Add hint to hint list, check initial extension state.
Definition at line 3978 of file pbx.c.
References add_hintdevice(), ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_list, ao2_find, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_link, ao2_lock, ao2_ref, ao2_unlock, ast_exten::app, ast_debug, AST_DEVICE_INVALID, ast_extension_state2(), ast_get_context_name(), ast_get_extension_app(), ast_get_extension_context(), ast_get_extension_name(), AST_HINT_UPDATE_DEVICE, ast_log, AST_PRESENCE_INVALID, AST_VECTOR_INIT, ast_hint::callbacks, ast_state_cb::change_cb, ast_state_cb::data, destroy_hint(), ast_hint::devices, execute_state_callback(), ast_exten::exten, ast_hint::exten, extension_presence_state_helper(), hint_id_cmp(), ast_hint::last_presence_message, ast_hint::last_presence_state, ast_hint::last_presence_subtype, ast_hint::laststate, LOG_WARNING, NULL, and statecbs.
Referenced by add_priority(), and ast_add_extension2_lockopt().
int ast_async_goto | ( | struct ast_channel * | chan, |
const char * | context, | ||
const char * | exten, | ||
int | priority | ||
) |
Set the channel to next execute the specified dialplan location.
Definition at line 6969 of file pbx.c.
References ast_channel_flags(), ast_channel_is_bridged(), ast_channel_lock, ast_channel_name(), ast_channel_pbx(), ast_channel_unlock, ast_channel_yank(), ast_explicit_goto(), AST_FLAG_IN_AUTOLOOP, ast_hangup(), ast_log, ast_pbx_start(), AST_SOFTHANGUP_ASYNCGOTO, ast_softhangup_nolock(), ast_test_flag, voicemailpwcheck::context, ast_channel::exten, LOG_WARNING, and priority.
Referenced by __ast_goto_if_exists(), action_redirect(), ast_async_goto_by_name(), bridge_channel_blind_transfer(), chan_pjsip_cng_tone_detected(), comeback_goto(), dahdi_handle_dtmf(), fax_detect_framehook(), my_handle_dtmf(), onModeChanged(), ooh323_rtp_read(), and pbx_parseable_goto().
int ast_async_goto_by_name | ( | const char * | channame, |
const char * | context, | ||
const char * | exten, | ||
int | priority | ||
) |
Set the channel to next execute the specified dialplan location.
Definition at line 7002 of file pbx.c.
References ast_async_goto(), ast_channel_get_by_name(), ast_channel_unref, voicemailpwcheck::context, ast_channel::exten, and priority.
int ast_async_goto_if_exists | ( | struct ast_channel * | chan, |
const char * | context, | ||
const char * | exten, | ||
int | priority | ||
) |
Definition at line 8786 of file pbx.c.
References __ast_goto_if_exists(), voicemailpwcheck::context, ast_channel::exten, and priority.
int ast_async_parseable_goto | ( | struct ast_channel * | chan, |
const char * | goto_string | ||
) |
Definition at line 8871 of file pbx.c.
References pbx_parseable_goto().
Referenced by asyncgoto_exec(), detect_callback(), handle_redirect(), and parking_duration_callback().
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.
c | not really important |
context | context to search within |
exten | extension to check |
priority | priority of extension path |
callerid | callerid of extension being searched for |
Definition at line 4190 of file pbx.c.
References c, voicemailpwcheck::context, E_CANMATCH, ast_exten::exten, NULL, pbx_extension_helper(), and priority.
Referenced by __analog_ss_thread(), analog_ss_thread(), background_detect_exec(), dp_lookup(), dundi_lookup_local(), get_destination(), leave_voicemail(), loopback_canmatch(), pbx_builtin_background(), test_exten(), and valid_exit().
Change hint for an extension.
Definition at line 4092 of file pbx.c.
References add_hintdevice(), ao2_find, ao2_link, ao2_lock, ao2_ref, ao2_unlock, ast_get_context_name(), ast_get_extension_app(), ast_get_extension_context(), ast_get_extension_name(), ast_log, ast_mutex_unlock, context_merge_lock, ast_hint::exten, LOG_WARNING, OBJ_UNLINK, publish_hint_change(), and remove_hintdevice().
Referenced by add_priority().
int ast_context_add_ignorepat | ( | const char * | context, |
const char * | ignorepat, | ||
const char * | registrar | ||
) |
Add an ignorepat.
context | which context to add the ignorepattern to |
ignorepat | ignorepattern to set up for the extension |
registrar | registrar of the ignore pattern |
Adds an ignore pattern to a particular context.
0 | on success |
-1 | on failure |
Definition at line 6835 of file pbx.c.
References ast_context_add_ignorepat2(), ast_unlock_contexts(), c, voicemailpwcheck::context, find_context_locked(), registrar, and value.
Referenced by handle_cli_dialplan_add_ignorepat().
int ast_context_add_ignorepat2 | ( | struct ast_context * | con, |
const char * | value, | ||
const char * | registrar | ||
) |
Definition at line 6848 of file pbx.c.
References ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_get_ignorepat_name(), ast_unlock_context(), AST_VECTOR_APPEND, ast_wrlock_context(), errno, ignorepat_alloc(), ignorepat_free(), ast_context::ignorepats, registrar, and value.
Referenced by ast_context_add_ignorepat(), and context_merge_incls_swits_igps_other_registrars().
int ast_context_add_include | ( | const char * | context, |
const char * | include, | ||
const char * | registrar | ||
) |
Add a context include.
context | context to add include to |
include | new include to add |
registrar | who's registering it |
Adds an include taking a char * string as the context parameter
0 | on success |
-1 | on error |
Definition at line 6664 of file pbx.c.
References ast_context_add_include2(), ast_unlock_contexts(), c, voicemailpwcheck::context, find_context_locked(), and registrar.
Referenced by AST_TEST_DEFINE(), and handle_cli_dialplan_add_include().
int ast_context_add_include2 | ( | struct ast_context * | con, |
const char * | value, | ||
const char * | registrar | ||
) |
Add a context include.
Adds an include taking a struct ast_context as the first parameter
Definition at line 6684 of file pbx.c.
References ast_context_includes_count(), ast_context_includes_get(), ast_debug, ast_get_context_name(), ast_get_include_name(), ast_unlock_context(), AST_VECTOR_APPEND, ast_wrlock_context(), errno, include_alloc(), include_free(), ast_context::includes, registrar, and value.
Referenced by ast_context_add_include(), and context_merge_incls_swits_igps_other_registrars().
int ast_context_add_switch | ( | const char * | context, |
const char * | sw, | ||
const char * | data, | ||
int | eval, | ||
const char * | registrar | ||
) |
Add a switch.
context | context to which to add the switch |
sw | switch to add |
data | data to pass to switch |
eval | whether to evaluate variables when running switch |
registrar | whoever registered the switch |
This function registers a switch with the asterisk switch architecture
0 | on success |
-1 | on failure |
Definition at line 6729 of file pbx.c.
References ast_context_add_switch2(), ast_unlock_contexts(), c, voicemailpwcheck::context, ast_context::data, find_context_locked(), and registrar.
int ast_context_add_switch2 | ( | struct ast_context * | con, |
const char * | value, | ||
const char * | data, | ||
int | eval, | ||
const char * | registrar | ||
) |
Adds a switch (first param is a ast_context)
Definition at line 6749 of file pbx.c.
References ast_context::alts, ast_context_switches_count(), ast_context_switches_get(), ast_get_context_name(), ast_get_switch_data(), ast_get_switch_name(), ast_unlock_context(), AST_VECTOR_APPEND, ast_verb, ast_wrlock_context(), ast_sw::data, errno, ast_sw::eval, registrar, sw_alloc(), sw_free(), and value.
Referenced by ast_context_add_switch(), and context_merge_incls_swits_igps_other_registrars().
void ast_context_destroy | ( | struct ast_context * | con, |
const char * | registrar | ||
) |
Destroy a context (matches the specified context or ANY context if NULL)
con | context to destroy |
registrar | who registered it |
You can optionally leave out either parameter. It will find it based on either the ast_context or the registrar name.
Definition at line 8221 of file pbx.c.
References __ast_context_destroy(), ast_unlock_contexts(), ast_wrlock_contexts(), contexts, contexts_table, and registrar.
Referenced by ast_context_destroy_by_name(), AST_TEST_DEFINE(), parking_lot_cfg_remove_extensions(), remove_all_configured_parking_lot_extensions(), remove_pending_parking_lot_extensions(), sla_destroy(), and unload_module().
int ast_context_destroy_by_name | ( | const char * | context, |
const char * | registrar | ||
) |
Destroy a context by name.
context | Name of the context to destroy |
registrar | who registered it |
You can optionally leave out the registrar parameter. It will find it based on the context name.
-1 | context not found |
0 | Success |
Definition at line 8205 of file pbx.c.
References ast_context_destroy(), ast_context_find(), ast_unlock_contexts(), ast_wrlock_contexts(), voicemailpwcheck::context, and registrar.
Referenced by __unload_module(), app_dtor(), ast_sip_destroy_sorcery_global(), check_regcontext(), and handle_cli_dialplan_remove_context().
struct ast_context * ast_context_find | ( | const char * | name | ) |
Find a context.
name | name of the context to find |
Will search for the context with the given name.
Definition at line 2439 of file pbx.c.
References ast_hashtab_lookup(), ast_rdlock_contexts(), ast_unlock_contexts(), ast_walk_contexts(), contexts_table, item, name, aco_type::name, NULL, and tmp().
Referenced by app_create(), ast_context_destroy_by_name(), ast_context_verify_includes(), ast_ignore_pattern(), context_included(), handle_cli_dialplan_add_extension(), handle_cli_dialplan_add_include(), and isexten_function_read().
struct ast_context * ast_context_find_or_create | ( | struct ast_context ** | extcontexts, |
struct ast_hashtab * | exttable, | ||
const char * | name, | ||
const char * | registrar | ||
) |
Register a new context or find an existing one.
extcontexts | pointer to the ast_context structure pointer |
exttable | pointer to the hashtable that contains all the elements in extcontexts |
name | name of the new context |
registrar | registrar of the context |
This function allows you to play in two environments: the global contexts (active dialplan) or an external context set of your choosing. To act on the external set, make sure extcontexts and exttable are set; for the globals, make sure both extcontexts and exttable are NULL.
This will first search for a context with your name. If it exists already, it will not create a new one. If it does not exist, it will create a new one with the given name and registrar.
Definition at line 6149 of file pbx.c.
References ast_assert, ast_calloc, ast_debug, ast_hashtab_compare_contexts(), ast_hashtab_create, ast_hashtab_hash_contexts(), ast_hashtab_insert_immediate, ast_hashtab_insert_safe, ast_hashtab_lookup(), ast_hashtab_newsize_java(), ast_hashtab_resize_java(), ast_log, ast_rdlock_contexts(), ast_rwlock_init, ast_unlock_contexts(), AST_VECTOR_INIT, ast_wrlock_contexts(), contexts, contexts_table, local_contexts, LOG_ERROR, name, ast_context::name, NULL, registrar, and tmp().
Referenced by add_hints(), app_create(), ast_compile_ael2(), ast_sip_persistent_endpoint_add_to_regcontext(), AST_TEST_DEFINE(), context_merge(), create_test_dialplan(), handle_cli_dialplan_add_extension(), handle_cli_dialplan_add_include(), load_module(), lua_register_hints(), lua_register_switches(), manager_dialplan_extension_add(), parking_duration_callback(), parking_lot_cfg_create_extensions(), pbx_load_config(), pbx_load_users(), set_config(), sla_build_station(), and sla_build_trunk().
int ast_context_ignorepats_count | ( | const struct ast_context * | con | ) |
Definition at line 8722 of file pbx.c.
References AST_VECTOR_SIZE, and ast_context::ignorepats.
Referenced by __ast_context_destroy(), ast_context_add_ignorepat2(), ast_context_remove_ignorepat2(), ast_ignore_pattern(), ast_walk_context_ignorepats(), complete_dialplan_remove_ignorepat(), context_merge_incls_swits_igps_other_registrars(), context_used(), handle_cli_dialplan_save(), lookup_c_ip(), manager_show_dialplan_helper(), and show_dialplan_helper().
const struct ast_ignorepat * ast_context_ignorepats_get | ( | const struct ast_context * | con, |
int | idx | ||
) |
Definition at line 8727 of file pbx.c.
References AST_VECTOR_GET, and ast_context::ignorepats.
Referenced by ast_context_add_ignorepat2(), ast_ignore_pattern(), ast_walk_context_ignorepats(), complete_dialplan_remove_ignorepat(), context_merge_incls_swits_igps_other_registrars(), handle_cli_dialplan_save(), lookup_c_ip(), manager_show_dialplan_helper(), and show_dialplan_helper().
int ast_context_includes_count | ( | const struct ast_context * | con | ) |
Definition at line 8679 of file pbx.c.
References AST_VECTOR_SIZE, and ast_context::includes.
Referenced by __ast_context_destroy(), ast_context_add_include2(), ast_context_remove_include2(), ast_context_verify_includes(), ast_walk_context_includes(), complete_dialplan_remove_include(), context_merge_incls_swits_igps_other_registrars(), context_used(), find_matching_priority(), handle_cli_dialplan_save(), lookup_ci(), manager_show_dialplan_helper(), pbx_find_extension(), and show_dialplan_helper().
const struct ast_include * ast_context_includes_get | ( | const struct ast_context * | con, |
int | idx | ||
) |
Definition at line 8684 of file pbx.c.
References AST_VECTOR_GET, and ast_context::includes.
Referenced by ast_context_add_include2(), ast_context_verify_includes(), ast_walk_context_includes(), complete_dialplan_remove_include(), context_merge_incls_swits_igps_other_registrars(), find_matching_priority(), handle_cli_dialplan_save(), lookup_ci(), manager_show_dialplan_helper(), pbx_find_extension(), and show_dialplan_helper().
int ast_context_remove_extension | ( | const char * | context, |
const char * | extension, | ||
int | priority, | ||
const char * | registrar | ||
) |
Simply remove extension from context.
Definition at line 4948 of file pbx.c.
References ast_context_remove_extension_callerid(), AST_EXT_MATCHCID_ANY, voicemailpwcheck::context, NULL, priority, and registrar.
Referenced by ast_sip_persistent_endpoint_update_state(), AST_TEST_DEFINE(), conf_ended(), delete_extens(), register_peer_exten(), sla_station_destructor(), sla_trunk_destructor(), and unregister_extension().
int ast_context_remove_extension2 | ( | struct ast_context * | con, |
const char * | extension, | ||
int | priority, | ||
const char * | registrar, | ||
int | already_locked | ||
) |
This functionc locks given context, search for the right extension and fires out all peer in this extensions with given priority. If priority is set to 0, all peers are removed. After that, unlock context and return.
Definition at line 4978 of file pbx.c.
References ast_context_remove_extension_callerid2(), AST_EXT_MATCHCID_ANY, NULL, priority, and registrar.
Referenced by add_extension(), and add_hints().
int ast_context_remove_extension_callerid | ( | const char * | context, |
const char * | extension, | ||
int | priority, | ||
const char * | callerid, | ||
int | matchcallerid, | ||
const char * | registrar | ||
) |
Definition at line 4953 of file pbx.c.
References ast_context_remove_extension_callerid2(), ast_unlock_contexts(), c, voicemailpwcheck::context, find_context_locked(), priority, and registrar.
Referenced by ast_context_remove_extension(), handle_cli_dialplan_remove_extension(), and manager_dialplan_extension_remove().
int ast_context_remove_extension_callerid2 | ( | struct ast_context * | con, |
const char * | extension, | ||
int | priority, | ||
const char * | callerid, | ||
int | matchcallerid, | ||
const char * | registrar, | ||
int | already_locked | ||
) |
Definition at line 4983 of file pbx.c.
References add_exten_to_pattern_tree(), ast_debug, ast_hashtab_insert_immediate, ast_hashtab_lookup(), ast_hashtab_remove_this_object(), ast_hashtab_size(), ast_log, ast_strlen_zero(), ast_unlock_context(), ast_verb, ast_wrlock_context(), ast_exten::cidmatch, destroy_exten(), ext_strncpy(), ast_exten::exten, match_char::exten, ast_exten::label, LOG_ERROR, LOG_NOTICE, LOG_WARNING, ast_exten::matchcid, ast_exten::name, ast_context::name, ast_exten::next, NULL, ast_context::pattern_tree, ast_exten::peer, ast_exten::peer_label_table, ast_exten::peer_table, priority, ast_exten::priority, ast_exten::registrar, registrar, ast_context::root, ast_context::root_table, and match_char::x.
Referenced by __ast_context_destroy(), ast_context_remove_extension2(), and ast_context_remove_extension_callerid().
int ast_context_remove_ignorepat | ( | const char * | context, |
const char * | ignorepat, | ||
const char * | registrar | ||
) |
Remove an ignorepat.
context | context from which to remove the pattern |
ignorepat | the pattern to remove |
registrar | the registrar of the ignore pattern |
This removes the given ignorepattern
0 | on success |
-1 | on failure |
Definition at line 6795 of file pbx.c.
References ast_context_remove_ignorepat2(), ast_unlock_contexts(), c, voicemailpwcheck::context, find_context_locked(), and registrar.
Referenced by handle_cli_dialplan_remove_ignorepat().
int ast_context_remove_ignorepat2 | ( | struct ast_context * | con, |
const char * | ignorepat, | ||
const char * | registrar | ||
) |
Definition at line 6808 of file pbx.c.
References ast_context_ignorepats_count(), ast_get_ignorepat_name(), ast_get_ignorepat_registrar(), ast_unlock_context(), AST_VECTOR_GET, AST_VECTOR_REMOVE_ORDERED, ast_wrlock_context(), errno, ignorepat_free(), ast_context::ignorepats, and registrar.
Referenced by ast_context_remove_ignorepat().
int ast_context_remove_include | ( | const char * | context, |
const char * | include, | ||
const char * | registrar | ||
) |
Remove included contexts. This function locks contexts list by &conlist, search for the right context structure, leave context list locked and call ast_context_remove_include2 which removes include, unlock contexts list and return ...
Remove a context include.
Definition at line 4836 of file pbx.c.
References ast_context_remove_include2(), ast_unlock_contexts(), c, voicemailpwcheck::context, find_context_locked(), and registrar.
Referenced by handle_cli_dialplan_remove_include().
int ast_context_remove_include2 | ( | struct ast_context * | con, |
const char * | include, | ||
const char * | registrar | ||
) |
Locks context, remove included contexts, unlocks context. When we call this function, &conlock lock must be locked, because when we giving *con argument, some process can remove/change this context and after that there can be segfault.
Removes an include by an ast_context structure.
0 | on success. |
-1 | on failure. |
Definition at line 4859 of file pbx.c.
References ast_context_includes_count(), ast_get_context_name(), ast_get_include_name(), ast_get_include_registrar(), ast_unlock_context(), AST_VECTOR_GET, AST_VECTOR_REMOVE_ORDERED, ast_verb, ast_wrlock_context(), include_free(), ast_context::includes, and registrar.
Referenced by ast_context_remove_include().
int ast_context_remove_switch | ( | const char * | context, |
const char * | sw, | ||
const char * | data, | ||
const char * | registrar | ||
) |
Remove a switch.
Definition at line 4894 of file pbx.c.
References ast_context_remove_switch2(), ast_unlock_contexts(), c, voicemailpwcheck::context, ast_context::data, find_context_locked(), and registrar.
int ast_context_remove_switch2 | ( | struct ast_context * | con, |
const char * | sw, | ||
const char * | data, | ||
const char * | registrar | ||
) |
This function locks given context, removes switch, unlock context and return.
Definition at line 4916 of file pbx.c.
References ast_context::alts, ast_context_switches_count(), ast_get_context_name(), ast_get_switch_data(), ast_get_switch_name(), ast_get_switch_registrar(), ast_unlock_context(), AST_VECTOR_GET, AST_VECTOR_REMOVE_ORDERED, ast_verb, ast_wrlock_context(), ast_sw::data, registrar, and sw_free().
Referenced by ast_context_remove_switch().
void ast_context_set_autohints | ( | struct ast_context * | con, |
int | enabled | ||
) |
Enable or disable autohints support on a context.
con | pointer to the context |
enabled | whether autohints are enabled |
Definition at line 6230 of file pbx.c.
References ast_context::autohints, and enabled.
Referenced by pbx_load_config().
int ast_context_switches_count | ( | const struct ast_context * | con | ) |
Definition at line 8634 of file pbx.c.
References ast_context::alts, and AST_VECTOR_SIZE.
Referenced by __ast_context_destroy(), ast_context_add_switch2(), ast_context_remove_switch2(), ast_walk_context_switches(), context_merge_incls_swits_igps_other_registrars(), context_used(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), pbx_find_extension(), and show_dialplan_helper().
const struct ast_sw * ast_context_switches_get | ( | const struct ast_context * | con, |
int | idx | ||
) |
Definition at line 8639 of file pbx.c.
References ast_context::alts, and AST_VECTOR_GET.
Referenced by ast_context_add_switch2(), ast_walk_context_switches(), context_merge_incls_swits_igps_other_registrars(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), pbx_find_extension(), and show_dialplan_helper().
int ast_context_verify_includes | ( | struct ast_context * | con | ) |
Verifies includes in an ast_contect structure.
con | context in which to verify the includes |
0 | if no problems found |
-1 | if there were any missing context |
Definition at line 8732 of file pbx.c.
References ast_context_find(), ast_context_includes_count(), ast_context_includes_get(), ast_get_context_name(), ast_log, AST_PBX_MAX_STACK, include_rname(), and LOG_WARNING.
Referenced by pbx_load_module().
enum ast_extension_states ast_devstate_to_extenstate | ( | enum ast_device_state | devstate | ) |
Map devstate to an extension state.
[in] | devstate | device state |
Definition at line 3006 of file pbx.c.
References AST_DEVICE_BUSY, AST_DEVICE_INUSE, AST_DEVICE_INVALID, AST_DEVICE_NOT_INUSE, AST_DEVICE_ONHOLD, AST_DEVICE_RINGING, AST_DEVICE_RINGINUSE, AST_DEVICE_TOTAL, AST_DEVICE_UNAVAILABLE, AST_DEVICE_UNKNOWN, AST_EXTENSION_BUSY, AST_EXTENSION_INUSE, AST_EXTENSION_NOT_INUSE, AST_EXTENSION_ONHOLD, AST_EXTENSION_RINGING, and AST_EXTENSION_UNAVAILABLE.
Referenced by ast_extension_state3(), and AST_TEST_DEFINE().
int ast_exists_extension | ( | struct ast_channel * | c, |
const char * | context, | ||
const char * | exten, | ||
int | priority, | ||
const char * | callerid | ||
) |
Determine whether an extension exists.
c | this is not important |
context | which context to look in |
exten | which extension to search for |
priority | priority of the action within the extension |
callerid | callerid to search for |
Definition at line 4175 of file pbx.c.
References c, voicemailpwcheck::context, E_MATCH, ast_exten::exten, NULL, pbx_extension_helper(), and priority.
Referenced by __analog_ss_thread(), __ast_goto_if_exists(), __ast_pbx_run(), acf_isexten_exec(), action_originate(), add_to_regcontext(), analog_ss_thread(), ast_app_dtget(), ast_bridge_setup_after_goto(), ast_pbx_outgoing_exten_predial(), ast_sip_persistent_endpoint_update_state(), chan_pjsip_cng_tone_detected(), cli_console_dial(), comeback_goto(), conf_run(), dahdi_handle_dtmf(), dial_exec_full(), dialplan_has_destination_cb(), disa_exec(), dp_lookup(), dundi_lookup_local(), fax_detect_framehook(), findmeexec(), get_destination(), gosub_exec(), grab_transfer(), handle_gosub(), isexten_function_read(), jingle_new(), join_conference_bridge(), key_dial_page(), leave_voicemail(), local_call(), local_devicestate(), loopback_exists(), minivm_greet_exec(), my_handle_dtmf(), new_subscribe(), onModeChanged(), ooh323_rtp_read(), options_on_rx_request(), pbx_builtin_waitexten(), privacy_exec(), readexten_exec(), refer_incoming_attended_request(), refer_incoming_blind_request(), register_peer_exten(), show_debug_helper(), socket_process_helper(), try_calling(), vm_authenticate(), and waitstream_core().
int ast_explicit_goto | ( | struct ast_channel * | chan, |
const char * | context, | ||
const char * | exten, | ||
int | priority | ||
) |
Definition at line 6945 of file pbx.c.
References ast_channel_context_set(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_lock, ast_channel_priority_set(), ast_channel_unlock, AST_FLAG_IN_AUTOLOOP, ast_strlen_zero(), ast_test_flag, voicemailpwcheck::context, and priority.
Referenced by __ast_goto_if_exists(), app_control_continue(), ast_async_goto(), ast_bridge_setup_after_goto(), disa_exec(), handle_setpriority(), msg_route(), and pbx_parseable_goto().
int ast_extension_close | ( | const char * | pattern, |
const char * | data, | ||
int | needmore | ||
) |
Definition at line 2432 of file pbx.c.
References ast_log, ast_exten::data, E_CANMATCH, E_MATCHMORE, extension_match_core(), and LOG_WARNING.
Referenced by lua_find_extension(), and realtime_switch_common().
int ast_extension_cmp | ( | const char * | a, |
const char * | b | ||
) |
Determine if one extension should match before another.
a | extension to compare with b |
b | extension to compare with a |
Checks whether or extension a should match before extension b
0 | if the two extensions have equal matching priority |
1 | on a > b |
-1 | on a < b |
Definition at line 2197 of file pbx.c.
References a, b, and ext_cmp().
Referenced by lua_extension_cmp().
int ast_extension_match | ( | const char * | pattern, |
const char * | extension | ||
) |
Determine if a given extension matches a given pattern (in NXX format)
pattern | pattern to match |
extension | extension to check against the pattern. |
Checks whether or not the given extension matches the given pattern.
1 | on match |
0 | on failure |
Definition at line 2427 of file pbx.c.
References ast_context::data, E_MATCH, and extension_match_core().
Referenced by ast_ignore_pattern(), do_say(), find_matching_priority(), load_module(), loopback_canmatch(), loopback_exists(), loopback_matchmore(), lua_find_extension(), manager_show_dialplan_helper(), matchcid(), realtime_switch_common(), reload(), and show_dialplan_helper().
int ast_extension_state | ( | struct ast_channel * | c, |
const char * | context, | ||
const char * | exten | ||
) |
Check extension state for an extension by using hint.
Uses hint and devicestate callback to get the state of an extension.
Definition at line 3170 of file pbx.c.
References c, voicemailpwcheck::context, ast_exten::exten, internal_extension_state_extended(), and NULL.
Referenced by action_extensionstate(), extstate_read(), and get_queue_member_status().
|
static |
Check state of extension by using hints.
Definition at line 3113 of file pbx.c.
References ast_extension_state3(), ast_get_extension_app(), ast_str_set(), ast_str_thread_get(), and extensionstate_buf.
Referenced by ast_add_hint(), and internal_extension_state_extended().
const char * ast_extension_state2str | ( | int | extension_state | ) |
Return extension_state as string.
Return string representation of the state of an extension.
Definition at line 3126 of file pbx.c.
References ARRAY_LEN, extension_states, and cfextension_states::text.
Referenced by action_extensionstate(), action_extensionstatelist(), AST_TEST_DEFINE(), exten_state_publisher_state_cb(), handle_show_hint(), handle_show_hints(), manager_state_cb(), and to_ami().
|
static |
Definition at line 3081 of file pbx.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_link, ao2_ref, ast_devstate_aggregate_add(), ast_devstate_aggregate_init(), ast_devstate_aggregate_result(), ast_devstate_to_extenstate(), ast_device_state_info::device_name, ast_device_state_info::device_state, device_state_info_dt(), parse_hint_device(), state, and strsep().
Referenced by ast_extension_state2(), and device_state_notify_callbacks().
int ast_extension_state_add | ( | const char * | context, |
const char * | exten, | ||
ast_state_cb_type | change_cb, | ||
void * | data | ||
) |
Add watcher for extension states.
context | which context to look in |
exten | which extension to get state |
change_cb | callback to call if state changed |
data | to pass to callback |
-1 | on failure |
0 | Global watcher added successfully |
ID | on success |
Definition at line 3823 of file pbx.c.
References voicemailpwcheck::context, ast_exten::data, ast_exten::exten, extension_state_add_destroy(), and NULL.
Referenced by __init_manager(), create_queue_member(), and publisher_start().
int ast_extension_state_add_destroy | ( | const char * | context, |
const char * | exten, | ||
ast_state_cb_type | change_cb, | ||
ast_state_cb_destroy_type | destroy_cb, | ||
void * | data | ||
) |
Add watcher for extension states with destructor.
context | which context to look in |
exten | which extension to get state |
change_cb | callback to call if state changed |
destroy_cb | callback to call when the watcher is destroyed. |
data | to pass to callbacks |
-1 | on failure |
0 | Global watcher added successfully |
ID | on success |
Definition at line 3817 of file pbx.c.
References voicemailpwcheck::context, ast_exten::data, ast_exten::exten, and extension_state_add_destroy().
int ast_extension_state_add_destroy_extended | ( | const char * | context, |
const char * | exten, | ||
ast_state_cb_type | change_cb, | ||
ast_state_cb_destroy_type | destroy_cb, | ||
void * | data | ||
) |
Add watcher for extended extension states with destructor.
context | which context to look in |
exten | which extension to get state |
change_cb | callback to call if state changed |
destroy_cb | callback to call when the watcher is destroyed. |
data | to pass to callbacks |
-1 | on failure |
0 | Global watcher added successfully |
ID | on success |
Definition at line 3829 of file pbx.c.
References voicemailpwcheck::context, ast_exten::data, ast_exten::exten, and extension_state_add_destroy().
Referenced by subscription_established().
int ast_extension_state_add_extended | ( | const char * | context, |
const char * | exten, | ||
ast_state_cb_type | change_cb, | ||
void * | data | ||
) |
Add watcher for extended extension states.
context | which context to look in |
exten | which extension to get state |
change_cb | callback to call if state changed |
data | to pass to callback |
-1 | on failure |
0 | Global watcher added successfully |
ID | on success |
Definition at line 3835 of file pbx.c.
References voicemailpwcheck::context, ast_exten::data, ast_exten::exten, extension_state_add_destroy(), and NULL.
int ast_extension_state_del | ( | int | id, |
ast_state_cb_type | change_cb | ||
) |
Deletes a state change watcher by ID.
id | of the state watcher to delete (0 for global watcher) |
change_cb | callback to call if state changed (Used if id == 0 (global)) |
0 | success |
-1 | failure |
Definition at line 3856 of file pbx.c.
References ao2_callback, ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_hint::callbacks, ast_state_cb::change_cb, find_hint_by_cb_id(), OBJ_UNLINK, and statecbs.
Referenced by destroy_queue_member_cb(), subscription_shutdown(), and unload_module().
int ast_extension_state_extended | ( | struct ast_channel * | c, |
const char * | context, | ||
const char * | exten, | ||
struct ao2_container ** | device_state_info | ||
) |
Check extended extension state for an extension by using hint.
Uses hint and devicestate callback to get the extended state of an extension.
Definition at line 3176 of file pbx.c.
References alloc_device_state_info(), ao2_ref, c, container, voicemailpwcheck::context, get_device_state_causing_channels(), internal_extension_state_extended(), and NULL.
Referenced by exten_state_data_alloc().
int ast_findlabel_extension | ( | struct ast_channel * | c, |
const char * | context, | ||
const char * | exten, | ||
const char * | label, | ||
const char * | callerid | ||
) |
Find the priority of an extension that has the specified label.
c | this is not important |
context | which context to look in |
exten | which extension to search for |
label | label of the action within the extension to match to priority |
callerid | callerid to search for |
the | priority which matches the given label in the extension |
-1 | if not found. |
Definition at line 4180 of file pbx.c.
References c, voicemailpwcheck::context, E_FINDLABEL, ast_exten::exten, ast_exten::label, NULL, and pbx_extension_helper().
Referenced by action_originate(), action_redirect(), ari_channels_handle_originate_with_id(), ast_ari_channels_continue_in_dialplan(), handle_gosub(), handle_setpriority(), isexten_function_read(), and pbx_parse_location().
int ast_findlabel_extension2 | ( | struct ast_channel * | c, |
struct ast_context * | con, | ||
const char * | exten, | ||
const char * | label, | ||
const char * | callerid | ||
) |
Find the priority of an extension that has the specified label.
Definition at line 4185 of file pbx.c.
References c, E_FINDLABEL, ast_exten::exten, ast_exten::label, NULL, and pbx_extension_helper().
Referenced by pbx_load_config().
const char * ast_get_context_name | ( | struct ast_context * | con | ) |
Definition at line 8499 of file pbx.c.
References ast_context::name, and NULL.
Referenced by ast_add_hint(), ast_change_hint(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_remove_include2(), ast_context_remove_switch2(), ast_context_verify_includes(), ast_remove_hint(), complete_show_dialplan_context(), context_merge_incls_swits_igps_other_registrars(), device_state_notify_callbacks(), handle_show_hint(), handle_show_hints(), manager_show_dialplan_helper(), presence_state_notify_callbacks(), print_hintdevices_key(), print_hints_key(), show_debug_helper(), and show_dialplan_helper().
const char * ast_get_context_registrar | ( | struct ast_context * | c | ) |
Definition at line 8527 of file pbx.c.
Referenced by handle_cli_dialplan_save(), show_debug_helper(), and show_dialplan_helper().
const char * ast_get_extension_app | ( | struct ast_exten * | e | ) |
Definition at line 8557 of file pbx.c.
References ast_exten::app, and NULL.
Referenced by add_extension(), ast_add_hint(), ast_change_hint(), ast_extension_state2(), ast_get_hint(), ast_str_get_hint(), device_state_notify_callbacks(), extension_is_compatible(), extension_presence_state_helper(), find_matching_endif(), find_matching_endwhile(), handle_cli_dialplan_save(), handle_show_hint(), handle_show_hints(), manager_show_dialplan_helper(), parking_is_exten_park(), presence_state_notify_callbacks(), and print_ext().
void * ast_get_extension_app_data | ( | struct ast_exten * | e | ) |
Definition at line 8562 of file pbx.c.
References ast_exten::data, and NULL.
Referenced by add_extension(), ast_get_extension_data(), ast_get_hint(), ast_str_get_hint(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), parking_blind_transfer_park(), and print_ext().
const char * ast_get_extension_cidmatch | ( | struct ast_exten * | e | ) |
Definition at line 8552 of file pbx.c.
References ast_exten::cidmatch_display, and NULL.
Referenced by complete_dialplan_remove_extension(), find_matching_priority(), handle_cli_dialplan_save(), and test_exten().
struct ast_context * ast_get_extension_context | ( | struct ast_exten * | exten | ) |
Definition at line 8504 of file pbx.c.
References NULL, and ast_exten::parent.
Referenced by ast_add_hint(), ast_change_hint(), ast_remove_hint(), device_state_notify_callbacks(), extension_is_compatible(), handle_show_hint(), handle_show_hints(), presence_state_notify_callbacks(), print_hintdevices_key(), and print_hints_key().
int ast_get_extension_data | ( | char * | buf, |
int | bufsize, | ||
struct ast_channel * | c, | ||
const char * | context, | ||
const char * | exten, | ||
int | priority | ||
) |
Fill a string buffer with the data at a dialplan extension.
buf | String buffer |
bufsize | Size of buf |
c | Channel |
context | Dialplan context |
exten | Dialplan extension |
priority | Dialplan priority |
-1 | Failed to obtain extension data |
0 | Successfully obtained extension data |
Definition at line 8567 of file pbx.c.
References ast_copy_string(), ast_get_extension_app_data(), ast_rdlock_contexts(), ast_unlock_contexts(), buf, c, voicemailpwcheck::context, E_MATCH, NULL, pbx_find_extension(), priority, pbx_find_info::stacklen, and tmp().
Referenced by eval_exten_read().
const char * ast_get_extension_label | ( | struct ast_exten * | exten | ) |
Definition at line 8514 of file pbx.c.
References ast_exten::label, and NULL.
Referenced by handle_cli_dialplan_save(), manager_show_dialplan_helper(), and show_dialplan_helper().
int ast_get_extension_matchcid | ( | struct ast_exten * | e | ) |
Definition at line 8547 of file pbx.c.
References ast_exten::matchcid.
Referenced by complete_dialplan_remove_extension(), find_matching_priority(), and handle_cli_dialplan_save().
const char * ast_get_extension_name | ( | struct ast_exten * | exten | ) |
Definition at line 8509 of file pbx.c.
References ast_exten::name, and NULL.
Referenced by ast_add_hint(), ast_change_hint(), ast_remove_hint(), complete_core_show_hint(), complete_dialplan_remove_extension(), device_state_notify_callbacks(), dundi_precache_full(), extension_is_compatible(), find_matching_priority(), handle_cli_dialplan_save(), handle_show_hint(), handle_show_hints(), hint_hash(), manager_show_dialplan_helper(), presence_state_notify_callbacks(), print_hintdevices_key(), print_hints_key(), show_dialplan_helper(), and test_exten().
int ast_get_extension_priority | ( | struct ast_exten * | exten | ) |
Definition at line 8519 of file pbx.c.
References ast_exten::priority.
Referenced by complete_dialplan_remove_extension(), find_matching_priority(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), and print_ext().
const char * ast_get_extension_registrar | ( | struct ast_exten * | e | ) |
Definition at line 8532 of file pbx.c.
References NULL, and ast_exten::registrar.
Referenced by extension_is_compatible(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), parking_duration_callback(), parking_lot_cfg_create_extensions(), and show_dialplan_helper_extension_output().
const char * ast_get_extension_registrar_file | ( | struct ast_exten * | e | ) |
Get name of configuration file used by registrar to register this extension.
NULL | if registrar did not indicate config file when registering the extension |
name | of the file used to register the extension |
Definition at line 8537 of file pbx.c.
References NULL, and ast_exten::registrar_file.
Referenced by show_dialplan_helper_extension_output().
int ast_get_extension_registrar_line | ( | struct ast_exten * | e | ) |
Get line number of configuration file used by registrar to register this extension.
0 | if the line wasn't indicated when the extension was registered |
positive | integer indicating what line in the config file was responsible for registering the extension. |
Definition at line 8542 of file pbx.c.
References ast_exten::registrar_line.
Referenced by show_dialplan_helper_extension_output().
int ast_get_hint | ( | char * | hint, |
int | hintsize, | ||
char * | name, | ||
int | namesize, | ||
struct ast_channel * | c, | ||
const char * | context, | ||
const char * | exten | ||
) |
Get hint for channel.
If an extension hint exists, return non-zero.
Definition at line 4137 of file pbx.c.
References ast_copy_string(), ast_get_extension_app(), ast_get_extension_app_data(), ast_hint_extension(), c, voicemailpwcheck::context, ast_exten::exten, name, and tmp().
Referenced by action_extensionstate(), device_state_cb(), get_cid_name(), get_resource_display_name(), hint_read(), and manager_state_cb().
int ast_goto_if_exists | ( | struct ast_channel * | chan, |
const char * | context, | ||
const char * | exten, | ||
int | priority | ||
) |
Definition at line 8781 of file pbx.c.
References __ast_goto_if_exists(), voicemailpwcheck::context, ast_channel::exten, and priority.
Referenced by ast_bridge_setup_after_goto(), background_detect_exec(), channel_spy(), common_exec(), conf_run(), goto_exten(), onedigit_goto(), select_entry(), valid_exit(), vm_execmain(), and vmauthenticate().
int ast_hashtab_compare_contexts | ( | const void * | ah_a, |
const void * | ah_b | ||
) |
hashtable functions for contexts
Definition at line 688 of file pbx.c.
References bc, and ast_context::name.
Referenced by ast_context_find_or_create().
unsigned int ast_hashtab_hash_contexts | ( | const void * | obj | ) |
Definition at line 740 of file pbx.c.
References ast_hashtab_hash_string(), and ast_context::name.
Referenced by ast_context_find_or_create().
|
static |
Definition at line 2997 of file pbx.c.
References ast_hint_extension_nolock(), ast_rdlock_contexts(), ast_unlock_contexts(), c, voicemailpwcheck::context, and ast_exten::exten.
Referenced by ast_get_hint(), ast_hint_presence_state(), ast_str_get_hint(), extension_state_add_destroy(), and internal_extension_state_extended().
|
static |
Find hint for given extension in context.
Definition at line 2991 of file pbx.c.
References c, voicemailpwcheck::context, E_MATCH, NULL, pbx_find_extension(), PRIORITY_HINT, and pbx_find_info::stacklen.
Referenced by ast_hint_extension(), and ast_merge_contexts_and_delete().
int ast_hint_presence_state | ( | struct ast_channel * | c, |
const char * | context, | ||
const char * | exten, | ||
char ** | subtype, | ||
char ** | message | ||
) |
Uses hint and presence state callback to get the presence state of an extension.
c | this is not important | |
context | which context to look in | |
exten | which extension to get state | |
[out] | subtype | Further information regarding the presence returned |
[out] | message | Custom message further describing current presence |
Definition at line 3226 of file pbx.c.
References ao2_lock, ao2_unlock, ast_exten::app, ast_add_extension(), ast_free_ptr(), ast_hint_extension(), ast_strdup, c, ast_exten::cidmatch, voicemailpwcheck::context, ast_exten::data, ast_exten::exten, extension_presence_state_helper(), ast_exten::label, ast_exten::matchcid, ast_context::name, NULL, ast_exten::parent, ast_exten::priority, and ast_exten::registrar.
Referenced by exten_state_data_alloc().
int ast_ignore_pattern | ( | const char * | context, |
const char * | pattern | ||
) |
Checks to see if a number should be ignored.
context | context to search within |
pattern | to check whether it should be ignored or not |
Check if a number should be ignored with respect to dialtone cancellation.
0 | if the pattern should not be ignored |
non-zero | if the pattern should be ignored |
Definition at line 6879 of file pbx.c.
References ast_context_find(), ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_extension_match(), ast_get_ignorepat_name(), ast_rdlock_contexts(), ast_unlock_contexts(), voicemailpwcheck::context, and ast_ignorepat::pattern.
Referenced by __analog_ss_thread(), analog_ss_thread(), ast_app_dtget(), disa_exec(), dp_lookup(), and dundi_lookup_local().
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)
c | not really important XXX |
context | context to search within |
exten | extension to check |
priority | priority of extension path |
callerid | callerid of extension being searched for |
Definition at line 4195 of file pbx.c.
References c, voicemailpwcheck::context, E_MATCHMORE, ast_exten::exten, NULL, pbx_extension_helper(), and priority.
Referenced by __analog_ss_thread(), __ast_pbx_run(), analog_ss_thread(), ast_app_dtget(), collect_digits(), disa_exec(), dp_lookup(), dundi_lookup_local(), key_dial_page(), loopback_matchmore(), pbx_builtin_background(), and readexten_exec().
void ast_merge_contexts_and_delete | ( | struct ast_context ** | extcontexts, |
struct ast_hashtab * | exttable, | ||
const char * | registrar | ||
) |
Merge the temporary contexts into a global contexts list and delete from the global list the ones that are being added.
extcontexts | pointer to the ast_context structure |
exttable | pointer to the ast_hashtab structure that contains all the elements in extcontexts |
registrar | of the context; if it's set the routine will delete all contexts that belong to that registrar; if NULL only the contexts that are specified in extcontexts |
Definition at line 6426 of file pbx.c.
References __ast_internal_context_destroy(), ao2_callback, ao2_container_count(), ao2_find, ao2_iterator_destroy(), AO2_ITERATOR_DONTLOCK, ao2_iterator_init(), ao2_iterator_next, ao2_link, ao2_lock, ao2_ref, ao2_unlock, ast_exten::app, ast_add_extension_nolock(), ast_calloc, ast_copy_string(), ast_free, ast_free_ptr(), ast_hashtab_destroy(), ast_hashtab_end_traversal(), ast_hashtab_next(), ast_hashtab_start_traversal, ast_hint_extension_nolock(), AST_HINT_UPDATE_DEVICE, AST_LIST_HEAD_NOLOCK_INIT_VALUE, AST_LIST_INSERT_HEAD, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_HEAD, ast_mutex_lock, ast_mutex_unlock, ast_strdup, ast_tvdiff_us(), ast_tvnow(), ast_unlock_contexts(), ast_verb, ast_wrlock_contexts(), ast_hint::callbacks, store_hint::callbacks, ast_state_cb::change_cb, store_hint::context, context_merge(), context_merge_lock, context_table_create_autohints(), contexts, contexts_table, ast_exten::data, ast_state_cb::data, E_MATCH, execute_state_callback(), ast_exten::exten, ast_hint::exten, store_hint::exten, ast_hint::last_presence_message, store_hint::last_presence_message, ast_hint::last_presence_state, store_hint::last_presence_state, ast_hint::last_presence_subtype, store_hint::last_presence_subtype, ast_hint::laststate, store_hint::laststate, ast_context::name, ast_context::next, NULL, OBJ_UNLINK, ast_exten::parent, pbx_find_extension(), PRIORITY_HINT, ast_exten::registrar, registrar, pbx_find_info::stacklen, and tmp().
Referenced by lua_reload_extensions(), and pbx_load_module().
int ast_parseable_goto | ( | struct ast_channel * | chan, |
const char * | goto_string | ||
) |
Definition at line 8866 of file pbx.c.
References pbx_parseable_goto().
Referenced by _while_exec(), ast_bridge_setup_after_goto(), dial_exec_full(), gosub_exec(), if_helper(), ivr_dispatch(), pbx_builtin_goto(), and while_continue_exec().
void ast_pbx_h_exten_run | ( | struct ast_channel * | chan, |
const char * | context | ||
) |
Run the h exten from the given context.
chan | Channel to run the h exten on. |
context | Context the h exten is in. |
Definition at line 4205 of file pbx.c.
References ast_channel_caller(), ast_channel_context(), ast_channel_context_set(), ast_channel_exten(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_priority(), ast_channel_priority_set(), ast_channel_unlock, ast_debug, AST_FLAG_BRIDGE_HANGUP_RUN, AST_FLAG_IN_AUTOLOOP, ast_set2_flag, ast_set_flag, AST_SOFTHANGUP_HANGUP_EXEC, ast_softhangup_nolock(), ast_spawn_extension(), ast_test_flag, ast_verb, voicemailpwcheck::context, NULL, and S_COR.
Referenced by __ast_pbx_run(), and ast_bridge_setup_after_goto().
int ast_pbx_init | ( | void | ) |
Provided by pbx.c
Definition at line 8989 of file pbx.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_hash, ao2_container_alloc_list, ao2_container_register(), ast_register_cleanup(), autohint_cmp(), autohint_hash_cb(), autohints, HASH_EXTENHINT_SIZE, hint_cmp(), hint_hash(), hintdevice_cmp_multiple(), hintdevice_hash_cb(), hintdevices, NULL, pbx_shutdown(), print_autohint_key(), print_hintdevices_key(), print_hints_key(), print_statecbs_key(), STASIS_MESSAGE_TYPE_INIT, statecbs, and statecbs_cmp().
Referenced by asterisk_daemon().
int ast_pbx_outgoing_app | ( | const char * | type, |
struct ast_format_cap * | cap, | ||
const char * | addr, | ||
int | timeout, | ||
const char * | app, | ||
const char * | appdata, | ||
int * | reason, | ||
int | synchronous, | ||
const char * | cid_num, | ||
const char * | cid_name, | ||
struct ast_variable * | vars, | ||
const char * | account, | ||
struct ast_channel ** | locked_channel, | ||
const struct ast_assigned_ids * | assignedids | ||
) |
Synchronously or asynchronously make an outbound call and execute an application on the channel.
Note that when the application stops executing, the channel is hungup.
type | The channel technology to create |
cap | The format capabilities for the channel |
addr | Address data to pass to the channel technology driver |
timeout | How long we should attempt to dial the outbound channel |
app | The name of the application to execute |
appdata | Data to pass to the application |
reason | Optional. If provided, the dialed status of the outgoing channel. Codes are AST_CONTROL_xxx values. Valid only if synchronous is non-zero. |
synchronous | defined by the ast_pbx_outgoing_sync enum. If AST_OUTGOING_NO_WAIT then don't wait for anything. If AST_OUTGOING_WAIT then block until the outbound channel answers or the call fails. If AST_OUTGOING_WAIT_COMPLETE then wait for the call to complete or fail. |
cid_num | The caller ID number to set on the outbound channel |
cid_name | The caller ID name to set on the outbound channel |
vars | Variables to set on the outbound channel |
account | The accountcode for the outbound channel |
locked_channel | Optional. The outbound channel that was created if success is returned. Otherwise it is set to NULL. This is returned both locked and reference bumped. |
assignedids | Optional. The uniqueid(s) to assign the channel(s) that are created. |
0 | on success |
-1 | on failure |
Definition at line 7980 of file pbx.c.
References app, ast_pbx_outgoing_app_predial(), NULL, and type.
Referenced by action_originate(), attempt_thread(), fast_originate(), and orig_app().
int ast_pbx_outgoing_app_predial | ( | const char * | type, |
struct ast_format_cap * | cap, | ||
const char * | addr, | ||
int | timeout, | ||
const char * | app, | ||
const char * | appdata, | ||
int * | reason, | ||
int | synchronous, | ||
const char * | cid_num, | ||
const char * | cid_name, | ||
struct ast_variable * | vars, | ||
const char * | account, | ||
struct ast_channel ** | locked_channel, | ||
const struct ast_assigned_ids * | assignedids, | ||
const char * | predial_callee | ||
) |
Definition at line 7990 of file pbx.c.
References app, ast_strlen_zero(), NULL, pbx_outgoing_attempt(), and type.
Referenced by ast_pbx_outgoing_app(), and originate_exec().
int ast_pbx_outgoing_exten | ( | const char * | type, |
struct ast_format_cap * | cap, | ||
const char * | addr, | ||
int | timeout, | ||
const char * | context, | ||
const char * | exten, | ||
int | priority, | ||
int * | reason, | ||
int | synchronous, | ||
const char * | cid_num, | ||
const char * | cid_name, | ||
struct ast_variable * | vars, | ||
const char * | account, | ||
struct ast_channel ** | locked_channel, | ||
int | early_media, | ||
const struct ast_assigned_ids * | assignedids | ||
) |
Synchronously or asynchronously make an outbound call and send it to a particular extension.
type | The channel technology to create |
cap | The format capabilities for the channel |
addr | Address data to pass to the channel technology driver |
timeout | How long we should attempt to dial the outbound channel |
context | The destination context for the outbound channel |
exten | The destination extension for the outbound channel |
priority | The destination priority for the outbound channel |
reason | Optional. If provided, the dialed status of the outgoing channel. Codes are AST_CONTROL_xxx values. Valid only if synchronous is non-zero. |
synchronous | defined by the ast_pbx_outgoing_sync enum. If AST_OUTGOING_NO_WAIT then don't wait for anything. If AST_OUTGOING_WAIT then block until the outbound channel answers or the call fails. If AST_OUTGOING_WAIT_COMPLETE then wait for the call to complete or fail. If AST_OUTGOING_WAIT or AST_OUTGOING_WAIT_COMPLETE is specified, the call doesn't answer, and failed@context exists then run a channel named OutgoingSpoolFailed at failed@context . |
cid_num | The caller ID number to set on the outbound channel |
cid_name | The caller ID name to set on the outbound channel |
vars | Variables to set on the outbound channel |
account | The accountcode for the outbound channel |
locked_channel | Optional. The outbound channel that was created if success is returned. Otherwise it is set to NULL. This is returned both locked and reference bumped. |
early_media | If non-zero the channel "answers" when progress is indicated. |
assignedids | Optional. The uniqueid(s) to assign the channel(s) that are created. |
0 | on success |
-1 | on failure |
Definition at line 7916 of file pbx.c.
References ast_pbx_outgoing_exten_predial(), voicemailpwcheck::context, NULL, priority, and type.
Referenced by attempt_thread(), fast_originate(), hook_launch_thread(), and orig_exten().
int ast_pbx_outgoing_exten_predial | ( | const char * | type, |
struct ast_format_cap * | cap, | ||
const char * | addr, | ||
int | timeout, | ||
const char * | context, | ||
const char * | exten, | ||
int | priority, | ||
int * | reason, | ||
int | synchronous, | ||
const char * | cid_num, | ||
const char * | cid_name, | ||
struct ast_variable * | vars, | ||
const char * | account, | ||
struct ast_channel ** | locked_channel, | ||
int | early_media, | ||
const struct ast_assigned_ids * | assignedids, | ||
const char * | predial_callee | ||
) |
Definition at line 7926 of file pbx.c.
References ast_assert, ast_channel_alloc, ast_channel_name(), ast_channel_unlock, ast_exists_extension(), ast_hangup(), ast_log, ast_pbx_run(), ast_set_variables(), AST_STATE_DOWN, voicemailpwcheck::context, LOG_ERROR, NULL, pbx_builtin_setvar_helper(), pbx_outgoing_attempt(), priority, and type.
Referenced by action_originate(), ast_pbx_outgoing_exten(), and originate_exec().
enum ast_pbx_result ast_pbx_run | ( | struct ast_channel * | c | ) |
Execute the PBX in the current thread.
c | channel to run the pbx on |
This executes the PBX on a given channel. It allocates a new PBX structure for the channel, and provides all PBX functionality. See ast_pbx_start for an asynchronous function to run the PBX in a new thread as opposed to the current one.
Zero | on success |
non-zero | on failure |
Definition at line 4755 of file pbx.c.
References ast_pbx_run_args(), c, and NULL.
Referenced by __analog_ss_thread(), analog_ss_thread(), ari_originate_dial(), ast_bridge_run_after_goto(), ast_pbx_outgoing_exten_predial(), do_notify(), pbx_outgoing_exec(), and unistim_ss().
enum ast_pbx_result ast_pbx_run_args | ( | struct ast_channel * | c, |
struct ast_pbx_args * | args | ||
) |
Execute the PBX in the current thread.
c | channel to run the pbx on |
args | options for the pbx |
This executes the PBX on a given channel. It allocates a new PBX structure for the channel, and provides all PBX functionality. See ast_pbx_start for an asynchronous function to run the PBX in a new thread as opposed to the current one.
Zero | on success |
non-zero | on failure |
Definition at line 4735 of file pbx.c.
References __ast_pbx_run(), args, ast_log, AST_OPT_FLAG_FULLY_BOOTED, ast_options, AST_PBX_CALL_LIMIT, AST_PBX_FAILED, AST_PBX_SUCCESS, ast_test_flag, c, decrease_call_count(), increase_call_count(), and LOG_WARNING.
Referenced by action_dialplan_exec(), ast_pbx_run(), handle_gosub(), msg_route(), and stasis_app_exec().
enum ast_pbx_result ast_pbx_start | ( | struct ast_channel * | c | ) |
Create a new thread and start the PBX.
c | channel to start the pbx on |
Zero | on success |
non-zero | on failure |
Definition at line 4708 of file pbx.c.
References ast_log, AST_OPT_FLAG_FULLY_BOOTED, ast_options, AST_PBX_CALL_LIMIT, AST_PBX_FAILED, AST_PBX_SUCCESS, ast_pthread_create_detached, ast_test_flag, c, decrease_call_count(), increase_call_count(), LOG_WARNING, NULL, and pbx_thread().
Referenced by ast_async_goto(), ast_iax2_new(), bridge_failed_peer_goto(), console_new(), dahdi_new(), dial_exec_full(), do_monitor_headset(), generic_recall(), handle_response_clip(), handle_response_cmgr(), jingle_action_session_initiate(), local_call(), ooh323_new(), pbx_start_incoming_request(), and unistim_new().
int ast_processed_calls | ( | void | ) |
Retrieve the total number of calls processed through the PBX since last restart.
Definition at line 4765 of file pbx.c.
References totalcalls.
Referenced by action_corestatus(), ast_var_Config(), get_total_call_count(), handle_chanlist(), and handle_showcalls().
int ast_rdlock_context | ( | struct ast_context * | con | ) |
Read locks a given context.
con | context to lock |
0 | on success |
-1 | on failure |
Definition at line 8486 of file pbx.c.
References ast_rwlock_rdlock, and ast_context::lock.
Referenced by complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), dundi_precache_full(), find_matching_endif(), find_matching_endwhile(), handle_cli_dialplan_save(), lookup_c_ip(), lookup_ci(), manager_show_dialplan_helper(), show_debug_helper(), and show_dialplan_helper().
int ast_rdlock_contexts | ( | void | ) |
Read locks the context list.
0 | on success |
-1 | on error |
Definition at line 8468 of file pbx.c.
References ast_mutex_lock, and conlock.
Referenced by ast_context_find(), ast_context_find_or_create(), ast_get_extension_data(), ast_hint_extension(), ast_ignore_pattern(), ast_unregister_application(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_show_dialplan_context(), dundi_precache_full(), find_context_locked(), find_matching_endif(), find_matching_endwhile(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), pbx_extension_helper(), show_debug_helper(), show_dialplan_helper(), and unreference_cached_app().
|
static |
Remove hint from extension.
Definition at line 3941 of file pbx.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_copy_string(), ast_get_context_name(), ast_get_extension_context(), ast_get_extension_name(), ast_hint::context_name, ast_hint::exten, ast_hint::exten_name, NULL, OBJ_UNLINK, publish_hint_remove(), and remove_hintdevice().
Referenced by destroy_exten().
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)
c | not important |
context | which context to generate the extension within |
exten | new extension to add |
priority | priority of new extension |
callerid | callerid of extension |
found | |
combined_find_spawn |
This adds a new extension to the asterisk extension list.
0 | on success |
-1 | on failure. |
Definition at line 4200 of file pbx.c.
References c, voicemailpwcheck::context, E_SPAWN, ast_exten::exten, NULL, pbx_extension_helper(), and priority.
Referenced by __ast_pbx_run(), ast_pbx_h_exten_run(), gosub_run(), and loopback_exec().
int ast_str_get_hint | ( | struct ast_str ** | hint, |
ssize_t | hintsize, | ||
struct ast_str ** | name, | ||
ssize_t | namesize, | ||
struct ast_channel * | c, | ||
const char * | context, | ||
const char * | exten | ||
) |
Get hint for channel.
If an extension hint exists, return non-zero.
Definition at line 4155 of file pbx.c.
References ast_get_extension_app(), ast_get_extension_app_data(), ast_hint_extension(), ast_str_set(), c, voicemailpwcheck::context, ast_exten::exten, name, and tmp().
Referenced by ast_str_retrieve_variable().
int ast_unlock_context | ( | struct ast_context * | con | ) |
Unlocks | the given context |
con | context to unlock |
0 | on success |
-1 | on failure |
Definition at line 8491 of file pbx.c.
References ast_rwlock_unlock, and ast_context::lock.
Referenced by __ast_context_destroy(), add_hints(), ast_add_extension2_lockopt(), ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_remove_extension_callerid2(), ast_context_remove_ignorepat2(), ast_context_remove_include2(), ast_context_remove_switch2(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), dundi_precache_full(), find_matching_endif(), find_matching_endwhile(), handle_cli_dialplan_save(), lookup_c_ip(), lookup_ci(), manager_show_dialplan_helper(), parking_duration_callback(), parking_lot_cfg_create_extensions(), show_debug_helper(), and show_dialplan_helper().
int ast_unlock_contexts | ( | void | ) |
Unlocks contexts.
0 | on success |
-1 | on failure |
Definition at line 8473 of file pbx.c.
References ast_mutex_unlock, and conlock.
Referenced by add_hints(), ast_add_extension(), ast_context_add_ignorepat(), ast_context_add_include(), ast_context_add_switch(), ast_context_destroy(), ast_context_destroy_by_name(), ast_context_find(), ast_context_find_or_create(), ast_context_remove_extension_callerid(), ast_context_remove_ignorepat(), ast_context_remove_include(), ast_context_remove_switch(), ast_get_extension_data(), ast_hint_extension(), ast_ignore_pattern(), ast_merge_contexts_and_delete(), ast_unregister_application(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_show_dialplan_context(), dundi_precache_full(), find_context_locked(), find_matching_endif(), find_matching_endwhile(), handle_cli_dialplan_save(), manager_dialplan_extension_add(), manager_show_dialplan_helper(), parking_duration_callback(), parking_lot_cfg_create_extensions(), pbx_extension_helper(), show_debug_helper(), show_dialplan_helper(), and unreference_cached_app().
struct ast_exten * ast_walk_context_extensions | ( | struct ast_context * | con, |
struct ast_exten * | exten | ||
) |
Definition at line 8596 of file pbx.c.
References ast_exten::exten, NULL, and ast_context::root.
Referenced by manager_show_dialplan_helper(), pbx_find_extension(), show_dialplan_helper(), and unreference_cached_app().
const struct ast_ignorepat * ast_walk_context_ignorepats | ( | const struct ast_context * | con, |
const struct ast_ignorepat * | ip | ||
) |
Definition at line 8689 of file pbx.c.
References ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_ignorepat::next, and NULL.
const struct ast_include * ast_walk_context_includes | ( | const struct ast_context * | con, |
const struct ast_include * | inc | ||
) |
Definition at line 8650 of file pbx.c.
References ast_context_includes_count(), ast_context_includes_get(), AST_VECTOR_GET, ast_context::includes, ast_include::next, and NULL.
Referenced by context_included().
const struct ast_sw * ast_walk_context_switches | ( | const struct ast_context * | con, |
const struct ast_sw * | sw | ||
) |
Definition at line 8605 of file pbx.c.
References ast_context_switches_count(), ast_context_switches_get(), ast_sw::next, and NULL.
struct ast_context * ast_walk_contexts | ( | struct ast_context * | con | ) |
Definition at line 8591 of file pbx.c.
References contexts, and ast_context::next.
Referenced by ast_context_find(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_show_dialplan_context(), dundi_precache_full(), find_matching_endif(), find_matching_endwhile(), find_matching_priority(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), pbx_load_module(), show_debug_helper(), show_dialplan_helper(), and unreference_cached_app().
struct ast_exten * ast_walk_extension_priorities | ( | struct ast_exten * | exten, |
struct ast_exten * | priority | ||
) |
Definition at line 8644 of file pbx.c.
References ast_exten::exten, and priority.
Referenced by complete_dialplan_remove_extension(), find_matching_priority(), handle_cli_dialplan_save(), manager_show_dialplan_helper(), show_dialplan_helper(), and unreference_cached_app().
int ast_wrlock_context | ( | struct ast_context * | con | ) |
Write locks a given context.
con | context to lock |
0 | on success |
-1 | on failure |
Definition at line 8481 of file pbx.c.
References ast_rwlock_wrlock, and ast_context::lock.
Referenced by __ast_context_destroy(), add_hints(), ast_add_extension2_lockopt(), ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_remove_extension_callerid2(), ast_context_remove_ignorepat2(), ast_context_remove_include2(), ast_context_remove_switch2(), parking_duration_callback(), and parking_lot_cfg_create_extensions().
int ast_wrlock_contexts | ( | void | ) |
Write locks the context list.
0 | on success |
-1 | on error |
Definition at line 8463 of file pbx.c.
References ast_mutex_lock, and conlock.
Referenced by add_hints(), ast_context_destroy(), ast_context_destroy_by_name(), ast_context_find_or_create(), ast_merge_contexts_and_delete(), complete_dialplan_remove_include(), manager_dialplan_extension_add(), parking_duration_callback(), and parking_lot_cfg_create_extensions().
|
static |
Definition at line 481 of file pbx.c.
References ast_assert, CMP_MATCH, CMP_STOP, ast_autohint::context, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by ast_pbx_init().
|
static |
Definition at line 460 of file pbx.c.
References ast_assert, ast_str_case_hash(), ast_autohint::context, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, and OBJ_SEARCH_OBJECT.
Referenced by ast_pbx_init().
|
static |
|
static |
Definition at line 1116 of file pbx.c.
References ast_cli(), ast_str_alloca, ast_str_buffer(), ast_str_set(), cli_match_char_tree(), and prefix.
Referenced by cli_match_char_tree(), and show_debug_helper().
|
static |
collect digits from the channel into the buffer.
c,buf,buflen,pos | |
waittime | is in milliseconds |
0 | on timeout or done. |
-1 | on error. |
Definition at line 4279 of file pbx.c.
References ast_channel_caller(), ast_channel_clear_softhangup(), ast_channel_context(), ast_channel_pbx(), ast_channel_softhangup_internal_flag(), ast_matchmore_extension(), AST_SOFTHANGUP_ASYNCGOTO, ast_waitfordigit(), buf, c, digit, ast_pbx::dtimeoutms, NULL, and S_COR.
Referenced by __ast_pbx_run().
|
static |
|
static |
autocomplete for CLI command 'core show hint'
Definition at line 5219 of file pbx.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_get_extension_name(), ast_strdup, ast_hint::exten, and NULL.
Referenced by handle_show_hint().
|
static |
Definition at line 5398 of file pbx.c.
References ast_get_context_name(), ast_rdlock_contexts(), ast_strdup, ast_unlock_contexts(), ast_walk_contexts(), c, and NULL.
Referenced by handle_debug_dialplan(), and handle_show_dialplan().
|
static |
Definition at line 6327 of file pbx.c.
References ast_exten::app, ast_add_extension2(), ast_context_find_or_create(), ast_free_ptr(), ast_hashtab_end_traversal(), ast_hashtab_lookup(), ast_hashtab_next(), ast_hashtab_start_traversal, ast_log, ast_strdup, ast_verb, ast_exten::cidmatch, voicemailpwcheck::context, context_merge_incls_swits_igps_other_registrars(), ast_exten::data, first, ast_exten::label, LOG_ERROR, ast_exten::matchcid, ast_exten::name, NULL, ast_exten::peer_table, ast_exten::priority, ast_exten::registrar, registrar, ast_exten::registrar_file, and ast_exten::registrar_line.
Referenced by ast_merge_contexts_and_delete().
|
static |
Definition at line 6252 of file pbx.c.
References ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_context_includes_count(), ast_context_includes_get(), ast_context_switches_count(), ast_context_switches_get(), ast_debug, ast_get_context_name(), ast_get_ignorepat_name(), ast_get_ignorepat_registrar(), ast_get_include_name(), ast_get_include_registrar(), ast_get_switch_data(), ast_get_switch_eval(), ast_get_switch_name(), ast_get_switch_registrar(), and registrar.
Referenced by context_merge().
|
static |
Set up an autohint placeholder in the hints container
Definition at line 6290 of file pbx.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_callback, ao2_link, ao2_ref, ast_copy_string(), ast_hashtab_end_traversal(), ast_hashtab_next(), ast_hashtab_start_traversal, ast_verb, ast_context::autohints, autohints, ast_autohint::context, ast_context::name, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, ast_context::registrar, ast_autohint::registrar, and table.
Referenced by ast_merge_contexts_and_delete().
|
static |
Definition at line 1770 of file pbx.c.
References add_exten_to_pattern_tree(), ast_debug, ast_hashtab_end_traversal(), ast_hashtab_get_stats(), ast_hashtab_next(), ast_hashtab_start_traversal, ast_log, ast_exten::exten, LOG_ERROR, ast_context::name, and ast_context::root_table.
Referenced by pbx_find_extension().
|
static |
Definition at line 4666 of file pbx.c.
References ast_mutex_lock, ast_mutex_unlock, countcalls, and maxcalllock.
Referenced by ast_pbx_run_args(), ast_pbx_start(), and pbx_thread().
|
static |
Definition at line 4674 of file pbx.c.
References ast_free, ast_hashtab_destroy(), ast_remove_hint(), ast_exten::data, ast_exten::datad, ast_exten::peer_label_table, ast_exten::peer_table, ast_exten::priority, and PRIORITY_HINT.
Referenced by __ast_internal_context_destroy(), and ast_context_remove_extension_callerid2().
|
static |
Definition at line 3903 of file pbx.c.
References ao2_cleanup, ast_free, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_hint::callbacks, ast_hint::devices, ast_hint::last_presence_message, and ast_hint::last_presence_subtype.
Referenced by ast_add_hint().
|
static |
Definition at line 1793 of file pbx.c.
References match_char::alt_char, ast_free, destroy_pattern_tree(), match_char::exten, and match_char::next_char.
Referenced by __ast_internal_context_destroy(), and destroy_pattern_tree().
|
static |
Definition at line 3714 of file pbx.c.
References ast_state_cb::data, ast_state_cb::destroy_cb, and ast_state_cb::id.
Referenced by extension_state_add_destroy().
|
static |
Definition at line 3584 of file pbx.c.
References ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_t_callback, ao2_t_ref, ao2_unlock, ast_add_extension(), ast_alloca, ast_device_state_message_type(), AST_EXTENSION_DEACTIVATED, ast_free, ast_free_ptr(), ast_get_hint(), AST_HINT_UPDATE_DEVICE, ast_mutex_lock, ast_mutex_unlock, ast_str_create, ast_strdup, ast_strdupa, ast_strlen_zero(), autohints, ast_hint::callbacks, ast_state_cb::change_cb, ast_autohint::context, context_merge_lock, ast_hint::context_name, ast_state_cb::data, ast_device_state_message::device, device_state_notify_callbacks(), ast_device_state_message::eid, end, execute_state_callback(), ast_hint::exten_name, handle_hint_change_message_type(), ast_hintdevice::hint, ast_hintdevice::hintdevice, hintdevice_cmp_multiple(), hintdevices, ast_hint::laststate, NULL, OBJ_MULTIPLE, OBJ_SEARCH_OBJECT, PRIORITY_HINT, ast_autohint::registrar, stasis_message_data(), stasis_message_type(), and type.
Referenced by load_pbx().
|
static |
Definition at line 3069 of file pbx.c.
References ao2_cleanup, and sip_to_pjsip::info().
Referenced by ast_extension_state3().
|
static |
Definition at line 3370 of file pbx.c.
References alloc_device_state_info(), ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_copy_string(), AST_EXTENSION_RINGING, ast_extension_state3(), ast_get_context_name(), ast_get_extension_app(), ast_get_extension_context(), ast_get_extension_name(), AST_HINT_UPDATE_DEVICE, AST_MAX_CONTEXT, AST_MAX_EXTENSION, ast_str_set(), ast_hint::callbacks, ast_state_cb::change_cb, context_name, ast_state_cb::data, execute_state_callback(), ast_hint::exten, exten_name, ast_state_cb::extended, get_device_state_causing_channels(), ast_hint::laststate, NULL, state, and statecbs.
Referenced by device_state_cb(), and handle_hint_change_message_type().
|
static |
Definition at line 2783 of file pbx.c.
References ast_free, and ast_string_field_free_memory.
|
static |
Definition at line 3250 of file pbx.c.
References ao2_lock, ao2_unlock, AST_EXTENSION_REMOVED, ast_strdupa, ast_strlen_zero(), voicemailpwcheck::context, ast_state_cb_info::device_state_info, sip_to_pjsip::info(), ast_hint::last_presence_message, ast_hint::last_presence_state, ast_hint::last_presence_subtype, ast_hint::laststate, and ast_state_cb_info::reason.
Referenced by ast_add_hint(), ast_merge_contexts_and_delete(), device_state_cb(), device_state_notify_callbacks(), and presence_state_notify_callbacks().
|
static |
Definition at line 2140 of file pbx.c.
References ext_cmp_exten(), and ext_cmp_pattern().
Referenced by ast_add_extension2_lockopt(), and ast_extension_cmp().
|
static |
Definition at line 1890 of file pbx.c.
Referenced by _extension_match_core(), and ext_cmp().
|
static |
Definition at line 1847 of file pbx.c.
Referenced by _extension_match_core().
|
static |
Definition at line 1817 of file pbx.c.
Referenced by _extension_match_core().
|
static |
Definition at line 2092 of file pbx.c.
References ARRAY_LEN, and ext_cmp_pattern_pos().
Referenced by _extension_match_core(), and ext_cmp().
|
static |
helper functions to sort extension patterns in the desired way, so that more specific patterns appear first.
The function compares individual characters (or sets of), returning an int where bits 0-7 are the ASCII code of the first char in the set, bits 8-15 are the number of characters in the set, and bits 16-20 are for special cases. This way more specific patterns (smaller character sets) appear first. Wildcards have a special value, so that we can directly compare them to sets by subtracting the two values. In particular: 0x001xx one character, character set starting with xx 0x0yyxx yy characters, character set starting with xx 0x18000 '.' (one or more of anything) 0x28000 '!' (zero or more of anything) 0x30000 NUL (end of string) 0x40000 error in set. The pointer to the string is advanced according to needs. NOTES:
Definition at line 1977 of file pbx.c.
References ast_log, BITS_PER, c, end, LOG_WARNING, and NULL.
Referenced by ext_cmp_pattern().
|
static |
Definition at line 2162 of file pbx.c.
References ast_exten::exten.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 7026 of file pbx.c.
Referenced by ast_add_extension2_lockopt(), and ast_context_remove_extension_callerid2().
|
static |
Definition at line 2414 of file pbx.c.
References _extension_match_core(), ast_add_profile(), ast_mark(), ast_strlen_zero(), and ast_exten::data.
Referenced by ast_extension_close(), ast_extension_match(), and pbx_find_extension().
|
static |
Definition at line 3200 of file pbx.c.
References app, ast_get_extension_app(), ast_str_set(), ast_str_thread_get(), ast_strlen_zero(), extensionstate_buf, and parse_hint_presence().
Referenced by ast_add_hint(), ast_hint_presence_state(), and handle_hint_change_message_type().
|
static |
Definition at line 3727 of file pbx.c.
References ao2_alloc, ao2_find, ao2_link, ao2_lock, ao2_ref, ao2_unlock, ast_exten::app, ast_add_extension(), ast_free_ptr(), ast_hint_extension(), ast_strdup, ast_hint::callbacks, ast_state_cb::change_cb, ast_exten::cidmatch, voicemailpwcheck::context, ast_exten::data, ast_state_cb::data, ast_state_cb::destroy_cb, destroy_state_cb(), ast_exten::exten, ast_state_cb::extended, id, ast_state_cb::id, ast_exten::label, ast_exten::matchcid, ast_context::name, NULL, OBJ_NODATA, OBJ_UNLINK, ast_exten::parent, ast_exten::priority, ast_exten::registrar, statecbs, and stateid.
Referenced by ast_extension_state_add(), ast_extension_state_add_destroy(), ast_extension_state_add_destroy_extended(), and ast_extension_state_add_extended().
|
static |
lookup for a context with a given name,
found | context or NULL if not found. |
Definition at line 4800 of file pbx.c.
References ast_hashtab_lookup(), voicemailpwcheck::context, contexts_table, item, and aco_type::name.
Referenced by ast_add_extension_nolock(), and pbx_find_extension().
|
static |
lookup for a context with a given name,
with | conlock held if found. |
NULL | if not found. |
Definition at line 4814 of file pbx.c.
References ast_hashtab_lookup(), ast_rdlock_contexts(), ast_unlock_contexts(), c, voicemailpwcheck::context, contexts_table, item, and aco_type::name.
Referenced by ast_add_extension(), ast_context_add_ignorepat(), ast_context_add_include(), ast_context_add_switch(), ast_context_remove_extension_callerid(), ast_context_remove_ignorepat(), ast_context_remove_include(), and ast_context_remove_switch().
|
static |
Find Hint by callback id.
Definition at line 3842 of file pbx.c.
References ao2_find, ao2_ref, ast_hint::callbacks, CMP_MATCH, and CMP_STOP.
Referenced by ast_extension_state_del().
|
static |
Definition at line 1146 of file pbx.c.
References ast_log, ast_exten::exten, match_char::exten, LOG_NOTICE, and match_char::next_char.
|
static |
Definition at line 3296 of file pbx.c.
References ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_channel_creationtime(), ast_channel_iterator_by_name_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_lock, AST_CHANNEL_NAME, ast_channel_ref, ast_channel_unlock, ast_channel_unref, AST_DEVICE_BUSY, AST_DEVICE_INUSE, AST_DEVICE_INVALID, AST_DEVICE_NOT_INUSE, AST_DEVICE_ONHOLD, AST_DEVICE_RINGING, AST_DEVICE_RINGINUSE, AST_DEVICE_TOTAL, AST_DEVICE_UNAVAILABLE, AST_DEVICE_UNKNOWN, AST_STATE_BUSY, AST_STATE_RINGING, AST_STATE_UP, ast_tvcmp(), c, sip_to_pjsip::info(), and match().
Referenced by ast_extension_state_extended(), and device_state_notify_callbacks().
|
static |
Definition at line 1518 of file pbx.c.
References ast_log, compare_char(), first, INC_DST_OVERFLOW_CHECK, last, LOG_ERROR, and LOG_WARNING.
Referenced by add_exten_to_pattern_tree().
|
static |
Send ack once.
Definition at line 5750 of file pbx.c.
References a, ast_cli(), AST_PBX_MAX_STACK, ast_strdupa, ast_strlen_zero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_show_dialplan_context(), voicemailpwcheck::context, dialplan_counters::context_existence, NULL, show_debug_helper(), strsep(), dialplan_counters::total_context, and ast_cli_entry::usage.
|
static |
Definition at line 3537 of file pbx.c.
References ast_free, AST_HINT_UPDATE_DEVICE, AST_HINT_UPDATE_PRESENCE, AST_PRESENCE_INVALID, ast_str_create, device_state_notify_callbacks(), ast_hint::exten, extension_presence_state_helper(), NULL, presence_state_notify_callbacks(), stasis_message_data(), stasis_message_type(), ast_presence_state_message::state, and state.
Referenced by device_state_cb().
|
static |
Definition at line 6056 of file pbx.c.
References a, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, pbx_set_extenpatternmatchnew(), and ast_cli_entry::usage.
|
static |
Definition at line 5683 of file pbx.c.
References a, ast_cli(), AST_PBX_MAX_STACK, ast_strdupa, ast_strlen_zero(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_show_dialplan_context(), voicemailpwcheck::context, dialplan_counters::context_existence, dialplan_counters::extension_existence, NULL, show_dialplan_helper(), strsep(), dialplan_counters::total_context, dialplan_counters::total_exten, dialplan_counters::total_prio, and ast_cli_entry::usage.
|
static |
handle_show_hint: CLI support for listing registered dial plan hint
Definition at line 5255 of file pbx.c.
References a, ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), ast_extension_state2str(), ast_get_context_name(), ast_get_extension_app(), ast_get_extension_context(), ast_get_extension_name(), AST_MAX_CONTEXT, AST_MAX_EXTENSION, ast_presence_state2str(), buf, ast_hint::callbacks, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_core_show_hint(), ast_hint::exten, ast_hint::last_presence_state, ast_hint::laststate, NULL, and ast_cli_entry::usage.
|
static |
handle_show_hints: CLI support for listing registered dial plan hints
Definition at line 5156 of file pbx.c.
References a, ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), ast_extension_state2str(), ast_get_context_name(), ast_get_extension_app(), ast_get_extension_context(), ast_get_extension_name(), AST_MAX_CONTEXT, AST_MAX_EXTENSION, ast_presence_state2str(), buf, ast_hint::callbacks, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_hint::exten, ast_hint::last_presence_state, ast_hint::laststate, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 6084 of file pbx.c.
References a, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, pbx_set_extenpatternmatchnew(), and ast_cli_entry::usage.
|
static |
Definition at line 733 of file pbx.c.
References bc, ast_exten::label, and S_OR.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 726 of file pbx.c.
References bc, and ast_exten::priority.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 698 of file pbx.c.
References AST_EXT_MATCHCID_ANY, AST_EXT_MATCHCID_OFF, ast_strlen_zero(), bc, ast_exten::cidmatch, ast_exten::exten, and ast_exten::matchcid.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 746 of file pbx.c.
References AST_EXT_MATCHCID_ON, ast_hashtab_hash_string(), ast_exten::cidmatch, ast_exten::exten, and ast_exten::matchcid.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 762 of file pbx.c.
References ast_hashtab_hash_string(), ast_exten::label, and S_OR.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 756 of file pbx.c.
References ast_hashtab_hash_int(), and ast_exten::priority.
Referenced by ast_add_extension2_lockopt().
|
static |
Definition at line 8896 of file pbx.c.
References CMP_MATCH, CMP_STOP, ast_exten::exten, and ast_hint::exten.
Referenced by ast_pbx_init().
|
static |
Definition at line 8876 of file pbx.c.
References ast_get_extension_name(), ast_str_case_hash(), ast_strlen_zero(), ast_hint::exten, and exten_name.
Referenced by ast_pbx_init().
|
static |
Definition at line 3889 of file pbx.c.
References CMP_MATCH, CMP_STOP, and ast_state_cb::id.
Referenced by ast_add_hint().
|
static |
Definition at line 428 of file pbx.c.
References ast_assert, CMP_MATCH, ast_hintdevice::hintdevice, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by ast_pbx_init(), device_state_cb(), and presence_state_cb().
|
static |
Definition at line 545 of file pbx.c.
References ao2_ref, ast_hintdevice::hint, and NULL.
Referenced by add_hintdevice().
|
static |
Definition at line 402 of file pbx.c.
References ast_assert, ast_str_case_hash(), ext, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, and OBJ_SEARCH_OBJECT.
Referenced by ast_pbx_init().
|
static |
Definition at line 511 of file pbx.c.
References CMP_MATCH, ast_hintdevice::hint, and ast_hintdevice::hintdevice.
Referenced by remove_hintdevice().
|
static |
Increase call count for channel.
0 | on success |
non-zero | if a configured limit (maxcalls, maxload, minmemfree) was reached |
Definition at line 4617 of file pbx.c.
References ast_channel_name(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_option_maxcalls, ast_option_maxload, c, countcalls, getloadavg(), LOG_WARNING, maxcalllock, option_minmemfree, and totalcalls.
Referenced by ast_pbx_run_args(), and ast_pbx_start().
|
static |
Definition at line 1423 of file pbx.c.
References match_char::alt_char, and match_char::specificity.
Referenced by add_pattern_node().
|
static |
Definition at line 3141 of file pbx.c.
References ao2_lock, ao2_unlock, ast_exten::app, ast_add_extension(), ast_extension_state2(), ast_free_ptr(), ast_hint_extension(), ast_strdup, c, ast_exten::cidmatch, voicemailpwcheck::context, ast_exten::data, ast_exten::exten, ast_exten::label, ast_exten::matchcid, ast_context::name, NULL, ast_exten::parent, ast_exten::priority, and ast_exten::registrar.
Referenced by ast_extension_state(), and ast_extension_state_extended().
int load_pbx | ( | void | ) |
Provided by pbx.c
Definition at line 8421 of file pbx.c.
References __ast_custom_function_register(), action_extensionstatelist(), ARRAY_LEN, ast_cli_register_multiple, ast_device_state_message_type(), ast_device_state_topic_all(), ast_manager_register_xml_core, ast_presence_state_message_type(), ast_presence_state_topic_all(), ast_register_cleanup(), ast_verb, device_state_cb(), device_state_sub, EVENT_FLAG_CALL, EVENT_FLAG_CONFIG, EVENT_FLAG_REPORTING, exception_function, manager_show_dialplan(), NULL, pbx_cli, presence_state_cb(), presence_state_sub, stasis_subscribe, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), testtime_function, and unload_pbx().
Referenced by asterisk_daemon().
|
static |
Send ack once.
Definition at line 5806 of file pbx.c.
References astman_send_listack().
Referenced by manager_show_dialplan(), and manager_show_dialplan_helper().
|
static |
Manager listing of dial plan.
Definition at line 5970 of file pbx.c.
References AST_PBX_MAX_STACK, ast_strlen_zero(), astman_append(), astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), voicemailpwcheck::context, dialplan_counters::context_existence, dialplan_counters::extension_existence, manager_dpsendack(), manager_show_dialplan_helper(), NULL, dialplan_counters::total_context, dialplan_counters::total_exten, dialplan_counters::total_items, and dialplan_counters::total_prio.
Referenced by load_pbx().
|
static |
Show dialplan extensions XXX this function is similar but not exactly the same as the CLI's show dialplan. Must check whether the difference is intentional or not.
Definition at line 5815 of file pbx.c.
References ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_context_includes_count(), ast_context_includes_get(), ast_context_switches_count(), ast_context_switches_get(), ast_debug, ast_extension_match(), ast_get_context_name(), ast_get_extension_app(), ast_get_extension_app_data(), ast_get_extension_label(), ast_get_extension_name(), ast_get_extension_priority(), ast_get_extension_registrar(), ast_get_ignorepat_name(), ast_get_ignorepat_registrar(), ast_get_include_name(), ast_get_include_registrar(), ast_get_switch_data(), ast_get_switch_name(), ast_get_switch_registrar(), ast_log, AST_MAX_EXTENSION, AST_PBX_MAX_STACK, ast_rdlock_context(), ast_rdlock_contexts(), ast_strlen_zero(), ast_unlock_context(), ast_unlock_contexts(), ast_walk_context_extensions(), ast_walk_contexts(), ast_walk_extension_priorities(), astman_append(), astman_send_error(), c, voicemailpwcheck::context, dialplan_counters::context_existence, ast_exten::exten, dialplan_counters::extension_existence, LOG_WARNING, manager_dpsendack(), manager_show_dialplan_helper(), NULL, PRIORITY_HINT, dialplan_counters::total_context, dialplan_counters::total_exten, dialplan_counters::total_items, and dialplan_counters::total_prio.
Referenced by manager_show_dialplan(), and manager_show_dialplan_helper().
|
static |
Definition at line 2470 of file pbx.c.
References ast_extension_match(), and ast_strlen_zero().
Referenced by pbx_find_extension().
|
static |
Definition at line 1236 of file pbx.c.
References match_char::alt_char, ast_debug, ast_log, scoreboard::canmatch, match_char::deleted, E_CANMATCH, E_MATCHMORE, match_char::exten, scoreboard::exten, match_char::is_pattern, ast_exten::label, LOG_NOTICE, ast_exten::name, new_find_extension(), NEW_MATCHER_CHK_MATCH, NEW_MATCHER_RECURSE, match_char::next_char, match_char::specificity, str, update_scoreboard(), and match_char::x.
Referenced by new_find_extension(), and pbx_find_extension().
|
static |
Definition at line 3056 of file pbx.c.
References ast_str_buffer(), ast_str_set(), ast_strdupa, copy(), and tmp().
Referenced by ast_extension_state3().
|
static |
Definition at line 3037 of file pbx.c.
References ast_str_buffer(), ast_str_set(), ast_strdupa, copy(), NULL, and tmp().
Referenced by extension_presence_state_helper().
int pbx_checkcondition | ( | const char * | condition | ) |
Evaluate a condition.
0 | if the condition is NULL or of zero length |
int | If the string is an integer, the integer representation of the integer is returned |
1 | Any other non-empty string |
Definition at line 8282 of file pbx.c.
References ast_strlen_zero().
Referenced by _while_exec(), acf_if(), execif_exec(), gosubif_exec(), if_helper(), pbx_builtin_gotoif(), testtime_write(), and waitforcond_exec().
|
static |
|
static |
Attempt to convert disconnect cause to old originate reason.
Definition at line 7681 of file pbx.c.
References AST_CAUSE_ANSWERED_ELSEWHERE, AST_CAUSE_CALL_REJECTED, AST_CAUSE_DESTINATION_OUT_OF_ORDER, AST_CAUSE_NETWORK_OUT_OF_ORDER, AST_CAUSE_NO_ANSWER, AST_CAUSE_NORMAL_CIRCUIT_CONGESTION, AST_CAUSE_NORMAL_TEMPORARY_FAILURE, AST_CAUSE_SWITCH_CONGESTION, AST_CAUSE_UNALLOCATED, AST_CAUSE_USER_BUSY, AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_HANGUP, AST_CONTROL_RINGING, AST_DIAL_RESULT_ANSWERED, and AST_DIAL_RESULT_HANGUP.
Referenced by pbx_outgoing_attempt().
|
static |
The return value depends on the action:
E_MATCH, E_CANMATCH, E_MATCHMORE require a real match, and return 0 on failure, -1 on match; E_FINDLABEL maps the label to a priority, and returns the priority on success, ... XXX E_SPAWN, spawn an application,
0 | on success. |
-1 | on failure. |
Definition at line 2875 of file pbx.c.
References app, ast_exten::app, app_name(), ast_channel_context(), ast_channel_context_set(), ast_channel_exten(), ast_channel_exten_set(), ast_channel_name(), ast_channel_priority_set(), ast_copy_string(), ast_debug, ast_log, ast_rdlock_contexts(), ast_strdupa, ast_strlen_zero(), ast_unlock_contexts(), ast_verb, c, ast_exten::cached_app, COLOR_BRCYAN, COLOR_BRMAGENTA, COLORIZE, COLORIZE_FMT, voicemailpwcheck::context, pbx_find_info::data, ast_exten::data, E_CANMATCH, E_FINDLABEL, E_MATCH, E_MATCHMORE, ast_switch::exec, EXT_DATA_SIZE, pbx_find_info::foundcontext, LOG_NOTICE, LOG_WARNING, ast_switch::name, ast_context::name, NULL, pbx_exec(), pbx_find_extension(), pbx_findapp(), pbx_substitute_variables_helper(), priority, ast_exten::priority, S_OR, pbx_find_info::stacklen, pbx_find_info::status, STATUS_NO_CONTEXT, STATUS_NO_EXTENSION, STATUS_NO_LABEL, STATUS_NO_PRIORITY, pbx_find_info::swo, tmp(), and VERBOSITY_ATLEAST.
Referenced by ast_canmatch_extension(), ast_exists_extension(), ast_findlabel_extension(), ast_findlabel_extension2(), ast_matchmore_extension(), and ast_spawn_extension().
struct ast_exten * pbx_find_extension | ( | struct ast_channel * | chan, |
struct ast_context * | bypass, | ||
struct pbx_find_info * | q, | ||
const char * | context, | ||
const char * | exten, | ||
int | priority, | ||
const char * | label, | ||
const char * | callerid, | ||
enum ext_match_t | action | ||
) |
Definition at line 2482 of file pbx.c.
References ast_autoservice_start(), ast_autoservice_stop(), ast_context_includes_count(), ast_context_includes_get(), ast_context_switches_count(), ast_context_switches_get(), ast_debug, ast_get_switch_data(), ast_get_switch_eval(), ast_get_switch_name(), ast_hashtab_lookup(), ast_log, AST_PBX_MAX_STACK, ast_str_buffer(), ast_str_size(), ast_str_thread_get(), ast_strdupa, ast_strlen_zero(), ast_walk_context_extensions(), ast_switch::canmatch, scoreboard::canmatch_exten, voicemailpwcheck::context, create_match_char_tree(), pbx_find_info::data, E_CANMATCH, E_FINDLABEL, E_MATCHMORE, ast_switch::exists, ast_exten::exten, scoreboard::exten, extenpatternmatchnew, extension_match_core(), find_context(), pbx_find_info::foundcontext, include_rname(), include_valid(), pbx_find_info::incstack, ast_exten::label, scoreboard::last_char, LOG_NOTICE, LOG_WARNING, match(), matchcid(), ast_switch::matchmore, name, new_find_extension(), scoreboard::node, NULL, overrideswitch, pbx_find_extension(), pbx_findswitch(), pbx_substitute_variables_helper(), priority, ast_exten::priority, pbx_find_info::stacklen, pbx_find_info::status, STATUS_NO_CONTEXT, STATUS_NO_EXTENSION, STATUS_NO_LABEL, STATUS_NO_PRIORITY, STATUS_SUCCESS, strsep(), switch_data, pbx_find_info::swo, tmp(), scoreboard::total_length, scoreboard::total_specificity, and trie_find_next_match().
Referenced by ast_get_extension_data(), ast_hint_extension_nolock(), ast_merge_contexts_and_delete(), pbx_extension_helper(), and pbx_find_extension().
|
static |
Definition at line 7720 of file pbx.c.
References ao2_alloc, ao2_cleanup, ao2_lock, ao2_object_get_lockaddr(), ao2_ref, ao2_unlock, app, outgoing::app, ast_channel_caller(), ast_channel_connected(), ast_channel_flags(), ast_channel_lock, ast_channel_ref, ast_channel_set_connected_line(), ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_unlock, ast_channel_unref, ast_cond_init, ast_cond_wait, ast_copy_string(), ast_dial_append(), ast_dial_create(), ast_dial_get_channel(), ast_dial_option_global_enable(), AST_DIAL_OPTION_PREDIAL, ast_dial_prerun(), ast_dial_reason(), AST_DIAL_RESULT_ANSWERED, AST_DIAL_RESULT_FAILED, ast_dial_set_global_timeout(), ast_dial_set_state_callback(), AST_FLAG_ORIGINATED, ast_log, AST_OUTGOING_WAIT_COMPLETE, ast_party_connected_line_set_init(), AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, ast_pthread_create_detached, ast_set_callerid(), ast_set_flag, ast_set_variables(), ast_strdup, ast_strlen_zero(), connected, voicemailpwcheck::context, outgoing::context, ast_channel::dialed, ast_channel::exten, outgoing::exten, LOG_WARNING, name, NULL, pbx_dial_reason(), pbx_outgoing_destroy(), pbx_outgoing_exec(), pbx_outgoing_state_callback(), priority, outgoing::priority, RAII_VAR, S_COR, thread, tmp(), and type.
Referenced by ast_pbx_outgoing_app_predial(), and ast_pbx_outgoing_exten_predial().
|
static |
Destructor for outgoing structure.
Definition at line 7578 of file pbx.c.
References ast_cond_destroy, ast_dial_destroy(), and ast_free.
Referenced by pbx_outgoing_attempt().
|
static |
Internal function which dials an outgoing leg and sends it to a provided extension or application.
Definition at line 7592 of file pbx.c.
References ao2_cleanup, ao2_lock, ao2_unlock, app, outgoing::app, ast_channel_context_set(), ast_channel_exten_set(), ast_channel_name(), ast_channel_priority_set(), ast_cond_signal, ast_dial_answered_steal(), AST_DIAL_RESULT_ANSWERED, ast_dial_run(), ast_hangup(), ast_log, ast_pbx_run(), ast_strlen_zero(), ast_verb, outgoing::context, outgoing::exten, LOG_ERROR, LOG_WARNING, NULL, pbx_exec(), pbx_findapp(), outgoing::priority, RAII_VAR, and S_OR.
Referenced by pbx_outgoing_attempt().
|
static |
Internal dialing state callback which causes early media to trigger an answer.
Definition at line 7655 of file pbx.c.
References ast_channel_name(), AST_CONTROL_ANSWER, ast_dial_get_channel(), AST_DIAL_RESULT_PROGRESS, ast_dial_state(), ast_queue_control(), and ast_verb.
Referenced by pbx_outgoing_attempt().
int pbx_parse_location | ( | struct ast_channel * | chan, |
char ** | context, | ||
char ** | exten, | ||
char ** | pri, | ||
int * | ipri, | ||
int * | mode, | ||
char * | rest | ||
) |
Parses a dialplan location into context, extension, priority.
chan | Channel to execute on |
context | Pointer to initial value for context. |
exten | Pointer to initial value for exten. |
pri | Pointer to initial value for pri |
ipri | Pointer to integer value of priority |
mode | Pointer to mode (or NULL if mode is not used) |
rest | Pointer to buffer to capture rest of parsing (or NULL if not used) |
strsep should be used to initially populate context, exten, and pri prior to calling this function. All arguments are modified in place.
0 | success |
non-zero | failure |
Definition at line 8791 of file pbx.c.
References ast_channel_caller(), ast_channel_context(), ast_channel_exten(), ast_findlabel_extension(), ast_log, voicemailpwcheck::context, ast_channel::exten, LOG_WARNING, NULL, and S_COR.
Referenced by eval_exten_read(), and pbx_parseable_goto().
|
static |
Definition at line 8832 of file pbx.c.
References ast_async_goto(), ast_channel_priority(), ast_explicit_goto(), ast_log, ast_strdupa, ast_strlen_zero(), voicemailpwcheck::context, ast_channel::exten, LOG_WARNING, pbx_parse_location(), and strsep().
Referenced by ast_async_parseable_goto(), and ast_parseable_goto().
int pbx_set_autofallthrough | ( | int | newval | ) |
Set "autofallthrough" flag, if newval is <0, does not actually set. If set to 1, sets to auto fall through. If newval set to 0, sets to no auto fall through (reads extension instead). Returns previous value.
Definition at line 4770 of file pbx.c.
References autofallthrough.
Referenced by pbx_load_module().
int pbx_set_extenpatternmatchnew | ( | int | newval | ) |
Set "extenpatternmatchnew" flag, if newval is <0, does not actually set. If set to 1, sets to use the new Trie-based pattern matcher. If newval set to 0, sets to use the old linear-search algorithm. Returns previous value.
Definition at line 4777 of file pbx.c.
References extenpatternmatchnew.
Referenced by AST_TEST_DEFINE(), handle_set_extenpatternmatchnew(), handle_unset_extenpatternmatchnew(), and pbx_load_module().
void pbx_set_overrideswitch | ( | const char * | newval | ) |
Set "overrideswitch" field. If set and of nonzero length, all contexts will be tried directly through the named switch prior to any other matching within that context.
Definition at line 4784 of file pbx.c.
References ast_free, ast_strdup, ast_strlen_zero(), NULL, and overrideswitch.
Referenced by pbx_load_module().
|
static |
Definition at line 8916 of file pbx.c.
References ao2_container_unregister(), ao2_ref, ast_hashtab_destroy(), autohints, contexts_table, hintdevices, NULL, STASIS_MESSAGE_TYPE_CLEANUP, and statecbs.
Referenced by ast_pbx_init().
|
static |
Definition at line 4688 of file pbx.c.
References __ast_pbx_run(), c, ast_channel::data, decrease_call_count(), and NULL.
Referenced by ast_pbx_start().
|
static |
Definition at line 8294 of file pbx.c.
References ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_next, ao2_t_callback, ao2_t_ref, ast_alloca, ast_free, ast_mutex_lock, ast_mutex_unlock, ast_presence_state_message_type(), ast_str_create, context_merge_lock, ast_hintdevice::hint, ast_hintdevice::hintdevice, hintdevice_cmp_multiple(), hintdevices, NULL, OBJ_MULTIPLE, OBJ_POINTER, presence_state_notify_callbacks(), stasis_message_data(), and stasis_message_type().
Referenced by load_pbx().
|
static |
Definition at line 3464 of file pbx.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_copy_string(), ast_free, ast_get_context_name(), ast_get_extension_app(), ast_get_extension_context(), ast_get_extension_name(), AST_HINT_UPDATE_PRESENCE, AST_MAX_CONTEXT, AST_MAX_EXTENSION, ast_str_set(), ast_strdup, ast_hint::callbacks, ast_state_cb::change_cb, context_name, ast_state_cb::data, execute_state_callback(), ast_hint::exten, exten_name, ast_hint::last_presence_message, ast_hint::last_presence_state, ast_hint::last_presence_subtype, NULL, ast_presence_state_message::state, and statecbs.
Referenced by handle_hint_change_message_type(), and presence_state_cb().
|
static |
Definition at line 8969 of file pbx.c.
References ast_autohint::context.
Referenced by ast_pbx_init().
|
static |
helper function to print an extension
Definition at line 5438 of file pbx.c.
References ast_get_extension_app(), ast_get_extension_app_data(), ast_get_extension_priority(), ast_strlen_zero(), buf, and PRIORITY_HINT.
Referenced by show_dialplan_helper().
|
static |
Definition at line 8957 of file pbx.c.
References ast_get_context_name(), ast_get_extension_context(), ast_get_extension_name(), and ast_hintdevice::hintdevice.
Referenced by ast_pbx_init().
|
static |
Definition at line 8946 of file pbx.c.
References ast_get_context_name(), ast_get_extension_context(), ast_get_extension_name(), and ast_hint::exten.
Referenced by ast_pbx_init().
|
static |
Definition at line 8979 of file pbx.c.
References ast_state_cb::id.
Referenced by ast_pbx_init().
Publish a hint changed event
Definition at line 4070 of file pbx.c.
References ao2_ref, ast_device_state_topic_all(), ast_presence_state_topic_all(), stasis_message_create(), and stasis_publish().
Referenced by ast_change_hint().
|
static |
Publish a hint removed event
Definition at line 3920 of file pbx.c.
References ao2_ref, ast_device_state_topic_all(), stasis_message_create(), and stasis_publish().
Referenced by ast_remove_hint().
int raise_exception | ( | struct ast_channel * | chan, |
const char * | reason, | ||
int | priority | ||
) |
pbx.c functions needed by pbx_builtins.c
Definition at line 2806 of file pbx.c.
References ast_calloc_with_stringfields, ast_channel_context(), ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_exten(), ast_channel_priority(), ast_datastore_alloc, ast_datastore_free(), ast_string_field_set, voicemailpwcheck::context, ast_datastore::data, exception_store_info, pbx_exception::exten, NULL, priority, pbx_exception::priority, pbx_exception::reason, and set_ext_pri().
Referenced by __ast_pbx_run(), pbx_builtin_raise_exception(), and pbx_builtin_waitexten().
|
static |
Definition at line 524 of file pbx.c.
References ao2_t_callback_data, ast_free, AST_VECTOR_GET, AST_VECTOR_REMOVE_UNORDERED, AST_VECTOR_SIZE, ast_hint::devices, hintdevice_remove_cb(), hintdevices, OBJ_NODATA, OBJ_SEARCH_KEY, and OBJ_UNLINK.
Referenced by ast_change_hint(), and ast_remove_hint().
void set_ext_pri | ( | struct ast_channel * | c, |
const char * | exten, | ||
int | pri | ||
) |
helper function to set extension and priority
Definition at line 4264 of file pbx.c.
References ast_channel_exten_set(), ast_channel_lock, ast_channel_priority_set(), ast_channel_unlock, c, and ast_exten::exten.
Referenced by __ast_pbx_run(), pbx_builtin_waitexten(), and raise_exception().
|
static |
Definition at line 5628 of file pbx.c.
References ast_cli(), ast_exists_extension(), ast_get_context_name(), ast_get_context_registrar(), ast_rdlock_context(), ast_rdlock_contexts(), ast_unlock_context(), ast_unlock_contexts(), ast_walk_contexts(), c, cli_match_char_tree(), voicemailpwcheck::context, dialplan_counters::context_existence, test_val::name, NULL, dialplan_counters::total_context, and dialplan_counters::total_exten.
Referenced by handle_debug_dialplan().
|
static |
Definition at line 5467 of file pbx.c.
References ast_cli(), ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_context_includes_count(), ast_context_includes_get(), ast_context_switches_count(), ast_context_switches_get(), AST_EXT_MATCHCID_ON, ast_extension_match(), ast_get_context_name(), ast_get_context_registrar(), ast_get_extension_label(), ast_get_extension_name(), ast_get_ignorepat_name(), ast_get_ignorepat_registrar(), ast_get_include_name(), ast_get_include_registrar(), ast_get_switch_data(), ast_get_switch_name(), ast_get_switch_registrar(), ast_log, AST_MAX_EXTENSION, AST_PBX_MAX_STACK, ast_rdlock_context(), ast_rdlock_contexts(), ast_unlock_context(), ast_unlock_contexts(), ast_walk_context_extensions(), ast_walk_contexts(), ast_walk_extension_priorities(), buf, buf2, c, ast_exten::cidmatch, voicemailpwcheck::context, dialplan_counters::context_existence, el, ast_exten::exten, dialplan_counters::extension_existence, LOG_WARNING, ast_exten::matchcid, NULL, print_ext(), show_dialplan_helper(), show_dialplan_helper_extension_output(), dialplan_counters::total_context, dialplan_counters::total_exten, and dialplan_counters::total_prio.
Referenced by handle_show_dialplan(), and show_dialplan_helper().
|
static |
Writes CLI output of a single extension for show dialplan.
Definition at line 5452 of file pbx.c.
References ast_cli(), ast_get_extension_registrar(), ast_get_extension_registrar_file(), ast_get_extension_registrar_line(), buf1, and buf2.
Referenced by show_dialplan_helper().
STASIS_MESSAGE_TYPE_DEFN_LOCAL | ( | hint_change_message_type | ) |
STASIS_MESSAGE_TYPE_DEFN_LOCAL | ( | hint_remove_message_type | ) |
|
static |
Definition at line 8904 of file pbx.c.
References ast_state_cb::change_cb, CMP_MATCH, and CMP_STOP.
Referenced by ast_pbx_init().
|
static |
Definition at line 1165 of file pbx.c.
References match_char::alt_char, match_char::exten, NULL, and trie_find_next_match().
Referenced by pbx_find_extension(), and trie_find_next_match().
|
static |
Definition at line 8409 of file pbx.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), ast_custom_function_unregister(), ast_manager_unregister(), device_state_sub, exception_function, pbx_cli, presence_state_sub, stasis_unsubscribe_and_join(), and testtime_function.
Referenced by load_pbx().
void unreference_cached_app | ( | struct ast_app * | app | ) |
pbx.c function needed by pbx_app.c
Definition at line 6130 of file pbx.c.
References app, ast_rdlock_contexts(), ast_unlock_contexts(), ast_walk_context_extensions(), ast_walk_contexts(), ast_walk_extension_priorities(), voicemailpwcheck::context, and NULL.
Referenced by ast_unregister_application().
|
static |
Definition at line 1069 of file pbx.c.
References ast_log, ast_exten::exten, scoreboard::exten, last, scoreboard::last_char, LOG_NOTICE, scoreboard::node, scoreboard::total_length, and scoreboard::total_specificity.
Referenced by new_find_extension().
void wait_for_hangup | ( | struct ast_channel * | chan, |
const void * | data | ||
) |
Definition at line 8228 of file pbx.c.
References ast_frfree, ast_read(), ast_safe_sleep_without_silence(), ast_strlen_zero(), ast_waitfor(), and ast_frame::data.
Referenced by indicate_busy(), and indicate_congestion().
|
static |
Definition at line 768 of file pbx.c.
Referenced by __ast_pbx_run(), and pbx_set_autofallthrough().
|
static |
Container for autohint contexts.
Definition at line 387 of file pbx.c.
Referenced by ast_pbx_init(), context_table_create_autohints(), device_state_cb(), and pbx_shutdown().
|
static |
Lock for the ast_context list.
Definition at line 790 of file pbx.c.
Referenced by ast_rdlock_contexts(), ast_unlock_contexts(), and ast_wrlock_contexts().
|
static |
Lock to hold off restructuring of hints by ast_merge_contexts_and_delete.
Definition at line 795 of file pbx.c.
Referenced by ast_change_hint(), ast_merge_contexts_and_delete(), device_state_cb(), and presence_state_cb().
|
static |
Definition at line 781 of file pbx.c.
Referenced by __ast_context_destroy(), ast_context_destroy(), ast_context_find_or_create(), ast_merge_contexts_and_delete(), AST_TEST_DEFINE(), and ast_walk_contexts().
|
static |
Definition at line 782 of file pbx.c.
Referenced by ast_context_destroy(), ast_context_find(), ast_context_find_or_create(), ast_merge_contexts_and_delete(), find_context(), find_context_locked(), and pbx_shutdown().
|
static |
Definition at line 778 of file pbx.c.
Referenced by ast_active_calls(), decrease_call_count(), and increase_call_count().
|
static |
Subscription for device state change events.
Definition at line 773 of file pbx.c.
Referenced by load_pbx(), and unload_pbx().
|
static |
Definition at line 2852 of file pbx.c.
Referenced by load_pbx(), and unload_pbx().
|
static |
Definition at line 2790 of file pbx.c.
Referenced by acf_exception_read(), and raise_exception().
|
static |
Definition at line 769 of file pbx.c.
Referenced by pbx_find_extension(), and pbx_set_extenpatternmatchnew().
|
static |
Referenced by ast_extension_state2str().
|
static |
Definition at line 229 of file pbx.c.
Referenced by ast_extension_state2(), and extension_presence_state_helper().
|
static |
Definition at line 359 of file pbx.c.
Referenced by add_hintdevice().
|
static |
Container for hint devices.
Definition at line 370 of file pbx.c.
Referenced by add_hintdevice(), ast_pbx_init(), device_state_cb(), pbx_shutdown(), presence_state_cb(), and remove_hintdevice().
|
static |
Definition at line 806 of file pbx.c.
Referenced by lua_register_hints(), and pvalExtenSetHints().
|
static |
Definition at line 777 of file pbx.c.
Referenced by decrease_call_count(), and increase_call_count().
|
static |
Definition at line 770 of file pbx.c.
Referenced by handle_cli_dialplan_save(), pbx_find_extension(), and pbx_set_overrideswitch().
|
static |
Definition at line 6115 of file pbx.c.
Referenced by load_pbx(), and unload_pbx().
|
static |
Subscription for presence state change events.
Definition at line 775 of file pbx.c.
Referenced by load_pbx(), and unload_pbx().
|
static |
Definition at line 808 of file pbx.c.
Referenced by ast_add_hint(), ast_extension_state_del(), ast_pbx_init(), device_state_notify_callbacks(), extension_state_add_destroy(), pbx_shutdown(), and presence_state_notify_callbacks().
|
static |
Definition at line 797 of file pbx.c.
Referenced by extension_state_add_destroy().
|
static |
Definition at line 228 of file pbx.c.
Referenced by pbx_find_extension().
|
static |
Definition at line 8277 of file pbx.c.
Referenced by load_pbx(), and unload_pbx().
|
static |
Definition at line 779 of file pbx.c.
Referenced by ast_processed_calls(), increase_call_count(), and timing_read().