Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Call Parking Applications. More...
#include "asterisk.h"
#include "res_parking.h"
#include "asterisk/config.h"
#include "asterisk/config_options.h"
#include "asterisk/utils.h"
#include "asterisk/astobj2.h"
#include "asterisk/features.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/say.h"
#include "asterisk/bridge_basic.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | park_announce_subscription_data |
Macros | |
#define | PARK_AND_ANNOUNCE_APPLICATION "ParkAndAnnounce" |
Enumerations | |
enum | park_args { OPT_ARG_COMEBACK , OPT_ARG_TIMEOUT , OPT_ARG_MUSICONHOLD , OPT_ARG_ARRAY_SIZE } |
enum | park_flags { MUXFLAG_RINGING = (1 << 0) , MUXFLAG_RANDOMIZE = (1 << 1) , MUXFLAG_NOANNOUNCE = (1 << 2) , MUXFLAG_COMEBACK_OVERRIDE = (1 << 3) , MUXFLAG_TIMEOUT_OVERRIDE = (1 << 4) , MUXFLAG_MUSICONHOLD = (1 << 5) } |
Functions | |
static void | announce_to_dial (char *dial_string, char *announce_string, int parkingspace, struct ast_channel_snapshot *parkee_snapshot) |
static int | apply_option_timeout (int *var, char *timeout_arg) |
struct park_common_datastore * | get_park_common_datastore_copy (struct ast_channel *parkee) |
Get a copy of the park_common_datastore from a channel that is being parked. More... | |
static void | inherit_channel_vars_from_id (struct outgoing_helper *oh, const char *channel_id) |
int | load_parking_applications (void) |
Register parking applications. More... | |
static int | park_and_announce_app_exec (struct ast_channel *chan, const char *data) |
static struct park_announce_subscription_data * | park_announce_subscription_data_create (const char *parkee_uuid, const char *dial_string, const char *announce_string) |
static void | park_announce_subscription_data_destroy (void *data) |
static void | park_announce_update_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | park_app_exec (struct ast_channel *chan, const char *data) |
static int | park_app_parse_data (const char *data, int *disable_announce, int *use_ringing, int *randomize, int *time_limit, char **comeback_override, char **lot_name, char **musicclass) |
struct ast_bridge * | park_application_setup (struct ast_channel *parkee, struct ast_channel *parker, const char *app_data, int *silence_announcements) |
Function to prepare a channel for parking by determining which parking bridge should be used, setting up a park common datastore so that the parking bridge will have access to necessary parking information when joining, and applying various bridge roles to the channel. More... | |
static void | park_common_datastore_destroy (void *data) |
void | park_common_datastore_free (struct park_common_datastore *datastore) |
Free a park common datastore struct. More... | |
struct ast_bridge * | park_common_setup (struct ast_channel *parkee, struct ast_channel *parker, const char *lot_name, const char *comeback_override, int use_ringing, int randomize, int time_limit, int silence_announcements) |
Setup a parked call on a parking bridge without needing to parse appdata. More... | |
static struct ast_bridge * | park_common_setup2 (struct ast_channel *parkee, struct ast_channel *parker, const char *lot_name, const char *comeback_override, const char *musicclass, int use_ringing, int randomize, int time_limit, int silence_announcements) |
static int | parked_call_app_exec (struct ast_channel *chan, const char *data) |
static int | setup_park_common_datastore (struct ast_channel *parkee, const char *parker_uuid, const char *comeback_override, int randomize, int time_limit, int silence_announce) |
void | unload_parking_applications (void) |
Unregister parking applications. More... | |
static void | wipe_park_common_datastore (struct ast_channel *chan) |
Variables | |
static const struct ast_datastore_info | park_common_info |
static const struct ast_app_option | park_opts [128] = { [ 'r' ] = { .flag = MUXFLAG_RINGING }, [ 'R' ] = { .flag = MUXFLAG_RANDOMIZE }, [ 's' ] = { .flag = MUXFLAG_NOANNOUNCE }, [ 'c' ] = { .flag = MUXFLAG_COMEBACK_OVERRIDE , .arg_index = OPT_ARG_COMEBACK + 1 }, [ 't' ] = { .flag = MUXFLAG_TIMEOUT_OVERRIDE , .arg_index = OPT_ARG_TIMEOUT + 1 }, [ 'm' ] = { .flag = MUXFLAG_MUSICONHOLD , .arg_index = OPT_ARG_MUSICONHOLD + 1 }, } |
Call Parking Applications.
Definition in file parking_applications.c.
#define PARK_AND_ANNOUNCE_APPLICATION "ParkAndAnnounce" |
Definition at line 237 of file parking_applications.c.
enum park_args |
Enumerator | |
---|---|
OPT_ARG_COMEBACK | |
OPT_ARG_TIMEOUT | |
OPT_ARG_MUSICONHOLD | |
OPT_ARG_ARRAY_SIZE |
Definition at line 241 of file parking_applications.c.
enum park_flags |
Enumerator | |
---|---|
MUXFLAG_RINGING | |
MUXFLAG_RANDOMIZE | |
MUXFLAG_NOANNOUNCE | |
MUXFLAG_COMEBACK_OVERRIDE | |
MUXFLAG_TIMEOUT_OVERRIDE | |
MUXFLAG_MUSICONHOLD |
Definition at line 248 of file parking_applications.c.
|
static |
Definition at line 819 of file parking_applications.c.
References __ast_request_and_dial(), ao2_cleanup, ast_channel_language(), ast_channel_name(), ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_slin, ast_hangup(), ast_log, ast_say_digits(), ast_stopstream(), ast_streamfile(), ast_variable_new, ast_variables_destroy(), ast_verb, ast_waitstream(), ast_channel_snapshot::base, buf, ast_channel_snapshot::caller, inherit_channel_vars_from_id(), LOG_WARNING, ast_channel_snapshot_caller::name, NULL, ast_channel_snapshot_caller::number, strsep(), ast_channel_snapshot_base::uniqueid, and outgoing_helper::vars.
Referenced by park_announce_update_cb().
|
static |
Definition at line 266 of file parking_applications.c.
References ast_log, ast_strlen_zero(), LOG_ERROR, and var.
Referenced by park_app_parse_data().
struct park_common_datastore * get_park_common_datastore_copy | ( | struct ast_channel * | parkee | ) |
Get a copy of the park_common_datastore from a channel that is being parked.
parkee | The channel entering parking with the datastore we are checking |
NULL | if the park_common_datastore could not be copied off of the channel. |
Definition at line 441 of file parking_applications.c.
References ast_assert, ast_calloc, ast_channel_datastore_find(), ast_strdup, park_common_datastore::comeback_override, ast_datastore::data, lock, NULL, park_common_datastore_free(), park_common_info, park_common_datastore::parker_dial_string, park_common_datastore::parker_uuid, park_common_datastore::randomize, SCOPED_CHANNELLOCK, park_common_datastore::silence_announce, and park_common_datastore::time_limit.
Referenced by bridge_parking_push().
|
static |
Definition at line 765 of file parking_applications.c.
References ast_channel_cleanup, ast_channel_get_by_name(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_channel_varshead(), ast_debug, AST_LIST_TRAVERSE, ast_var_full_name(), ast_var_value(), ast_variable_new, current, ast_variable::name, ast_variable::next, and outgoing_helper::vars.
Referenced by announce_to_dial().
int load_parking_applications | ( | void | ) |
Register parking applications.
0 | if successful |
-1 | on failure |
Definition at line 1008 of file parking_applications.c.
References ast_register_application_xml, park_and_announce_app_exec(), PARK_AND_ANNOUNCE_APPLICATION, park_app_exec(), PARK_APPLICATION, parked_call_app_exec(), and PARKED_CALL_APPLICATION.
Referenced by load_module().
|
static |
Definition at line 911 of file parking_applications.c.
References ao2_cleanup, args, AST_APP_ARG, ast_bridge_features_cleanup(), ast_bridge_features_init(), ast_bridge_join(), ast_channel_lock, ast_channel_softhangup_internal_flag(), ast_channel_uniqueid(), ast_channel_unlock, AST_DECLARE_APP_ARGS, ast_log, ast_parked_call_type(), ast_parking_topic(), AST_SOFTHANGUP_ASYNCGOTO, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), LOG_ERROR, NULL, options, park_announce_subscription_data_create(), park_announce_subscription_data_destroy(), park_announce_update_cb(), park_application_setup(), parking_subscription, RAII_VAR, stasis_subscribe_pool, stasis_subscription_accept_message_type(), stasis_subscription_change_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), and stasis_unsubscribe().
Referenced by load_parking_applications().
|
static |
Definition at line 739 of file parking_applications.c.
References park_announce_subscription_data::announce_string, ast_calloc, ast_strdup, park_announce_subscription_data::dial_string, NULL, park_announce_subscription_data_destroy(), and park_announce_subscription_data::parkee_uuid.
Referenced by park_and_announce_app_exec().
|
static |
Definition at line 730 of file parking_applications.c.
References park_announce_subscription_data::announce_string, ast_free, park_announce_subscription_data::dial_string, and park_announce_subscription_data::parkee_uuid.
Referenced by park_and_announce_app_exec(), park_announce_subscription_data_create(), and park_announce_update_cb().
|
static |
Definition at line 878 of file parking_applications.c.
References park_announce_subscription_data::announce_string, announce_to_dial(), ast_parked_call_type(), ast_strlen_zero(), ast_channel_snapshot::base, park_announce_subscription_data::dial_string, ast_parked_call_payload::event_type, park_announce_subscription_data_destroy(), PARKED_CALL, ast_parked_call_payload::parkee, park_announce_subscription_data::parkee_uuid, ast_parked_call_payload::parkingspace, stasis_message_data(), stasis_message_type(), stasis_subscription_final_message(), sub, and ast_channel_snapshot_base::uniqueid.
Referenced by park_and_announce_app_exec().
|
static |
Definition at line 565 of file parking_applications.c.
References ao2_cleanup, ast_answer(), ast_bridge_features_cleanup(), ast_bridge_features_init(), ast_bridge_join(), ast_channel_lock, ast_channel_softhangup_internal_flag(), ast_channel_unlock, AST_SOFTHANGUP_ASYNCGOTO, AST_STATE_UP, ast_stream_and_wait(), ast_strlen_zero(), NULL, park_application_setup(), pbx_builtin_getvar_helper(), publish_parked_call_failure(), and RAII_VAR.
Referenced by load_parking_applications().
|
static |
Definition at line 281 of file parking_applications.c.
References apply_option_timeout(), args, AST_APP_ARG, ast_app_parse_options(), AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strdup, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_flags::flags, MUXFLAG_COMEBACK_OVERRIDE, MUXFLAG_MUSICONHOLD, MUXFLAG_NOANNOUNCE, MUXFLAG_RANDOMIZE, MUXFLAG_RINGING, MUXFLAG_TIMEOUT_OVERRIDE, NULL, OPT_ARG_ARRAY_SIZE, OPT_ARG_COMEBACK, OPT_ARG_MUSICONHOLD, OPT_ARG_TIMEOUT, options, and park_opts.
Referenced by park_application_setup().
struct ast_bridge * park_application_setup | ( | struct ast_channel * | parkee, |
struct ast_channel * | parker, | ||
const char * | app_data, | ||
int * | silence_announcements | ||
) |
Function to prepare a channel for parking by determining which parking bridge should be used, setting up a park common datastore so that the parking bridge will have access to necessary parking information when joining, and applying various bridge roles to the channel.
parkee | The channel being prepared for parking |
parker | The channel initiating the park; may be the parkee as well. May be NULL. |
app_data | arguments supplied to the Park application. May be NULL. |
silence_announcements | optional pointer to an integer where we want to store the silence option flag this value should be initialized to 0 prior to calling park_common_setup. |
NULL | on failure |
Definition at line 545 of file parking_applications.c.
References ast_free, NULL, park_app_parse_data(), park_common_setup2(), and RAII_VAR.
Referenced by park_and_announce_app_exec(), park_app_exec(), and parking_park_bridge_channel().
|
static |
Definition at line 347 of file parking_applications.c.
References park_common_datastore_free().
void park_common_datastore_free | ( | struct park_common_datastore * | datastore | ) |
Free a park common datastore struct.
datastore | The park_common_datastore being free'd. (NULL tolerant) |
Definition at line 335 of file parking_applications.c.
References ast_free, park_common_datastore::comeback_override, park_common_datastore::parker_dial_string, and park_common_datastore::parker_uuid.
Referenced by bridge_parking_push(), get_park_common_datastore_copy(), and park_common_datastore_destroy().
struct ast_bridge * park_common_setup | ( | struct ast_channel * | parkee, |
struct ast_channel * | parker, | ||
const char * | lot_name, | ||
const char * | comeback_override, | ||
int | use_ringing, | ||
int | randomize, | ||
int | time_limit, | ||
int | silence_announcements | ||
) |
Setup a parked call on a parking bridge without needing to parse appdata.
Definition at line 538 of file parking_applications.c.
References NULL, and park_common_setup2().
Referenced by manager_park_unbridged().
|
static |
Definition at line 492 of file parking_applications.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_channel_lock, ast_channel_set_bridge_role_option(), ast_channel_uniqueid(), ast_channel_unlock, ast_log, ast_strdupa, ast_strlen_zero(), find_channel_parking_lot_name(), LOG_ERROR, NULL, parking_channel_set_roles(), parking_create_dynamic_lot(), parking_lot_find_by_name(), parking_lot_get_bridge(), RAII_VAR, and setup_park_common_datastore().
Referenced by park_application_setup(), and park_common_setup().
|
static |
Definition at line 624 of file parking_applications.c.
References ao2_cleanup, args, ast_answer(), AST_APP_ARG, ast_assert, ast_bridge_basic_new(), ast_bridge_destroy(), ast_bridge_features_cleanup(), ast_bridge_features_init(), ast_bridge_join(), AST_BRIDGE_JOIN_PASS_REFERENCE, ast_bridge_move(), ast_channel_lock, ast_channel_snapshot_create(), ast_channel_unlock, AST_DECLARE_APP_ARGS, AST_FEATURE_FLAG_BYCALLER, ast_log, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_stream_and_wait(), ast_strlen_zero(), find_channel_parking_lot_name(), LOG_ERROR, NULL, parked_call_retrieve_enable_features(), parking_lot_find_by_name(), parking_lot_retrieve_parked_user(), and RAII_VAR.
Referenced by load_parking_applications().
|
static |
Definition at line 371 of file parking_applications.c.
References ast_calloc, ast_channel_datastore_add(), ast_channel_lock, ast_channel_name_to_dial_string(), ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), ast_strdup, ast_strdupa, ast_strlen_zero(), ast_verb, park_common_datastore::comeback_override, ast_datastore::data, NULL, park_common_info, park_common_datastore::parker_dial_string, park_common_datastore::parker_uuid, pbx_builtin_getvar_helper(), park_common_datastore::randomize, park_common_datastore::silence_announce, park_common_datastore::time_limit, and wipe_park_common_datastore().
Referenced by park_common_setup2().
void unload_parking_applications | ( | void | ) |
Unregister parking applications.
Definition at line 1025 of file parking_applications.c.
References ast_unregister_application(), PARK_AND_ANNOUNCE_APPLICATION, PARK_APPLICATION, and PARKED_CALL_APPLICATION.
Referenced by unload_module().
|
static |
Definition at line 358 of file parking_applications.c.
References ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, ast_datastore_free(), NULL, and park_common_info.
Referenced by setup_park_common_datastore().
|
static |
Definition at line 353 of file parking_applications.c.
Referenced by get_park_common_datastore_copy(), setup_park_common_datastore(), and wipe_park_common_datastore().
|
static |
Definition at line 264 of file parking_applications.c.
Referenced by park_app_parse_data().