Asterisk - The Open Source Telephony Project
18.5.0
|
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().
Definition at line 105 of file core_unreal.h.
Referenced by ast_unreal_answer(), ast_unreal_digit_begin(), ast_unreal_digit_end(), ast_unreal_queryoption(), ast_unreal_sendhtml(), ast_unreal_sendtext(), ast_unreal_write_stream(), unreal_colp_redirect_indicate(), unreal_colp_stream_topology_request_change(), and unreal_queue_indicate().
#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 announce_request(), got_optimized_out(), local_alloc(), manager_optimize_away(), media_request_helper(), publish_local_bridge_message(), and unreal_queue_indicate().
#define AST_UNREAL_OPTIMIZE_BEGUN (1 << 3) |
Indicates that an optimization attempt has been started
Definition at line 110 of file core_unreal.h.
Referenced by try_merge_optimize_out(), and try_swap_optimize_out().
Enumerator | |
---|---|
AST_UNREAL_OWNER | |
AST_UNREAL_CHAN |
Definition at line 49 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. |
pvt | on success. |
NULL | on error. |
Definition at line 1111 of file core_unreal.c.
References ast_stream_topology_create_from_format_cap(), ast_stream_topology_free(), ast_unreal_alloc_stream_topology(), and NULL.
Referenced by announce_request(), and media_request_helper().
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. |
cap | Format capabilities to give the unreal private struct. |
pvt | on success. |
NULL | on error. |
Definition at line 1128 of file core_unreal.c.
References ao2_alloc, ao2_ref, ast_stream_topology_clone(), ast_stream_topology_get_formats(), ast_jb_conf::flags, ast_unreal_pvt::jb_conf, NULL, 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_lock, ao2_ref, ao2_unlock, ast_channel_name(), ast_channel_tech_pvt(), AST_CONTROL_ANSWER, AST_FRAME_CONTROL, ast_log, AST_UNREAL_IS_OUTBOUND, LOG_WARNING, 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_CAUSE_ANSWERED_ELSEWHERE, ast_channel_accountcode(), ast_channel_caller(), ast_channel_cc_params_init(), ast_channel_connected(), ast_channel_datastore_inherit(), ast_channel_dialed(), ast_channel_get_cc_config_params(), ast_channel_hangupcause(), ast_channel_hangupcause_set(), ast_channel_language(), ast_channel_musicclass(), ast_channel_parkinglot(), ast_channel_peeraccount(), ast_channel_publish_varset(), ast_channel_redirecting(), ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_varshead(), ast_connected_line_copy_from_caller(), ast_connected_line_copy_to_caller(), AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_party_dialed_copy(), ast_party_redirecting_copy(), ast_var_assign, ast_var_full_name(), ast_var_value(), ast_var_t::entries, ast_var_t::name, and ast_var_t::value.
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_cleanup, ao2_lock, ao2_ref, ao2_unlock, ast_bridge_features_new(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_INDEPENDENT, ast_bridge_lock, ast_bridge_unlock, ast_channel_callid(), ast_channel_callid_set(), ast_channel_lock, ast_channel_ref, ast_channel_tech_pvt(), ast_channel_unlock, ast_channel_unref, ast_set_flag, AST_UNREAL_CARETAKER_THREAD, ast_bridge::callid, ast_bridge_features::feature_flags, lock, NULL, RAII_VAR, SCOPED_AO2LOCK, and SCOPED_CHANNELLOCK.
Referenced by ari_bridges_play_new(), ast_ari_bridges_record(), and bridge_moh_create().
void ast_unreal_destructor | ( | void * | vdoomed | ) |
struct ast_unreal_pvt destructor.
vdoomed | Object to destroy. |
Definition at line 1099 of file core_unreal.c.
References ao2_cleanup, ast_stream_topology_free(), ast_unreal_pvt::chan_old_topology, NULL, ast_unreal_pvt::owner_old_topology, ast_unreal_pvt::reqcap, and ast_unreal_pvt::reqtopology.
Referenced by announce_pvt_destructor(), local_pvt_destructor(), and media_request_helper().
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_lock, ao2_ref, ao2_unlock, ast_channel_tech_pvt(), AST_FRAME_DTMF_BEGIN, AST_UNREAL_IS_OUTBOUND, digit, 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_lock, ao2_ref, ao2_unlock, ast_channel_tech_pvt(), AST_FRAME_DTMF_END, AST_UNREAL_IS_OUTBOUND, digit, 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 ao2_lock, ao2_unlock, ast_channel_internal_bridge(), ast_channel_name(), ast_channel_tech_pvt(), ast_check_hangup(), ast_log, ast_queue_hangup(), ast_unreal_pvt::chan, LOG_WARNING, 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, ao2_unlock, AST_CAUSE_ANSWERED_ELSEWHERE, ast_channel_hangupcause(), ast_channel_hangupcause_set(), ast_channel_lock, ast_channel_name(), ast_channel_tech_pvt_set(), ast_channel_unlock, ast_channel_unref, ast_clear_flag, ast_debug, ast_hangup(), ast_log, ast_queue_hangup_with_cause(), ast_test_flag, AST_UNREAL_CARETAKER_THREAD, ast_unreal_lock_all(), ast_unreal_pvt::chan, hangup_chan(), LOG_WARNING, NULL, ast_unreal_pvt::owner, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), and status.
Referenced by announce_hangup(), local_hangup(), and media_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, ao2_unlock, ast_channel_get_stream_topology(), ast_channel_is_multistream(), ast_channel_lock, ast_channel_set_stream_topology(), ast_channel_tech_pvt(), ast_channel_unlock, 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_free, ast_log, AST_MEDIA_TYPE_IMAGE, 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_test_flag, ast_unreal_lock_all(), AST_UNREAL_MOH_INTERCEPT, ast_unreal_pvt::chan_old_topology, LOG_ERROR, NULL, ast_unreal_pvt::owner_old_topology, ast_control_t38_parameters::request_response, unreal_colp_redirect_indicate(), unreal_colp_stream_topology_request_change(), and unreal_queue_indicate().
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 ao2_lock, ao2_unlock, ast_channel_lock, ast_channel_lock_both, ast_channel_ref, ast_channel_unlock, ast_channel_unref, ast_unreal_pvt::chan, NULL, and ast_unreal_pvt::owner.
Referenced by ast_local_lock_all(), ast_unreal_hangup(), ast_unreal_indicate(), local_call(), publish_local_bridge_message(), stasis_app_channel_unreal_set_internal(), unreal_colp_redirect_indicate(), and unreal_colp_stream_topology_request_change().
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) |
requestor | Channel requesting creation. (NULL if none) |
callid | Thread callid to use. |
semi1_channel | on success. |
NULL | on error. |
Definition at line 1162 of file core_unreal.c.
References ao2_cleanup, ao2_ref, ast_alloca, ast_atomic_fetchadd_int(), ast_channel_alloc, ast_channel_callid_set(), ast_channel_cc_params_init(), ast_channel_flags(), ast_channel_get_cc_config_params(), ast_channel_is_multistream(), ast_channel_nativeformats_set(), ast_channel_release(), ast_channel_set_rawreadformat(), ast_channel_set_rawwriteformat(), ast_channel_set_readformat(), ast_channel_set_stream_topology(), ast_channel_set_writeformat(), ast_channel_tech_pvt_set(), ast_channel_tech_set(), ast_channel_unlock, AST_FLAG_DISABLE_DEVSTATE_CACHE, ast_format_cap_get_format(), ast_jb_configure(), ast_log, ast_set_flag, ast_stream_topology_clone(), ast_stream_topology_free(), ast_strlen_zero, ast_unreal_pvt::chan, ast_unreal_pvt::jb_conf, LOG_WARNING, ast_unreal_pvt::name, name_sequence, NULL, ast_unreal_pvt::owner, RAII_VAR, ast_unreal_pvt::reqcap, ast_unreal_pvt::reqtopology, ast_channel_tech::type, ast_assigned_ids::uniqueid, and ast_assigned_ids::uniqueid2.
Referenced by announce_request(), local_request_with_stream_topology(), and media_request_helper().
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 ao2_lock, ao2_unlock, ast_channel_bridge_peer(), ast_channel_lock, ast_channel_queryoption(), ast_channel_ref, ast_channel_tech_pvt(), ast_channel_unlock, ast_channel_unref, AST_OPTION_T38_STATE, AST_UNREAL_IS_OUTBOUND, 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_lock, ao2_ref, ao2_unlock, ast_channel_tech_pvt(), AST_FRAME_HTML, AST_UNREAL_IS_OUTBOUND, ast_frame::data, ast_frame::datalen, ast_frame_subclass::integer, ast_frame::ptr, 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_lock, ao2_ref, ao2_unlock, ast_channel_tech_pvt(), AST_FRAME_TEXT, AST_UNREAL_IS_OUTBOUND, ast_frame::data, ast_frame::datalen, ast_frame::ptr, 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_lock, ao2_ref, ao2_unlock, AST_CHAN_WRITE_INFO_T_VERSION, ast_channel_lock, ast_channel_ref, ast_channel_tech_pvt(), ast_channel_unlock, ast_channel_unref, ast_log, AST_OPTION_CHANNEL_WRITE, ast_unreal_pvt::chan, ast_chan_write_info_t::chan, ast_channel::data, ast_chan_write_info_t::data, ast_chan_write_info_t::function, if(), LOG_ERROR, NULL, ast_unreal_pvt::owner, ast_chan_write_info_t::value, ast_chan_write_info_t::version, and ast_chan_write_info_t::write_fn.
Referenced by local_setoption().
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_lock, ao2_ref, ao2_unlock, ast_channel_get_default_stream(), ast_channel_tech_pvt(), AST_CONTROL_VIDUPDATE, AST_FRAME_CONTROL, AST_FRAME_VIDEO, AST_FRAME_VOICE, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_VIDEO, AST_UNREAL_IS_OUTBOUND, ast_frame::frametype, got_optimized_out(), ast_frame_subclass::integer, ast_frame::stream_num, ast_frame::subclass, and unreal_queue_frame().
Referenced by ast_unreal_write().