Asterisk - The Open Source Telephony Project
18.5.0
|
Routines implementing call pickup. More...
#include "asterisk.h"
#include "asterisk/pickup.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/callerid.h"
#include "asterisk/causes.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/features_config.h"
Go to the source code of this file.
Functions | |
int | ast_can_pickup (struct ast_channel *chan) |
Test if a channel can be picked up. More... | |
int | ast_do_pickup (struct ast_channel *chan, struct ast_channel *target) |
Pickup a call target. More... | |
int | ast_pickup_call (struct ast_channel *chan) |
Pickup a call. More... | |
struct ast_channel * | ast_pickup_find_by_group (struct ast_channel *chan) |
Find a pickup channel target by group. More... | |
int | ast_pickup_init (void) |
Initialize pickup. More... | |
static struct ast_manager_event_blob * | call_pickup_to_ami (struct stasis_message *message) |
static int | find_channel_by_group (void *obj, void *arg, void *data, int flags) |
static void | pickup_shutdown (void) |
static int | send_call_pickup_stasis_message (struct ast_channel *picking_up, struct ast_channel_snapshot *chan, struct ast_channel_snapshot *target) |
STASIS_MESSAGE_TYPE_DEFN (ast_call_pickup_type,.to_ami=call_pickup_to_ami) | |
Variables | |
static const struct ast_datastore_info | pickup_active |
Routines implementing call pickup.
Definition in file pickup.c.
int ast_can_pickup | ( | struct ast_channel * | chan | ) |
Test if a channel can be picked up.
chan | Channel to test if can be picked up. |
Definition at line 77 of file pickup.c.
References ast_channel_datastore_find(), ast_channel_flags(), ast_channel_masq(), ast_channel_pbx(), AST_FLAG_ZOMBIE, AST_STATE_DOWN, AST_STATE_RING, AST_STATE_RINGING, ast_test_flag, and NULL.
Referenced by ast_pickup_find_by_group(), find_by_mark(), find_by_name(), find_by_uniqueid(), find_channel_by_group(), handle_invite_replaces(), and pickup_by_exten().
int ast_do_pickup | ( | struct ast_channel * | chan, |
struct ast_channel * | target | ||
) |
Pickup a call target.
chan | channel that initiated pickup. |
target | channel to be picked up. |
0 | on success. |
-1 | on failure. |
< A masquerade changes channel names.
< A masquerade changes channel names.
Definition at line 302 of file pickup.c.
References ao2_cleanup, ast_answer(), AST_CAUSE_ANSWERED_ELSEWHERE, ast_channel_caller(), ast_channel_connected(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_channel_datastore_add(), ast_channel_datastore_remove(), ast_channel_hangupcause_set(), ast_channel_lock, ast_channel_move(), ast_channel_name(), ast_channel_queue_connected_line_update(), ast_channel_snapshot_create(), ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_update_connected_line(), ast_connected_line_copy_from_caller(), AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER, AST_CONTROL_ANSWER, ast_datastore_alloc, ast_datastore_free(), ast_debug, ast_log, ast_party_connected_line_copy(), ast_party_connected_line_free(), ast_party_connected_line_init(), ast_party_id_reset(), ast_queue_control(), ast_strdupa, LOG_WARNING, NULL, ast_party_connected_line::priv, RAII_VAR, send_call_pickup_stasis_message(), and ast_party_connected_line::source.
Referenced by ast_pickup_call(), AST_TEST_DEFINE(), handle_invite_replaces(), pickup_by_channel(), pickup_by_exten(), pickup_by_group(), pickup_by_mark(), and pickup_by_part().
int ast_pickup_call | ( | struct ast_channel * | chan | ) |
Pickup a call.
chan | channel that initiated pickup. |
Walk list of channels, checking it is not itself, channel is pbx one, check that the callgroup for both channels are the same and the channel is ringing. Answer calling channel, flag channel as answered on queue, masq channels together.
< Potential pickup target
Definition at line 200 of file pickup.c.
References ao2_cleanup, ast_answer(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_channel_unref, ast_debug, ast_do_pickup(), ast_get_chan_features_pickup_config(), ast_log, ast_pickup_find_by_group(), ast_strdupa, ast_stream_and_wait(), ast_strlen_zero, LOG_ERROR, LOG_NOTICE, LOG_WARNING, NULL, pbx_builtin_setvar_helper(), and RAII_VAR.
Referenced by __analog_ss_thread(), analog_ss_thread(), call_pickup_incoming_request(), cb_events(), handle_call_outgoing(), handle_soft_key_event_message(), mgcp_ss(), and sip_pickup_thread().
struct ast_channel* ast_pickup_find_by_group | ( | struct ast_channel * | chan | ) |
Find a pickup channel target by group.
chan | channel that initiated pickup. |
target | on success. The returned channel is locked and reffed. |
NULL | on error. |
< Candidate channels found to pickup.
< Potential pickup target
< Potential new older target
Definition at line 133 of file pickup.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_list, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ao2_unlink, ast_can_pickup(), ast_channel_callback(), ast_channel_creationtime(), ast_channel_lock, ast_channel_unlock, ast_channel_unref, ast_tvcmp(), find_channel_by_group(), and NULL.
Referenced by ast_pickup_call(), and pickup_by_group().
int ast_pickup_init | ( | void | ) |
Initialize pickup.
0 | on success |
non-zero | on failure |
Definition at line 401 of file pickup.c.
References ast_call_pickup_type(), ast_register_cleanup(), pickup_shutdown(), and STASIS_MESSAGE_TYPE_INIT.
Referenced by asterisk_daemon().
|
static |
Definition at line 246 of file pickup.c.
References ast_assert, ast_free, ast_manager_build_channel_state_string(), ast_manager_build_channel_state_string_prefix(), ast_manager_event_blob_create(), ast_multi_channel_blob_get_channel(), ast_str_buffer(), contents, EVENT_FLAG_CALL, NULL, RAII_VAR, and stasis_message_data().
|
static |
< Potential pickup target
< Channel wanting to pickup call
< Candidate channels found.
Definition at line 95 of file pickup.c.
References ao2_link, ast_can_pickup(), ast_channel_callgroup(), ast_channel_lock, ast_channel_named_callgroups(), ast_channel_named_pickupgroups(), ast_channel_pickupgroup(), ast_channel_trylock, ast_channel_unlock, and ast_namedgroups_intersect().
Referenced by ast_pickup_find_by_group().
|
static |
Definition at line 396 of file pickup.c.
References ast_call_pickup_type(), and STASIS_MESSAGE_TYPE_CLEANUP.
Referenced by ast_pickup_init().
|
static |
Definition at line 278 of file pickup.c.
References ao2_cleanup, ast_call_pickup_type(), ast_channel_topic(), ast_json_null(), ast_multi_channel_blob_add_channel(), ast_multi_channel_blob_create(), NULL, RAII_VAR, stasis_message_create(), and stasis_publish().
Referenced by ast_do_pickup().
STASIS_MESSAGE_TYPE_DEFN | ( | ast_call_pickup_type | , |
. | to_ami = call_pickup_to_ami |
||
) |
|
static |