| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
Populate and remember extensions from static config file. More...
#include "asterisk.h"#include <ctype.h>#include "asterisk/paths.h"#include "asterisk/pbx.h"#include "asterisk/config.h"#include "asterisk/module.h"#include "asterisk/logger.h"#include "asterisk/cli.h"#include "asterisk/channel.h"#include "asterisk/callerid.h"
Go to the source code of this file.
| Macros | |
| #define | AMI_EXTENSION_ADD "DialplanExtensionAdd" | 
| #define | AMI_EXTENSION_REMOVE "DialplanExtensionRemove" | 
| #define | PUT_CTX_HDR | 
| Functions | |
| static void | __reg_module (void) | 
| static void | __unreg_module (void) | 
| struct ast_module * | AST_MODULE_SELF_SYM (void) | 
| static char * | complete_dialplan_add_extension (struct ast_cli_args *) | 
| static char * | complete_dialplan_add_ignorepat (struct ast_cli_args *) | 
| static char * | complete_dialplan_add_include (struct ast_cli_args *) | 
| static char * | complete_dialplan_remove_context (struct ast_cli_args *) | 
| static char * | complete_dialplan_remove_extension (struct ast_cli_args *) | 
| static char * | complete_dialplan_remove_ignorepat (struct ast_cli_args *) | 
| static char * | complete_dialplan_remove_include (struct ast_cli_args *) | 
| static char * | handle_cli_dialplan_add_extension (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| ADD EXTENSION command stuff. | |
| static char * | handle_cli_dialplan_add_ignorepat (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_dialplan_add_include (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_dialplan_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_dialplan_remove_context (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_dialplan_remove_extension (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_dialplan_remove_ignorepat (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_dialplan_remove_include (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| static char * | handle_cli_dialplan_save (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) | 
| 'save dialplan' CLI command implementation functions ... | |
| static int | load_module (void) | 
| static int | lookup_c_ip (struct ast_context *c, const char *name) | 
| return true if 'name' is in the ignorepats for context c | |
| static int | lookup_ci (struct ast_context *c, const char *name) | 
| return true if 'name' is included by context c | |
| static int | manager_dialplan_extension_add (struct mansession *s, const struct message *m) | 
| static int | manager_dialplan_extension_remove (struct mansession *s, const struct message *m) | 
| static int | partial_match (const char *s, const char *word, int len) | 
| match the first 'len' chars of word. len==0 always succeeds | |
| static int | pbx_load_config (const char *config_file) | 
| static int | pbx_load_module (void) | 
| static char * | pbx_strsep (char **destructible, const char *delim) | 
| static int | reload (void) | 
| static const char * | skip_words (const char *p, int n) | 
| moves to the n-th word in the string, or empty string if none | |
| static int | split_ec (const char *src, char **ext, char **const ctx, char **const cid) | 
| split extension@context in two parts, return -1 on error. The return string is malloc'ed and pointed by *ext | |
| static int | unload_module (void) | 
Populate and remember extensions from static config file.
Definition in file pbx_config.c.
| #define AMI_EXTENSION_ADD "DialplanExtensionAdd" | 
Definition at line 1625 of file pbx_config.c.
| #define AMI_EXTENSION_REMOVE "DialplanExtensionRemove" | 
Definition at line 1626 of file pbx_config.c.
| #define PUT_CTX_HDR | 
| 
 | static | 
Definition at line 2046 of file pbx_config.c.
| 
 | static | 
Definition at line 2046 of file pbx_config.c.
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) | 
Definition at line 2046 of file pbx_config.c.
| 
 | static | 
dialplan add extension 6123,1,Dial,IAX/212.71.138.13/6123 into local
Definition at line 1312 of file pbx_config.c.
References a, ast_get_context_name(), ast_log, ast_rdlock_contexts(), ast_strdup, ast_unlock_contexts(), ast_walk_contexts(), c, len(), LOG_WARNING, NULL, and partial_match().
Referenced by handle_cli_dialplan_add_extension().
| 
 | static | 
Definition at line 1398 of file pbx_config.c.
References a, ast_free, ast_get_context_name(), ast_log, ast_rdlock_contexts(), ast_strdup, ast_unlock_contexts(), ast_walk_contexts(), c, len(), LOG_ERROR, lookup_c_ip(), NULL, partial_match(), skip_words(), and strsep().
Referenced by handle_cli_dialplan_add_ignorepat().
| 
 | static | 
Definition at line 750 of file pbx_config.c.
References a, ast_free, ast_get_context_name(), ast_log, ast_rdlock_contexts(), ast_strdup, ast_unlock_contexts(), ast_walk_contexts(), c, len(), LOG_ERROR, lookup_ci(), NULL, partial_match(), skip_words(), and strsep().
Referenced by handle_cli_dialplan_add_include().
| 
 | static | 
Definition at line 1283 of file pbx_config.c.
References a, ast_get_context_name(), ast_log, ast_rdlock_contexts(), ast_strdup, ast_unlock_contexts(), ast_walk_contexts(), c, len(), LOG_WARNING, NULL, and partial_match().
Referenced by handle_cli_dialplan_remove_context().
| 
 | static | 
Definition at line 556 of file pbx_config.c.
References a, ast_asprintf, ast_free, ast_get_context_name(), ast_get_extension_cidmatch(), ast_get_extension_matchcid(), ast_get_extension_name(), ast_get_extension_priority(), ast_log, ast_rdlock_contexts(), ast_strdup, ast_unlock_contexts(), ast_walk_context_extensions(), ast_walk_contexts(), ast_walk_extension_priorities(), c, ast_exten::exten, len(), LOG_ERROR, NULL, partial_match(), priority, skip_words(), and split_ec().
Referenced by handle_cli_dialplan_remove_extension().
| 
 | static | 
Definition at line 1494 of file pbx_config.c.
References a, ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_free, ast_get_context_name(), ast_get_ignorepat_name(), ast_log, ast_rdlock_context(), ast_rdlock_contexts(), ast_strdup, ast_unlock_context(), ast_unlock_contexts(), ast_walk_contexts(), c, len(), LOG_WARNING, lookup_c_ip(), NULL, partial_match(), and strsep().
Referenced by handle_cli_dialplan_remove_ignorepat().
| 
 | static | 
Definition at line 295 of file pbx_config.c.
References a, ast_context_includes_count(), ast_context_includes_get(), ast_free, ast_get_context_name(), ast_get_include_name(), ast_log, ast_rdlock_context(), ast_rdlock_contexts(), ast_strdup, ast_unlock_context(), ast_unlock_contexts(), ast_walk_contexts(), ast_wrlock_contexts(), c, len(), LOG_ERROR, LOG_WARNING, lookup_ci(), NULL, partial_match(), skip_words(), and strsep().
Referenced by handle_cli_dialplan_remove_include().
| 
 | static | 
ADD EXTENSION command stuff.
Definition at line 1069 of file pbx_config.c.
References a, app, ast_add_extension(), ast_cli(), ast_context_find(), ast_context_find_or_create(), ast_free_ptr(), ast_strdup, ast_strdupa, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_dialplan_add_extension(), end, errno, NULL, PRIORITY_HINT, registrar, strsep(), and ast_cli_entry::usage.
| 
 | static | 
IGNOREPAT CLI stuff
Definition at line 1344 of file pbx_config.c.
References a, ast_cli(), ast_context_add_ignorepat(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_dialplan_add_ignorepat(), errno, NULL, registrar, and ast_cli_entry::usage.
| 
 | static | 
Include context ...
Definition at line 680 of file pbx_config.c.
References a, ast_cli(), ast_context_add_include(), ast_context_find(), ast_context_find_or_create(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_dialplan_add_include(), errno, NULL, registrar, and ast_cli_entry::usage.
| 
 | static | 
Definition at line 1582 of file pbx_config.c.
References a, ast_cli(), clearglobalvars_config, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, pbx_builtin_clear_globals(), pbx_load_module(), and ast_cli_entry::usage.
| 
 | static | 
Definition at line 138 of file pbx_config.c.
References a, ast_cli(), ast_context_destroy_by_name(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_dialplan_remove_context(), NULL, and ast_cli_entry::usage.
| 
 | static | 
REMOVE EXTENSION command stuff
Definition at line 421 of file pbx_config.c.
References a, ast_cli(), ast_context_remove_extension_callerid(), ast_free, c, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_dialplan_remove_extension(), NULL, PRIORITY_HINT, registrar, split_ec(), and ast_cli_entry::usage.
| 
 | static | 
Definition at line 1445 of file pbx_config.c.
References a, ast_cli(), ast_context_remove_ignorepat(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_dialplan_remove_ignorepat(), errno, NULL, registrar, and ast_cli_entry::usage.
| 
 | static | 
REMOVE INCLUDE command stuff
Definition at line 166 of file pbx_config.c.
References a, ast_cli(), ast_context_remove_include(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_dialplan_remove_include(), NULL, registrar, and ast_cli_entry::usage.
| 
 | static | 
'save dialplan' CLI command implementation functions ...
Definition at line 815 of file pbx_config.c.
References a, ast_cli(), ast_config_AST_CONFIG_DIR, ast_config_destroy(), ast_config_load, 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_escape_semicolons(), ast_get_context_name(), ast_get_context_registrar(), ast_get_extension_app(), ast_get_extension_app_data(), ast_get_extension_cidmatch(), ast_get_extension_label(), ast_get_extension_matchcid(), 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_mutex_lock, ast_mutex_unlock, ast_rdlock_context(), ast_rdlock_contexts(), ast_strlen_zero(), ast_unlock_context(), ast_unlock_contexts(), ast_variable_browse(), ast_walk_context_extensions(), ast_walk_contexts(), ast_walk_extension_priorities(), autofallthrough_config, c, clearglobalvars_config, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, config, el, ext, extenpatternmatchnew_config, ast_exten::label, ast_variable::name, ast_variable::next, NULL, overrideswitch, overrideswitch_config, PRIORITY_HINT, PUT_CTX_HDR, registrar, save_dialplan_lock, static_config, ast_cli_entry::usage, ast_variable::value, and write_protect_config.
| 
 | static | 
Definition at line 2008 of file pbx_config.c.
References AMI_EXTENSION_ADD, AMI_EXTENSION_REMOVE, ARRAY_LEN, ast_cli_register, ast_cli_register_multiple, ast_manager_register_xml, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, cli_dialplan_save, cli_pbx_config, EVENT_FLAG_SYSTEM, manager_dialplan_extension_add(), manager_dialplan_extension_remove(), pbx_load_module(), static_config, unload_module(), and write_protect_config.
| 
 | static | 
return true if 'name' is in the ignorepats for context c
Definition at line 218 of file pbx_config.c.
References ast_context_ignorepats_count(), ast_context_ignorepats_get(), ast_get_ignorepat_name(), ast_rdlock_context(), ast_unlock_context(), c, and name.
Referenced by complete_dialplan_add_ignorepat(), and complete_dialplan_remove_ignorepat().
| 
 | static | 
return true if 'name' is included by context c
Definition at line 194 of file pbx_config.c.
References ast_context_includes_count(), ast_context_includes_get(), ast_get_include_name(), ast_rdlock_context(), ast_unlock_context(), c, and name.
Referenced by complete_dialplan_add_include(), and complete_dialplan_remove_include().
| 
 | static | 
Definition at line 1201 of file pbx_config.c.
References ast_add_extension2(), ast_context_find_or_create(), ast_free_ptr(), ast_strdup, ast_strdupa, ast_strlen_zero(), ast_true(), ast_unlock_contexts(), ast_wrlock_contexts(), astman_get_header(), astman_send_ack(), astman_send_error(), errno, NULL, priority, PRIORITY_HINT, registrar, replace(), and strsep().
Referenced by load_module().
| 
 | static | 
Definition at line 508 of file pbx_config.c.
References ast_context_remove_extension_callerid(), ast_strdupa, ast_strlen_zero(), astman_get_header(), astman_send_ack(), astman_send_error(), NULL, priority, PRIORITY_HINT, registrar, and strsep().
Referenced by load_module().
| 
 | static | 
match the first 'len' chars of word. len==0 always succeeds
Definition at line 257 of file pbx_config.c.
References len().
Referenced by complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_context(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), and complete_dialplan_remove_include().
| 
 | static | 
Definition at line 1680 of file pbx_config.c.
References ast_add_extension2(), ast_category_browse(), ast_config_destroy(), ast_config_load, ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_find_or_create(), ast_context_set_autohints(), ast_copy_string(), ast_findlabel_extension2(), ast_free, ast_free_ptr(), ast_log, ast_opt_dont_warn, ast_shrink_phone_number(), ast_skip_blanks(), ast_strdup, ast_strip(), ast_strlen_zero(), ast_true(), ast_variable_browse(), ast_variable_retrieve(), autofallthrough_config, clearglobalvars_config, config_file, CONFIG_STATUS_FILEINVALID, end, errno, ext, extenpatternmatchnew_config, ast_variable::file, ast_variable::lineno, local_contexts, local_table, LOG_ERROR, LOG_WARNING, ast_variable::name, ast_variable::next, NULL, overrideswitch_config, pbx_builtin_setvar_helper(), pbx_strsep(), pbx_substitute_variables_helper(), PRIORITY_HINT, registrar, S_OR, static_config, strsep(), userscontext, ast_variable::value, and write_protect_config.
Referenced by pbx_load_module().
| 
 | static | 
Definition at line 1971 of file pbx_config.c.
References ast_context_verify_includes(), ast_hashtab_compare_contexts(), ast_hashtab_create, ast_hashtab_destroy(), ast_hashtab_hash_contexts(), ast_hashtab_newsize_java(), ast_hashtab_resize_java(), ast_merge_contexts_and_delete(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_mutex_lock, ast_mutex_unlock, ast_walk_contexts(), autofallthrough_config, config, extenpatternmatchnew_config, local_contexts, local_table, NULL, overrideswitch_config, pbx_load_config(), pbx_set_autofallthrough(), pbx_set_extenpatternmatchnew(), pbx_set_overrideswitch(), registrar, and reload_lock.
Referenced by handle_cli_dialplan_reload(), load_module(), and reload().
| 
 | static | 
Definition at line 1650 of file pbx_config.c.
References NULL.
Referenced by pbx_load_config().
| 
 | static | 
Definition at line 2034 of file pbx_config.c.
References clearglobalvars_config, pbx_builtin_clear_globals(), and pbx_load_module().
| 
 | static | 
moves to the n-th word in the string, or empty string if none
Definition at line 242 of file pbx_config.c.
Referenced by complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_extension(), and complete_dialplan_remove_include().
| 
 | static | 
split extension@context in two parts, return -1 on error. The return string is malloc'ed and pointed by *ext
Definition at line 265 of file pbx_config.c.
References ast_free, ast_strdup, c, ext, and NULL.
Referenced by complete_dialplan_remove_extension(), and handle_cli_dialplan_remove_extension().
| 
 | static | 
Standard module functions ...
Definition at line 1631 of file pbx_config.c.
References AMI_EXTENSION_ADD, AMI_EXTENSION_REMOVE, ARRAY_LEN, ast_cli_unregister(), ast_cli_unregister_multiple(), ast_context_destroy(), ast_free, ast_manager_unregister(), cli_dialplan_save, cli_pbx_config, NULL, overrideswitch_config, and registrar.
Referenced by load_module().
| 
 | static | 
Definition at line 2046 of file pbx_config.c.
| 
 | static | 
Definition at line 2046 of file pbx_config.c.
| 
 | static | 
Definition at line 108 of file pbx_config.c.
Referenced by handle_cli_dialplan_save(), pbx_load_config(), and pbx_load_module().
| 
 | static | 
Definition at line 109 of file pbx_config.c.
Referenced by handle_cli_dialplan_reload(), handle_cli_dialplan_save(), pbx_load_config(), and reload().
| 
 | static | 
Definition at line 1622 of file pbx_config.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
CLI entries for commands provided by this module
Definition at line 1611 of file pbx_config.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
Definition at line 102 of file pbx_config.c.
Referenced by handle_cli_dialplan_save(), and pbx_load_module().
| 
 | static | 
Definition at line 110 of file pbx_config.c.
Referenced by handle_cli_dialplan_save(), pbx_load_config(), and pbx_load_module().
| 
 | static | 
Definition at line 117 of file pbx_config.c.
Referenced by ast_compile_ael2(), ast_context_find_or_create(), pbx_load_config(), pbx_load_module(), and pbx_load_module().
| 
 | static | 
Definition at line 118 of file pbx_config.c.
Referenced by ast_compile_ael2(), pbx_load_config(), pbx_load_module(), and pbx_load_module().
| 
 | static | 
Definition at line 111 of file pbx_config.c.
Referenced by handle_cli_dialplan_save(), pbx_load_config(), pbx_load_module(), and unload_module().
| 
 | static | 
Definition at line 103 of file pbx_config.c.
Referenced by handle_cli_dialplan_add_extension(), handle_cli_dialplan_add_ignorepat(), handle_cli_dialplan_add_include(), handle_cli_dialplan_remove_extension(), handle_cli_dialplan_remove_ignorepat(), handle_cli_dialplan_remove_include(), handle_cli_dialplan_save(), manager_dialplan_extension_add(), manager_dialplan_extension_remove(), pbx_load_config(), pbx_load_module(), and unload_module().
| 
 | static | 
Definition at line 115 of file pbx_config.c.
Referenced by pbx_load_module().
| 
 | static | 
Definition at line 113 of file pbx_config.c.
Referenced by handle_cli_dialplan_save().
| 
 | static | 
Definition at line 106 of file pbx_config.c.
Referenced by handle_cli_dialplan_save(), load_module(), and pbx_load_config().
| 
 | static | 
Definition at line 104 of file pbx_config.c.
Referenced by pbx_load_config().
| 
 | static | 
Definition at line 107 of file pbx_config.c.
Referenced by handle_cli_dialplan_save(), load_module(), and pbx_load_config().