74 .
type =
"pickup-active",
100 if (chan == target) {
205 const char *pickup_sound;
206 const char *fail_sound;
212 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration. Unable to play pickup sounds\n");
214 pickup_sound =
ast_strdupa(pickup_cfg ? pickup_cfg->pickupsound :
"");
215 fail_sound =
ast_strdupa(pickup_cfg ? pickup_cfg->pickupfailsound :
"");
306 const char *chan_name;
307 const char *target_name;
320 "Unable to create channel datastore on '%s' for call pickup\n", target_name);
362 if (!chan_snapshot) {
367 if (!target_snapshot) {
373 chan_name, target_name);
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
Struct containing info for an AMI event to send out.
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int is_caller, int frame)
Run a connected line interception macro and update a channel's connected line information.
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
static void pickup_shutdown(void)
void ast_party_id_reset(struct ast_party_id *id)
Destroy and initialize the given party id structure.
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_channel * ast_pickup_find_by_group(struct ast_channel *chan)
Find a pickup channel target by group.
#define ast_test_flag(p, flag)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Structure representing a snapshot of channel state.
struct ast_str * ast_manager_build_channel_state_string_prefix(const struct ast_channel_snapshot *snapshot, const char *prefix)
Generate the AMI message body from a channel snapshot.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
static int send_call_pickup_stasis_message(struct ast_channel *picking_up, struct ast_channel_snapshot *chan, struct ast_channel_snapshot *target)
Structure for a data store type.
ast_channel_state
ast_channel states
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
Structure for a data store object.
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
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.
int ast_channel_move(struct ast_channel *dest, struct ast_channel *source)
Move a channel from its current location to a new location.
struct ast_manager_event_blob * ast_manager_event_blob_create(int event_flags, const char *manager_event, const char *extra_fields_fmt,...)
Construct a ast_manager_event_blob.
struct ast_namedgroups * ast_channel_named_callgroups(const struct ast_channel *chan)
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.
#define ast_strlen_zero(foo)
struct ast_json * ast_json_null(void)
Get the JSON null value.
static int find_channel_by_group(void *obj, void *arg, void *data, int flags)
#define ast_debug(level,...)
Log a DEBUG message.
void ast_channel_queue_connected_line_update(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Queue a connected line update frame on a channel.
STASIS_MESSAGE_TYPE_DEFN(ast_call_pickup_type,.to_ami=call_pickup_to_ami)
General Asterisk PBX channel definitions.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
#define AST_CAUSE_ANSWERED_ELSEWHERE
void ast_multi_channel_blob_add_channel(struct ast_multi_channel_blob *obj, const char *role, struct ast_channel_snapshot *snapshot)
Add a ast_channel_snapshot to a ast_multi_channel_blob object.
#define ao2_ref(o, delta)
#define ast_strdupa(s)
duplicate a string in memory from the stack
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
Core PBX routines and definitions.
struct ast_channel * ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
Call a function with every active channel.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
int ast_pickup_init(void)
Initialize pickup.
struct stasis_message_type * ast_call_pickup_type(void)
accessor for call pickup message type
int ast_tvcmp(struct timeval _a, struct timeval _b)
Compres two struct timeval instances returning -1, 0, 1 if the first arg is smaller, equal or greater to the second.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static struct ast_manager_event_blob * call_pickup_to_ami(struct stasis_message *message)
#define ao2_unlink(container, obj)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
int ast_channel_connected_line_sub(struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame)
Run a connected line interception subroutine and update a channel's connected line information...
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
Connected Line/Party information.
#define ao2_iterator_next(iter)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
#define ast_channel_unlock(chan)
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
int ast_can_pickup(struct ast_channel *chan)
Test if a channel can be picked up.
int source
Information about the source of an update.
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.
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)
int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target)
Pickup a call target.
int ast_namedgroups_intersect(struct ast_namedgroups *a, struct ast_namedgroups *b)
Return TRUE if group a and b contain at least one common groupname.
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
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...
static const struct ast_datastore_info pickup_active
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
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_namedgroups * ast_channel_named_pickupgroups(const struct ast_channel *chan)
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel_snapshot * ast_multi_channel_blob_get_channel(struct ast_multi_channel_blob *obj, const char *role)
Retrieve a channel snapshot associated with a specific role from a ast_multi_channel_blob.
A multi channel blob data structure for multi_channel_blob stasis messages.
int ast_answer(struct ast_channel *chan)
Answer a channel.
Internal Asterisk hangup causes.
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
#define ast_datastore_alloc(info, uid)
#define ast_channel_trylock(chan)
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ast_party_id priv
Private connected party ID.
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
struct ast_multi_channel_blob * ast_multi_channel_blob_create(struct ast_json *blob)
Create a ast_multi_channel_blob suitable for a stasis_message.
Configuration relating to call pickup.
#define ao2_link(container, obj)