Asterisk - The Open Source Telephony Project
21.4.1
|
Unreal channel derivative framework. More...
#include "asterisk/astobj2.h"
#include "asterisk/channel.h"
#include "asterisk/bridge.h"
#include "asterisk/abstract_jb.h"
Go to the source code of this file.
Data Structures | |
struct | ast_unreal_pvt |
The base pvt structure for local channel derivatives. More... | |
struct | ast_unreal_pvt_callbacks |
Callbacks that can be provided by concrete implementations of the unreal channel driver that will be called when events occur in the unreal layer. More... | |
Macros | |
#define | AST_UNREAL_CARETAKER_THREAD (1 << 0) |
#define | AST_UNREAL_IS_OUTBOUND(a, b) ((a) == (b)->chan ? 1 : 0) |
#define | AST_UNREAL_MOH_INTERCEPT (1 << 2) |
#define | AST_UNREAL_NO_OPTIMIZATION (1 << 1) |
#define | AST_UNREAL_OPTIMIZE_BEGUN (1 << 3) |
Enumerations | |
enum | ast_unreal_channel_indicator { AST_UNREAL_OWNER, AST_UNREAL_CHAN } |
Functions | |
struct ast_unreal_pvt * | ast_unreal_alloc (size_t size, ao2_destructor_fn destructor, struct ast_format_cap *cap) |
Allocate the base unreal struct for a derivative. More... | |
struct ast_unreal_pvt * | ast_unreal_alloc_stream_topology (size_t size, ao2_destructor_fn destructor, struct ast_stream_topology *topology) |
Allocate the base unreal struct for a derivative. More... | |
int | ast_unreal_answer (struct ast_channel *ast) |
void | ast_unreal_call_setup (struct ast_channel *semi1, struct ast_channel *semi2) |
Setup unreal owner and chan channels before initiating call. More... | |
int | ast_unreal_channel_push_to_bridge (struct ast_channel *ast, struct ast_bridge *bridge, unsigned int flags) |
Push the semi2 unreal channel into a bridge from either member of the unreal pair. More... | |
void | ast_unreal_destructor (void *vdoomed) |
struct ast_unreal_pvt destructor. More... | |
int | ast_unreal_digit_begin (struct ast_channel *ast, char digit) |
int | ast_unreal_digit_end (struct ast_channel *ast, char digit, unsigned int duration) |
int | ast_unreal_fixup (struct ast_channel *oldchan, struct ast_channel *newchan) |
int | ast_unreal_hangup (struct ast_unreal_pvt *p, struct ast_channel *ast) |
Hangup one end (maybe both ends) of an unreal channel derivative. More... | |
int | ast_unreal_indicate (struct ast_channel *ast, int condition, const void *data, size_t datalen) |
void | ast_unreal_lock_all (struct ast_unreal_pvt *p, struct ast_channel **outchan, struct ast_channel **outowner) |
Send an unreal pvt in with no locks held and get all locks. More... | |
struct ast_channel * | ast_unreal_new_channels (struct ast_unreal_pvt *p, const struct ast_channel_tech *tech, int semi1_state, int semi2_state, const char *exten, const char *context, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid) |
Create the semi1 and semi2 unreal channels. More... | |
int | ast_unreal_queryoption (struct ast_channel *ast, int option, void *data, int *datalen) |
struct ast_frame * | ast_unreal_read (struct ast_channel *ast) |
int | ast_unreal_sendhtml (struct ast_channel *ast, int subclass, const char *data, int datalen) |
int | ast_unreal_sendtext (struct ast_channel *ast, const char *text) |
int | ast_unreal_setoption (struct ast_channel *chan, int option, void *data, int datalen) |
int | ast_unreal_write (struct ast_channel *ast, struct ast_frame *f) |
int | ast_unreal_write_stream (struct ast_channel *ast, int stream_num, struct ast_frame *f) |
#define AST_UNREAL_CARETAKER_THREAD (1 << 0) |
The ;2 side launched a PBX, was pushed into a bridge, or was masqueraded into an application.
Definition at line 107 of file core_unreal.h.
Referenced by ast_local_setup_bridge(), ast_local_setup_masquerade(), ast_unreal_channel_push_to_bridge(), ast_unreal_hangup(), conf_announce_channel_push(), local_call(), and local_devicestate().
#define AST_UNREAL_MOH_INTERCEPT (1 << 2) |
Intercept and act on hold/unhold control frames
Definition at line 109 of file core_unreal.h.
Referenced by ast_unreal_indicate(), and local_alloc().
#define AST_UNREAL_NO_OPTIMIZATION (1 << 1) |
Do not optimize out the unreal channels
Definition at line 108 of file core_unreal.h.
Referenced by local_alloc().
#define AST_UNREAL_OPTIMIZE_BEGUN (1 << 3) |
Indicates that an optimization attempt has been started
Definition at line 110 of file core_unreal.h.
struct ast_unreal_pvt* ast_unreal_alloc | ( | size_t | size, |
ao2_destructor_fn | destructor, | ||
struct ast_format_cap * | cap | ||
) |
Allocate the base unreal struct for a derivative.
size | Size of the unreal struct to allocate. |
destructor | Destructor callback. |
cap | Format capabilities to give the unreal private struct. |
NULL | on error. |
Definition at line 1109 of file core_unreal.c.
References ast_stream_topology_create_from_format_cap(), ast_stream_topology_free(), and ast_unreal_alloc_stream_topology().
struct ast_unreal_pvt* ast_unreal_alloc_stream_topology | ( | size_t | size, |
ao2_destructor_fn | destructor, | ||
struct ast_stream_topology * | topology | ||
) |
Allocate the base unreal struct for a derivative.
size | Size of the unreal struct to allocate. |
destructor | Destructor callback. |
topology |
NULL | on error. |
Definition at line 1126 of file core_unreal.c.
References ao2_ref, ast_stream_topology_clone(), ast_stream_topology_get_formats(), ast_jb_conf::flags, ast_unreal_pvt::jb_conf, ast_unreal_pvt::reqcap, and ast_unreal_pvt::reqtopology.
Referenced by ast_unreal_alloc(), and local_alloc().
int ast_unreal_answer | ( | struct ast_channel * | ast | ) |
Unreal channel framework struct ast_channel_tech.answer callback
Definition at line 254 of file core_unreal.c.
References ao2_ref, AST_CONTROL_ANSWER, AST_FRAME_CONTROL, and unreal_queue_frame().
void ast_unreal_call_setup | ( | struct ast_channel * | semi1, |
struct ast_channel * | semi2 | ||
) |
Setup unreal owner and chan channels before initiating call.
semi1 | Owner channel of unreal channel pair. |
semi2 | Outgoing channel of unreal channel pair. |
Definition at line 870 of file core_unreal.c.
References ast_channel_cc_params_init(), ast_channel_datastore_inherit(), ast_channel_get_cc_config_params(), ast_channel_publish_varset(), ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_connected_line_copy_from_caller(), ast_connected_line_copy_to_caller(), AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_party_dialed_copy(), and ast_party_redirecting_copy().
Referenced by local_call().
int ast_unreal_channel_push_to_bridge | ( | struct ast_channel * | ast, |
struct ast_bridge * | bridge, | ||
unsigned int | flags | ||
) |
Push the semi2 unreal channel into a bridge from either member of the unreal pair.
ast | A member of the unreal channel being pushed |
bridge | Which bridge we want to push the channel to |
flags | Feature flags to be set on the bridge channel. |
0 | if the channel is successfully imparted onto the bridge |
-1 | on failure |
Definition at line 928 of file core_unreal.c.
References ao2_ref, ast_bridge_features_new(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_INDEPENDENT, ast_bridge_lock, ast_bridge_unlock, ast_channel_callid_set(), ast_channel_ref, ast_channel_unref, AST_UNREAL_CARETAKER_THREAD, ast_bridge::callid, ast_unreal_pvt::chan, ast_bridge_features::feature_flags, lock, ast_unreal_pvt::owner, RAII_VAR, SCOPED_AO2LOCK, and SCOPED_CHANNELLOCK.
Referenced by ast_ari_bridges_record().
void ast_unreal_destructor | ( | void * | vdoomed | ) |
struct ast_unreal_pvt destructor.
vdoomed | Object to destroy. |
Definition at line 1097 of file core_unreal.c.
References ast_stream_topology_free(), ast_unreal_pvt::chan_old_topology, ast_unreal_pvt::owner_old_topology, ast_unreal_pvt::reqcap, and ast_unreal_pvt::reqtopology.
int ast_unreal_digit_begin | ( | struct ast_channel * | ast, |
char | digit | ||
) |
Unreal channel framework struct ast_channel_tech.send_digit_begin callback
Definition at line 779 of file core_unreal.c.
References ao2_ref, AST_FRAME_DTMF_BEGIN, ast_frame_subclass::integer, ast_frame::subclass, and unreal_queue_frame().
int ast_unreal_digit_end | ( | struct ast_channel * | ast, |
char | digit, | ||
unsigned int | duration | ||
) |
Unreal channel framework struct ast_channel_tech.send_digit_end callback
Definition at line 801 of file core_unreal.c.
References ao2_ref, AST_FRAME_DTMF_END, ast_frame_subclass::integer, ast_frame::len, ast_frame::subclass, and unreal_queue_frame().
int ast_unreal_fixup | ( | struct ast_channel * | oldchan, |
struct ast_channel * | newchan | ||
) |
Unreal channel framework struct ast_channel_tech.fixup callback
Definition at line 369 of file core_unreal.c.
References ast_check_hangup(), ast_queue_hangup(), ast_unreal_pvt::chan, and ast_unreal_pvt::owner.
int ast_unreal_hangup | ( | struct ast_unreal_pvt * | p, |
struct ast_channel * | ast | ||
) |
Hangup one end (maybe both ends) of an unreal channel derivative.
p | Private channel struct (reffed) |
ast | Channel being hung up. (locked) |
0 | on success. |
-1 | on error. |
Definition at line 1018 of file core_unreal.c.
References ao2_ref, ast_channel_unref, ast_debug, ast_hangup(), ast_queue_hangup_with_cause(), AST_UNREAL_CARETAKER_THREAD, ast_unreal_lock_all(), ast_unreal_pvt::chan, ast_unreal_pvt::owner, pbx_builtin_getvar_helper(), and pbx_builtin_setvar_helper().
Referenced by local_hangup().
int ast_unreal_indicate | ( | struct ast_channel * | ast, |
int | condition, | ||
const void * | data, | ||
size_t | datalen | ||
) |
Unreal channel framework struct ast_channel_tech.indicate callback
Definition at line 622 of file core_unreal.c.
References ao2_bump, ao2_ref, ast_channel_get_stream_topology(), ast_channel_is_multistream(), ast_channel_set_stream_topology(), ast_channel_unref, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_HOLD, AST_CONTROL_MASQUERADE_NOTIFY, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE, AST_CONTROL_T38_PARAMETERS, AST_CONTROL_UNHOLD, ast_moh_start(), ast_moh_stop(), AST_STATE_RING, ast_stream_alloc(), ast_stream_topology_alloc(), ast_stream_topology_append_stream(), AST_T38_NEGOTIATED, AST_T38_TERMINATED, ast_unreal_lock_all(), AST_UNREAL_MOH_INTERCEPT, ast_unreal_pvt::chan_old_topology, ast_unreal_pvt::owner_old_topology, and ast_control_t38_parameters::request_response.
void ast_unreal_lock_all | ( | struct ast_unreal_pvt * | p, |
struct ast_channel ** | outchan, | ||
struct ast_channel ** | outowner | ||
) |
Send an unreal pvt in with no locks held and get all locks.
Definition at line 47 of file core_unreal.c.
References ast_channel_lock_both, ast_channel_ref, ast_channel_unref, ast_unreal_pvt::chan, and ast_unreal_pvt::owner.
Referenced by ast_local_lock_all(), ast_unreal_hangup(), ast_unreal_indicate(), local_call(), and stasis_app_channel_unreal_set_internal().
struct ast_channel* ast_unreal_new_channels | ( | struct ast_unreal_pvt * | p, |
const struct ast_channel_tech * | tech, | ||
int | semi1_state, | ||
int | semi2_state, | ||
const char * | exten, | ||
const char * | context, | ||
const struct ast_assigned_ids * | assignedids, | ||
const struct ast_channel * | requestor, | ||
ast_callid | callid | ||
) |
Create the semi1 and semi2 unreal channels.
p | Unreal channel private struct. |
tech | Channel technology to use. |
semi1_state | State to start the semi1(owner) channel in. |
semi2_state | State to start the semi2(outgoing chan) channel in. |
exten | Exten to start the chennels in. (NULL if s) |
context | Context to start the channels in. (NULL if default) |
assignedids | |
requestor | Channel requesting creation. (NULL if none) |
callid | Thread callid to use. |
NULL | on error. |
Definition at line 1160 of file core_unreal.c.
References ao2_ref, ast_alloca, ast_atomic_fetchadd_int(), ast_channel_alloc, ast_channel_callid_set(), ast_channel_cc_params_init(), ast_channel_get_cc_config_params(), ast_channel_is_multistream(), ast_channel_release(), ast_channel_set_stream_topology(), AST_FLAG_DISABLE_DEVSTATE_CACHE, ast_format_cap_get_format(), ast_jb_configure(), ast_stream_get_state(), ast_stream_set_state(), AST_STREAM_STATE_RECVONLY, AST_STREAM_STATE_SENDONLY, ast_stream_topology_clone(), ast_stream_topology_free(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_unreal_pvt::chan, ast_unreal_pvt::jb_conf, ast_unreal_pvt::name, ast_unreal_pvt::owner, RAII_VAR, ast_unreal_pvt::reqcap, and ast_unreal_pvt::reqtopology.
Referenced by local_request_with_stream_topology().
int ast_unreal_queryoption | ( | struct ast_channel * | ast, |
int | option, | ||
void * | data, | ||
int * | datalen | ||
) |
Unreal channel framework struct ast_channel_tech.queryoption callback
Definition at line 166 of file core_unreal.c.
References ast_channel_bridge_peer(), ast_channel_queryoption(), ast_channel_ref, ast_channel_unref, ast_unreal_pvt::chan, and ast_unreal_pvt::owner.
struct ast_frame* ast_unreal_read | ( | struct ast_channel * | ast | ) |
Unreal channel framework struct ast_channel_tech.read and struct ast_channel_tech.exception callback
Definition at line 313 of file core_unreal.c.
References ast_null_frame.
int ast_unreal_sendhtml | ( | struct ast_channel * | ast, |
int | subclass, | ||
const char * | data, | ||
int | datalen | ||
) |
Unreal channel framework struct ast_channel_tech.send_html callback
Definition at line 846 of file core_unreal.c.
References ao2_ref, AST_FRAME_HTML, ast_frame::data, ast_frame::datalen, ast_frame_subclass::integer, ast_frame::subclass, and unreal_queue_frame().
int ast_unreal_sendtext | ( | struct ast_channel * | ast, |
const char * | text | ||
) |
Unreal channel framework struct ast_channel_tech.send_text callback
Definition at line 824 of file core_unreal.c.
References ao2_ref, AST_FRAME_TEXT, ast_frame::data, ast_frame::datalen, and unreal_queue_frame().
int ast_unreal_setoption | ( | struct ast_channel * | chan, |
int | option, | ||
void * | data, | ||
int | datalen | ||
) |
Unreal channel framework struct ast_channel_tech.setoption callback
Definition at line 97 of file core_unreal.c.
References ao2_ref, AST_CHAN_WRITE_INFO_T_VERSION, ast_channel_ref, ast_channel_unref, AST_OPTION_CHANNEL_WRITE, ast_unreal_pvt::chan, ast_channel::data, and ast_unreal_pvt::owner.
int ast_unreal_write | ( | struct ast_channel * | ast, |
struct ast_frame * | f | ||
) |
Unreal channel framework struct ast_channel_tech.write callback
Definition at line 318 of file core_unreal.c.
References ast_unreal_write_stream().
int ast_unreal_write_stream | ( | struct ast_channel * | ast, |
int | stream_num, | ||
struct ast_frame * | f | ||
) |
Unreal channel framework struct ast_channel_tech.write_stream callback
Definition at line 323 of file core_unreal.c.
References ao2_ref, ast_channel_get_default_stream(), AST_CONTROL_VIDUPDATE, AST_FRAME_CONTROL, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::stream_num, ast_frame::subclass, and unreal_queue_frame().
Referenced by ast_unreal_write().