Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Macros | Functions | Variables
channel_internal_api.c File Reference

Channel Accessor API. More...

#include "asterisk.h"
#include <unistd.h>
#include <fcntl.h>
#include "asterisk/alertpipe.h"
#include "asterisk/paths.h"
#include "asterisk/channel.h"
#include "asterisk/channel_internal.h"
#include "asterisk/endpoints.h"
#include "asterisk/indications.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_endpoints.h"
#include "asterisk/stringfields.h"
#include "asterisk/stream.h"
#include "asterisk/test.h"
#include "asterisk/vector.h"

Go to the source code of this file.

Data Structures

struct  ast_channel
 Main Channel structure associated with a channel. More...
 
struct  ast_channel_id
 Channel UniqueId structure. More...
 

Macros

#define DEFINE_STRINGFIELD_GETTER_FOR(field)
 
#define DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR(field, publish, assert_on_null, invalidate)
 
#define DEFINE_STRINGFIELD_SETTERS_FOR(field, assert_on_null)
 
#define DIALED_CAUSES_BUCKETS   37
 

Functions

struct ast_channel__ast_channel_internal_alloc (void(*destructor)(void *obj), const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *file, int line, const char *function)
 
static void __init_channel_errno (void)
 
enum ast_channel_adsicpe ast_channel_adsicpe (const struct ast_channel *chan)
 
void ast_channel_adsicpe_set (struct ast_channel *chan, enum ast_channel_adsicpe value)
 
int ast_channel_alert_writable (struct ast_channel *chan)
 
int ast_channel_alert_write (struct ast_channel *chan)
 
enum ama_flags ast_channel_amaflags (const struct ast_channel *chan)
 
void ast_channel_amaflags_set (struct ast_channel *chan, enum ama_flags value)
 
struct timeval ast_channel_answertime (struct ast_channel *chan)
 
void ast_channel_answertime_set (struct ast_channel *chan, struct timeval *value)
 
const char * ast_channel_appl (const struct ast_channel *chan)
 
void ast_channel_appl_set (struct ast_channel *chan, const char *value)
 
struct ast_audiohook_listast_channel_audiohooks (const struct ast_channel *chan)
 
void ast_channel_audiohooks_set (struct ast_channel *chan, struct ast_audiohook_list *value)
 
struct ast_autochan_listast_channel_autochans (struct ast_channel *chan)
 
pthread_t ast_channel_blocker (const struct ast_channel *chan)
 
void ast_channel_blocker_set (struct ast_channel *chan, pthread_t value)
 
int ast_channel_blocker_tid (const struct ast_channel *chan)
 
void ast_channel_blocker_tid_set (struct ast_channel *chan, int value)
 
const char * ast_channel_blockproc (const struct ast_channel *chan)
 
void ast_channel_blockproc_set (struct ast_channel *chan, const char *value)
 
struct ast_party_callerast_channel_caller (struct ast_channel *chan)
 
void ast_channel_caller_set (struct ast_channel *chan, struct ast_party_caller *value)
 
ast_group_t ast_channel_callgroup (const struct ast_channel *chan)
 
void ast_channel_callgroup_set (struct ast_channel *chan, ast_group_t value)
 
ast_callid ast_channel_callid (const struct ast_channel *chan)
 
void ast_channel_callid_cleanup (struct ast_channel *chan)
 
void ast_channel_callid_set (struct ast_channel *chan, ast_callid callid)
 
struct ast_cdrast_channel_cdr (const struct ast_channel *chan)
 
void ast_channel_cdr_set (struct ast_channel *chan, struct ast_cdr *value)
 
struct ast_party_connected_lineast_channel_connected (struct ast_channel *chan)
 
struct ast_party_id ast_channel_connected_effective_id (struct ast_channel *chan)
 
struct ast_party_connected_lineast_channel_connected_indicated (struct ast_channel *chan)
 
void ast_channel_connected_set (struct ast_channel *chan, struct ast_party_connected_line *value)
 
const char * ast_channel_context (const struct ast_channel *chan)
 
void ast_channel_context_set (struct ast_channel *chan, const char *value)
 
struct timeval ast_channel_creationtime (struct ast_channel *chan)
 
void ast_channel_creationtime_set (struct ast_channel *chan, struct timeval *value)
 
const char * ast_channel_data (const struct ast_channel *chan)
 
void ast_channel_data_set (struct ast_channel *chan, const char *value)
 
struct ast_datastore_listast_channel_datastores (struct ast_channel *chan)
 
struct ast_party_dialedast_channel_dialed (struct ast_channel *chan)
 
int ast_channel_dialed_causes_add (const struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
 Add cause code information to the channel. More...
 
struct ast_strast_channel_dialed_causes_channels (const struct ast_channel *chan)
 Retrieve a comma-separated list of channels for which dialed cause information is available. More...
 
void ast_channel_dialed_causes_clear (const struct ast_channel *chan)
 Clear all cause information from the channel. More...
 
struct ast_control_pvt_cause_codeast_channel_dialed_causes_find (const struct ast_channel *chan, const char *chan_name)
 Retrieve a ref-counted cause code information structure. More...
 
void ast_channel_dialed_set (struct ast_channel *chan, struct ast_party_dialed *value)
 
char ast_channel_dtmf_digit_to_emulate (const struct ast_channel *chan)
 
void ast_channel_dtmf_digit_to_emulate_set (struct ast_channel *chan, char value)
 
struct timeval * ast_channel_dtmf_tv (struct ast_channel *chan)
 
void ast_channel_dtmf_tv_set (struct ast_channel *chan, struct timeval *value)
 
struct ast_frameast_channel_dtmff (struct ast_channel *chan)
 
void ast_channel_dtmff_set (struct ast_channel *chan, struct ast_frame *value)
 
unsigned int ast_channel_emulate_dtmf_duration (const struct ast_channel *chan)
 
void ast_channel_emulate_dtmf_duration_set (struct ast_channel *chan, unsigned int value)
 
const char * ast_channel_exten (const struct ast_channel *chan)
 
void ast_channel_exten_set (struct ast_channel *chan, const char *value)
 
int ast_channel_fd (const struct ast_channel *chan, int which)
 
int ast_channel_fd_add (struct ast_channel *chan, int value)
 Add a file descriptor to the channel without a fixed position. More...
 
int ast_channel_fd_count (const struct ast_channel *chan)
 Retrieve the number of file decriptor positions present on the channel. More...
 
int ast_channel_fd_isset (const struct ast_channel *chan, int which)
 
int ast_channel_fdno (const struct ast_channel *chan)
 
void ast_channel_fdno_set (struct ast_channel *chan, int value)
 
unsigned int ast_channel_fin (const struct ast_channel *chan)
 
void ast_channel_fin_set (struct ast_channel *chan, unsigned int value)
 
struct ast_flagsast_channel_flags (struct ast_channel *chan)
 
int ast_channel_forward_endpoint (struct ast_channel *chan, struct ast_endpoint *endpoint)
 Forward channel stasis messages to the given endpoint. More...
 
unsigned int ast_channel_fout (const struct ast_channel *chan)
 
void ast_channel_fout_set (struct ast_channel *chan, unsigned int value)
 
struct ast_framehook_listast_channel_framehooks (const struct ast_channel *chan)
 
void ast_channel_framehooks_set (struct ast_channel *chan, struct ast_framehook_list *value)
 
struct ast_generatorast_channel_generator (const struct ast_channel *chan)
 
void ast_channel_generator_set (struct ast_channel *chan, struct ast_generator *value)
 
void * ast_channel_generatordata (const struct ast_channel *chan)
 
void ast_channel_generatordata_set (struct ast_channel *chan, void *value)
 
struct ast_streamast_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. More...
 
struct ast_stream_topologyast_channel_get_stream_topology (const struct ast_channel *chan)
 Retrieve the topology of streams on a channel. More...
 
void * ast_channel_get_stream_topology_change_source (struct ast_channel *chan)
 Retrieve the source that initiated the last stream topology change. More...
 
struct ast_hangup_handler_listast_channel_hangup_handlers (struct ast_channel *chan)
 
int ast_channel_hangupcause (const struct ast_channel *chan)
 
void ast_channel_hangupcause_set (struct ast_channel *chan, int value)
 
int ast_channel_hold_state (const struct ast_channel *chan)
 
void ast_channel_hold_state_set (struct ast_channel *chan, int value)
 
unsigned long ast_channel_insmpl (const struct ast_channel *chan)
 
void ast_channel_insmpl_set (struct ast_channel *chan, unsigned long value)
 
ast_alert_status_t ast_channel_internal_alert_flush (struct ast_channel *chan)
 
ast_alert_status_t ast_channel_internal_alert_read (struct ast_channel *chan)
 
int ast_channel_internal_alert_readable (struct ast_channel *chan)
 
int ast_channel_internal_alert_readfd (struct ast_channel *chan)
 
void ast_channel_internal_alertpipe_clear (struct ast_channel *chan)
 
void ast_channel_internal_alertpipe_close (struct ast_channel *chan)
 
int ast_channel_internal_alertpipe_init (struct ast_channel *chan)
 
void ast_channel_internal_alertpipe_swap (struct ast_channel *chan1, struct ast_channel *chan2)
 Swap the interal alertpipe between two channels. More...
 
struct ast_bridgeast_channel_internal_bridge (const struct ast_channel *chan)
 
struct ast_bridge_channelast_channel_internal_bridge_channel (const struct ast_channel *chan)
 
void ast_channel_internal_bridge_channel_set (struct ast_channel *chan, struct ast_bridge_channel *value)
 
void ast_channel_internal_bridge_set (struct ast_channel *chan, struct ast_bridge *value)
 
void ast_channel_internal_cleanup (struct ast_channel *chan)
 
void ast_channel_internal_copy_linkedid (struct ast_channel *dest, struct ast_channel *source)
 Copy the full linkedid channel id structure from one channel to another. More...
 
enum ast_channel_error ast_channel_internal_errno (void)
 
void ast_channel_internal_errno_set (enum ast_channel_error error)
 
void ast_channel_internal_fd_clear (struct ast_channel *chan, int which)
 
void ast_channel_internal_fd_clear_all (struct ast_channel *chan)
 
void ast_channel_internal_fd_set (struct ast_channel *chan, int which, int value)
 
void ast_channel_internal_finalize (struct ast_channel *chan)
 
int ast_channel_internal_is_finalized (struct ast_channel *chan)
 
struct ast_channelast_channel_internal_oldest_linkedid (struct ast_channel *a, struct ast_channel *b)
 Determine which channel has an older linkedid. More...
 
void ast_channel_internal_set_fake_ids (struct ast_channel *chan, const char *uniqueid, const char *linkedid)
 Set uniqueid and linkedid string value only (not time) More...
 
void ast_channel_internal_set_stream_topology (struct ast_channel *chan, struct ast_stream_topology *topology)
 
void ast_channel_internal_set_stream_topology_change_source (struct ast_channel *chan, void *change_source)
 
int ast_channel_internal_setup_topics (struct ast_channel *chan)
 
void ast_channel_internal_swap_endpoint_forward (struct ast_channel *a, struct ast_channel *b)
 Swap endpoint_forward between two channels. More...
 
void ast_channel_internal_swap_snapshots (struct ast_channel *a, struct ast_channel *b)
 Swap snapshots beteween two channels. More...
 
void ast_channel_internal_swap_stream_topology (struct ast_channel *chan1, struct ast_channel *chan2)
 
void ast_channel_internal_swap_topics (struct ast_channel *a, struct ast_channel *b)
 Swap topics beteween two channels. More...
 
void ast_channel_internal_swap_uniqueid_and_linkedid (struct ast_channel *a, struct ast_channel *b)
 Swap uniqueid and linkedid beteween two channels. More...
 
int ast_channel_is_multistream (struct ast_channel *chan)
 Determine if a channel is multi-stream capable. More...
 
int ast_channel_is_t38_active (struct ast_channel *chan)
 This function will check if T.38 is active on the channel. More...
 
int ast_channel_is_t38_active_nolock (struct ast_channel *chan)
 ast_channel_is_t38_active variant. Use this if the channel is already locked prior to calling. More...
 
struct ast_jbast_channel_jb (struct ast_channel *chan)
 
void ast_channel_jb_set (struct ast_channel *chan, struct ast_jb *value)
 
const char * ast_channel_lastcontext (const struct ast_channel *chan)
 
const char * ast_channel_lastexten (const struct ast_channel *chan)
 
const char * ast_channel_linkedid (const struct ast_channel *chan)
 
struct ast_channelast_channel_masq (const struct ast_channel *chan)
 
void ast_channel_masq_set (struct ast_channel *chan, struct ast_channel *value)
 
struct ast_channelast_channel_masqr (const struct ast_channel *chan)
 
void ast_channel_masqr_set (struct ast_channel *chan, struct ast_channel *value)
 
void * ast_channel_music_state (const struct ast_channel *chan)
 
void ast_channel_music_state_set (struct ast_channel *chan, void *value)
 
struct ast_namedgroups * ast_channel_named_callgroups (const struct ast_channel *chan)
 
void ast_channel_named_callgroups_set (struct ast_channel *chan, struct ast_namedgroups *value)
 
struct ast_namedgroups * ast_channel_named_pickupgroups (const struct ast_channel *chan)
 
void ast_channel_named_pickupgroups_set (struct ast_channel *chan, struct ast_namedgroups *value)
 
struct ast_format_capast_channel_nativeformats (const struct ast_channel *chan)
 
void ast_channel_nativeformats_set (struct ast_channel *chan, struct ast_format_cap *value)
 
struct ast_formatast_channel_oldwriteformat (struct ast_channel *chan)
 
unsigned long ast_channel_outsmpl (const struct ast_channel *chan)
 
void ast_channel_outsmpl_set (struct ast_channel *chan, unsigned long value)
 
struct ast_pbxast_channel_pbx (const struct ast_channel *chan)
 
void ast_channel_pbx_set (struct ast_channel *chan, struct ast_pbx *value)
 
ast_group_t ast_channel_pickupgroup (const struct ast_channel *chan)
 
void ast_channel_pickupgroup_set (struct ast_channel *chan, ast_group_t value)
 
int ast_channel_priority (const struct ast_channel *chan)
 
void ast_channel_priority_set (struct ast_channel *chan, int value)
 
struct ast_formatast_channel_rawreadformat (struct ast_channel *chan)
 
struct ast_formatast_channel_rawwriteformat (struct ast_channel *chan)
 
struct ast_formatast_channel_readformat (struct ast_channel *chan)
 
struct ast_readq_listast_channel_readq (struct ast_channel *chan)
 
struct ast_trans_pvtast_channel_readtrans (const struct ast_channel *chan)
 
void ast_channel_readtrans_set (struct ast_channel *chan, struct ast_trans_pvt *value)
 
struct ast_party_redirectingast_channel_redirecting (struct ast_channel *chan)
 
struct ast_party_id ast_channel_redirecting_effective_from (struct ast_channel *chan)
 
struct ast_party_id ast_channel_redirecting_effective_orig (struct ast_channel *chan)
 
struct ast_party_id ast_channel_redirecting_effective_to (struct ast_channel *chan)
 
void ast_channel_redirecting_set (struct ast_channel *chan, struct ast_party_redirecting *value)
 
int ast_channel_rings (const struct ast_channel *chan)
 
void ast_channel_rings_set (struct ast_channel *chan, int value)
 
struct ast_sched_contextast_channel_sched (const struct ast_channel *chan)
 
void ast_channel_sched_set (struct ast_channel *chan, struct ast_sched_context *value)
 
char ast_channel_sending_dtmf_digit (const struct ast_channel *chan)
 
void ast_channel_sending_dtmf_digit_set (struct ast_channel *chan, char value)
 
struct timeval ast_channel_sending_dtmf_tv (const struct ast_channel *chan)
 
void ast_channel_sending_dtmf_tv_set (struct ast_channel *chan, struct timeval value)
 
void ast_channel_set_is_t38_active (struct ast_channel *chan, int is_t38_active)
 Sets the is_t38_active flag. More...
 
void ast_channel_set_is_t38_active_nolock (struct ast_channel *chan, int is_t38_active)
 Variant of ast_channel_set_is_t38_active. Use this if the channel is already locked prior to calling. More...
 
void ast_channel_set_oldwriteformat (struct ast_channel *chan, struct ast_format *format)
 
void ast_channel_set_rawreadformat (struct ast_channel *chan, struct ast_format *format)
 
void ast_channel_set_rawwriteformat (struct ast_channel *chan, struct ast_format *format)
 
void ast_channel_set_readformat (struct ast_channel *chan, struct ast_format *format)
 
struct ast_stream_topologyast_channel_set_stream_topology (struct ast_channel *chan, struct ast_stream_topology *topology)
 Set the topology of streams on a channel. More...
 
void ast_channel_set_unbridged (struct ast_channel *chan, int value)
 Sets the unbridged flag and queues a NULL frame on the channel to trigger a check by bridge_channel_wait. More...
 
void ast_channel_set_unbridged_nolock (struct ast_channel *chan, int value)
 Variant of ast_channel_set_unbridged. Use this if the channel is already locked prior to calling. More...
 
void ast_channel_set_writeformat (struct ast_channel *chan, struct ast_format *format)
 
struct ast_channel_snapshotast_channel_snapshot (const struct ast_channel *chan)
 
struct ast_flagsast_channel_snapshot_segment_flags (struct ast_channel *chan)
 
void ast_channel_snapshot_set (struct ast_channel *chan, struct ast_channel_snapshot *snapshot)
 
int ast_channel_softhangup_internal_flag (struct ast_channel *chan)
 
void ast_channel_softhangup_internal_flag_add (struct ast_channel *chan, int value)
 
void ast_channel_softhangup_internal_flag_clear (struct ast_channel *chan, int value)
 
void ast_channel_softhangup_internal_flag_set (struct ast_channel *chan, int value)
 
enum ast_channel_state ast_channel_state (const struct ast_channel *chan)
 
void ast_channel_state_set (struct ast_channel *chan, enum ast_channel_state value)
 
struct ast_filestreamast_channel_stream (const struct ast_channel *chan)
 
void ast_channel_stream_set (struct ast_channel *chan, struct ast_filestream *value)
 
int ast_channel_streamid (const struct ast_channel *chan)
 
void ast_channel_streamid_set (struct ast_channel *chan, int value)
 
const struct ast_channel_techast_channel_tech (const struct ast_channel *chan)
 
void * ast_channel_tech_pvt (const struct ast_channel *chan)
 
void ast_channel_tech_pvt_set (struct ast_channel *chan, void *value)
 
void ast_channel_tech_set (struct ast_channel *chan, const struct ast_channel_tech *value)
 
struct ast_timerast_channel_timer (const struct ast_channel *chan)
 
void ast_channel_timer_set (struct ast_channel *chan, struct ast_timer *value)
 
void * ast_channel_timingdata (const struct ast_channel *chan)
 
void ast_channel_timingdata_set (struct ast_channel *chan, void *value)
 
int ast_channel_timingfd (const struct ast_channel *chan)
 
void ast_channel_timingfd_set (struct ast_channel *chan, int value)
 
ast_timing_func_t ast_channel_timingfunc (const struct ast_channel *chan)
 
void ast_channel_timingfunc_set (struct ast_channel *chan, ast_timing_func_t value)
 
struct stasis_topicast_channel_topic (struct ast_channel *chan)
 A topic which publishes the events for a particular channel. More...
 
unsigned short ast_channel_transfercapability (const struct ast_channel *chan)
 
void ast_channel_transfercapability_set (struct ast_channel *chan, unsigned short value)
 
int ast_channel_unbridged (struct ast_channel *chan)
 This function will check if the bridge needs to be re-evaluated due to external changes. More...
 
int ast_channel_unbridged_nolock (struct ast_channel *chan)
 ast_channel_unbridged variant. Use this if the channel is already locked prior to calling. More...
 
const char * ast_channel_uniqueid (const struct ast_channel *chan)
 
struct varsheadast_channel_varshead (struct ast_channel *chan)
 
void ast_channel_varshead_set (struct ast_channel *chan, struct varshead *value)
 
int ast_channel_visible_indication (const struct ast_channel *chan)
 
void ast_channel_visible_indication_set (struct ast_channel *chan, int value)
 
struct ast_filestreamast_channel_vstream (const struct ast_channel *chan)
 
void ast_channel_vstream_set (struct ast_channel *chan, struct ast_filestream *value)
 
int ast_channel_vstreamid (const struct ast_channel *chan)
 
void ast_channel_vstreamid_set (struct ast_channel *chan, int value)
 
struct timeval * ast_channel_whentohangup (struct ast_channel *chan)
 
void ast_channel_whentohangup_set (struct ast_channel *chan, struct timeval *value)
 
struct ast_formatast_channel_writeformat (struct ast_channel *chan)
 
struct ast_trans_pvtast_channel_writetrans (const struct ast_channel *chan)
 
void ast_channel_writetrans_set (struct ast_channel *chan, struct ast_trans_pvt *value)
 
struct ast_tone_zoneast_channel_zone (const struct ast_channel *chan)
 
void ast_channel_zone_set (struct ast_channel *chan, struct ast_tone_zone *value)
 
static void channel_set_default_streams (struct ast_channel *chan)
 
static int collect_names_cb (void *obj, void *arg, int flags)
 
 DEFINE_STRINGFIELD_GETTER_FOR (name)
 
 DEFINE_STRINGFIELD_GETTER_FOR (language)
 
 DEFINE_STRINGFIELD_GETTER_FOR (musicclass)
 
 DEFINE_STRINGFIELD_GETTER_FOR (latest_musicclass)
 
 DEFINE_STRINGFIELD_GETTER_FOR (accountcode)
 
 DEFINE_STRINGFIELD_GETTER_FOR (peeraccount)
 
 DEFINE_STRINGFIELD_GETTER_FOR (userfield)
 
 DEFINE_STRINGFIELD_GETTER_FOR (call_forward)
 
 DEFINE_STRINGFIELD_GETTER_FOR (parkinglot)
 
 DEFINE_STRINGFIELD_GETTER_FOR (hangupsource)
 
 DEFINE_STRINGFIELD_GETTER_FOR (dialcontext)
 
 DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR (name, 0, 1, AST_CHANNEL_SNAPSHOT_INVALIDATE_BASE)
 
 DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR (language, 1, 0, AST_CHANNEL_SNAPSHOT_INVALIDATE_BASE)
 
 DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR (accountcode, 1, 0, AST_CHANNEL_SNAPSHOT_INVALIDATE_BASE)
 
 DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR (peeraccount, 1, 0, AST_CHANNEL_SNAPSHOT_INVALIDATE_PEER)
 
 DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR (userfield, 0, 0, AST_CHANNEL_SNAPSHOT_INVALIDATE_BASE)
 
 DEFINE_STRINGFIELD_SETTERS_AND_INVALIDATE_FOR (hangupsource, 0, 0, AST_CHANNEL_SNAPSHOT_INVALIDATE_HANGUP)
 
 DEFINE_STRINGFIELD_SETTERS_FOR (musicclass, 0)
 
 DEFINE_STRINGFIELD_SETTERS_FOR (latest_musicclass, 0)
 
 DEFINE_STRINGFIELD_SETTERS_FOR (call_forward, 0)
 
 DEFINE_STRINGFIELD_SETTERS_FOR (parkinglot, 0)
 
 DEFINE_STRINGFIELD_SETTERS_FOR (dialcontext, 0)
 
static int pvt_cause_cmp_fn (void *obj, void *vstr, int flags)
 Comparison function for pvt cause code frames.
 
static int pvt_cause_hash_fn (const void *vpc, const int flags)
 Hash function for pvt cause code frames.
 

Variables

static struct ast_threadstorage channel_errno = { .once = PTHREAD_ONCE_INIT , .key_init = __init_channel_errno , .custom_init = NULL , }
 
static int uniqueint
 The monotonically increasing integer counter for channel uniqueids.
 

Detailed Description

Channel Accessor API.

This file is intended to be the only file that ever accesses the internals of an ast_channel. All other files should use the accessor functions defined here.

Author
Terry Wilson

Definition in file channel_internal_api.c.

Macro Definition Documentation

#define DEFINE_STRINGFIELD_GETTER_FOR (   field)
Value:
const char *ast_channel_##field(const struct ast_channel *chan) \
{ \
return chan->field; \
}
Main Channel structure associated with a channel.

Definition at line 286 of file channel_internal_api.c.

Function Documentation

void ast_channel_amaflags_set ( struct ast_channel chan,
enum ama_flags  value 
)
Precondition
chan is locked

Definition at line 409 of file channel_internal_api.c.

References ast_channel::amaflags, and ast_channel_publish_snapshot().

Referenced by __ast_channel_alloc_ap(), ast_cel_fabricate_channel_from_event(), and ast_iax2_new().

410 {
411  if (chan->amaflags == value) {
412  return;
413  }
414  chan->amaflags = value;
416 }
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
void ast_channel_callgroup_set ( struct ast_channel chan,
ast_group_t  value 
)
Precondition
chan is locked

Definition at line 1063 of file channel_internal_api.c.

References ast_channel::callgroup.

Referenced by chan_pjsip_new(), jingle_new(), and unistim_new().

1064 {
1065  chan->callgroup = value;
1066 }
ast_group_t callgroup
void ast_channel_callid_set ( struct ast_channel chan,
ast_callid  value 
)
Precondition
chan is locked

Definition at line 782 of file channel_internal_api.c.

References ast_callid_strnprint(), ast_debug, ast_test_suite_event_notify, and ast_channel::callid.

Referenced by __ast_pbx_run(), ast_iax2_new(), ast_unreal_channel_push_to_bridge(), ast_unreal_new_channels(), and jingle_new().

783 {
784  char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
785  char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
786  call_identifier_from[0] = '\0';
787  ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
788  if (chan->callid) {
789  ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
790  ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
791  }
792 
793  chan->callid = callid;
794 
795  ast_test_suite_event_notify("CallIDChange",
796  "State: CallIDChange\r\n"
797  "Channel: %s\r\n"
798  "CallID: %s\r\n"
799  "PriorCallID: %s",
800  ast_channel_name(chan),
801  call_identifier_to,
802  call_identifier_from);
803 }
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_test_suite_event_notify(s, f,...)
Definition: test.h:189
void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid)
copy a string representation of the callid into a target string
Definition: logger.c:2288
int ast_channel_dialed_causes_add ( const struct ast_channel chan,
const struct ast_control_pvt_cause_code cause_code,
int  datalen 
)

Add cause code information to the channel.

Since
11

This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function. The passed in data is copied and so is still owned by the caller.

Parameters
chanThe channel on which to add information
cause_codeThe cause information to be added to the channel
datalenThe total length of the structure since its length is variable
Return values
0on success
-1on error

Definition at line 1278 of file channel_internal_api.c.

References ao2_link, ao2_ref, ast_control_pvt_cause_code::chan_name, ast_channel::dialed_causes, OBJ_KEY, OBJ_NODATA, and OBJ_UNLINK.

Referenced by ast_channel_hangupcause_hash_set().

1279 {
1280  struct ast_control_pvt_cause_code *ao2_cause_code;
1281  ao2_find(chan->dialed_causes, cause_code->chan_name, OBJ_KEY | OBJ_UNLINK | OBJ_NODATA);
1282  ao2_cause_code = ao2_alloc(datalen, NULL);
1283 
1284  if (ao2_cause_code) {
1285  memcpy(ao2_cause_code, cause_code, datalen);
1286  ao2_link(chan->dialed_causes, ao2_cause_code);
1287  ao2_ref(ao2_cause_code, -1);
1288  return 0;
1289  } else {
1290  return -1;
1291  }
1292 }
char chan_name[AST_CHANNEL_NAME]
#define OBJ_KEY
Definition: astobj2.h:1151
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
struct ao2_container * dialed_causes
#define ao2_link(container, obj)
Add an object to a container.
Definition: astobj2.h:1532
struct ast_str* ast_channel_dialed_causes_channels ( const struct ast_channel chan)

Retrieve a comma-separated list of channels for which dialed cause information is available.

Since
11

This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function.

Parameters
chanThe channel from which to retrieve information
Return values
NULLon allocation failure
Pointerto an ast_str object containing the desired information which must be freed

Definition at line 1260 of file channel_internal_api.c.

References ao2_callback, ast_str_create, and ast_channel::dialed_causes.

1261 {
1262  struct ast_str *chanlist = ast_str_create(128);
1263 
1264  if (!chanlist) {
1265  return NULL;
1266  }
1267 
1268  ao2_callback(chan->dialed_causes, 0, collect_names_cb, &chanlist);
1269 
1270  return chanlist;
1271 }
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below.
Definition: astobj2.h:1693
List of channel drivers.
Definition: app_dial.c:797
struct ao2_container * dialed_causes
Support for dynamic strings.
Definition: strings.h:623
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
Definition: strings.h:659
void ast_channel_dialed_causes_clear ( const struct ast_channel chan)

Clear all cause information from the channel.

Since
11

This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function.

Parameters
chanThe channel from which to clear information

Definition at line 1294 of file channel_internal_api.c.

References ao2_callback, ast_channel::dialed_causes, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.

1295 {
1297 }
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below.
Definition: astobj2.h:1693
struct ao2_container * dialed_causes
struct ast_control_pvt_cause_code* ast_channel_dialed_causes_find ( const struct ast_channel chan,
const char *  chan_name 
)

Retrieve a ref-counted cause code information structure.

Since
11

This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function. This function increases the ref count of the returned object, so the calling function must decrease the reference count when it is finished with the object.

Parameters
chanThe channel from which to retrieve information
chan_nameThe name of the channel about which to retrieve information
Return values
NULLon search failure
Pointerto a ref-counted ast_control_pvt_cause_code object containing the desired information

Definition at line 1273 of file channel_internal_api.c.

References ast_channel::dialed_causes, and OBJ_KEY.

Referenced by hangupcause_read().

1274 {
1275  return ao2_find(chan->dialed_causes, chan_name, OBJ_KEY);
1276 }
#define OBJ_KEY
Definition: astobj2.h:1151
struct ao2_container * dialed_causes
int ast_channel_fd_add ( struct ast_channel chan,
int  value 
)

Add a file descriptor to the channel without a fixed position.

Since
15
Parameters
chanThe channel to add the file descriptor to
valueThe file descriptor
Precondition
chan is locked
Returns
The position of the file descriptor

Definition at line 1185 of file channel_internal_api.c.

References AST_EXTENDED_FDS, AST_VECTOR_REPLACE, and ast_channel::fds.

1186 {
1187  int pos = AST_EXTENDED_FDS;
1188 
1189  while (ast_channel_fd_isset(chan, pos)) {
1190  pos += 1;
1191  }
1192 
1193  AST_VECTOR_REPLACE(&chan->fds, pos, value);
1194 
1195  return pos;
1196 }
struct ast_channel::@335 fds
#define AST_EXTENDED_FDS
Definition: channel.h:195
#define AST_VECTOR_REPLACE(vec, idx, elem)
Replace an element at a specific position in a vector, growing the vector if needed.
Definition: vector.h:284
int ast_channel_fd_count ( const struct ast_channel chan)

Retrieve the number of file decriptor positions present on the channel.

Since
15
Parameters
chanThe channel to get the count of
Precondition
chan is locked
Returns
The number of file descriptor positions

Definition at line 1180 of file channel_internal_api.c.

References AST_VECTOR_SIZE, and ast_channel::fds.

Referenced by ast_waitfor_nandfds(), and channel_do_masquerade().

1181 {
1182  return AST_VECTOR_SIZE(&chan->fds);
1183 }
struct ast_channel::@335 fds
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
Definition: vector.h:609
int ast_channel_forward_endpoint ( struct ast_channel chan,
struct ast_endpoint endpoint 
)

Forward channel stasis messages to the given endpoint.

Since
12
Parameters
chanThe channel to forward from
endpointThe endpoint to forward to
Return values
0Success
non-zeroFailure

Definition at line 1497 of file channel_internal_api.c.

References ast_channel_topic(), ast_endpoint_topic(), ast_channel::endpoint_forward, and stasis_forward_all().

Referenced by ast_endpoint_add_channel().

1499 {
1500  ast_assert(chan != NULL);
1501  ast_assert(endpoint != NULL);
1502 
1503  chan->endpoint_forward =
1505  ast_endpoint_topic(endpoint));
1506  if (!chan->endpoint_forward) {
1507  return -1;
1508  }
1509 
1510  return 0;
1511 }
struct stasis_topic * ast_endpoint_topic(struct ast_endpoint *endpoint)
Returns the topic for a specific endpoint.
struct stasis_topic * ast_channel_topic(struct ast_channel *chan)
A topic which publishes the events for a particular channel.
struct stasis_forward * endpoint_forward
struct stasis_forward * stasis_forward_all(struct stasis_topic *from_topic, struct stasis_topic *to_topic)
Create a subscription which forwards all messages from one topic to another.
Definition: stasis.c:1578
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.

Parameters
chanThe channel to get the stream from
typeThe media type of the default stream
Precondition
chan is locked
Return values
non-NULLsuccess
NULLfailure

Definition at line 1605 of file channel_internal_api.c.

References ast_channel::default_streams, and ast_stream::type.

Referenced by __ast_read(), ast_unreal_write_stream(), and ast_write_stream().

1607 {
1608  ast_assert(chan != NULL);
1609  ast_assert(type < AST_MEDIA_TYPE_END);
1610 
1611  return chan->default_streams[type];
1612 }
struct ast_stream * default_streams[AST_MEDIA_TYPE_END]
struct ast_stream_topology* ast_channel_get_stream_topology ( const struct ast_channel chan)

Retrieve the topology of streams on a channel.

Parameters
chanThe channel to get the stream topology of
Precondition
chan is locked
Return values
non-NULLsuccess
NULLfailure

Definition at line 1569 of file channel_internal_api.c.

References ast_channel::stream_topology.

Referenced by __ast_read(), ast_bridge_channel_stream_map(), ast_channel_request_stream_topology_change(), ast_unreal_indicate(), ast_write_stream(), dial_exec_full(), do_forward(), handle_showchan(), map_source_to_destinations(), native_rtp_bridge_join(), sfu_topologies_on_join(), and softmix_bridge_stream_topology_changed().

1571 {
1572  ast_assert(chan != NULL);
1573 
1574  return chan->stream_topology;
1575 }
struct ast_stream_topology * stream_topology
void* ast_channel_get_stream_topology_change_source ( struct ast_channel chan)

Retrieve the source that initiated the last stream topology change.

Parameters
chanThe channel
Return values
Thechannel's stream topology change source

Definition at line 657 of file channel_internal_api.c.

References ast_channel::stream_topology_change_source.

658 {
659  return chan->stream_topology_change_source;
660 }
void * stream_topology_change_source
void ast_channel_internal_alertpipe_swap ( struct ast_channel chan1,
struct ast_channel chan2 
)

Swap the interal alertpipe between two channels.

Note
Handle all of the necessary locking before calling this

Definition at line 1140 of file channel_internal_api.c.

Referenced by channel_do_masquerade().

1141 {
1142  ast_alertpipe_swap(chan1->alertpipe, chan2->alertpipe);
1143 }
void ast_channel_internal_bridge_set ( struct ast_channel chan,
struct ast_bridge value 
)
Precondition
chan is locked

Definition at line 1229 of file channel_internal_api.c.

References ast_channel_publish_snapshot(), AST_CHANNEL_SNAPSHOT_INVALIDATE_BRIDGE, ast_channel_snapshot_invalidate_segment(), and ast_channel::bridge.

1230 {
1231  chan->bridge = value;
1234 }
void ast_channel_snapshot_invalidate_segment(struct ast_channel *chan, enum ast_channel_snapshot_segment_invalidation segment)
Invalidate a channel snapshot segment from being reused.
struct ast_bridge * bridge
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
void ast_channel_internal_copy_linkedid ( struct ast_channel dest,
struct ast_channel source 
)

Copy the full linkedid channel id structure from one channel to another.

Parameters
destDestination to copy linkedid to
sourceSource channel to copy linkedid from

Definition at line 1390 of file channel_internal_api.c.

References ast_channel_publish_snapshot(), AST_CHANNEL_SNAPSHOT_INVALIDATE_PEER, ast_channel_snapshot_invalidate_segment(), ast_channel_id::creation_time, ast_channel_id::creation_unique, ast_channel::linkedid, and ast_channel_id::unique_id.

1391 {
1392  if (dest->linkedid.creation_time == source->linkedid.creation_time
1393  && dest->linkedid.creation_unique == source->linkedid.creation_unique
1394  && !strcmp(dest->linkedid.unique_id, source->linkedid.unique_id)) {
1395  return;
1396  }
1397  dest->linkedid = source->linkedid;
1400 }
struct ast_channel_id linkedid
void ast_channel_snapshot_invalidate_segment(struct ast_channel *chan, enum ast_channel_snapshot_segment_invalidation segment)
Invalidate a channel snapshot segment from being reused.
char unique_id[AST_MAX_UNIQUEID]
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
struct ast_channel* ast_channel_internal_oldest_linkedid ( struct ast_channel a,
struct ast_channel b 
)

Determine which channel has an older linkedid.

Parameters
aFirst channel
bSecond channel
Returns
Returns an ast_channel structure that has oldest linkedid

Definition at line 1373 of file channel_internal_api.c.

References ast_channel_id::creation_time, ast_channel_id::creation_unique, and ast_channel::linkedid.

1374 {
1375  ast_assert(a->linkedid.creation_time != 0);
1376  ast_assert(b->linkedid.creation_time != 0);
1377 
1379  return a;
1380  }
1382  return b;
1383  }
1385  return a;
1386  }
1387  return b;
1388 }
struct ast_channel_id linkedid
void ast_channel_internal_set_fake_ids ( struct ast_channel chan,
const char *  uniqueid,
const char *  linkedid 
)

Set uniqueid and linkedid string value only (not time)

Parameters
chanThe channel to set the uniqueid to
uniqueidThe uniqueid to set
linkedidThe linkedid to set
Note
This is used only by ast_cel_fabricate_channel_from_event() to create a temporary fake channel - time values are invalid

Definition at line 1451 of file channel_internal_api.c.

References ast_copy_string(), ast_channel::linkedid, ast_channel_id::unique_id, and ast_channel::uniqueid.

Referenced by ast_cel_fabricate_channel_from_event().

1452 {
1453  ast_copy_string(chan->uniqueid.unique_id, uniqueid, sizeof(chan->uniqueid.unique_id));
1454  ast_copy_string(chan->linkedid.unique_id, linkedid, sizeof(chan->linkedid.unique_id));
1455 }
struct ast_channel_id linkedid
char unique_id[AST_MAX_UNIQUEID]
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
struct ast_channel_id uniqueid
void ast_channel_internal_swap_endpoint_forward ( struct ast_channel a,
struct ast_channel b 
)

Swap endpoint_forward between two channels.

Parameters
aFirst channel
bSecond channel
Note
This is used in masquerade to exchange endpoint details if one of the two or both the channels were created with endpoint

Definition at line 1433 of file channel_internal_api.c.

References ast_channel::endpoint_forward.

Referenced by channel_do_masquerade().

1434 {
1435  struct stasis_forward *temp;
1436 
1437  temp = a->endpoint_forward;
1439  b->endpoint_forward = temp;
1440 }
struct stasis_forward * endpoint_forward
Forwarding information.
Definition: stasis.c:1531
void ast_channel_internal_swap_snapshots ( struct ast_channel a,
struct ast_channel b 
)

Swap snapshots beteween two channels.

Parameters
aFirst channel
bSecond channel
Note
This is used in masquerade to exchange snapshots

Definition at line 1442 of file channel_internal_api.c.

References ast_channel::snapshot.

Referenced by channel_do_masquerade().

1443 {
1444  struct ast_channel_snapshot *snapshot;
1445 
1446  snapshot = a->snapshot;
1447  a->snapshot = b->snapshot;
1448  b->snapshot = snapshot;
1449 }
Structure representing a snapshot of channel state.
struct ast_channel_snapshot * snapshot
void ast_channel_internal_swap_topics ( struct ast_channel a,
struct ast_channel b 
)

Swap topics beteween two channels.

Parameters
aFirst channel
bSecond channel
Note
This is used in masquerade to exchange topics for message routing

Definition at line 1419 of file channel_internal_api.c.

References ast_channel::channel_forward, and ast_channel::topic.

Referenced by channel_do_masquerade().

1420 {
1421  struct stasis_topic *topic;
1422  struct stasis_forward *forward;
1423 
1424  topic = a->topic;
1425  a->topic = b->topic;
1426  b->topic = topic;
1427 
1428  forward = a->channel_forward;
1430  b->channel_forward = forward;
1431 }
struct stasis_forward * channel_forward
struct stasis_topic * topic
Forwarding information.
Definition: stasis.c:1531
void ast_channel_internal_swap_uniqueid_and_linkedid ( struct ast_channel a,
struct ast_channel b 
)

Swap uniqueid and linkedid beteween two channels.

Parameters
aFirst channel
bSecond channel
Note
This is used in masquerade to exchange identities

Definition at line 1402 of file channel_internal_api.c.

References ast_channel::linkedid, and ast_channel::uniqueid.

Referenced by channel_do_masquerade().

1403 {
1404  struct ast_channel_id temp;
1405 
1406  /* This operation is used as part of masquerading and so does not invalidate the peer
1407  * segment. This is due to the masquerade process invalidating all segments.
1408  */
1409 
1410  temp = a->uniqueid;
1411  a->uniqueid = b->uniqueid;
1412  b->uniqueid = temp;
1413 
1414  temp = a->linkedid;
1415  a->linkedid = b->linkedid;
1416  b->linkedid = temp;
1417 }
struct ast_channel_id linkedid
Channel UniqueId structure.
struct ast_channel_id uniqueid
int ast_channel_is_multistream ( struct ast_channel chan)

Determine if a channel is multi-stream capable.

Parameters
chanThe channel to test
Precondition
chan is locked
Return values
trueif the channel is multi-stream capable.

Definition at line 1629 of file channel_internal_api.c.

References ast_channel_tech::read_stream, ast_channel::tech, and ast_channel_tech::write_stream.

Referenced by ast_channel_request_stream_topology_change(), ast_channel_set_stream_topology(), ast_channel_stream_topology_changed(), ast_channel_stream_topology_changed_externally(), ast_unreal_indicate(), and ast_unreal_new_channels().

1630 {
1631  return (chan && chan->tech && chan->tech->read_stream && chan->tech->write_stream);
1632 }
struct ast_frame *(*const read_stream)(struct ast_channel *chan)
Read a frame (or chain of frames from the same stream), in standard format (see frame.h), with stream num.
Definition: channel.h:747
const struct ast_channel_tech * tech
int(*const write_stream)(struct ast_channel *chan, int stream_num, struct ast_frame *frame)
Write a frame on a specific stream, in standard format (see frame.h)
Definition: channel.h:753
int ast_channel_is_t38_active ( struct ast_channel chan)

This function will check if T.38 is active on the channel.

Parameters
chanChannel on which to check the unbridge_eval flag
Returns
Returns 0 if the flag is down or 1 if the flag is up.

Definition at line 1031 of file channel_internal_api.c.

References ast_channel_is_t38_active_nolock().

1032 {
1033  int res;
1034 
1035  ast_channel_lock(chan);
1037  ast_channel_unlock(chan);
1038  return res;
1039 }
int ast_channel_is_t38_active_nolock(struct ast_channel *chan)
ast_channel_is_t38_active variant. Use this if the channel is already locked prior to calling...
int ast_channel_is_t38_active_nolock ( struct ast_channel chan)

ast_channel_is_t38_active variant. Use this if the channel is already locked prior to calling.

Parameters
chanChannel on which to check the is_t38_active flag
Returns
Returns 0 if the flag is down or 1 if the flag is up.

Definition at line 1026 of file channel_internal_api.c.

References ast_channel::is_t38_active.

Referenced by ast_channel_is_t38_active().

1027 {
1028  return chan->is_t38_active;
1029 }
void ast_channel_pickupgroup_set ( struct ast_channel chan,
ast_group_t  value 
)
Precondition
chan is locked

Definition at line 1071 of file channel_internal_api.c.

References ast_channel::pickupgroup.

Referenced by chan_pjsip_new(), jingle_new(), and unistim_new().

1072 {
1073  chan->pickupgroup = value;
1074 }
ast_group_t pickupgroup
void ast_channel_set_is_t38_active ( struct ast_channel chan,
int  is_t38_active 
)

Sets the is_t38_active flag.

Parameters
chanWhich channel is having its is_t38_active value set
is_t38_activeNon-zero if T.38 is active

Definition at line 1046 of file channel_internal_api.c.

References ast_channel_set_is_t38_active_nolock().

1047 {
1048  ast_channel_lock(chan);
1049  ast_channel_set_is_t38_active_nolock(chan, is_t38_active);
1050  ast_channel_unlock(chan);
1051 }
void ast_channel_set_is_t38_active_nolock(struct ast_channel *chan, int is_t38_active)
Variant of ast_channel_set_is_t38_active. Use this if the channel is already locked prior to calling...
void ast_channel_set_is_t38_active_nolock ( struct ast_channel chan,
int  is_t38_active 
)

Variant of ast_channel_set_is_t38_active. Use this if the channel is already locked prior to calling.

Parameters
chanWhich channel is having its is_t38_active value set
is_t38_activeNon-zero if T.38 is active

Definition at line 1041 of file channel_internal_api.c.

References ast_channel::is_t38_active.

Referenced by ast_channel_set_is_t38_active(), and indicate_data_internal().

1042 {
1043  chan->is_t38_active = !!is_t38_active;
1044 }
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.

Parameters
chanThe channel to set the stream topology on
topologyThe stream topology to set
Precondition
chan is locked
Note
If topology is NULL a new empty topology will be created and returned.
Return values
non-NULLSuccess
NULLfailure

Definition at line 1577 of file channel_internal_api.c.

References ast_channel_is_multistream(), ast_str_tmp, ast_stream_topology_alloc(), and ast_stream_topology_to_str().

Referenced by ast_unreal_indicate(), ast_unreal_new_channels(), and chan_pjsip_new().

1579 {
1580  struct ast_stream_topology *new_topology;
1581  SCOPE_ENTER(1, "%s: %s\n", ast_channel_name(chan),
1582  ast_str_tmp(256, ast_stream_topology_to_str(topology, &STR_TMP)));
1583 
1584  ast_assert(chan != NULL);
1585 
1586  /* A non-MULTISTREAM channel can't manipulate topology directly */
1587  ast_assert(ast_channel_is_multistream(chan));
1588 
1589  /* Unless the channel is being destroyed, we always want a topology on
1590  * it even if its empty.
1591  */
1592  if (!topology) {
1593  new_topology = ast_stream_topology_alloc();
1594  } else {
1595  new_topology = topology;
1596  }
1597 
1598  if (new_topology) {
1599  ast_channel_internal_set_stream_topology(chan, new_topology);
1600  }
1601 
1602  SCOPE_EXIT_RTN_VALUE(new_topology, "Used %s topology\n", topology ? "provided" : "empty");
1603 }
int ast_channel_is_multistream(struct ast_channel *chan)
Determine if a channel is multi-stream capable.
#define ast_str_tmp(init_len, __expr)
Provides a temporary ast_str and returns a copy of its buffer.
Definition: strings.h:1189
const char * ast_stream_topology_to_str(const struct ast_stream_topology *topology, struct ast_str **buf)
Get a string representing the topology for debugging/display purposes.
Definition: stream.c:936
struct ast_stream_topology * ast_stream_topology_alloc(void)
Create a stream topology.
Definition: stream.c:650
void ast_channel_set_unbridged ( struct ast_channel chan,
int  value 
)

Sets the unbridged flag and queues a NULL frame on the channel to trigger a check by bridge_channel_wait.

Parameters
chanWhich channel is having its unbridged value set
valueWhat the unbridge value is being set to

Definition at line 1019 of file channel_internal_api.c.

References ast_channel_set_unbridged_nolock().

Referenced by ast_bridge_setup_after_goto(), and t38_change_state().

1020 {
1021  ast_channel_lock(chan);
1022  ast_channel_set_unbridged_nolock(chan, value);
1023  ast_channel_unlock(chan);
1024 }
void ast_channel_set_unbridged_nolock(struct ast_channel *chan, int value)
Variant of ast_channel_set_unbridged. Use this if the channel is already locked prior to calling...
void ast_channel_set_unbridged_nolock ( struct ast_channel chan,
int  value 
)

Variant of ast_channel_set_unbridged. Use this if the channel is already locked prior to calling.

Parameters
chanWhich channel is having its unbridged value set
valueWhat the unbridge value is being set to

Definition at line 1013 of file channel_internal_api.c.

References ast_null_frame, ast_queue_frame(), and ast_channel::unbridged.

Referenced by ast_audiohook_attach(), ast_audiohook_remove(), ast_channel_set_unbridged(), ast_framehook_attach(), ast_framehook_detach(), ast_framehook_list_fixup(), audio_audiohook_write_list(), chan_pjsip_read_stream(), and dtmf_audiohook_write_list().

1014 {
1015  chan->unbridged = !!value;
1017 }
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
Definition: channel.c:1139
struct ast_frame ast_null_frame
Definition: main/frame.c:79
struct stasis_topic* ast_channel_topic ( struct ast_channel chan)

A topic which publishes the events for a particular channel.

Since
12 If the given chan is NULL, ast_channel_topic_all() is returned.
Parameters
chanChannel, or NULL.
Return values
Topicfor channel's events.
ast_channel_topic_all()if chan is NULL.

Definition at line 1488 of file channel_internal_api.c.

References ast_channel_topic_all(), and ast_channel::topic.

Referenced by ast_ari_bridges_record(), ast_channel_forward_endpoint(), ast_channel_publish_blob(), ast_channel_publish_cached_blob(), ast_channel_publish_final_snapshot(), ast_channel_publish_snapshot(), ast_multi_object_blob_single_channel_publish(), forwards_create_channel(), local_optimization_finished_cb(), local_optimization_started_cb(), manager_mute_mixmonitor(), report_fax_status(), report_receive_fax_status(), report_send_fax_status(), and stasis_app_control_publish().

1489 {
1490  if (!chan) {
1491  return ast_channel_topic_all();
1492  }
1493 
1494  return chan->topic;
1495 }
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
struct stasis_topic * topic
int ast_channel_unbridged ( struct ast_channel chan)

This function will check if the bridge needs to be re-evaluated due to external changes.

Parameters
chanChannel on which to check the unbridge_eval flag
Returns
Returns 0 if the flag is down or 1 if the flag is up.

Definition at line 1004 of file channel_internal_api.c.

References ast_channel_unbridged_nolock().

Referenced by ast_channel_is_leaving_bridge().

1005 {
1006  int res;
1007  ast_channel_lock(chan);
1008  res = ast_channel_unbridged_nolock(chan);
1009  ast_channel_unlock(chan);
1010  return res;
1011 }
int ast_channel_unbridged_nolock(struct ast_channel *chan)
ast_channel_unbridged variant. Use this if the channel is already locked prior to calling...
int ast_channel_unbridged_nolock ( struct ast_channel chan)

ast_channel_unbridged variant. Use this if the channel is already locked prior to calling.

Parameters
chanChannel on which to check the unbridge flag
Returns
Returns 0 if the flag is down or 1 if the flag is up.

Definition at line 999 of file channel_internal_api.c.

References ast_channel::unbridged.

Referenced by ast_channel_unbridged().

1000 {
1001  return chan->unbridged;
1002 }
void ast_channel_whentohangup_set ( struct ast_channel chan,
struct timeval *  value 
)
Precondition
chan is locked

Definition at line 953 of file channel_internal_api.c.

References ast_channel::whentohangup.

Referenced by ast_channel_setwhentohangup_tv(), and dial_exec_full().

954 {
955  chan->whentohangup = *value;
956 }
struct timeval whentohangup