Asterisk - The Open Source Telephony Project
18.5.0
|
Provide a directory of extensions. More...
#include "asterisk.h"
#include <ctype.h>
#include "asterisk/paths.h"
#include "asterisk/file.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/say.h"
#include "asterisk/app.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Data Structures | |
struct | directory_item |
struct | itemlist |
Macros | |
#define | VOICEMAIL_CONFIG "voicemail.conf" |
Enumerations | |
enum | { OPT_LISTBYFIRSTNAME = (1 << 0), OPT_SAYEXTENSION = (1 << 1), OPT_FROMVOICEMAIL = (1 << 2), OPT_SELECTFROMMENU = (1 << 3), OPT_LISTBYLASTNAME = (1 << 4), OPT_LISTBYEITHER = OPT_LISTBYFIRSTNAME | OPT_LISTBYLASTNAME, OPT_PAUSE = (1 << 5), OPT_NOANSWER = (1 << 6), OPT_ALIAS = (1 << 7) } |
enum | { OPT_ARG_FIRSTNAME = 0, OPT_ARG_LASTNAME = 1, OPT_ARG_EITHER = 2, OPT_ARG_PAUSE = 3, OPT_ARG_ARRAY_SIZE = 4 } |
Functions | |
static void | __init_commonbuf (void) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | check_match (struct directory_item **result, const char *item_context, const char *item_fullname, const char *item_ext, const char *pattern_ext, int use_first_name) |
static int | compare (const char *text, const char *template) |
static int | directory_exec (struct ast_channel *chan, const char *data) |
static int | do_directory (struct ast_channel *chan, struct ast_config *vmcfg, struct ast_config *ucfg, char *context, char *dialcontext, char digit, int digits, struct ast_flags *flags, char *opts[]) |
static int | goto_exten (struct ast_channel *chan, const char *dialcontext, char *ext) |
static int | load_module (void) |
static int | play_mailbox_owner (struct ast_channel *chan, const char *context, const char *ext, const char *name, struct ast_flags *flags) |
static struct ast_config * | realtime_directory (char *context) |
static int | search_directory (const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist) |
static int | search_directory_sub (const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist) |
static int | select_entry (struct ast_channel *chan, const char *dialcontext, const struct directory_item *item, struct ast_flags *flags) |
static int | select_item_menu (struct ast_channel *chan, struct directory_item **items, int count, const char *dialcontext, struct ast_flags *flags, char *opts[]) |
static int | select_item_pause (struct ast_channel *chan, struct ast_flags *flags, char *opts[]) |
static int | select_item_seq (struct ast_channel *chan, struct directory_item **items, int count, const char *dialcontext, struct ast_flags *flags, char *opts[]) |
static void | sort_items (struct directory_item **sorted, int count) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Extension Directory" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const char | app [] = "Directory" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_threadstorage | commonbuf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_commonbuf , .custom_init = NULL , } |
static const struct ast_app_option | directory_app_options [128] = { [ 'f' ] = { .flag = OPT_LISTBYFIRSTNAME , .arg_index = OPT_ARG_FIRSTNAME + 1 }, [ 'l' ] = { .flag = OPT_LISTBYLASTNAME , .arg_index = OPT_ARG_LASTNAME + 1 }, [ 'b' ] = { .flag = OPT_LISTBYEITHER , .arg_index = OPT_ARG_EITHER + 1 }, [ 'p' ] = { .flag = OPT_PAUSE , .arg_index = OPT_ARG_PAUSE + 1 }, [ 'e' ] = { .flag = OPT_SAYEXTENSION }, [ 'v' ] = { .flag = OPT_FROMVOICEMAIL }, [ 'm' ] = { .flag = OPT_SELECTFROMMENU }, [ 'n' ] = { .flag = OPT_NOANSWER }, [ 'a' ] = { .flag = OPT_ALIAS }, } |
Provide a directory of extensions.
Definition in file app_directory.c.
#define VOICEMAIL_CONFIG "voicemail.conf" |
Definition at line 144 of file app_directory.c.
Referenced by realtime_directory().
anonymous enum |
Enumerator | |
---|---|
OPT_LISTBYFIRSTNAME | |
OPT_SAYEXTENSION | |
OPT_FROMVOICEMAIL | |
OPT_SELECTFROMMENU | |
OPT_LISTBYLASTNAME | |
OPT_LISTBYEITHER | |
OPT_PAUSE | |
OPT_NOANSWER | |
OPT_ALIAS |
Definition at line 146 of file app_directory.c.
anonymous enum |
Enumerator | |
---|---|
OPT_ARG_FIRSTNAME | |
OPT_ARG_LASTNAME | |
OPT_ARG_EITHER | |
OPT_ARG_PAUSE | |
OPT_ARG_ARRAY_SIZE |
Definition at line 158 of file app_directory.c.
|
static |
Definition at line 459 of file app_directory.c.
|
static |
Definition at line 992 of file app_directory.c.
|
static |
Definition at line 992 of file app_directory.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 992 of file app_directory.c.
|
static |
Definition at line 559 of file app_directory.c.
References ast_calloc, ast_copy_string(), ast_debug, ast_strlen_zero, compare(), directory_item::context, directory_item::exten, item, directory_item::key, directory_item::name, and NULL.
Referenced by search_directory_sub().
|
static |
Definition at line 188 of file app_directory.c.
References ast_strlen_zero, and digit.
Referenced by _ast_hashtab_create(), ast_sip_is_content_type(), and check_match().
|
static |
Definition at line 847 of file app_directory.c.
References args, ast_answer(), AST_APP_ARG, ast_app_parse_options(), ast_check_hangup(), ast_config_destroy(), ast_config_load, AST_DECLARE_APP_ARGS, AST_DIGIT_ANY, ast_log, ast_set_flag, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_stream_and_wait(), ast_strlen_zero, ast_test_flag, ast_variable_retrieve(), ast_waitfordigit(), ast_waitstream(), CONFIG_STATUS_FILEINVALID, dialcontext, digit, directory_app_options, do_directory(), LOG_ERROR, NULL, OPT_ARG_ARRAY_SIZE, OPT_ARG_EITHER, OPT_ARG_FIRSTNAME, OPT_ARG_LASTNAME, OPT_LISTBYFIRSTNAME, OPT_LISTBYLASTNAME, OPT_NOANSWER, options, parse(), pbx_builtin_setvar_helper(), and realtime_directory().
Referenced by load_module().
|
static |
Definition at line 768 of file app_directory.c.
References ast_calloc, ast_channel_language(), ast_free, AST_LIST_HEAD_NOLOCK_INIT_VALUE, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE, ast_log, ast_readstring(), ast_streamfile(), ast_test_flag, DEBUG_ATLEAST, digit, ext, directory_item::exten, goto_exten(), item, LOG_DEBUG, directory_item::name, NULL, OPT_SELECTFROMMENU, pbx_builtin_setvar_helper(), search_directory(), select_item_menu(), select_item_seq(), and sort_items().
Referenced by directory_exec().
|
static |
Definition at line 268 of file app_directory.c.
References ast_channel_context(), ast_channel_macrocontext(), ast_goto_if_exists(), ast_log, ast_strlen_zero, LOG_WARNING, and S_OR.
Referenced by do_directory(), and select_item_seq().
|
static |
Definition at line 987 of file app_directory.c.
References app, ast_register_application_xml, and directory_exec().
|
static |
Definition at line 286 of file app_directory.c.
References ast_alloca, ast_app_sayname(), ast_channel_language(), AST_DIGIT_ANY, AST_SAY_CASE_NONE, ast_say_character_str(), ast_stopstream(), ast_stream_and_wait(), ast_strlen_zero, ast_test_flag, OPT_SAYEXTENSION, and S_OR.
Referenced by select_item_menu(), and select_item_seq().
|
static |
Definition at line 461 of file app_directory.c.
References ast_category_append(), ast_category_browse(), ast_category_get(), ast_category_new_dynamic, ast_config_destroy(), ast_config_load, ast_debug, ast_load_realtime_multientry(), ast_log, ast_str_append(), ast_str_buffer(), ast_str_set(), ast_str_thread_get(), ast_strlen_zero, ast_true(), ast_variable_append(), ast_variable_browse(), ast_variable_new, ast_variable_retrieve(), CONFIG_STATUS_FILEINVALID, LOG_ERROR, LOG_WARNING, mailbox, ast_variable::name, ast_variable::next, NULL, S_OR, SENTINEL, tmp(), ast_variable::value, var, and VOICEMAIL_CONFIG.
Referenced by directory_exec().
|
static |
Definition at line 717 of file app_directory.c.
References ast_category_browse(), ast_debug, ast_strlen_zero, ast_true(), ast_variable_retrieve(), NULL, and search_directory_sub().
Referenced by do_directory().
|
static |
Definition at line 606 of file app_directory.c.
References a, ast_category_browse(), ast_config_option(), ast_debug, AST_LIST_INSERT_TAIL, ast_str_buffer(), ast_str_set(), ast_str_thread_get(), ast_strlen_zero, ast_test_flag, ast_true(), ast_variable_browse(), ast_variable_retrieve(), buf, check_match(), item, ast_variable::name, directory_item::name, ast_variable::next, NULL, OPT_ALIAS, OPT_LISTBYFIRSTNAME, OPT_LISTBYLASTNAME, options, strcasestr(), strsep(), and ast_variable::value.
Referenced by search_directory().
|
static |
Definition at line 314 of file app_directory.c.
References ast_channel_exten_set(), ast_debug, ast_goto_if_exists(), ast_log, ast_test_flag, directory_item::context, directory_item::exten, LOG_WARNING, directory_item::name, OPT_FROMVOICEMAIL, pbx_builtin_setvar_helper(), and S_OR.
Referenced by select_item_menu(), and select_item_seq().
|
static |
Definition at line 395 of file app_directory.c.
References ast_channel_language(), AST_DIGIT_ANY, ast_streamfile(), ast_waitfordigit(), ast_waitstream(), buf, directory_item::context, directory_item::exten, item, directory_item::name, pbx_builtin_setvar_helper(), play_mailbox_owner(), select_entry(), and select_item_pause().
Referenced by do_directory().
|
static |
Definition at line 333 of file app_directory.c.
References ast_strlen_zero, ast_test_flag, ast_waitfordigit(), OPT_ARG_PAUSE, and OPT_PAUSE.
Referenced by select_item_menu(), and select_item_seq().
|
static |
Definition at line 347 of file app_directory.c.
References AST_DIGIT_ANY, ast_stopstream(), ast_stream_and_wait(), ast_waitfordigit(), directory_item::context, directory_item::exten, goto_exten(), item, directory_item::name, pbx_builtin_setvar_helper(), play_mailbox_owner(), select_entry(), and select_item_pause().
Referenced by do_directory().
|
static |
Definition at line 746 of file app_directory.c.
References directory_item::key, and tmp().
Referenced by do_directory().
|
static |
Definition at line 980 of file app_directory.c.
References app, and ast_unregister_application().
|
static |
Definition at line 992 of file app_directory.c.
|
static |
Definition at line 139 of file app_directory.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 992 of file app_directory.c.
|
static |
Definition at line 459 of file app_directory.c.
|
static |
Definition at line 186 of file app_directory.c.
Referenced by directory_exec().