Asterisk - The Open Source Telephony Project
21.4.1
|
Call Parking Resource. More...
#include "asterisk.h"
#include "parking/res_parking.h"
#include "asterisk/config.h"
#include "asterisk/config_options.h"
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/cli.h"
#include "asterisk/astobj2.h"
#include "asterisk/features.h"
#include "asterisk/manager.h"
#include "asterisk/pbx.h"
Go to the source code of this file.
Data Structures | |
struct | parking_config |
struct | parking_global_config |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static struct parking_lot * | alloc_new_parking_lot (struct parking_lot_cfg *lot_cfg) |
static | AO2_GLOBAL_OBJ_STATIC (globals) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static struct parking_lot_cfg * | clone_parkinglot_cfg (struct parking_lot_cfg *source, const char *name) |
CONFIG_INFO_STANDARD (cfg_info, globals, parking_config_alloc,.files=ACO_FILES(&parking_lot_conf),.pre_apply_config=config_parking_preapply,.post_apply_config=link_configured_disable_marked_lots,) | |
static int | config_parking_preapply (void) |
static int | configure_parking_extensions (void) |
static struct parking_lot * | create_dynamic_lot_full (const char *name, struct ast_channel *chan, int forced) |
static void | disable_marked_lots (void) |
static int | extension_is_compatible (struct parking_lot_cfg *lot_cfg, const char *app_type, struct ast_exten *extension) |
const char * | find_channel_parking_lot_name (struct ast_channel *chan) |
Find parking lot name from channel. More... | |
static void | generate_or_link_lots_to_configs (void) |
struct ao2_container * | get_parking_lot_container (void) |
Get a pointer to the parking lot container for purposes such as iteration. More... | |
static void | link_configured_disable_marked_lots (void) |
static int | load_module (void) |
static void | mark_lots_as_disabled (void) |
static void * | named_item_find (struct ao2_container *container, const char *name) |
find an item in a container by its name More... | |
static int | option_handler_findslot (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom field handler for the findslot option. | |
static int | option_handler_parkedfeature (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom field handler for feature mapping on parked call pickup options. | |
static int | option_handler_parkpos (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom field handler for parking positions. | |
static int | parked_user_cmp_fn (void *obj, void *arg, int flags) |
static int | parked_user_sort_fn (const void *obj_left, const void *obj_right, int flags) |
static int | parking_add_extension (struct ast_context *context, int replace, const char *extension, int priority, const char *application, const char *data, const char *registrar) |
static void * | parking_config_alloc (void) |
allocator callback for parking_config. Notice it returns void * since it is only used by the backend config code | |
static void | parking_config_destructor (void *obj) |
destructor for parking_config | |
struct parking_lot * | parking_create_dynamic_lot (const char *name, struct ast_channel *chan) |
Create a dynamic parking lot. More... | |
int | parking_dynamic_lots_enabled (void) |
Check global configuration to see if dynamic parking is enabled. More... | |
static int | parking_feature_flag_cfg (int *param, const char *var) |
Maps string values for option_handler_parkedfeature to their ENUM values. | |
static void | parking_global_config_destructor (void *obj) |
destructor for parking_global_config | |
struct parking_lot * | parking_lot_build_or_update (struct parking_lot_cfg *lot_cfg, int dynamic) |
If a parking lot exists in the parking lot list already, update its status to match the provided configuration and return a reference return a reference to it. Otherwise, create a parking lot struct based on a parking lot configuration and return a reference to the new one. More... | |
static void * | parking_lot_cfg_alloc (const char *cat) |
create a parking lot structure More... | |
static int | parking_lot_cfg_cmp_fn (void *obj, void *arg, const int flags) |
int | parking_lot_cfg_create_extensions (struct parking_lot_cfg *lot_cfg) |
Add extensions for a parking lot configuration. More... | |
static void | parking_lot_cfg_destructor (void *obj) |
Destroy a parking lot cfg object. | |
static int | parking_lot_cfg_hash_fn (const void *obj, const int flags) |
void | parking_lot_cfg_remove_extensions (struct parking_lot_cfg *lot_cfg) |
Remove extensions belonging to a parking lot configuration. More... | |
static void | parking_lot_destructor (void *obj) |
static void | parking_lot_disable (struct parking_lot *lot) |
struct parking_lot * | parking_lot_find_by_name (const char *lot_name) |
Find a parking lot based on its name. More... | |
int | parking_lot_remove_if_unused (struct parking_lot *lot) |
Remove a parking lot from the usable lists if it is no longer involved in any calls and no configuration currently claims it. More... | |
static int | parking_lot_sort_fn (const void *obj_left, const void *obj_right, int flags) |
static int | reload_module (void) |
static void | remove_all_configured_parking_lot_extensions (void) |
static void | remove_pending_parking_lot_extensions (struct parking_config *cfg_pending) |
static int | unload_module (void) |
static int | verify_default_parking_lot (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Call Parking Resource" , .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 = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_DEVSTATE_PROVIDER, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct aco_type | global_option |
struct aco_type * | global_options [] = ACO_TYPES(&global_option) |
struct aco_file | parking_lot_conf |
static struct ao2_container * | parking_lot_container |
static struct aco_type | parking_lot_type |
struct aco_type * | parking_lot_types [] = ACO_TYPES(&parking_lot_type) |
Call Parking Resource.
Definition in file res_parking.c.
const char* find_channel_parking_lot_name | ( | struct ast_channel * | chan | ) |
Find parking lot name from channel.
chan | The channel we want the parking lot name for |
Definition at line 608 of file res_parking.c.
References parking_lot::name, and pbx_builtin_getvar_helper().
struct ao2_container* get_parking_lot_container | ( | void | ) |
Get a pointer to the parking lot container for purposes such as iteration.
Definition at line 597 of file res_parking.c.
References parking_lot_container.
|
static |
find an item in a container by its name
XXX This is actually incredibly generic and might be better placed in something like astobj2 if there isn't already an equivalent
container | ao2container where we want the item from |
name | name of the item wanted to be found |
NULL | if not found. |
Definition at line 497 of file res_parking.c.
References OBJ_KEY.
Referenced by parking_lot_build_or_update(), and parking_lot_find_by_name().
struct parking_lot* parking_create_dynamic_lot | ( | const char * | name, |
struct ast_channel * | chan | ||
) |
Create a dynamic parking lot.
name | Dynamic parking lot name to create |
chan | Channel parkee to get dynamic parking lot parameters from |
NULL | on error |
Definition at line 1060 of file res_parking.c.
int parking_dynamic_lots_enabled | ( | void | ) |
Check global configuration to see if dynamic parking is enabled.
1 | if dynamic parking is enabled |
0 | if dynamic parking is disabled |
Definition at line 929 of file res_parking.c.
References ao2_global_obj_ref, and RAII_VAR.
struct parking_lot* parking_lot_build_or_update | ( | struct parking_lot_cfg * | cfg, |
int | dynamic | ||
) |
If a parking lot exists in the parking lot list already, update its status to match the provided configuration and return a reference return a reference to it. Otherwise, create a parking lot struct based on a parking lot configuration and return a reference to the new one.
cfg | The configuration being used as a reference to build the parking lot from. |
dynamic | non-zero if creating a dynamic parking lot with this. Don't replace existing parking lots. Ever. |
NULL | if it was not found and could not be allocated |
Definition at line 869 of file res_parking.c.
References ao2_link, ao2_ref, parking_lot::cfg, parking_lot::disable_mark, parking_lot::mode, parking_lot_cfg::name, named_item_find(), and PARKINGLOT_DYNAMIC.
|
static |
create a parking lot structure
cat | name given to the parking lot |
NULL | failure |
non-NULL | successfully allocated parking lot |
Definition at line 461 of file res_parking.c.
References ast_string_field_init, ast_string_field_set, parking_lot_cfg::name, and parking_lot_cfg_destructor().
int parking_lot_cfg_create_extensions | ( | struct parking_lot_cfg * | lot_cfg | ) |
Add extensions for a parking lot configuration.
lot_cfg | parking lot configuration to generate extensions for |
0 | on success |
non-zero | on failure |
Definition at line 759 of file res_parking.c.
References ast_context_find_or_create(), AST_MAX_EXTENSION, ast_str_buffer(), ast_str_create, ast_str_set(), ast_string_field_build, ast_unlock_context(), ast_unlock_contexts(), ast_wrlock_context(), ast_wrlock_contexts(), parking_lot_cfg::name, PARK_APPLICATION, parking_lot_cfg::parkaddhints, parking_lot_cfg::parkext, parking_lot_cfg::parkext_exclusive, parking_lot_cfg::parking_con, parking_lot_cfg::parking_start, PRIORITY_HINT, RAII_VAR, and parking_lot_cfg::registrar.
void parking_lot_cfg_remove_extensions | ( | struct parking_lot_cfg * | lot_cfg | ) |
Remove extensions belonging to a parking lot configuration.
lot_cfg | parking lot configuratin to remove extensions from |
Definition at line 664 of file res_parking.c.
References ast_context_destroy(), ast_string_field_set, and parking_lot_cfg::registrar.
Referenced by parking_lot_cfg_destructor().
struct parking_lot* parking_lot_find_by_name | ( | const char * | lot_name | ) |
Find a parking lot based on its name.
lot_name | Name of the parking lot sought |
NULL | if no parking lot with the name specified exists |
Definition at line 602 of file res_parking.c.
References named_item_find().
Referenced by func_get_parkingslot_channel().
int parking_lot_remove_if_unused | ( | struct parking_lot * | lot | ) |
Remove a parking lot from the usable lists if it is no longer involved in any calls and no configuration currently claims it.
lot | Which parking lot is being checked for elimination |
0 | if the parking lot was removed |
-1 | if the parking lot wasn't removed. |
Definition at line 400 of file res_parking.c.
References ao2_container_count(), ao2_unlink, parking_lot::mode, parking_lot::parked_users, and PARKINGLOT_DISABLED.
Referenced by parking_lot_retrieve_parked_user(), and unpark_parked_user().
struct aco_file parking_lot_conf |
Definition at line 307 of file res_parking.c.
|
static |
All parking lots that are currently alive in some fashion can be obtained from here
Definition at line 266 of file res_parking.c.
Referenced by get_parking_lot_container().