65 if (!owner || !chan) {
78 if (p->
owner != owner || p->
chan != chan) {
112 ast_log(
LOG_ERROR,
"The chan_write_info_t type has changed, and this channel hasn't been updated!\n");
116 info_data = write_info->
data;
117 if (!strcmp(write_info->
function,
"CHANNEL")) {
118 if (!strncasecmp(info_data,
"hangup_handler_", 15)) {
124 if (!strcasecmp(info_data,
"accountcode")) {
125 info_data =
"peeraccount";
126 }
else if (!strcasecmp(info_data,
"peeraccount")) {
127 info_data =
"accountcode";
141 if (!otherchan || otherchan == write_info->
chan) {
145 goto setoption_cleanup;
235 if (us && us_locked) {
246 if (us && us_locked) {
304 if (ast == p->
owner) {
306 }
else if (ast == p->
chan) {
381 if ((p->
owner != oldchan) && (p->
chan != oldchan)) {
386 if (p->
owner == oldchan) {
400 if (bridge_owner && bridge_owner == bridge_chan) {
441 .subclass.integer = condition,
442 .data.ptr = (
void *)
data,
458 ast_debug(4,
"Blocked indication %d\n", condition);
485 unsigned char frame_data[1024];
488 .subclass.integer = condition,
489 .data.ptr = frame_data,
508 this_channel = p->
chan;
509 the_other_channel = p->
owner;
511 this_channel = p->
owner;
512 the_other_channel = p->
chan;
514 if (the_other_channel) {
533 if (the_other_channel) {
568 if (!this_channel_topology) {
573 if (!the_other_channel_topology) {
594 this_channel = p->
chan;
595 the_other_channel = p->
owner;
597 this_channel = p->
owner;
598 the_other_channel = p->
chan;
604 if (the_other_channel) {
1020 int hangup_chan = 0;
1032 if (ast != chan && ast != owner) {
1034 goto unreal_hangup_cleanup;
1039 if (ast == p->
chan) {
1058 ast_debug(2,
"%s has AST_CAUSE_ANSWERED_ELSEWHERE set.\n",
1077unreal_hangup_cleanup:
1187 strcat(uniqueid2,
";2");
1195 if (!chan_topology) {
1220 exten,
context, &id1, requestor, 0,
1221 "%s/%s-%08x;1", tech->
type, p->
name, (
unsigned)generated_seqno);
1275 exten,
context, &id2, owner, 0,
1276 "%s/%s-%08x;2", tech->
type, p->
name, (
unsigned)generated_seqno);
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
Configures a jitterbuffer on a channel.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
void(* ao2_destructor_fn)(void *vdoomed)
Typedef for an object destructor.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
#define ao2_alloc(data_size, destructor_fn)
#define ast_bridge_unlock(bridge)
Unlock the bridge.
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, enum ast_bridge_impart_flags flags) attribute_warn_unused_result
Impart a channel to a bridge (non-blocking)
#define ast_bridge_lock(bridge)
Lock the bridge.
@ AST_BRIDGE_IMPART_CHAN_INDEPENDENT
int ast_bridge_unreal_optimize_out(struct ast_channel *chan, struct ast_channel *peer, struct ast_unreal_pvt *pvt)
Check and optimize out the unreal channels between bridges.
struct ast_bridge_features * ast_bridge_features_new(void)
Allocate a new bridge features struct.
Internal Asterisk hangup causes.
#define AST_CAUSE_ANSWERED_ELSEWHERE
static int answer(void *data)
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_bridge * ast_channel_internal_bridge(const struct ast_channel *chan)
struct ast_stream_topology * ast_channel_set_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology)
Set the topology of streams on a channel.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
struct varshead * ast_channel_varshead(struct ast_channel *chan)
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
int ast_queue_hangup(struct ast_channel *chan)
Queue a hangup frame.
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
const char * ast_channel_musicclass(const struct ast_channel *chan)
#define ast_channel_lock(chan)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
int ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block)
Checks the value of an option.
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
int ast_channel_cc_params_init(struct ast_channel *chan, const struct ast_cc_config_params *base_params)
Set up datastore with CCSS parameters for a channel.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define ast_channel_ref(c)
Increase channel reference count.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
ast_callid ast_channel_callid(const struct ast_channel *chan)
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
const char * ast_channel_accountcode(const struct ast_channel *chan)
const char * ast_channel_parkinglot(const struct ast_channel *chan)
const char * ast_channel_peeraccount(const struct ast_channel *chan)
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
void ast_party_dialed_copy(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
Copy the source dialed party information to the destination dialed party.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
int ast_redirecting_build_data(unsigned char *data, size_t datalen, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Build the redirecting id data frame.
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
int ast_connected_line_build_data(unsigned char *data, size_t datalen, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Build the connected line information data frame.
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_stream * ast_channel_get_default_stream(struct ast_channel *chan, enum ast_media_type type)
Retrieve the default stream of a specific media type on a channel.
int ast_channel_stream_topology_changed_externally(struct ast_channel *chan)
Provide notice from a channel that the topology has changed on it as a result of the remote party ren...
struct ast_generator * ast_channel_generator(const struct ast_channel *chan)
const char * ast_channel_language(const struct ast_channel *chan)
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.
@ AST_FLAG_DISABLE_DEVSTATE_CACHE
#define AST_CHAN_WRITE_INFO_T_VERSION
ast_chan_write_info_t version. Must be incremented if structure is changed
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid value)
void ast_connected_line_copy_to_caller(struct ast_party_caller *dest, const struct ast_party_connected_line *src)
Copy the connected line information to the caller information.
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
int ast_channel_is_multistream(struct ast_channel *chan)
Determine if a channel is multi-stream capable.
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
struct ast_cc_config_params * ast_channel_get_cc_config_params(struct ast_channel *chan)
Get the CCSS parameters from a channel.
#define ast_channel_unlock(chan)
void ast_party_redirecting_copy(struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
Copy the source redirecting information to the destination redirecting.
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
ast_channel_state
ast_channel states
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
#define ast_var_assign(name, value)
const char * ast_var_full_name(const struct ast_var_t *var)
const char * ast_var_value(const struct ast_var_t *var)
int ast_unreal_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
int ast_unreal_setoption(struct ast_channel *ast, int option, void *data, int datalen)
static int unreal_colp_redirect_indicate(struct ast_unreal_pvt *p, struct ast_channel *ast, int condition)
int ast_unreal_queryoption(struct ast_channel *ast, int option, void *data, int *datalen)
int ast_unreal_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
int ast_unreal_digit_begin(struct ast_channel *ast, char digit)
int ast_unreal_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen)
void ast_unreal_call_setup(struct ast_channel *semi1, struct ast_channel *semi2)
Setup unreal owner and chan channels before initiating call.
void ast_unreal_destructor(void *vdoomed)
struct ast_unreal_pvt destructor.
int ast_unreal_hangup(struct ast_unreal_pvt *p, struct ast_channel *ast)
Hangup one end (maybe both ends) of an unreal channel derivative.
static int unreal_queue_indicate(struct ast_unreal_pvt *p, struct ast_channel *ast, int condition, const void *data, size_t datalen)
static unsigned int name_sequence
int ast_unreal_write(struct ast_channel *ast, struct ast_frame *f)
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.
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.
int ast_unreal_indicate(struct ast_channel *ast, int condition, const void *data, size_t datalen)
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.
int ast_unreal_sendtext(struct ast_channel *ast, const char *text)
static int got_optimized_out(struct ast_channel *ast, struct ast_unreal_pvt *p)
static int unreal_queue_frame(struct ast_unreal_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us, int us_locked)
queue a frame onto either the p->owner or p->chan
int ast_unreal_answer(struct ast_channel *ast)
int ast_unreal_write_stream(struct ast_channel *ast, int stream_num, struct ast_frame *f)
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.
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.
static int unreal_colp_stream_topology_request_change(struct ast_unreal_pvt *p, struct ast_channel *ast, const struct ast_stream_topology *topology)
struct ast_frame * ast_unreal_read(struct ast_channel *ast)
Unreal channel derivative framework.
#define AST_UNREAL_IS_OUTBOUND(a, b)
#define AST_UNREAL_MOH_INTERCEPT
#define AST_UNREAL_NO_OPTIMIZATION
#define AST_UNREAL_CARETAKER_THREAD
void ast_channel_publish_varset(struct ast_channel *chan, const char *variable, const char *value)
Publish a ast_channel_publish_varset for a channel.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
#define AST_OPTION_CHANNEL_WRITE
Handle channel write data If a channel needs to process the data from a func_channel write operation ...
#define AST_OPTION_T38_STATE
@ AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE
@ AST_CONTROL_REDIRECTING
@ AST_CONTROL_T38_PARAMETERS
@ AST_CONTROL_STREAM_TOPOLOGY_CHANGED
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_MASQUERADE_NOTIFY
@ AST_CONTROL_PVT_CAUSE_CODE
struct ast_frame ast_null_frame
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
Core PBX routines and definitions.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
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.
struct ast_stream_topology * ast_stream_topology_alloc(void)
Create a stream topology.
struct ast_stream * ast_stream_alloc(const char *name, enum ast_media_type type)
Create a new media stream representation.
@ AST_STREAM_STATE_RECVONLY
Set when the stream is receiving media only.
@ AST_STREAM_STATE_SENDONLY
Set when the stream is sending media only.
void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state)
Set the state of a stream.
int ast_stream_topology_append_stream(struct ast_stream_topology *topology, struct ast_stream *stream)
Append a stream to the topology.
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream)
Get the current state of a stream.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
struct ast_stream_topology * ast_stream_topology_create_from_format_cap(struct ast_format_cap *cap)
A helper function that, given a format capabilities structure, creates a topology and separates the m...
struct ast_format_cap * ast_stream_topology_get_formats(struct ast_stream_topology *topology)
Create a format capabilities structure representing the topology.
struct ast_stream_topology * ast_stream_topology_clone(const struct ast_stream_topology *topology)
Create a deep clone of an existing stream topology.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Structure to pass both assignedid values to channel drivers.
Structure that contains features information.
struct ast_flags feature_flags
Structure that contains information about a bridge.
Structure to handle passing func_channel_write info to channels via setoption.
ast_acf_write_fn_t write_fn
struct ast_channel * chan
Structure to describe a channel "technology", ie a channel driver See for examples:
Main Channel structure associated with a channel.
struct ast_filestream * stream
struct ast_bridge * bridge
char exten[AST_MAX_EXTENSION]
const struct ast_channel_tech * tech
enum ast_control_t38 request_response
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
General jitterbuffer configuration.
The base pvt structure for local channel derivatives.
struct ast_jb_conf jb_conf
struct ast_stream_topology * chan_old_topology
struct ast_format_cap * reqcap
struct ast_channel * chan
char name[AST_MAX_EXTENSION+AST_MAX_CONTEXT+2]
struct ast_channel * owner
struct ast_stream_topology * owner_old_topology
struct ast_stream_topology * reqtopology
struct ast_var_t::@211 entries
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_clear_flag(p, flag)
#define ast_set_flag(p, flag)