87 .
type =
"park subscription",
108 const char *parkee_to_act_on =
data->parkee_uuid;
114 if (strcmp(parkee_to_act_on, parkee_snapshot->
base->
uniqueid)) {
131 if (!bridge_channel) {
139 snprintf(saynum_buf,
sizeof(saynum_buf),
"%d %u", data->
hangup_after,
message->parkingspace);
182 size_t parker_uuid_size;
183 size_t parkee_uuid_size;
192 if (!(parked_datastore =
ast_calloc(1,
sizeof(*parked_datastore)))) {
200 if (!(subscription_data =
ast_calloc(1,
sizeof(*subscription_data) + parker_uuid_size +
201 parkee_uuid_size))) {
207 if (parked_channel_data) {
209 ao2_ref(parked_channel_data, +1);
224 datastore->
data = parked_datastore;
252 snprintf(destination,
sizeof(destination),
"%s@%s",
exten,
context);
285 if (
ast_call(parkee, destination, 0)) {
301 const char *app_at_exten;
361 if (peer_count == 2) {
364 other_chan = other->chan;
369 if (peer_count < 2) {
377 if (peer_count > 2) {
381 if (!transfer_chan) {
386 if (parked_channel_cb) {
407 if (parked_channel_cb) {
448 ast_log(
LOG_NOTICE,
"Channel with uuid %s left before we could start parking the call. Parking canceled.\n", uuid_parker);
464 if (!original_bridge) {
502 const char *lot_name;
578 const char *dial_string;
579 char *dial_string_flat;
583 char *duplicate_returnexten;
602 dial_string =
user->parker_dial_string;
607 snprintf(parking_space,
sizeof(parking_space),
"%d",
user->parking_space);
621 ast_log(
LOG_ERROR,
"Failed to lock the contexts list. Can't add the park-dial extension.\n");
630 goto abandon_extension_creation;
638 goto abandon_extension_creation;
645 snprintf(returnexten,
sizeof(returnexten),
"%s,%u", dial_string,
646 user->lot->cfg->comebackdialtime);
648 duplicate_returnexten =
ast_strdup(returnexten);
649 if (!duplicate_returnexten) {
650 ast_log(
LOG_ERROR,
"Failed to create parking redial parker extension %s@%s - Dial(%s)\n",
657 ast_debug(3,
"An extension for '%s@%s' was already registered by another registrar '%s'\n",
661 ast_log(
LOG_ERROR,
"Failed to create parking redial parker extension %s@%s - Dial(%s)\n",
669abandon_extension_creation:
683 unsigned int numeric_value;
684 unsigned int hangup_after;
686 if (sscanf(payload,
"%u %u", &hangup_after, &numeric_value) != 2) {
705 unsigned int time_limit;
707 time_limit =
user->time_limit * 1000;
716 if (time_limit <= 0) {
735 unsigned int space = 0;
736 const char *content =
NULL;
762 ast_log(
LOG_ERROR,
"value '%s' for parking_space argument is invalid. Must be an integer greater than 0.\n",
780 .
name =
"PARK_GET_CHANNEL",
786 .module_name = __FILE__,
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void __ao2_cleanup(void *obj)
#define ast_bridge_unlock(bridge)
Unlock the bridge.
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, enum ast_bridge_impart_flags flags) attribute_warn_unused_result
Impart a channel to a bridge (non-blocking)
@ AST_BRIDGE_TRANSFER_SINGLE_PARTY
@ AST_BRIDGE_TRANSFER_MULTI_PARTY
void(* transfer_channel_cb)(struct ast_channel *chan, struct transfer_channel_data *user_data, enum ast_transfer_type transfer_type)
Callback function type called during blind transfers.
void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int is_attended)
Set the relevant transfer variables for a single channel.
@ AST_BRIDGE_IMPART_CHAN_INDEPENDENT
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.
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel)
Lock the bridge associated with the bridge channel.
struct ast_bridge_channel * ast_bridge_channel_peer(struct ast_bridge_channel *bridge_channel)
Get the peer bridge channel of a two party bridge.
@ BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE
int ast_bridge_channel_queue_playfile(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Queue a bridge action play file frame onto the bridge channel.
int ast_bridge_channel_queue_playfile_sync(struct ast_bridge_channel *bridge_channel, ast_bridge_custom_play_fn custom_play, const char *playfile, const char *moh_class)
Synchronously queue a bridge action play file frame onto the bridge channel.
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause)
Set bridge channel state to leave bridge (if not leaving already).
int ast_bridge_channel_write_park(struct ast_bridge_channel *bridge_channel, const char *parkee_uuid, const char *parker_uuid, const char *app_data)
Have a bridge channel park a channel in the bridge.
int ast_bridge_features_unregister(enum ast_bridge_builtin_feature feature)
Unregister a handler for a built in feature.
int ast_bridge_interval_hook(struct ast_bridge_features *features, enum ast_bridge_hook_timer_option flags, unsigned int interval, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach an interval hook to a bridge features structure.
@ AST_BRIDGE_HOOK_REMOVE_ON_PULL
@ AST_BRIDGE_BUILTIN_PARKCALL
int ast_bridge_features_register(enum ast_bridge_builtin_feature feature, ast_bridge_hook_callback callback, const char *dtmf)
Register a handler for a built in feature.
Internal Asterisk hangup causes.
#define AST_CAUSE_NORMAL_CLEARING
const char * ast_channel_name(const struct ast_channel *chan)
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
@ AST_CHANNEL_REQUESTOR_REPLACEMENT
#define ast_channel_lock(chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
#define ast_channel_ref(c)
Increase channel reference count.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
const char * ast_channel_uniqueid(const struct ast_channel *chan)
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
const char * ast_channel_parkinglot(const struct ast_channel *chan)
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
#define ast_channel_unref(c)
Decrease channel reference count.
const char * ast_channel_language(const struct ast_channel *chan)
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
Copy the caller information to the connected line information.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
#define ast_channel_cleanup(c)
Cleanup a channel reference.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
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.
Conversion utility functions.
int ast_str_to_uint(const char *str, unsigned int *res)
Convert the given string to an unsigned integer.
Local proxy channel special access.
struct ast_channel * ast_local_get_peer(struct ast_channel *ast)
Get the other local channel in the pair.
Asterisk datastore objects.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
@ AST_FEATURE_FLAG_BYCALLER
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct stasis_topic * ast_parking_topic(void)
accessor for the parking stasis topic
struct stasis_message_type * ast_parked_call_type(void)
accessor for the parked call stasis message type
struct stasis_message_type * stasis_subscription_change_type(void)
Gets the message type for subscription change notices.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
Support for logging to various files, console and syslog Configuration in file logger....
#define ast_debug(level,...)
Log a DEBUG message.
Asterisk module definitions.
#define SCOPED_MODULE_USE(module)
int ast_parking_unregister_bridge_features(const char *module_name)
Unregister the current parking provider.
int ast_parking_register_bridge_features(struct ast_parking_bridge_feature_fn_table *fn_table)
Register a parking provider.
#define PARK_APPLICATION
The default parking application that Asterisk expects.
#define PARKING_MODULE_VERSION
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,...
static void wipe_subscription_datastore(struct ast_channel *chan)
static int parking_duration_callback(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
void unload_parking_bridge_features(void)
Unregister features registered by load_parking_bridge_features.
static void parker_parked_call_message_response(struct ast_parked_call_payload *message, struct parked_subscription_data *data, struct stasis_subscription *sub)
static void parking_timeout_set_caller_features(struct ast_channel *chan, struct parking_lot_cfg *cfg)
void parking_set_duration(struct ast_bridge_features *features, struct parked_user *user)
Setup timeout interval feature on an ast_bridge_features for parking.
static int parking_park_bridge_channel(struct ast_bridge_channel *bridge_channel, const char *uuid_parkee, const char *uuid_parker, const char *app_data)
struct ast_parking_bridge_feature_fn_table parking_provider
static int parking_blind_transfer_park(struct ast_bridge_channel *bridge_channel, const char *context, const char *exten, transfer_channel_cb parked_channel_cb, struct transfer_channel_data *parked_channel_data)
static const struct ast_datastore_info parked_subscription_info
int create_parked_subscription(struct ast_channel *chan, const char *parkee_uuid, int hangup_after)
Create a parking announcement subscription.
static int parking_park_call(struct ast_bridge_channel *parker, char *exten, size_t length)
static void parked_subscription_datastore_destroy(void *data)
void say_parking_space(struct ast_bridge_channel *bridge_channel, const char *payload)
custom callback function for ast_bridge_channel_queue_playfile which plays a parking space and option...
static struct ast_channel * park_local_transfer(struct ast_channel *parker, const char *context, const char *exten, struct transfer_channel_data *parked_channel_data)
static int func_get_parkingslot_channel(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
Dial plan function to get the parking lot channel of an occupied parking lot.
int load_parking_bridge_features(void)
Register bridge features for parking.
static void parker_update_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static int feature_park_call(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static struct ast_custom_function getparkingslotchannel_function
static int create_parked_subscription_full(struct ast_channel *chan, const char *parkee_uuid, int hangup_after, struct transfer_channel_data *parked_channel_data)
static int parking_is_exten_park(const char *context, const char *exten)
struct parked_user * parking_lot_inspect_parked_user(struct parking_lot *lot, int target)
Determine if there is a parked user in a parking space and return it if there is.
void flatten_dial_string(char *dialstring)
Flattens a dial string so that it can be written to/found from PBX extensions.
int comeback_goto(struct parked_user *pu, struct parking_lot *lot)
Set a channel's position in the PBX after timeout using the parking lot settings.
void publish_parked_call_failure(struct ast_channel *parkee)
Publish a stasis parked call message for the channel indicating failure to park.
Core PBX routines and definitions.
void * ast_get_extension_app_data(struct ast_exten *e)
int ast_wrlock_contexts(void)
Write locks the context list.
int ast_wrlock_context(struct ast_context *con)
Write locks a given context.
const char * ast_get_extension_app(struct ast_exten *e)
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
int ast_unlock_context(struct ast_context *con)
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string)
int ast_add_extension2_nolock(struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar, const char *registrar_file, int registrar_line)
Same as ast_add_extension2, but assumes you have already locked context.
struct ast_exten * pbx_find_extension(struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action)
int ast_unlock_contexts(void)
Unlocks contexts.
const char * ast_get_extension_registrar(struct ast_exten *e)
struct stasis_forward * sub
Call Parking Resource Internal API.
struct parking_lot * parking_create_dynamic_lot(const char *name, struct ast_channel *chan)
Create a dynamic parking lot.
#define PARK_DIAL_CONTEXT
const char * find_channel_parking_lot_name(struct ast_channel *chan)
Find parking lot name from channel.
struct parking_lot * parking_lot_find_by_name(const char *lot_name)
Find a parking lot based on its name.
Say numbers and dates (maybe words one day too)
int ast_say_digits(struct ast_channel *chan, int num, const char *ints, const char *lang)
says digits
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
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.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
#define stasis_subscribe_pool(topic, callback, data)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
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.
struct stasis_subscription * stasis_unsubscribe(struct stasis_subscription *subscription)
Cancel a subscription.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Structure that contains information regarding a channel in a bridge.
struct ast_bridge * bridge
Bridge this channel is participating in.
struct ast_channel * chan
Structure that contains features information.
Structure that contains information about a bridge.
unsigned int num_channels
const ast_string_field uniqueid
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_base * base
Main Channel structure associated with a channel.
struct ast_bridge_channel * bridge_channel
char exten[AST_MAX_EXTENSION]
ast_context: An extension context
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
A parked call message payload.
A function table providing parking functionality to the Bridging API Bridging API and other consumers...
unsigned int module_version
The version of this function table. If the ABI for this table changes, the module version (/ref PARKI...
const char * module_name
The name of the module that provides this parking functionality.
struct ast_module * module
The module info for the module registering this parking provider.
struct transfer_channel_data * transfer_data
unsigned int hangup_after
struct stasis_subscription * parked_subscription
AO2 object that wraps data for transfer_channel_cb.
structure to hold users read from users.conf
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.