237 #define PARK_AND_ANNOUNCE_APPLICATION "ParkAndAnnounce" 266 ast_log(
LOG_ERROR,
"No duration value provided for the timeout ('t') option.\n");
270 if (sscanf(timeout_arg,
"%d", var) != 1 || *var < 0) {
271 ast_log(
LOG_ERROR,
"Duration value provided for timeout ('t') option must be 0 or greater.\n");
278 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)
306 if (disable_announce) {
307 *disable_announce = 1;
346 .
type =
"park entry data",
367 const char *attended_transfer;
368 const char *blind_transfer;
377 if (!(park_datastore =
ast_calloc(1,
sizeof(*park_datastore)))) {
381 datastore->
data = park_datastore;
393 parker_dial_string =
ast_strdupa(attended_transfer);
397 attended_transfer =
NULL;
403 ast_verb(4,
"Setting Parker dial string to %s from %s value\n",
405 attended_transfer ?
"ATTENDEDTRANSFER" :
"BLINDTRANSFER");
417 if (comeback_override) {
445 data = datastore->
data;
450 data_copy =
ast_calloc(1,
sizeof(*data_copy));
485 const char *lot_name,
const char *comeback_override,
486 int use_ringing,
int randomize,
int time_limit,
int silence_announcements)
515 if (!parking_bridge) {
522 silence_announcements);
523 return parking_bridge;
527 int *silence_announcements)
537 park_app_parse_data(app_data, silence_announcements, &use_ringing, &randomize, &time_limit, &comeback_override, &lot_name_app_arg);
540 return park_common_setup(parkee, parker, lot_name_app_arg, comeback_override, use_ringing,
541 randomize, time_limit, silence_announcements ? *silence_announcements : 0);
551 int silence_announcements = 0;
565 if (!silence_announcements && !blind_transfer) {
609 int target_space = -1;
612 const char *lot_name;
628 lot_name =
args.lot_name;
645 if (sscanf(
args.parking_space,
"%d", &target_space) != 1 || target_space < 0) {
647 ast_log(
LOG_ERROR,
"value '%s' for parking_space argument is invalid. Must be an integer greater than 0.\n",
args.parking_space);
665 if (!retrieval_bridge) {
724 if (!(pa_data =
ast_calloc(1,
sizeof(*pa_data)))) {
769 if (varname[0] ==
'_') {
771 if (varname[1] ==
'_') {
787 ast_debug(1,
"Inheriting variable %s from %s.\n",
810 dial_tech =
strsep(&dial_string,
"/");
811 ast_verb(3,
"Dial Tech,String: (%s,%s)\n", dial_tech, dial_string);
815 goto announce_cleanup;
819 snprintf(buf,
sizeof(buf),
"%d", parkingspace);
833 goto announce_cleanup;
836 ast_verb(4,
"Announce Template: %s\n", announce_string);
838 for (cur_announce =
strsep(&announce_string,
":"); cur_announce; cur_announce =
strsep(&announce_string,
":")) {
839 ast_verb(4,
"Announce:%s\n", cur_announce);
840 if (!strcmp(cur_announce,
"PARKED")) {
897 int silence_announcements = 1;
913 ast_log(
LOG_ERROR,
"ParkAndAnnounce has required arguments. No arguments were provided.\n");
922 ast_log(
LOG_ERROR,
"ParkAndAnnounce requires the announce_template argument.\n");
932 if (!strchr(
args.dial,
'/')) {
static int apply_option_timeout(int *var, char *timeout_arg)
struct ast_variable * next
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
void ast_bridge_features_cleanup(struct ast_bridge_features *features)
Clean up the contents of a bridge features structure.
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)
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
struct ast_channel_snapshot_base * base
Asterisk main include file. File version handling, generic pbx functions.
struct parking_lot * parking_create_dynamic_lot(const char *name, struct ast_channel *chan)
Create a dynamic parking lot.
void park_common_datastore_free(struct park_common_datastore *datastore)
Free a park common datastore struct.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
const ast_string_field name
Structure that contains features information.
void unload_parking_applications(void)
Unregister parking applications.
#define ast_test_flag(p, flag)
const char * ast_var_value(const struct ast_var_t *var)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static void announce_to_dial(char *dial_string, char *announce_string, int parkingspace, struct ast_channel_snapshot *parkee_snapshot)
struct stasis_message_type * ast_parked_call_type(void)
accessor for the parked call stasis message type
int ast_bridge_features_init(struct ast_bridge_features *features)
Initialize bridge features structure.
Structure for variables, used for configurations and for channel variables.
Structure representing a snapshot of channel state.
void parked_call_retrieve_enable_features(struct ast_channel *chan, struct parking_lot *lot, int recipient_mode)
Apply features based on the parking lot feature options.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
Structure for a data store type.
ast_channel_state
ast_channel states
int ast_say_digits(struct ast_channel *chan, int num, const char *ints, const char *lang)
says digits
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
const ast_string_field uniqueid
A parked call message payload.
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
struct varshead * ast_channel_varshead(struct ast_channel *chan)
int ast_unregister_application(const char *app)
Unregister an application.
enum ast_parked_call_event_type event_type
#define ast_verb(level,...)
struct parked_user * parking_lot_retrieve_parked_user(struct parking_lot *lot, int target)
Determine if there is a parked user in a parking space and pull it from the parking lot if there is...
struct ast_channel_snapshot * ast_channel_snapshot_create(struct ast_channel *chan)
Generate a snapshot of the channel state. This is an ao2 object, so ao2_cleanup() to deallocate...
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
struct ast_variable * vars
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
#define PARK_AND_ANNOUNCE_APPLICATION
#define ast_strlen_zero(foo)
void publish_parked_call_failure(struct ast_channel *parkee)
Publish a stasis parked call message for the channel indicating failure to park.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
static int park_and_announce_app_exec(struct ast_channel *chan, const char *data)
Configuration File Parser.
static const struct ast_datastore_info park_common_info
#define ast_debug(level,...)
Log a DEBUG message.
static struct park_announce_subscription_data * park_announce_subscription_data_create(const char *parkee_uuid, const char *dial_string, const char *announce_string)
int parking_channel_set_roles(struct ast_channel *chan, struct parking_lot *lot, int force_ringing)
Set necessary bridge roles on a channel that is about to enter a parking lot.
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
struct ast_channel_snapshot * parkee
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...
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_channel_cleanup(c)
Cleanup a channel reference.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_variable_new(name, value, filename)
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct ast_channel_snapshot_caller * caller
static int parked_call_app_exec(struct ast_channel *chan, const char *data)
int load_parking_applications(void)
Register parking applications.
Configuration option-handling.
Structure that contains information about a bridge.
void ast_channel_name_to_dial_string(char *channel_name)
Removes the trailing identifiers from a channel name string.
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
unsigned int parkingspace
#define stasis_subscribe_pool(topic, callback, data)
struct stasis_subscription * stasis_unsubscribe(struct stasis_subscription *subscription)
Cancel a subscription.
#define PARK_APPLICATION
The default parking application that Asterisk expects.
const char * ast_var_full_name(const struct ast_var_t *var)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
int stasis_subscription_final_message(struct stasis_subscription *sub, struct stasis_message *msg)
Determine whether a message is the final message to be received on a subscription.
#define ast_channel_unlock(chan)
static void parse(struct mgcp_request *req)
#define ast_calloc(num, len)
A wrapper for calloc()
#define PARKED_CALL_APPLICATION
int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *digits)
stream file until digit If the file name is non-empty, try to play it.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
struct ast_channel * __ast_request_and_dial(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
Request a channel of a given type, with data as optional information used by the low level module and...
Basic bridge subclass API.
static void park_announce_subscription_data_destroy(void *data)
Structure used to handle boolean flags.
int ast_bridge_join(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, struct ast_bridge_tech_optimizations *tech_args, enum ast_bridge_join_flags flags)
Join a channel to a bridge (blocking)
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)
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
struct ast_bridge * ast_bridge_basic_new(void)
Create a new basic class bridge.
struct stasis_topic * ast_parking_topic(void)
accessor for the parking stasis topic
char * strsep(char **str, const char *delims)
int ast_bridge_move(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_channel *chan, struct ast_channel *swap, int attempt_recovery)
Move a channel from one bridge to another.
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.
static void park_common_datastore_destroy(void *data)
const ast_string_field number
const char * ast_channel_name(const struct ast_channel *chan)
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
int ast_answer(struct ast_channel *chan)
Answer a channel.
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
struct stasis_forward * sub
const char * ast_channel_language(const struct ast_channel *chan)
static void wipe_park_common_datastore(struct ast_channel *chan)
static int park_app_exec(struct ast_channel *chan, const char *data)
struct stasis_message_type * stasis_subscription_change_type(void)
Gets the message type for subscription change notices.
#define ast_datastore_alloc(info, uid)
static void park_announce_update_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
struct parking_lot * parking_lot_find_by_name(const char *lot_name)
Find a parking lot based on its name.
Call Parking Resource Internal API.
char * parker_dial_string
const char * find_channel_parking_lot_name(struct ast_channel *chan)
Find parking lot name from channel.
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
struct ast_bridge * parking_lot_get_bridge(struct parking_lot *lot)
Get a reference to a parking lot's bridge. If it doesn't exist, create it and get a reference...
Say numbers and dates (maybe words one day too)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
Asterisk module definitions.
static const struct ast_app_option park_opts[128]
static struct stasis_forward * parking_subscription
Our subscription for parking.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
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.
#define AST_APP_ARG(name)
Define an application argument.
static void inherit_channel_vars_from_id(struct outgoing_helper *oh, const char *channel_id)