Asterisk - The Open Source Telephony Project
18.5.0
|
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_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) } |
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) |
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 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 }, } |
Call Parking Applications.
Definition in file parking_applications.c.
#define PARK_AND_ANNOUNCE_APPLICATION "ParkAndAnnounce" |
Definition at line 237 of file parking_applications.c.
Referenced by load_parking_applications(), and unload_parking_applications().
enum park_args |
Enumerator | |
---|---|
OPT_ARG_COMEBACK | |
OPT_ARG_TIMEOUT | |
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 |
Definition at line 247 of file parking_applications.c.
|
static |
Definition at line 800 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 263 of file parking_applications.c.
References ast_log, ast_strlen_zero, and LOG_ERROR.
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 |
Pointer | to a copy of the park common datastore for parkee if it could be cloned. This needs to be free'd with park_common_datastore free. |
NULL | if the park_common_datastore could not be copied off of the channel. |
Definition at line 433 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_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 746 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, 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 989 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 892 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, parse(), 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 718 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 709 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 859 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(), and ast_channel_snapshot_base::uniqueid.
Referenced by park_and_announce_app_exec().
|
static |
Definition at line 545 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 278 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, MUXFLAG_COMEBACK_OVERRIDE, MUXFLAG_NOANNOUNCE, MUXFLAG_RANDOMIZE, MUXFLAG_RINGING, MUXFLAG_TIMEOUT_OVERRIDE, NULL, OPT_ARG_ARRAY_SIZE, OPT_ARG_COMEBACK, OPT_ARG_TIMEOUT, options, park_opts, and parse().
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 preparred 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. |
reference | to a parking bridge if successful |
NULL | on failure |
Definition at line 526 of file parking_applications.c.
References ast_free, NULL, park_app_parse_data(), park_common_setup(), and RAII_VAR.
Referenced by AST_TEST_DEFINE(), park_and_announce_app_exec(), park_app_exec(), and parking_park_bridge_channel().
|
static |
Definition at line 339 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 327 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 484 of file parking_applications.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_channel_lock, 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 manager_park_unbridged(), and park_application_setup().
|
static |
Definition at line 603 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(), parse(), and RAII_VAR.
Referenced by load_parking_applications().
|
static |
Definition at line 363 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_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_setup().
void unload_parking_applications | ( | void | ) |
Unregister parking applications.
Definition at line 1006 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 350 of file parking_applications.c.
References ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, ast_datastore_free(), and NULL.
Referenced by setup_park_common_datastore().
|
static |
Definition at line 345 of file parking_applications.c.
|
static |
Definition at line 261 of file parking_applications.c.
Referenced by park_app_parse_data().