Asterisk - The Open Source Telephony Project
21.4.1
|
Local proxy channel driver. More...
#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/cli.h"
#include "asterisk/manager.h"
#include "asterisk/devicestate.h"
#include "asterisk/astobj2.h"
#include "asterisk/bridge.h"
#include "asterisk/core_unreal.h"
#include "asterisk/core_local.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/_private.h"
#include "asterisk/stream.h"
#include "asterisk/translate.h"
Go to the source code of this file.
Data Structures | |
struct | local_bridge |
struct | local_pvt |
the local pvt structure for all channels More... | |
Enumerations | |
enum | local_call_action { LOCAL_CALL_ACTION_DIALPLAN, LOCAL_CALL_ACTION_BRIDGE, LOCAL_CALL_ACTION_MASQUERADE } |
Functions | |
struct ast_channel * | ast_local_get_peer (struct ast_channel *ast) |
Get the other local channel in the pair. More... | |
int | ast_local_init (void) |
Initialize the local proxy channel. More... | |
void | ast_local_lock_all (struct ast_channel *chan, void **tech_pvt, struct ast_channel **base_chan, struct ast_channel **base_owner) |
Add a reference to the local channel's private tech, lock the local channel's private base, and add references and lock both sides of the local channel. More... | |
int | ast_local_setup_bridge (struct ast_channel *ast, struct ast_bridge *bridge, struct ast_channel *swap, struct ast_bridge_features *features) |
Setup the outgoing local channel to join a bridge on ast_call(). More... | |
int | ast_local_setup_masquerade (struct ast_channel *ast, struct ast_channel *masq) |
Setup the outgoing local channel to masquerade into a channel on ast_call(). More... | |
void | ast_local_unlock_all (void *tech_pvt, struct ast_channel *base_chan, struct ast_channel *base_owner) |
Remove a reference to the given local channel's private tech, unlock the given local channel's private base, and remove references and unlock both sides of given the local channel. More... | |
static struct local_pvt * | local_alloc (const char *data, struct ast_stream_topology *topology) |
Create a call structure. | |
static int | local_call (struct ast_channel *ast, const char *dest, int timeout) |
Initiate new call, part of PBX interface dest is the dial string. | |
static struct ast_multi_channel_blob * | local_channel_optimization_blob (struct local_pvt *p, struct ast_json *json_object) |
static int | local_devicestate (const char *data) |
Adds devicestate to local channels. | |
static int | local_hangup (struct ast_channel *ast) |
Hangup a call through the local proxy channel. | |
static struct ast_manager_event_blob * | local_message_to_ami (struct stasis_message *msg) |
static void | local_optimization_finished_cb (struct ast_unreal_pvt *base, int success, unsigned int id) |
Callback for ast_unreal_pvt_callbacks optimization_finished . | |
static void | local_optimization_started_cb (struct ast_unreal_pvt *base, struct ast_channel *source, enum ast_unreal_channel_indicator dest, unsigned int id) |
Callback for ast_unreal_pvt_callbacks optimization_started . | |
static void | local_pvt_destructor (void *vdoomed) |
static struct ast_channel * | local_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause) |
Part of PBX interface. | |
static struct ast_channel * | local_request_with_stream_topology (const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause) |
Part of PBX interface. | |
static int | local_setoption (struct ast_channel *chan, int option, void *data, int datalen) |
static void | local_shutdown (void) |
static int | locals_cmp_cb (void *obj, void *arg, int flags) |
static char * | locals_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command "local show channels". | |
static int | manager_optimize_away (struct mansession *s, const struct message *m) |
static void | publish_local_bridge_message (struct local_pvt *p) |
STASIS_MESSAGE_TYPE_DEFN (ast_local_bridge_type,.to_ami=local_message_to_ami,) | |
Define local channel message types. | |
STASIS_MESSAGE_TYPE_DEFN (ast_local_optimization_begin_type,.to_ami=local_message_to_ami,) | |
STASIS_MESSAGE_TYPE_DEFN (ast_local_optimization_end_type,.to_ami=local_message_to_ami,) | |
Variables | |
static struct ast_cli_entry | cli_local [] |
static struct ast_channel_tech | local_tech |
struct ast_unreal_pvt_callbacks | local_unreal_callbacks |
Callbacks from the unreal core when channel optimization occurs. More... | |
static struct ao2_container * | locals |
static const char | tdesc [] = "Local Proxy Channel Driver" |
enum local_call_action |
What to do with the ;2 channel when ast_call() happens.
Definition at line 197 of file core_local.c.
struct ast_channel* ast_local_get_peer | ( | struct ast_channel * | ast | ) |
Get the other local channel in the pair.
ast | Local channel to get peer. |
peer | reffed on success. |
NULL | if no peer or error. |
Definition at line 276 of file core_local.c.
References ao2_ref, ast_channel_ref, local_pvt::base, ast_unreal_pvt::chan, and ast_unreal_pvt::owner.
int ast_local_init | ( | void | ) |
Initialize the local proxy channel.
0 | on success. |
-1 | on error. |
Definition at line 1139 of file core_local.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_list, ast_channel_register(), ast_cli_register_multiple, ast_format_cap_alloc, ast_format_cap_append_by_type(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_local_bridge_type(), ast_local_optimization_begin_type(), ast_local_optimization_end_type(), ast_manager_register_xml_core, ast_register_cleanup(), ast_channel_tech::capabilities, and STASIS_MESSAGE_TYPE_INIT.
void ast_local_lock_all | ( | struct ast_channel * | chan, |
void ** | tech_pvt, | ||
struct ast_channel ** | base_chan, | ||
struct ast_channel ** | base_owner | ||
) |
Add a reference to the local channel's private tech, lock the local channel's private base, and add references and lock both sides of the local channel.
chan | Must be a local channel | |
[out] | tech_pvt | channel's private tech (ref and lock added) |
[out] | base_chan | One side of the local channel (ref and lock added) |
[out] | base_owner | Other side of the local channel (ref and lock added) |
Definition at line 241 of file core_local.c.
References ao2_bump, ast_unreal_lock_all(), and local_pvt::base.
Referenced by attended_transfer_bridge().
int ast_local_setup_bridge | ( | struct ast_channel * | ast, |
struct ast_bridge * | bridge, | ||
struct ast_channel * | swap, | ||
struct ast_bridge_features * | features | ||
) |
Setup the outgoing local channel to join a bridge on ast_call().
ast | Either channel of a local channel pair. |
bridge | Bridge to join. |
swap | Channel to swap with when joining. |
features | Bridge features structure. |
0 | on success. |
-1 | on error. |
Definition at line 601 of file core_local.c.
References local_pvt::action, ao2_ref, ast_bridge_features_destroy(), ast_channel_ref, AST_UNREAL_CARETAKER_THREAD, local_pvt::base, local_pvt::bridge, ast_unreal_pvt::chan, local_bridge::features, local_bridge::join, ast_unreal_pvt::owner, local_bridge::swap, and local_pvt::type.
Referenced by attended_transfer_bridge().
int ast_local_setup_masquerade | ( | struct ast_channel * | ast, |
struct ast_channel * | masq | ||
) |
Setup the outgoing local channel to masquerade into a channel on ast_call().
ast | Either channel of a local channel pair. |
masq | Channel to masquerade into. |
0 | on success. |
-1 | on error. |
Definition at line 643 of file core_local.c.
References local_pvt::action, ao2_ref, ast_channel_ref, AST_UNREAL_CARETAKER_THREAD, local_pvt::base, ast_unreal_pvt::chan, local_pvt::masq, ast_unreal_pvt::owner, and local_pvt::type.
Referenced by attended_transfer_bridge().
void ast_local_unlock_all | ( | void * | tech_pvt, |
struct ast_channel * | base_chan, | ||
struct ast_channel * | base_owner | ||
) |
Remove a reference to the given local channel's private tech, unlock the given local channel's private base, and remove references and unlock both sides of given the local channel.
tech_pvt | channel's private tech (ref and lock removed) |
base_chan | One side of the local channel (ref and lock removed) |
base_owner | Other side of the local channel (ref and lock removed) |
Definition at line 256 of file core_local.c.
References ao2_ref, ast_channel_unref, and local_pvt::base.
Referenced by attended_transfer_bridge().
|
static |
Definition at line 1070 of file core_local.c.
struct ast_unreal_pvt_callbacks local_unreal_callbacks |
Callbacks from the unreal core when channel optimization occurs.
Definition at line 167 of file core_local.c.
Referenced by local_alloc().