Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
channel.h File Reference

General Asterisk PBX channel definitions. More...

#include "asterisk/alertpipe.h"
#include "asterisk/abstract_jb.h"
#include "asterisk/astobj2.h"
#include "asterisk/poll-compat.h"
#include "asterisk/frame.h"
#include "asterisk/chanvars.h"
#include "asterisk/config.h"
#include "asterisk/lock.h"
#include "asterisk/cdr.h"
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stringfields.h"
#include "asterisk/datastore.h"
#include "asterisk/format_cap.h"
#include "asterisk/channelstate.h"
#include "asterisk/ccss.h"
#include "asterisk/framehook.h"
#include "asterisk/stasis.h"
#include "asterisk/endpoints.h"
Include dependency graph for channel.h:

Go to the source code of this file.

Data Structures

struct  ast_assigned_ids
 Structure to pass both assignedid values to channel drivers. More...
 
struct  ast_autochan_list
 
struct  ast_bridge_config
 bridge configuration More...
 
struct  ast_chan_write_info_t
 Structure to handle passing func_channel_write info to channels via setoption. More...
 
struct  ast_channel_initializers
 Helper struct for initializing additional channel information on channel creation. More...
 
struct  ast_channel_tech
 Structure to describe a channel "technology", ie a channel driver See for examples: More...
 
struct  ast_datastore_list
 
struct  ast_generator
 
struct  ast_group_info
 channel group info More...
 
struct  ast_hangup_handler
 
struct  ast_hangup_handler_list
 
struct  ast_party_caller
 Caller Party information. More...
 
struct  ast_party_connected_line
 Connected Line/Party information. More...
 
struct  ast_party_dialed
 Dialed/Called Party information. More...
 
struct  ast_party_id
 Information needed to identify an endpoint in a call. More...
 
struct  ast_party_name
 Information needed to specify a name in a call. More...
 
struct  ast_party_number
 Information needed to specify a number in a call. More...
 
struct  ast_party_redirecting
 Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call diversion or transfer was invoked. More...
 
struct  ast_party_redirecting_reason
 Redirecting reason information. More...
 
struct  ast_party_subaddress
 Information needed to specify a subaddress in a call. More...
 
struct  ast_readq_list
 
struct  ast_set_party_caller
 Indicate what information in ast_party_caller should be set. More...
 
struct  ast_set_party_connected_line
 Indicate what information in ast_party_connected_line should be set. More...
 
struct  ast_set_party_id
 Indicate what information in ast_party_id should be set. More...
 
struct  ast_set_party_redirecting
 Indicate what information in ast_party_redirecting should be set. More...
 
struct  outgoing_helper
 

Macros

#define AST_AGENT_FD   (AST_MAX_FDS-3)
 
#define AST_ALERT_FD   (AST_MAX_FDS-1)
 
#define AST_BRIDGE_DTMF_CHANNEL_0   (1 << 0)
 Report DTMF on channel 0. More...
 
#define AST_BRIDGE_DTMF_CHANNEL_1   (1 << 1)
 Report DTMF on channel 1. More...
 
#define AST_CHAN_WRITE_INFO_T_VERSION   1
 ast_chan_write_info_t version. Must be incremented if structure is changed More...
 
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, ...)
 Create a channel structure. More...
 
#define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint, ...)
 
#define ast_channel_alloc_with_initializers(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint, initializers, ...)
 
#define ast_channel_cleanup(c)   ({ ao2_cleanup(c); (struct ast_channel *) (NULL); })
 Cleanup a channel reference. More...
 
#define ast_channel_has_tech_function(chan, function)    (ast_channel_tech(chan) ? ast_channel_tech(chan)->function != NULL : 0)
 Checks if a channel's technology implements a particular callback function. More...
 
#define AST_CHANNEL_INITIALIZERS_VERSION   1
 struct ABI version More...
 
#define ast_channel_lock(chan)   ao2_lock(chan)
 
#define ast_channel_lock_both(chan1, chan2)
 Lock two channels. More...
 
#define AST_CHANNEL_NAME   80
 
#define ast_channel_ref(c)   ({ ao2_ref(c, +1); (c); })
 Increase channel reference count. More...
 
#define ast_channel_trylock(chan)   ao2_trylock(chan)
 
#define ast_channel_unlock(chan)   ao2_unlock(chan)
 
#define ast_channel_unref(c)   ({ ao2_ref(c, -1); (struct ast_channel *) (NULL); })
 Decrease channel reference count. More...
 
#define ast_dummy_channel_alloc()   __ast_dummy_channel_alloc(__FILE__, __LINE__, __PRETTY_FUNCTION__)
 Create a fake channel structure. More...
 
#define AST_EXTENDED_FDS   12
 
#define AST_FEATURE_DTMF_MASK
 
#define AST_GENERATOR_FD   (AST_MAX_FDS-4)
 
#define AST_JITTERBUFFER_FD   (AST_MAX_FDS-5)
 
#define AST_MAX_ACCOUNT_CODE   80
 
#define AST_MAX_CONTEXT   80
 
#define AST_MAX_EXTENSION   80
 
#define AST_MAX_FDS   11
 
#define AST_MAX_PUBLIC_UNIQUEID   149
 
#define AST_MAX_TENANT_ID   64
 
#define AST_MAX_UNIQUEID   (AST_MAX_PUBLIC_UNIQUEID + 2 + 1)
 
#define AST_MAX_USER_FIELD   256
 
#define AST_MUTE_DIRECTION_READ   (1 << 0)
 
#define AST_MUTE_DIRECTION_WRITE   (1 << 1)
 
#define AST_NUM_CHANNEL_BUCKETS   1567
 
#define AST_TIMING_FD   (AST_MAX_FDS-2)
 
#define CHECK_BLOCKING(c)
 Set the blocking indication on the channel. More...
 
#define DATASTORE_INHERIT_FOREVER   INT_MAX
 
#define DEBUGCHAN_FLAG   0x80000000
 
#define DECLARE_STRINGFIELD_SETTERS_FOR(field)
 
#define FRAMECOUNT_INC(x)   ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) )
 
#define MAX_LANGUAGE   40
 
#define MAX_MUSICCLASS   80
 

Typedefs

typedef int(* ast_acf_read2_fn_t) (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len)
 Typedef for a custom read2 function. More...
 
typedef int(* ast_acf_read_fn_t) (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
 Typedef for a custom read function. More...
 
typedef int(* ast_acf_write_fn_t) (struct ast_channel *chan, const char *function, char *data, const char *value)
 Typedef for a custom write function. More...
 
typedef unsigned long long ast_group_t
 
typedef int(* ast_timing_func_t) (const void *data)
 

Enumerations

enum  { AST_CHAN_TP_WANTSJITTER = (1 << 0) , AST_CHAN_TP_CREATESJITTER = (1 << 1) , AST_CHAN_TP_INTERNAL = (1 << 2) , AST_CHAN_TP_SEND_TEXT_DATA = (1 << 3) }
 ast_channel_tech Properties More...
 
enum  {
  AST_FLAG_DEFER_DTMF = (1 << 1) , AST_FLAG_WRITE_INT = (1 << 2) , AST_FLAG_BLOCKING = (1 << 3) , AST_FLAG_ZOMBIE = (1 << 4) ,
  AST_FLAG_EXCEPTION = (1 << 5) , AST_FLAG_MOH = (1 << 6) , AST_FLAG_SPYING = (1 << 7) , AST_FLAG_IN_AUTOLOOP = (1 << 9) ,
  AST_FLAG_OUTGOING = (1 << 10) , AST_FLAG_IN_DTMF = (1 << 12) , AST_FLAG_EMULATE_DTMF = (1 << 13) , AST_FLAG_END_DTMF_ONLY = (1 << 14) ,
  AST_FLAG_MASQ_NOSTREAM = (1 << 16) , AST_FLAG_BRIDGE_HANGUP_RUN = (1 << 17) , AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20) , AST_FLAG_DISABLE_DEVSTATE_CACHE = (1 << 21) ,
  AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT = (1 << 22) , AST_FLAG_ORIGINATED = (1 << 23) , AST_FLAG_DEAD = (1 << 24) , AST_FLAG_SNAPSHOT_STAGE = (1 << 25) ,
  AST_FLAG_TIMINGDATA_IS_AO2_OBJ = (1 << 26) , AST_FLAG_SUBROUTINE_EXEC = (1 << 27)
}
 ast_channel flags More...
 
enum  {
  AST_FEATURE_PLAY_WARNING = (1 << 0) , AST_FEATURE_REDIRECT = (1 << 1) , AST_FEATURE_DISCONNECT = (1 << 2) , AST_FEATURE_ATXFER = (1 << 3) ,
  AST_FEATURE_AUTOMON = (1 << 4) , AST_FEATURE_PARKCALL = (1 << 5) , AST_FEATURE_AUTOMIXMON = (1 << 6)
}
 ast_bridge_config flags More...
 
enum  {
  AST_SOFTHANGUP_DEV = (1 << 0) , AST_SOFTHANGUP_ASYNCGOTO = (1 << 1) , AST_SOFTHANGUP_SHUTDOWN = (1 << 2) , AST_SOFTHANGUP_TIMEOUT = (1 << 3) ,
  AST_SOFTHANGUP_APPUNLOAD = (1 << 4) , AST_SOFTHANGUP_EXPLICIT = (1 << 5) , AST_SOFTHANGUP_HANGUP_EXEC = (1 << 7) , AST_SOFTHANGUP_ALL = (0xFFFFFFFF)
}
 
enum  ama_flags { AST_AMA_NONE = 0 , AST_AMA_OMIT , AST_AMA_BILLING , AST_AMA_DOCUMENTATION }
 Channel AMA Flags. More...
 
enum  ast_bridge_result { AST_BRIDGE_COMPLETE = 0 , AST_BRIDGE_FAILED = -1 , AST_BRIDGE_FAILED_NOWARN = -2 , AST_BRIDGE_RETRY = -3 }
 
enum  ast_channel_adsicpe { AST_ADSI_UNKNOWN , AST_ADSI_AVAILABLE , AST_ADSI_UNAVAILABLE , AST_ADSI_OFFHOOKONLY }
 
enum  ast_channel_error { AST_CHANNEL_ERROR_UNKNOWN , AST_CHANNEL_ERROR_ID_EXISTS }
 
enum  ast_channel_requestor_relationship { AST_CHANNEL_REQUESTOR_BRIDGE_PEER , AST_CHANNEL_REQUESTOR_REPLACEMENT }
 
enum  AST_MONITORING_STATE { AST_MONITOR_RUNNING , AST_MONITOR_PAUSED }
 
enum  AST_PARTY_CHAR_SET {
  AST_PARTY_CHAR_SET_UNKNOWN = 0 , AST_PARTY_CHAR_SET_ISO8859_1 = 1 , AST_PARTY_CHAR_SET_WITHDRAWN = 2 , AST_PARTY_CHAR_SET_ISO8859_2 = 3 ,
  AST_PARTY_CHAR_SET_ISO8859_3 = 4 , AST_PARTY_CHAR_SET_ISO8859_4 = 5 , AST_PARTY_CHAR_SET_ISO8859_5 = 6 , AST_PARTY_CHAR_SET_ISO8859_7 = 7 ,
  AST_PARTY_CHAR_SET_ISO10646_BMPSTRING = 8 , AST_PARTY_CHAR_SET_ISO10646_UTF_8STRING = 9
}
 
enum  ast_t38_state {
  T38_STATE_UNAVAILABLE , T38_STATE_UNKNOWN , T38_STATE_NEGOTIATING , T38_STATE_REJECTED ,
  T38_STATE_NEGOTIATED
}
 Possible T38 states on channels. More...
 
enum  channelreloadreason {
  CHANNEL_MODULE_LOAD , CHANNEL_MODULE_RELOAD , CHANNEL_CLI_RELOAD , CHANNEL_MANAGER_RELOAD ,
  CHANNEL_ACL_RELOAD
}
 Channel reload reasons for manager events at load or reload of configuration. More...
 

Functions

int __ast_answer (struct ast_channel *chan, unsigned int delay)
 Answer a channel, with a selectable delay before returning. More...
 
struct ast_channel__ast_channel_alloc (int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint, const char *file, int line, const char *function, const char *name_fmt,...)
 Create a channel structure. More...
 
struct ast_channel__ast_channel_alloc_with_initializers (int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint, struct ast_channel_initializers *initializers, const char *file, int line, const char *function, const char *name_fmt,...)
 Create a channel structure. More...
 
struct ast_channel__ast_dummy_channel_alloc (const char *file, int line, const char *function)
 
struct ast_channel__ast_request_and_dial (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh)
 Request a channel of a given type, with data as optional information used by the low level module and attempt to place a call on it. More...
 
int ast_activate_generator (struct ast_channel *chan, struct ast_generator *gen, void *params)
 
int ast_active_channels (void)
 returns number of active/allocated channels More...
 
static int ast_add_fd (struct pollfd *pfd, int fd)
 if fd is a valid descriptor, set *pfd with the descriptor More...
 
int ast_answer (struct ast_channel *chan)
 Answer a channel. More...
 
int ast_auto_answer (struct ast_channel *chan)
 Answer a channel, if it's not already answered. More...
 
void ast_autoservice_chan_hangup_peer (struct ast_channel *chan, struct ast_channel *peer)
 Put chan into autoservice while hanging up peer. More...
 
int ast_autoservice_ignore (struct ast_channel *chan, enum ast_frame_type ftype)
 Ignore certain frame types. More...
 
int ast_autoservice_start (struct ast_channel *chan)
 Automatically service a channel for us... More...
 
int ast_autoservice_stop (struct ast_channel *chan)
 Stop servicing a channel for us... More...
 
int ast_call (struct ast_channel *chan, const char *addr, int timeout)
 Make a call. More...
 
struct ast_channelast_call_forward (struct ast_channel *caller, struct ast_channel *orig, int *timeout, struct ast_format_cap *cap, struct outgoing_helper *oh, int *outstate)
 Forwards a call to a new channel specified by the original channel's call_forward str. If possible, the new forwarded channel is created and returned while the original one is terminated. More...
 
const char * ast_cause2str (int cause) attribute_pure
 Gives the string form of a given cause code. More...
 
void ast_change_name (struct ast_channel *chan, const char *newname)
 Change channel name. More...
 
struct ast_channelast_channel__bridge (const struct ast_channel *chan)
 
void ast_channel__bridge_set (struct ast_channel *chan, struct ast_channel *value)
 
const char * ast_channel_accountcode (const struct ast_channel *chan)
 
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)
 
const char * ast_channel_amaflags2string (enum ama_flags flags)
 Convert the enum representation of an AMA flag to a string representation. More...
 
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 tid)
 
const char * ast_channel_blockproc (const struct ast_channel *chan)
 
void ast_channel_blockproc_set (struct ast_channel *chan, const char *value)
 
struct ast_channelast_channel_bridge_peer (struct ast_channel *chan)
 Get the channel's bridge peer only if the bridge is two-party. More...
 
const char * ast_channel_call_forward (const struct ast_channel *chan)
 
struct ast_channelast_channel_callback (ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
 Call a function with every active channel. More...
 
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 value)
 
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. More...
 
struct ast_cdrast_channel_cdr (const struct ast_channel *chan)
 
void ast_channel_cdr_set (struct ast_channel *chan, struct ast_cdr *value)
 
void ast_channel_clear_flag (struct ast_channel *chan, unsigned int flag)
 Clear a flag on a channel. More...
 
void ast_channel_clear_softhangup (struct ast_channel *chan, int flag)
 Clear a set of softhangup flags from a channel. More...
 
int ast_channel_cmpwhentohangup_tv (struct ast_channel *chan, struct timeval offset)
 Compare a offset with the settings of when to hang a channel up. More...
 
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)
 
int ast_channel_connected_line_sub (struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *connected_info, int frame)
 Run a connected line interception subroutine and update a channel's connected line information. More...
 
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)
 
int ast_channel_datastore_add (struct ast_channel *chan, struct ast_datastore *datastore)
 Add a datastore to a channel. More...
 
struct ast_datastoreast_channel_datastore_find (struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
 Find a datastore on a channel. More...
 
int ast_channel_datastore_inherit (struct ast_channel *from, struct ast_channel *to)
 Inherit datastores from a parent to a child. More...
 
int ast_channel_datastore_remove (struct ast_channel *chan, struct ast_datastore *datastore)
 Remove a datastore from a channel. More...
 
struct ast_datastore_listast_channel_datastores (struct ast_channel *chan)
 
int ast_channel_defer_dtmf (struct ast_channel *chan)
 Defers DTMF so that you only read things like hangups and audio. More...
 
const char * ast_channel_dialcontext (const 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)
 
int ast_channel_early_bridge (struct ast_channel *c0, struct ast_channel *c1)
 Bridge two channels together (early) More...
 
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)
 
void ast_channel_end_dtmf (struct ast_channel *chan, char digit, struct timeval start, const char *why)
 Simulate a DTMF end on a broken bridge channel. More...
 
int ast_channel_epfd (const struct ast_channel *chan)
 
void ast_channel_epfd_set (struct ast_channel *chan, int value)
 
enum ast_channel_error ast_channel_errno (void)
 Get error code for latest channel operation. More...
 
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)
 
int ast_channel_feature_hooks_append (struct ast_channel *chan, struct ast_bridge_features *features)
 Appends to the channel-attached features a channel has access to upon being bridged. More...
 
struct ast_bridge_featuresast_channel_feature_hooks_get (struct ast_channel *chan)
 Gets the channel-attached features a channel has access to upon being bridged. More...
 
int ast_channel_feature_hooks_replace (struct ast_channel *chan, struct ast_bridge_features *features)
 Sets the channel-attached features a channel has access to upon being bridged. More...
 
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 varsheadast_channel_get_ari_vars (struct ast_channel *chan)
 Gets the variables for a given channel, as specified by ast_channel_set_ari_vars(). More...
 
struct ast_bridgeast_channel_get_bridge (const struct ast_channel *chan)
 Get the bridge associated with a channel. More...
 
struct ast_bridge_channelast_channel_get_bridge_channel (struct ast_channel *chan)
 Get a reference to the channel's bridge pointer. More...
 
int ast_channel_get_cc_agent_type (struct ast_channel *chan, char *agent_type, size_t size)
 Find the appropriate CC agent type to use given a channel. More...
 
struct ast_cc_config_paramsast_channel_get_cc_config_params (struct ast_channel *chan)
 Get the CCSS parameters from a channel. More...
 
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...
 
int ast_channel_get_device_name (struct ast_channel *chan, char *device_name, size_t name_buffer_length)
 Get a device name given its channel structure. More...
 
int ast_channel_get_duration (struct ast_channel *chan)
 Obtain how long the channel since the channel was created. More...
 
int64_t ast_channel_get_duration_ms (struct ast_channel *chan)
 Obtain how long it's been, in milliseconds, since the channel was created. More...
 
int ast_channel_get_intercept_mode (void)
 Am I currently running an intercept dialplan routine. More...
 
struct varsheadast_channel_get_manager_vars (struct ast_channel *chan)
 Gets the variables for a given channel, as specified by ast_channel_set_manager_vars(). 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...
 
static enum ast_t38_state ast_channel_get_t38_state (struct ast_channel *chan)
 Retrieves the current T38 state of a channel. More...
 
int ast_channel_get_up_time (struct ast_channel *chan)
 Obtain how long it has been since the channel was answered. More...
 
int64_t ast_channel_get_up_time_ms (struct ast_channel *chan)
 Obtain how long it has been since the channel was answered in ms. More...
 
struct varsheadast_channel_get_vars (struct ast_channel *chan)
 Gets the variables for a given channel, as set using pbx_builtin_setvar_helper(). 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_hash_set (struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
 Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel. More...
 
void ast_channel_hangupcause_set (struct ast_channel *chan, int value)
 
const char * ast_channel_hangupsource (const struct ast_channel *chan)
 
int ast_channel_has_ari_vars (void)
 Return whether or not any ARI variables have been set. More...
 
int ast_channel_has_audio_frame_or_monitor (struct ast_channel *chan)
 Check if the channel has active audiohooks, active framehooks, or a monitor. More...
 
int ast_channel_has_hook_requiring_audio (struct ast_channel *chan)
 Check if the channel has any active hooks that require audio. More...
 
int ast_channel_has_manager_vars (void)
 Return whether or not any manager variables have been set. More...
 
int ast_channel_hold_state (const struct ast_channel *chan)
 
void ast_channel_hold_state_set (struct ast_channel *chan, int value)
 
void ast_channel_inherit_variables (const struct ast_channel *parent, struct ast_channel *child)
 Inherits channel variable from parent to child channel. More...
 
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)
 
struct ast_channelast_channel_internal_bridged_channel (const struct ast_channel *chan)
 
void ast_channel_internal_bridged_channel_set (struct ast_channel *chan, struct ast_channel *value)
 
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...
 
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)
 
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_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_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_bridged (const struct ast_channel *chan)
 Determine if a channel is in a bridge. More...
 
int ast_channel_is_leaving_bridge (struct ast_channel *chan)
 Determine if a channel is leaving a bridge, but not hung up. 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_language (const struct ast_channel *chan)
 
const char * ast_channel_lastcontext (const struct ast_channel *chan)
 
const char * ast_channel_lastexten (const struct ast_channel *chan)
 
const char * ast_channel_latest_musicclass (const struct ast_channel *chan)
 
const char * ast_channel_linkedid (const struct ast_channel *chan)
 
int ast_channel_make_compatible (struct ast_channel *chan, struct ast_channel *peer)
 Make the frame formats of two channels compatible. More...
 
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)
 
int ast_channel_move (struct ast_channel *dest, struct ast_channel *source)
 Move a channel from its current location to a new location. More...
 
void * ast_channel_music_state (const struct ast_channel *chan)
 
void ast_channel_music_state_set (struct ast_channel *chan, void *value)
 
const char * ast_channel_musicclass (const struct ast_channel *chan)
 
const char * ast_channel_name (const struct ast_channel *chan)
 
void ast_channel_name_to_dial_string (char *channel_name)
 Removes the trailing identifiers from a channel name string. More...
 
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)
 
const char * ast_channel_oldest_linkedid (const char *a, const char *b)
 Return the oldest linkedid between two channels. More...
 
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)
 
const char * ast_channel_parkinglot (const struct ast_channel *chan)
 
struct ast_pbxast_channel_pbx (const struct ast_channel *chan)
 
void ast_channel_pbx_set (struct ast_channel *chan, struct ast_pbx *value)
 
const char * ast_channel_peeraccount (const struct ast_channel *chan)
 
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)
 
int ast_channel_queryoption (struct ast_channel *channel, int option, void *data, int *datalen, int block)
 Checks the value of an option. More...
 
void ast_channel_queue_connected_line_update (struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
 Queue a connected line update frame on a channel. More...
 
void ast_channel_queue_redirecting_update (struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
 Queue a redirecting update frame on a channel. More...
 
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)
 
const char * ast_channel_reason2str (int reason)
 return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument More...
 
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_redirecting_sub (struct ast_channel *autoservice_chan, struct ast_channel *sub_chan, const void *redirecting_info, int is_frame)
 Run a redirecting interception subroutine and update a channel's redirecting information. More...
 
int ast_channel_register (const struct ast_channel_tech *tech)
 Register a channel technology (a new channel driver) Called by a channel module to register the kind of channels it supports. More...
 
struct ast_channelast_channel_release (struct ast_channel *chan)
 Unlink and release reference to a channel. More...
 
void ast_channel_req_accountcodes (struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
 Setup new channel accountcodes from the requestor channel after ast_request(). More...
 
void ast_channel_req_accountcodes_precious (struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
 Setup new channel accountcodes from the requestor channel after ast_request(). More...
 
int ast_channel_request_stream_topology_change (struct ast_channel *chan, struct ast_stream_topology *topology, void *change_source)
 Request that the stream topology of a channel change. More...
 
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)
 
int ast_channel_sendhtml (struct ast_channel *channel, int subclass, const char *data, int datalen)
 Sends HTML on given channel Send HTML or URL on link. More...
 
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)
 
int ast_channel_sendurl (struct ast_channel *channel, const char *url)
 Sends a URL on a given link Send URL on link. More...
 
void ast_channel_set_ari_vars (size_t varc, char **vars)
 Sets the variables to be stored in the ari_vars field of all snapshots. More...
 
void ast_channel_set_caller (struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
 Set the caller id information in the Asterisk channel. More...
 
void ast_channel_set_caller_event (struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
 Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name or number changed. More...
 
void ast_channel_set_connected_line (struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
 Set the connected line information in the Asterisk channel. More...
 
void ast_channel_set_fd (struct ast_channel *chan, int which, int fd)
 
void ast_channel_set_flag (struct ast_channel *chan, unsigned int flag)
 Set a flag on a channel. More...
 
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_manager_vars (size_t varc, char **vars)
 Sets the variables to be stored in the manager_vars field of all snapshots. 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)
 
void ast_channel_set_redirecting (struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
 Set the redirecting id information in the Asterisk channel. More...
 
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)
 
int ast_channel_setoption (struct ast_channel *channel, int option, void *data, int datalen, int block)
 Sets an option on a channel. More...
 
void ast_channel_setwhentohangup_tv (struct ast_channel *chan, struct timeval offset)
 Set when to hang a channel up. More...
 
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)
 
void ast_channel_softhangup_withcause_locked (struct ast_channel *chan, int causecode)
 Lock the given channel, then request softhangup on the channel with the given causecode. More...
 
struct ast_silence_generatorast_channel_start_silence_generator (struct ast_channel *chan)
 Starts a silence generator on the given channel. More...
 
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)
 
void ast_channel_stop_silence_generator (struct ast_channel *chan, struct ast_silence_generator *state)
 Stops a previously-started silence generator on the given channel. More...
 
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_stream_topology_changed (struct ast_channel *chan, struct ast_stream_topology *topology)
 Provide notice to a channel that the stream topology has changed. More...
 
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 renegotiating. More...
 
int ast_channel_streamid (const struct ast_channel *chan)
 
void ast_channel_streamid_set (struct ast_channel *chan, int value)
 
enum ama_flags ast_channel_string2amaflag (const char *flag)
 Convert a string to a detail record AMA flag. More...
 
int ast_channel_supports_html (struct ast_channel *channel)
 Checks for HTML support on a channel. More...
 
int ast_channel_suppress (struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
 Suppress passing of a frame type on a channel. More...
 
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)
 
const char * ast_channel_tenantid (const struct ast_channel *chan)
 
void ast_channel_tenantid_set (struct ast_channel *chan, const char *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...
 
void ast_channel_undefer_dtmf (struct ast_channel *chan)
 Unset defer DTMF flag on channel. More...
 
const char * ast_channel_uniqueid (const struct ast_channel *chan)
 
void ast_channel_unlink (struct ast_channel *chan)
 Remove a channel from the global channels container. More...
 
void ast_channel_unregister (const struct ast_channel_tech *tech)
 Unregister a channel technology. More...
 
int ast_channel_unsuppress (struct ast_channel *chan, unsigned int direction, enum ast_frame_type frametype)
 Stop suppressing of a frame type on a channel. More...
 
void ast_channel_update_connected_line (struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
 Indicate that the connected line information has changed. More...
 
void ast_channel_update_redirecting (struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
 Indicate that the redirecting id has changed. More...
 
const char * ast_channel_userfield (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_channelast_channel_yank (struct ast_channel *yankee)
 Gain control of a channel in the system. More...
 
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)
 
struct ast_variableast_channeltype_list (void)
 return an ast_variable list of channeltypes More...
 
int ast_check_hangup (struct ast_channel *chan)
 Check to see if a channel is needing hang up. More...
 
int ast_check_hangup_locked (struct ast_channel *chan)
 
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. More...
 
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. More...
 
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. More...
 
int ast_connected_line_parse_data (const unsigned char *data, size_t datalen, struct ast_party_connected_line *connected)
 Parse connected line indication frame data. More...
 
void ast_deactivate_generator (struct ast_channel *chan)
 
static int ast_fdisset (struct pollfd *pfds, int fd, int maximum, int *start)
 Helper function for migrating select to poll. More...
 
const struct ast_channel_techast_get_channel_tech (const char *name)
 Get a channel technology structure by name. More...
 
ast_group_t ast_get_group (const char *s)
 
struct ast_namedgroups * ast_get_namedgroups (const char *s)
 Create an ast_namedgroups set with group names from comma separated string. More...
 
void ast_hangup (struct ast_channel *chan)
 Hang up a channel. More...
 
int ast_indicate (struct ast_channel *chan, int condition)
 Indicates condition of channel. More...
 
int ast_indicate_data (struct ast_channel *chan, int condition, const void *data, size_t datalen)
 Indicates condition of channel, with payload. More...
 
int ast_is_deferrable_frame (const struct ast_frame *frame)
 Should we keep this frame for later? More...
 
int ast_namedgroups_intersect (struct ast_namedgroups *a, struct ast_namedgroups *b)
 Return TRUE if group a and b contain at least one common groupname. More...
 
void ast_party_caller_copy (struct ast_party_caller *dest, const struct ast_party_caller *src)
 Copy the source caller information to the destination caller. More...
 
void ast_party_caller_free (struct ast_party_caller *doomed)
 Destroy the caller party contents. More...
 
void ast_party_caller_init (struct ast_party_caller *init)
 Initialize the given caller structure. More...
 
void ast_party_caller_set (struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update)
 Set the caller information based on another caller source. More...
 
void ast_party_caller_set_init (struct ast_party_caller *init, const struct ast_party_caller *guide)
 Initialize the given caller structure using the given guide for a set update operation. More...
 
void ast_party_connected_line_collect_caller (struct ast_party_connected_line *connected, struct ast_party_caller *caller)
 Collect the caller party information into a connected line structure. More...
 
void ast_party_connected_line_copy (struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
 Copy the source connected line information to the destination connected line. More...
 
void ast_party_connected_line_free (struct ast_party_connected_line *doomed)
 Destroy the connected line information contents. More...
 
void ast_party_connected_line_init (struct ast_party_connected_line *init)
 Initialize the given connected line structure. More...
 
void ast_party_connected_line_set (struct ast_party_connected_line *dest, const struct ast_party_connected_line *src, const struct ast_set_party_connected_line *update)
 Set the connected line information based on another connected line source. More...
 
void ast_party_connected_line_set_init (struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
 Initialize the given connected line structure using the given guide for a set update operation. More...
 
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. More...
 
void ast_party_dialed_free (struct ast_party_dialed *doomed)
 Destroy the dialed party contents. More...
 
void ast_party_dialed_init (struct ast_party_dialed *init)
 Initialize the given dialed structure. More...
 
void ast_party_dialed_set (struct ast_party_dialed *dest, const struct ast_party_dialed *src)
 Set the dialed information based on another dialed source. More...
 
void ast_party_dialed_set_init (struct ast_party_dialed *init, const struct ast_party_dialed *guide)
 Initialize the given dialed structure using the given guide for a set update operation. More...
 
void ast_party_id_copy (struct ast_party_id *dest, const struct ast_party_id *src)
 Copy the source party id information to the destination party id. More...
 
void ast_party_id_free (struct ast_party_id *doomed)
 Destroy the party id contents. More...
 
void ast_party_id_init (struct ast_party_id *init)
 Initialize the given party id structure. More...
 
void ast_party_id_invalidate (struct ast_party_id *id)
 Invalidate all components of the given party id. More...
 
struct ast_party_id ast_party_id_merge (struct ast_party_id *base, struct ast_party_id *overlay)
 Merge a given party id into another given party id. More...
 
void ast_party_id_merge_copy (struct ast_party_id *dest, struct ast_party_id *base, struct ast_party_id *overlay)
 Copy a merge of a given party id into another given party id to a given destination party id. More...
 
int ast_party_id_presentation (const struct ast_party_id *id)
 Determine the overall presentation value for the given party. More...
 
void ast_party_id_reset (struct ast_party_id *id)
 Destroy and initialize the given party id structure. More...
 
void ast_party_id_set (struct ast_party_id *dest, const struct ast_party_id *src, const struct ast_set_party_id *update)
 Set the source party id information into the destination party id. More...
 
void ast_party_id_set_init (struct ast_party_id *init, const struct ast_party_id *guide)
 Initialize the given party id structure using the given guide for a set update operation. More...
 
void ast_party_name_copy (struct ast_party_name *dest, const struct ast_party_name *src)
 Copy the source party name information to the destination party name. More...
 
void ast_party_name_free (struct ast_party_name *doomed)
 Destroy the party name contents. More...
 
void ast_party_name_init (struct ast_party_name *init)
 Initialize the given name structure. More...
 
void ast_party_name_set (struct ast_party_name *dest, const struct ast_party_name *src)
 Set the source party name information into the destination party name. More...
 
void ast_party_name_set_init (struct ast_party_name *init, const struct ast_party_name *guide)
 Initialize the given party name structure using the given guide for a set update operation. More...
 
void ast_party_number_copy (struct ast_party_number *dest, const struct ast_party_number *src)
 Copy the source party number information to the destination party number. More...
 
void ast_party_number_free (struct ast_party_number *doomed)
 Destroy the party number contents. More...
 
void ast_party_number_init (struct ast_party_number *init)
 Initialize the given number structure. More...
 
void ast_party_number_set (struct ast_party_number *dest, const struct ast_party_number *src)
 Set the source party number information into the destination party number. More...
 
void ast_party_number_set_init (struct ast_party_number *init, const struct ast_party_number *guide)
 Initialize the given party number structure using the given guide for a set update operation. More...
 
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. More...
 
void ast_party_redirecting_free (struct ast_party_redirecting *doomed)
 Destroy the redirecting information contents. More...
 
void ast_party_redirecting_init (struct ast_party_redirecting *init)
 Initialize the given redirecting structure. More...
 
void ast_party_redirecting_reason_copy (struct ast_party_redirecting_reason *dest, const struct ast_party_redirecting_reason *src)
 Copy the source redirecting reason information to the destination redirecting reason. More...
 
void ast_party_redirecting_reason_free (struct ast_party_redirecting_reason *doomed)
 Destroy the redirecting reason contents. More...
 
void ast_party_redirecting_reason_init (struct ast_party_redirecting_reason *init)
 Initialize the given redirecting reason structure. More...
 
void ast_party_redirecting_reason_set (struct ast_party_redirecting_reason *dest, const struct ast_party_redirecting_reason *src)
 Set the redirecting reason information based on another redirecting reason source. More...
 
void ast_party_redirecting_reason_set_init (struct ast_party_redirecting_reason *init, const struct ast_party_redirecting_reason *guide)
 Initialize the given redirecting reason structure using the given guide for a set update operation. More...
 
void ast_party_redirecting_set (struct ast_party_redirecting *dest, const struct ast_party_redirecting *src, const struct ast_set_party_redirecting *update)
 Set the redirecting information based on another redirecting source. More...
 
void ast_party_redirecting_set_init (struct ast_party_redirecting *init, const struct ast_party_redirecting *guide)
 Initialize the given redirecting id structure using the given guide for a set update operation. More...
 
void ast_party_subaddress_copy (struct ast_party_subaddress *dest, const struct ast_party_subaddress *src)
 Copy the source party subaddress information to the destination party subaddress. More...
 
void ast_party_subaddress_free (struct ast_party_subaddress *doomed)
 Destroy the party subaddress contents. More...
 
void ast_party_subaddress_init (struct ast_party_subaddress *init)
 Initialize the given subaddress structure. More...
 
void ast_party_subaddress_set (struct ast_party_subaddress *dest, const struct ast_party_subaddress *src)
 Set the source party subaddress information into the destination party subaddress. More...
 
void ast_party_subaddress_set_init (struct ast_party_subaddress *init, const struct ast_party_subaddress *guide)
 Initialize the given party subaddress structure using the given guide for a set update operation. More...
 
int ast_pre_call (struct ast_channel *chan, const char *sub_args)
 Execute a Gosub call on the channel before a call is placed. More...
 
char * ast_print_group (char *buf, int buflen, ast_group_t group)
 Print call and pickup groups into buffer. More...
 
char * ast_print_namedgroups (struct ast_str **buf, struct ast_namedgroups *groups)
 Print named call groups and named pickup groups. More...
 
int ast_prod (struct ast_channel *chan)
 Send empty audio to prime a channel driver. More...
 
int ast_queue_answer (struct ast_channel *chan, const struct ast_stream_topology *topology)
 Queue an ANSWER control frame with topology. More...
 
int ast_queue_control (struct ast_channel *chan, enum ast_control_frame_type control)
 Queue a control frame without payload. More...
 
int ast_queue_control_data (struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
 Queue a control frame with payload. More...
 
int ast_queue_frame (struct ast_channel *chan, struct ast_frame *f)
 Queue one or more frames to a channel's frame queue. More...
 
int ast_queue_frame_head (struct ast_channel *chan, struct ast_frame *f)
 Queue one or more frames to the head of a channel's frame queue. More...
 
int ast_queue_hangup (struct ast_channel *chan)
 Queue a hangup frame. More...
 
int ast_queue_hangup_with_cause (struct ast_channel *chan, int cause)
 Queue a hangup frame with hangupcause set. More...
 
int ast_queue_hold (struct ast_channel *chan, const char *musicclass)
 Queue a hold frame. More...
 
int ast_queue_unhold (struct ast_channel *chan)
 Queue an unhold frame. More...
 
int ast_raw_answer (struct ast_channel *chan)
 Answer a channel. More...
 
int ast_raw_answer_with_stream_topology (struct ast_channel *chan, struct ast_stream_topology *topology)
 Answer a channel passing in a stream topology. More...
 
struct ast_frameast_read (struct ast_channel *chan)
 Reads a frame. More...
 
struct ast_frameast_read_noaudio (struct ast_channel *chan)
 Reads a frame, returning AST_FRAME_NULL frame if audio. More...
 
struct ast_frameast_read_stream (struct ast_channel *chan)
 Reads a frame, but does not filter to just the default streams. More...
 
struct ast_frameast_read_stream_noaudio (struct ast_channel *chan)
 Reads a frame, but does not filter to just the default streams, returning AST_FRAME_NULL frame if audio. More...
 
int ast_readstring (struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders)
 Reads multiple digits. More...
 
int ast_readstring_full (struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders, int audiofd, int ctrlfd)
 
int ast_recvchar (struct ast_channel *chan, int timeout)
 Receives a text character from a channel. More...
 
char * ast_recvtext (struct ast_channel *chan, int timeout)
 Receives a text string from a channel Read a string of text from a channel. More...
 
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. More...
 
int ast_redirecting_parse_data (const unsigned char *data, size_t datalen, struct ast_party_redirecting *redirecting)
 Parse redirecting indication frame data. More...
 
struct ast_namedgroups * ast_ref_namedgroups (struct ast_namedgroups *groups)
 
struct ast_channelast_request (const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
 Requests a channel. More...
 
struct ast_channelast_request_and_dial (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int timeout, int *reason, const char *cid_num, const char *cid_name)
 Request a channel of a given type, with data as optional information used by the low level module and attempt to place a call on it. More...
 
struct ast_channelast_request_with_stream_topology (const char *type, struct ast_stream_topology *topology, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
 Requests a channel (specifying stream topology) More...
 
int ast_safe_sleep (struct ast_channel *chan, int ms)
 Wait for a specified amount of time, looking for hangups. More...
 
int ast_safe_sleep_conditional (struct ast_channel *chan, int ms, int(*cond)(void *), void *data)
 Wait for a specified amount of time, looking for hangups and a condition argument. More...
 
int ast_safe_sleep_without_silence (struct ast_channel *chan, int ms)
 Wait for a specified amount of time, looking for hangups, and do not generate silence. More...
 
int ast_senddigit (struct ast_channel *chan, char digit, unsigned int duration)
 Send a DTMF digit to a channel. More...
 
int ast_senddigit_begin (struct ast_channel *chan, char digit)
 Send a DTMF digit to a channel. More...
 
int ast_senddigit_end (struct ast_channel *chan, char digit, unsigned int duration)
 Send a DTMF digit to a channel. More...
 
int ast_senddigit_external (struct ast_channel *chan, char digit, unsigned int duration)
 Send a DTMF digit to a channel from an external thread. More...
 
int ast_senddigit_mf (struct ast_channel *chan, char digit, unsigned int duration, unsigned int durationkp, unsigned int durationst, int is_external)
 Send an MF digit to a channel. More...
 
int ast_senddigit_mf_begin (struct ast_channel *chan, char digit)
 Send an MF digit to a channel. More...
 
int ast_senddigit_mf_end (struct ast_channel *chan)
 End sending an MF digit to a channel. More...
 
int ast_sendtext (struct ast_channel *chan, const char *text)
 Sends text to a channel. More...
 
int ast_sendtext_data (struct ast_channel *chan, struct ast_msg_data *msg)
 Sends text to a channel in an ast_msg_data structure wrapper with ast_sendtext as fallback. More...
 
void ast_set_callerid (struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
 Set caller ID number, name and ANI and generate AMI event. More...
 
void ast_set_hangupsource (struct ast_channel *chan, const char *source, int force)
 Set the source of the hangup in this channel and it's bridge. More...
 
void ast_set_party_id_all (struct ast_set_party_id *update_id)
 Set the update marker to update all information of a corresponding party id. More...
 
int ast_set_read_format (struct ast_channel *chan, struct ast_format *format)
 Sets read format on channel chan. More...
 
int ast_set_read_format_from_cap (struct ast_channel *chan, struct ast_format_cap *formats)
 Sets read format on channel chan from capabilities Set read format for channel to whichever component of "format" is best. More...
 
int ast_set_read_format_path (struct ast_channel *chan, struct ast_format *raw_format, struct ast_format *core_format)
 Set specific read path on channel. More...
 
void ast_set_variables (struct ast_channel *chan, struct ast_variable *vars)
 adds a list of channel variables to a channel More...
 
int ast_set_write_format (struct ast_channel *chan, struct ast_format *format)
 Sets write format on channel chan. More...
 
int ast_set_write_format_from_cap (struct ast_channel *chan, struct ast_format_cap *formats)
 Sets write format on channel chan Set write format for channel to whichever component of "format" is best. More...
 
int ast_set_write_format_interleaved_stereo (struct ast_channel *chan, struct ast_format *format)
 Sets write format for a channel. All internal data will than be handled in an interleaved format. (needed by binaural opus) More...
 
int ast_set_write_format_path (struct ast_channel *chan, struct ast_format *core_format, struct ast_format *raw_format)
 Set specific write path on channel. More...
 
int ast_settimeout (struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data)
 Enable or disable timer ticks for a channel. More...
 
int ast_settimeout_full (struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data, unsigned int is_ao2_obj)
 
int ast_softhangup (struct ast_channel *chan, int cause)
 Softly hangup up a channel. More...
 
void ast_softhangup_all (void)
 Soft hangup all active channels. More...
 
int ast_softhangup_nolock (struct ast_channel *chan, int cause)
 Softly hangup up a channel (no channel lock) More...
 
const char * ast_state2str (enum ast_channel_state state)
 Gives the string form of a given channel state. More...
 
int ast_str2cause (const char *name) attribute_pure
 Convert the string form of a cause code to a number. More...
 
int ast_tonepair (struct ast_channel *chan, int freq1, int freq2, int duration, int vol)
 
int ast_tonepair_start (struct ast_channel *chan, int freq1, int freq2, int duration, int vol)
 
void ast_tonepair_stop (struct ast_channel *chan)
 
int ast_transfer (struct ast_channel *chan, char *dest)
 Transfer a channel (if supported). More...
 
int ast_transfer_protocol (struct ast_channel *chan, char *dest, int *protocol)
 Transfer a channel (if supported) receieve protocol result. More...
 
char * ast_transfercapability2str (int transfercapability) attribute_const
 Gives the string form of a given transfer capability. More...
 
int ast_undestroyed_channels (void)
 
struct ast_namedgroups * ast_unref_namedgroups (struct ast_namedgroups *groups)
 
int ast_waitfor (struct ast_channel *chan, int ms)
 Wait for input on a channel. More...
 
struct ast_channelast_waitfor_n (struct ast_channel **chan, int n, int *ms)
 Waits for input on a group of channels Wait for input on an array of channels for a given # of milliseconds. More...
 
int ast_waitfor_n_fd (int *fds, int n, int *ms, int *exception)
 Waits for input on an fd. More...
 
struct ast_channelast_waitfor_nandfds (struct ast_channel **c, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
 Waits for activity on a group of channels. More...
 
int ast_waitfordigit (struct ast_channel *c, int ms)
 Waits for a digit. More...
 
int ast_waitfordigit_full (struct ast_channel *c, int ms, const char *breakon, int audiofd, int ctrlfd)
 Wait for a digit Same as ast_waitfordigit() with audio fd for outputting read audio and ctrlfd to monitor for reading. More...
 
int ast_write (struct ast_channel *chan, struct ast_frame *frame)
 Write a frame to a channel This function writes the given frame to the indicated channel. More...
 
int ast_write_stream (struct ast_channel *chan, int stream_num, struct ast_frame *frame)
 Write a frame to a stream This function writes the given frame to the indicated stream on the channel. More...
 
int ast_write_text (struct ast_channel *chan, struct ast_frame *frame)
 Write text frame to a channel This function writes the given frame to the indicated channel. More...
 
int ast_write_video (struct ast_channel *chan, struct ast_frame *frame)
 Write video frame to a channel This function writes the given frame to the indicated channel. More...
 
 DECLARE_STRINGFIELD_SETTERS_FOR (accountcode)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (call_forward)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (dialcontext)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (hangupsource)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (language)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (latest_musicclass)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (linkedid)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (musicclass)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (name)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (parkinglot)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (peeraccount)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (uniqueid)
 
 DECLARE_STRINGFIELD_SETTERS_FOR (userfield)
 
struct ast_channel_iteratorast_channel_iterator_all_new (void)
 Create a new channel iterator. More...
 
struct ast_channel_iteratorast_channel_iterator_by_exten_new (const char *exten, const char *context)
 Create a new channel iterator based on extension. More...
 
struct ast_channel_iteratorast_channel_iterator_by_name_new (const char *name, size_t name_len)
 Create a new channel iterator based on name. More...
 
struct ast_channel_iteratorast_channel_iterator_destroy (struct ast_channel_iterator *i)
 Destroy a channel iterator. More...
 
struct ast_channelast_channel_iterator_next (struct ast_channel_iterator *i)
 Get the next channel for a channel iterator. More...
 
struct ast_channelast_channel_get_by_exten (const char *exten, const char *context)
 Find a channel by extension and context. More...
 
struct ast_channelast_channel_get_by_name (const char *name)
 Find a channel by name. More...
 
struct ast_channelast_channel_get_by_name_prefix (const char *name, size_t name_len)
 Find a channel by a name prefix. More...
 

Variables

const struct ast_channel_tech ast_kill_tech
 Kill the channel channel driver technology descriptor. More...
 
static const char ast_stream_topology_changed_external [] = "external"
 Set as the change source reason when a channel stream topology has been changed externally as a result of the remote side renegotiating. More...
 
unsigned long global_fin
 
unsigned long global_fout
 

Detailed Description

General Asterisk PBX channel definitions.

See also:

Definition in file channel.h.

Macro Definition Documentation

◆ AST_AGENT_FD

#define AST_AGENT_FD   (AST_MAX_FDS-3)

used by agents for pass through

Definition at line 204 of file channel.h.

◆ AST_ALERT_FD

#define AST_ALERT_FD   (AST_MAX_FDS-1)

used for alertpipe

Definition at line 202 of file channel.h.

◆ AST_BRIDGE_DTMF_CHANNEL_0

#define AST_BRIDGE_DTMF_CHANNEL_0   (1 << 0)

Report DTMF on channel 0.

Definition at line 2416 of file channel.h.

◆ AST_BRIDGE_DTMF_CHANNEL_1

#define AST_BRIDGE_DTMF_CHANNEL_1   (1 << 1)

Report DTMF on channel 1.

Definition at line 2418 of file channel.h.

◆ AST_CHAN_WRITE_INFO_T_VERSION

#define AST_CHAN_WRITE_INFO_T_VERSION   1

ast_chan_write_info_t version. Must be incremented if structure is changed

Definition at line 593 of file channel.h.

◆ ast_channel_alloc

#define ast_channel_alloc (   needqueue,
  state,
  cid_num,
  cid_name,
  acctcode,
  exten,
  context,
  assignedids,
  requestor,
  amaflag,
  ... 
)
Value:
__ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, NULL, \
__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
struct ast_channel * __ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint, const char *file, int line, const char *function, const char *name_fmt,...)
Create a channel structure.
Definition: channel.c:954
#define NULL
Definition: resample.c:96

Create a channel structure.

Return values
NULLfailure
non-NULLsuccessfully allocated channel
Note
Absolutely NO channel locks should be held before calling this function.
By default, new channels are set to the "s" extension and "default" context.
Since 12.0.0 this function returns with the newly created channel locked.

Definition at line 1299 of file channel.h.

◆ ast_channel_alloc_with_endpoint

#define ast_channel_alloc_with_endpoint (   needqueue,
  state,
  cid_num,
  cid_name,
  acctcode,
  exten,
  context,
  assignedids,
  requestor,
  amaflag,
  endpoint,
  ... 
)
Value:
__ast_channel_alloc((needqueue), (state), (cid_num), (cid_name), (acctcode), (exten), (context), (assignedids), (requestor), (amaflag), (endpoint), \
__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)

Definition at line 1303 of file channel.h.

◆ ast_channel_alloc_with_initializers

#define ast_channel_alloc_with_initializers (   needqueue,
  state,
  cid_num,
  cid_name,
  acctcode,
  exten,
  context,
  assignedids,
  requestor,
  amaflag,
  endpoint,
  initializers,
  ... 
)
Value:
__ast_channel_alloc_with_initializers((needqueue), (state), (cid_num), (cid_name), (acctcode), (exten), (context), (assignedids), (requestor), (amaflag), (endpoint), \
(initializers), __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
struct ast_channel * __ast_channel_alloc_with_initializers(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint, struct ast_channel_initializers *initializers, const char *file, int line, const char *function, const char *name_fmt,...)
Create a channel structure.
Definition: channel.c:973

Definition at line 1307 of file channel.h.

◆ ast_channel_cleanup

#define ast_channel_cleanup (   c)    ({ ao2_cleanup(c); (struct ast_channel *) (NULL); })

Cleanup a channel reference.

Parameters
cthe channel (NULL tolerant)
Return values
NULLalways
Since
12.0.0

Definition at line 3015 of file channel.h.

◆ ast_channel_has_tech_function

#define ast_channel_has_tech_function (   chan,
  function 
)     (ast_channel_tech(chan) ? ast_channel_tech(chan)->function != NULL : 0)

Checks if a channel's technology implements a particular callback function.

Since
18.0.0
Parameters
chanThe channel
functionThe function to look for
Return values
1if the channel has a technology set and it implements the function
0if the channel doesn't have a technology set or it doesn't implement the function

Definition at line 4996 of file channel.h.

◆ AST_CHANNEL_INITIALIZERS_VERSION

#define AST_CHANNEL_INITIALIZERS_VERSION   1

struct ABI version

Note
This must be incremented when the struct changes.

Definition at line 620 of file channel.h.

◆ ast_channel_lock

#define ast_channel_lock (   chan)    ao2_lock(chan)

Definition at line 2968 of file channel.h.

◆ ast_channel_lock_both

#define ast_channel_lock_both (   chan1,
  chan2 
)

Lock two channels.

Definition at line 2975 of file channel.h.

◆ AST_CHANNEL_NAME

#define AST_CHANNEL_NAME   80

Max length of an ast_channel name

Definition at line 173 of file channel.h.

◆ ast_channel_ref

#define ast_channel_ref (   c)    ({ ao2_ref(c, +1); (c); })

Increase channel reference count.

Parameters
cthe channel
Return values
calways
Since
1.8

Definition at line 2993 of file channel.h.

◆ ast_channel_trylock

#define ast_channel_trylock (   chan)    ao2_trylock(chan)

Definition at line 2970 of file channel.h.

◆ ast_channel_unlock

#define ast_channel_unlock (   chan)    ao2_unlock(chan)

Definition at line 2969 of file channel.h.

◆ ast_channel_unref

#define ast_channel_unref (   c)    ({ ao2_ref(c, -1); (struct ast_channel *) (NULL); })

Decrease channel reference count.

Parameters
cthe channel
Return values
NULLalways
Since
1.8

Definition at line 3004 of file channel.h.

◆ ast_dummy_channel_alloc

#define ast_dummy_channel_alloc ( )    __ast_dummy_channel_alloc(__FILE__, __LINE__, __PRETTY_FUNCTION__)

Create a fake channel structure.

Return values
NULLfailure
non-NULLsuccessfully allocated channel
Note
This function should ONLY be used to create a fake channel that can then be populated with data for use in variable substitution when a real channel does not exist.
The created dummy channel should be destroyed by ast_channel_unref(). Using ast_channel_release() needlessly grabs the channel container lock and can cause a deadlock as a result. Also grabbing the channel container lock reduces system performance.

Definition at line 1328 of file channel.h.

◆ AST_EXTENDED_FDS

#define AST_EXTENDED_FDS   12

the start of extended file descriptor positions

Definition at line 197 of file channel.h.

◆ AST_FEATURE_DTMF_MASK

#define AST_FEATURE_DTMF_MASK
Value:
@ AST_FEATURE_AUTOMIXMON
Definition: channel.h:1089
@ AST_FEATURE_REDIRECT
Definition: channel.h:1084
@ AST_FEATURE_PARKCALL
Definition: channel.h:1088
@ AST_FEATURE_AUTOMON
Definition: channel.h:1087
@ AST_FEATURE_DISCONNECT
Definition: channel.h:1085

Definition at line 1092 of file channel.h.

◆ AST_GENERATOR_FD

#define AST_GENERATOR_FD   (AST_MAX_FDS-4)

used by generator

Definition at line 205 of file channel.h.

◆ AST_JITTERBUFFER_FD

#define AST_JITTERBUFFER_FD   (AST_MAX_FDS-5)

used by generator

Definition at line 206 of file channel.h.

◆ AST_MAX_ACCOUNT_CODE

#define AST_MAX_ACCOUNT_CODE   80

Max length of an account code

Definition at line 172 of file channel.h.

◆ AST_MAX_CONTEXT

#define AST_MAX_CONTEXT   80

Max length of a context

Definition at line 135 of file channel.h.

◆ AST_MAX_EXTENSION

#define AST_MAX_EXTENSION   80

Max length of an extension

Definition at line 134 of file channel.h.

◆ AST_MAX_FDS

#define AST_MAX_FDS   11

original maximum number of file descriptors

Definition at line 196 of file channel.h.

◆ AST_MAX_PUBLIC_UNIQUEID

#define AST_MAX_PUBLIC_UNIQUEID   149

Max length of a channel uniqueid reported to the outside world.

149 = 127 (max systemname) + "-" + 10 (epoch timestamp)

  • "." + 10 (monotonically incrementing integer).
Note
If this value is ever changed, MAX_CHANNEL_ID should be updated in rtp_engine.h.

Definition at line 147 of file channel.h.

◆ AST_MAX_TENANT_ID

#define AST_MAX_TENANT_ID   64

Max length of a channel tenant_id

Definition at line 149 of file channel.h.

◆ AST_MAX_UNIQUEID

#define AST_MAX_UNIQUEID   (AST_MAX_PUBLIC_UNIQUEID + 2 + 1)

Maximum size of an internal Asterisk channel unique ID.

Add two for the Local;2 channel to append a ';2' if needed plus nul terminator.

Note
If this value is ever changed, MAX_CHANNEL_ID should be updated in rtp_engine.h.

Definition at line 170 of file channel.h.

◆ AST_MAX_USER_FIELD

#define AST_MAX_USER_FIELD   256

Max length of the channel user field

Definition at line 176 of file channel.h.

◆ AST_MUTE_DIRECTION_READ

#define AST_MUTE_DIRECTION_READ   (1 << 0)

Definition at line 4760 of file channel.h.

◆ AST_MUTE_DIRECTION_WRITE

#define AST_MUTE_DIRECTION_WRITE   (1 << 1)

Definition at line 4761 of file channel.h.

◆ AST_NUM_CHANNEL_BUCKETS

#define AST_NUM_CHANNEL_BUCKETS   1567

The number of buckets to store channels or channel information

Definition at line 157 of file channel.h.

◆ AST_TIMING_FD

#define AST_TIMING_FD   (AST_MAX_FDS-2)

used for timingfd

Definition at line 203 of file channel.h.

◆ CHECK_BLOCKING

#define CHECK_BLOCKING (   c)

Set the blocking indication on the channel.

Indicate that the thread handling the channel is about to do a blocking operation to wait for media on the channel. (poll, read, or write)

Masquerading and ast_queue_frame() use this indication to wake up the thread.

Precondition
The channel needs to be locked

Definition at line 2917 of file channel.h.

◆ DATASTORE_INHERIT_FOREVER

#define DATASTORE_INHERIT_FOREVER   INT_MAX

Definition at line 194 of file channel.h.

◆ DEBUGCHAN_FLAG

#define DEBUGCHAN_FLAG   0x80000000

The high bit of the frame count is used as a debug marker, so increments of the counters must be done with care. Please use c->fin = FRAMECOUNT_INC(c->fin) and the same for c->fout.

Definition at line 877 of file channel.h.

◆ DECLARE_STRINGFIELD_SETTERS_FOR

#define DECLARE_STRINGFIELD_SETTERS_FOR (   field)
Value:
void ast_channel_##field##_set(struct ast_channel *chan, const char *field); \
void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) __attribute__((format(printf, 2, 0))); \
void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) __attribute__((format(printf, 2, 3)))
Main Channel structure associated with a channel.

Definition at line 4084 of file channel.h.

◆ FRAMECOUNT_INC

#define FRAMECOUNT_INC (   x)    ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) )

Definition at line 880 of file channel.h.

◆ MAX_LANGUAGE

#define MAX_LANGUAGE   40

Max length of the language setting

Definition at line 174 of file channel.h.

◆ MAX_MUSICCLASS

#define MAX_MUSICCLASS   80

Max length of the music class setting

Definition at line 175 of file channel.h.

Typedef Documentation

◆ ast_acf_read2_fn_t

typedef int(* ast_acf_read2_fn_t) (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len)

Typedef for a custom read2 function.

Note
data should be treated as const char *.

Definition at line 582 of file channel.h.

◆ ast_acf_read_fn_t

typedef int(* ast_acf_read_fn_t) (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)

Typedef for a custom read function.

Note
data should be treated as const char *.

Definition at line 576 of file channel.h.

◆ ast_acf_write_fn_t

typedef int(* ast_acf_write_fn_t) (struct ast_channel *chan, const char *function, char *data, const char *value)

Typedef for a custom write function.

Note
data should be treated as const char *.

Definition at line 588 of file channel.h.

◆ ast_group_t

typedef unsigned long long ast_group_t

Definition at line 215 of file channel.h.

◆ ast_timing_func_t

typedef int(* ast_timing_func_t) (const void *data)

Definition at line 919 of file channel.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

ast_channel_tech Properties

Enumerator
AST_CHAN_TP_WANTSJITTER 

Channels have this property if they can accept input with jitter; i.e. most VoIP channels.

AST_CHAN_TP_CREATESJITTER 

Channels have this property if they can create jitter; i.e. most VoIP channels.

AST_CHAN_TP_INTERNAL 

Channels with this particular technology are an implementation detail of Asterisk and should generally not be exposed or manipulated by the outside world.

AST_CHAN_TP_SEND_TEXT_DATA 

Channels have this property if they implement send_text_data.

Definition at line 975 of file channel.h.

975 {
976 /*!
977 * \brief Channels have this property if they can accept input with jitter;
978 * i.e. most VoIP channels
979 */
980 AST_CHAN_TP_WANTSJITTER = (1 << 0),
981 /*!
982 * \brief Channels have this property if they can create jitter;
983 * i.e. most VoIP channels
984 */
985 AST_CHAN_TP_CREATESJITTER = (1 << 1),
986 /*!
987 * \brief Channels with this particular technology are an implementation detail of
988 * Asterisk and should generally not be exposed or manipulated by the outside
989 * world
990 */
991 AST_CHAN_TP_INTERNAL = (1 << 2),
992 /*!
993 * \brief Channels have this property if they implement send_text_data
994 */
996};
@ AST_CHAN_TP_INTERNAL
Channels with this particular technology are an implementation detail of Asterisk and should generall...
Definition: channel.h:991
@ AST_CHAN_TP_SEND_TEXT_DATA
Channels have this property if they implement send_text_data.
Definition: channel.h:995
@ AST_CHAN_TP_WANTSJITTER
Channels have this property if they can accept input with jitter; i.e. most VoIP channels.
Definition: channel.h:980
@ AST_CHAN_TP_CREATESJITTER
Channels have this property if they can create jitter; i.e. most VoIP channels.
Definition: channel.h:985

◆ anonymous enum

anonymous enum

ast_channel flags

Enumerator
AST_FLAG_DEFER_DTMF 

Queue incoming DTMF, to be released when this flag is turned off

AST_FLAG_WRITE_INT 

write should be interrupt generator

AST_FLAG_BLOCKING 

a thread is blocking on this channel

AST_FLAG_ZOMBIE 

This is a zombie channel

AST_FLAG_EXCEPTION 

There is an exception pending

AST_FLAG_MOH 

Listening to moh XXX anthm promises me this will disappear XXX

AST_FLAG_SPYING 

This channel is spying on another channel

AST_FLAG_IN_AUTOLOOP 

the channel is in an auto-incrementing dialplan processor, so when ->priority is set, it will get incremented before finding the next priority to run

AST_FLAG_OUTGOING 

This is an outgoing call

AST_FLAG_IN_DTMF 

A DTMF_BEGIN frame has been read from this channel, but not yet an END

AST_FLAG_EMULATE_DTMF 

A DTMF_END was received when not IN_DTMF, so the length of the digit is currently being emulated

AST_FLAG_END_DTMF_ONLY 

This is set to tell the channel not to generate DTMF begin frames, and to instead only generate END frames.

AST_FLAG_MASQ_NOSTREAM 

This flag indicates that on a masquerade, an active stream should not be carried over

AST_FLAG_BRIDGE_HANGUP_RUN 

This flag indicates that the hangup exten was run when the bridge terminated, a message aimed at preventing a subsequent hangup exten being run at the pbx_run level

AST_FLAG_DISABLE_WORKAROUNDS 

Disable certain workarounds. This reintroduces certain bugs, but allows some non-traditional dialplans (like AGI) to continue to function.

AST_FLAG_DISABLE_DEVSTATE_CACHE 

Disable device state event caching. This allows channel drivers to selectively prevent device state events from being cached by certain channels such as anonymous calls which have no persistent represenatation that can be tracked.

AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT 

This flag indicates that a dual channel redirect is in progress. The bridge needs to wait until the flag is cleared to continue.

AST_FLAG_ORIGINATED 

This flag indicates that the channel was originated.

AST_FLAG_DEAD 

The channel is well and truly dead. Once this is set and published, no further actions should be taken upon the channel, and no further publications should occur.

AST_FLAG_SNAPSHOT_STAGE 

Channel snapshot should not be published, it is being staged for an explicit publish.

AST_FLAG_TIMINGDATA_IS_AO2_OBJ 

The data on chan->timingdata is an astobj2 object.

AST_FLAG_SUBROUTINE_EXEC 

The channel is executing a subroutine or macro

Definition at line 999 of file channel.h.

999 {
1000 /*! Queue incoming DTMF, to be released when this flag is turned off */
1001 AST_FLAG_DEFER_DTMF = (1 << 1),
1002 /*! write should be interrupt generator */
1003 AST_FLAG_WRITE_INT = (1 << 2),
1004 /*! a thread is blocking on this channel */
1005 AST_FLAG_BLOCKING = (1 << 3),
1006 /*! This is a zombie channel */
1007 AST_FLAG_ZOMBIE = (1 << 4),
1008 /*! There is an exception pending */
1009 AST_FLAG_EXCEPTION = (1 << 5),
1010 /*! Listening to moh XXX anthm promises me this will disappear XXX */
1011 AST_FLAG_MOH = (1 << 6),
1012 /*! This channel is spying on another channel */
1013 AST_FLAG_SPYING = (1 << 7),
1014 /*! the channel is in an auto-incrementing dialplan processor,
1015 * so when ->priority is set, it will get incremented before
1016 * finding the next priority to run */
1017 AST_FLAG_IN_AUTOLOOP = (1 << 9),
1018 /*! This is an outgoing call */
1019 AST_FLAG_OUTGOING = (1 << 10),
1020 /*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */
1021 AST_FLAG_IN_DTMF = (1 << 12),
1022 /*! A DTMF_END was received when not IN_DTMF, so the length of the digit is
1023 * currently being emulated */
1024 AST_FLAG_EMULATE_DTMF = (1 << 13),
1025 /*! This is set to tell the channel not to generate DTMF begin frames, and
1026 * to instead only generate END frames. */
1027 AST_FLAG_END_DTMF_ONLY = (1 << 14),
1028 /* OBSOLETED in favor of AST_CAUSE_ANSWERED_ELSEWHERE
1029 * Flag to show channels that this call is hangup due to the fact that the call
1030 * was indeed answered, but in another channel */
1031 /* AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), */
1032 /*! This flag indicates that on a masquerade, an active stream should not
1033 * be carried over */
1034 AST_FLAG_MASQ_NOSTREAM = (1 << 16),
1035 /*! This flag indicates that the hangup exten was run when the bridge terminated,
1036 * a message aimed at preventing a subsequent hangup exten being run at the pbx_run
1037 * level */
1038 AST_FLAG_BRIDGE_HANGUP_RUN = (1 << 17),
1039 /*! Disable certain workarounds. This reintroduces certain bugs, but allows
1040 * some non-traditional dialplans (like AGI) to continue to function.
1041 */
1042 AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20),
1043 /*!
1044 * Disable device state event caching. This allows channel
1045 * drivers to selectively prevent device state events from being
1046 * cached by certain channels such as anonymous calls which have
1047 * no persistent represenatation that can be tracked.
1048 */
1050 /*!
1051 * This flag indicates that a dual channel redirect is in
1052 * progress. The bridge needs to wait until the flag is cleared
1053 * to continue.
1054 */
1056 /*!
1057 * This flag indicates that the channel was originated.
1058 */
1059 AST_FLAG_ORIGINATED = (1 << 23),
1060 /*!
1061 * The channel is well and truly dead. Once this is set and published, no further
1062 * actions should be taken upon the channel, and no further publications should
1063 * occur.
1064 */
1065 AST_FLAG_DEAD = (1 << 24),
1066 /*!
1067 * Channel snapshot should not be published, it is being staged for an explicit
1068 * publish.
1069 */
1070 AST_FLAG_SNAPSHOT_STAGE = (1 << 25),
1071 /*!
1072 * The data on chan->timingdata is an astobj2 object.
1073 */
1075 /*!
1076 * The channel is executing a subroutine or macro
1077 */
1078 AST_FLAG_SUBROUTINE_EXEC = (1 << 27),
1079};
@ AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT
Definition: channel.h:1055
@ AST_FLAG_ZOMBIE
Definition: channel.h:1007
@ AST_FLAG_DISABLE_DEVSTATE_CACHE
Definition: channel.h:1049
@ AST_FLAG_SNAPSHOT_STAGE
Definition: channel.h:1070
@ AST_FLAG_OUTGOING
Definition: channel.h:1019
@ AST_FLAG_BRIDGE_HANGUP_RUN
Definition: channel.h:1038
@ AST_FLAG_MASQ_NOSTREAM
Definition: channel.h:1034
@ AST_FLAG_IN_AUTOLOOP
Definition: channel.h:1017
@ AST_FLAG_END_DTMF_ONLY
Definition: channel.h:1027
@ AST_FLAG_DEAD
Definition: channel.h:1065
@ AST_FLAG_EXCEPTION
Definition: channel.h:1009
@ AST_FLAG_EMULATE_DTMF
Definition: channel.h:1024
@ AST_FLAG_IN_DTMF
Definition: channel.h:1021
@ AST_FLAG_WRITE_INT
Definition: channel.h:1003
@ AST_FLAG_DEFER_DTMF
Definition: channel.h:1001
@ AST_FLAG_BLOCKING
Definition: channel.h:1005
@ AST_FLAG_SPYING
Definition: channel.h:1013
@ AST_FLAG_DISABLE_WORKAROUNDS
Definition: channel.h:1042
@ AST_FLAG_SUBROUTINE_EXEC
Definition: channel.h:1078
@ AST_FLAG_ORIGINATED
Definition: channel.h:1059
@ AST_FLAG_TIMINGDATA_IS_AO2_OBJ
Definition: channel.h:1074
@ AST_FLAG_MOH
Definition: channel.h:1011

◆ anonymous enum

anonymous enum

ast_bridge_config flags

Enumerator
AST_FEATURE_PLAY_WARNING 
AST_FEATURE_REDIRECT 
AST_FEATURE_DISCONNECT 
AST_FEATURE_ATXFER 
AST_FEATURE_AUTOMON 
AST_FEATURE_PARKCALL 
AST_FEATURE_AUTOMIXMON 

Definition at line 1082 of file channel.h.

1082 {
1083 AST_FEATURE_PLAY_WARNING = (1 << 0),
1084 AST_FEATURE_REDIRECT = (1 << 1),
1085 AST_FEATURE_DISCONNECT = (1 << 2),
1086 AST_FEATURE_ATXFER = (1 << 3),
1087 AST_FEATURE_AUTOMON = (1 << 4),
1088 AST_FEATURE_PARKCALL = (1 << 5),
1089 AST_FEATURE_AUTOMIXMON = (1 << 6),
1090};
@ AST_FEATURE_ATXFER
Definition: channel.h:1086
@ AST_FEATURE_PLAY_WARNING
Definition: channel.h:1083

◆ anonymous enum

anonymous enum
Enumerator
AST_SOFTHANGUP_DEV 

Soft hangup requested by device or other internal reason. Actual hangup needed.

AST_SOFTHANGUP_ASYNCGOTO 

Used to break the normal frame flow so an async goto can be done instead of actually hanging up.

AST_SOFTHANGUP_SHUTDOWN 

Soft hangup requested by system shutdown. Actual hangup needed.

AST_SOFTHANGUP_TIMEOUT 

Used to break the normal frame flow after a timeout so an implicit async goto can be done to the 'T' exten if it exists instead of actually hanging up. If the exten does not exist then actually hangup.

AST_SOFTHANGUP_APPUNLOAD 

Soft hangup requested by application/channel-driver being unloaded. Actual hangup needed.

AST_SOFTHANGUP_EXPLICIT 

Soft hangup requested by non-associated party. Actual hangup needed.

AST_SOFTHANGUP_HANGUP_EXEC 

Used to indicate that the channel is currently executing hangup logic in the dialplan. The channel has been hungup when this is set.

AST_SOFTHANGUP_ALL 

All softhangup flags.

This can be used as an argument to ast_channel_clear_softhangup() to clear all softhangup flags from a channel.

Definition at line 1136 of file channel.h.

1136 {
1137 /*!
1138 * Soft hangup requested by device or other internal reason.
1139 * Actual hangup needed.
1140 */
1141 AST_SOFTHANGUP_DEV = (1 << 0),
1142 /*!
1143 * Used to break the normal frame flow so an async goto can be
1144 * done instead of actually hanging up.
1145 */
1146 AST_SOFTHANGUP_ASYNCGOTO = (1 << 1),
1147 /*!
1148 * Soft hangup requested by system shutdown. Actual hangup
1149 * needed.
1150 */
1151 AST_SOFTHANGUP_SHUTDOWN = (1 << 2),
1152 /*!
1153 * Used to break the normal frame flow after a timeout so an
1154 * implicit async goto can be done to the 'T' exten if it exists
1155 * instead of actually hanging up. If the exten does not exist
1156 * then actually hangup.
1157 */
1158 AST_SOFTHANGUP_TIMEOUT = (1 << 3),
1159 /*!
1160 * Soft hangup requested by application/channel-driver being
1161 * unloaded. Actual hangup needed.
1162 */
1163 AST_SOFTHANGUP_APPUNLOAD = (1 << 4),
1164 /*!
1165 * Soft hangup requested by non-associated party. Actual hangup
1166 * needed.
1167 */
1168 AST_SOFTHANGUP_EXPLICIT = (1 << 5),
1169 /*!
1170 * Used to indicate that the channel is currently executing hangup
1171 * logic in the dialplan. The channel has been hungup when this is
1172 * set.
1173 */
1174 AST_SOFTHANGUP_HANGUP_EXEC = (1 << 7),
1175 /*!
1176 * \brief All softhangup flags.
1177 *
1178 * This can be used as an argument to ast_channel_clear_softhangup()
1179 * to clear all softhangup flags from a channel.
1180 */
1181 AST_SOFTHANGUP_ALL = (0xFFFFFFFF)
1182};
@ AST_SOFTHANGUP_ASYNCGOTO
Definition: channel.h:1146
@ AST_SOFTHANGUP_EXPLICIT
Definition: channel.h:1168
@ AST_SOFTHANGUP_DEV
Definition: channel.h:1141
@ AST_SOFTHANGUP_HANGUP_EXEC
Definition: channel.h:1174
@ AST_SOFTHANGUP_ALL
All softhangup flags.
Definition: channel.h:1181
@ AST_SOFTHANGUP_TIMEOUT
Definition: channel.h:1158
@ AST_SOFTHANGUP_SHUTDOWN
Definition: channel.h:1151
@ AST_SOFTHANGUP_APPUNLOAD
Definition: channel.h:1163

◆ ama_flags

enum ama_flags

Channel AMA Flags.

Enumerator
AST_AMA_NONE 
AST_AMA_OMIT 
AST_AMA_BILLING 
AST_AMA_DOCUMENTATION 

Definition at line 1197 of file channel.h.

1197 {
1198 AST_AMA_NONE = 0,
1202};
@ AST_AMA_DOCUMENTATION
Definition: channel.h:1201
@ AST_AMA_OMIT
Definition: channel.h:1199
@ AST_AMA_NONE
Definition: channel.h:1198
@ AST_AMA_BILLING
Definition: channel.h:1200

◆ ast_bridge_result

Enumerator
AST_BRIDGE_COMPLETE 
AST_BRIDGE_FAILED 
AST_BRIDGE_FAILED_NOWARN 
AST_BRIDGE_RETRY 

Definition at line 208 of file channel.h.

208 {
212 AST_BRIDGE_RETRY = -3,
213};
@ AST_BRIDGE_FAILED_NOWARN
Definition: channel.h:211
@ AST_BRIDGE_RETRY
Definition: channel.h:212
@ AST_BRIDGE_COMPLETE
Definition: channel.h:209
@ AST_BRIDGE_FAILED
Definition: channel.h:210

◆ ast_channel_adsicpe

Enumerator
AST_ADSI_UNKNOWN 
AST_ADSI_AVAILABLE 
AST_ADSI_UNAVAILABLE 
AST_ADSI_OFFHOOKONLY 

Definition at line 888 of file channel.h.

888 {
893};
@ AST_ADSI_UNKNOWN
Definition: channel.h:889
@ AST_ADSI_UNAVAILABLE
Definition: channel.h:891
@ AST_ADSI_AVAILABLE
Definition: channel.h:890
@ AST_ADSI_OFFHOOKONLY
Definition: channel.h:892

◆ ast_channel_error

Enumerator
AST_CHANNEL_ERROR_UNKNOWN 
AST_CHANNEL_ERROR_ID_EXISTS 

Definition at line 4841 of file channel.h.

4841 {
4842 /* Unable to determine what error occurred. */
4844 /* Channel with this ID already exists */
4846};
@ AST_CHANNEL_ERROR_ID_EXISTS
Definition: channel.h:4845
@ AST_CHANNEL_ERROR_UNKNOWN
Definition: channel.h:4843

◆ ast_channel_requestor_relationship

Enumerator
AST_CHANNEL_REQUESTOR_BRIDGE_PEER 

The requestor is the future bridge peer of the channel.

AST_CHANNEL_REQUESTOR_REPLACEMENT 

The requestor is to be replaced by the channel.

Definition at line 1521 of file channel.h.

1521 {
1522 /*! The requestor is the future bridge peer of the channel. */
1524 /*! The requestor is to be replaced by the channel. */
1526};
@ AST_CHANNEL_REQUESTOR_BRIDGE_PEER
Definition: channel.h:1523
@ AST_CHANNEL_REQUESTOR_REPLACEMENT
Definition: channel.h:1525

◆ AST_MONITORING_STATE

Enumerator
AST_MONITOR_RUNNING 
AST_MONITOR_PAUSED 

Definition at line 4077 of file channel.h.

4077 {
4080};
@ AST_MONITOR_PAUSED
Definition: channel.h:4079
@ AST_MONITOR_RUNNING
Definition: channel.h:4078

◆ AST_PARTY_CHAR_SET

Party name character set enumeration values (values from Q.SIG)

Enumerator
AST_PARTY_CHAR_SET_UNKNOWN 
AST_PARTY_CHAR_SET_ISO8859_1 
AST_PARTY_CHAR_SET_WITHDRAWN 
AST_PARTY_CHAR_SET_ISO8859_2 
AST_PARTY_CHAR_SET_ISO8859_3 
AST_PARTY_CHAR_SET_ISO8859_4 
AST_PARTY_CHAR_SET_ISO8859_5 
AST_PARTY_CHAR_SET_ISO8859_7 
AST_PARTY_CHAR_SET_ISO10646_BMPSTRING 
AST_PARTY_CHAR_SET_ISO10646_UTF_8STRING 

Definition at line 244 of file channel.h.

244 {
247 AST_PARTY_CHAR_SET_WITHDRAWN = 2,/* ITU withdrew this enum value. */
255};
@ AST_PARTY_CHAR_SET_UNKNOWN
Definition: channel.h:245
@ AST_PARTY_CHAR_SET_ISO8859_4
Definition: channel.h:250
@ AST_PARTY_CHAR_SET_WITHDRAWN
Definition: channel.h:247
@ AST_PARTY_CHAR_SET_ISO8859_5
Definition: channel.h:251
@ AST_PARTY_CHAR_SET_ISO8859_7
Definition: channel.h:252
@ AST_PARTY_CHAR_SET_ISO8859_2
Definition: channel.h:248
@ AST_PARTY_CHAR_SET_ISO8859_1
Definition: channel.h:246
@ AST_PARTY_CHAR_SET_ISO10646_UTF_8STRING
Definition: channel.h:254
@ AST_PARTY_CHAR_SET_ISO10646_BMPSTRING
Definition: channel.h:253
@ AST_PARTY_CHAR_SET_ISO8859_3
Definition: channel.h:249

◆ ast_t38_state

Possible T38 states on channels.

Enumerator
T38_STATE_UNAVAILABLE 

T38 is unavailable on this channel or disabled by configuration

T38_STATE_UNKNOWN 

The channel supports T38 but the current status is unknown

T38_STATE_NEGOTIATING 

T38 is being negotiated

T38_STATE_REJECTED 

Remote side has rejected our offer

T38_STATE_NEGOTIATED 

T38 established

Definition at line 898 of file channel.h.

898 {
899 T38_STATE_UNAVAILABLE, /*!< T38 is unavailable on this channel or disabled by configuration */
900 T38_STATE_UNKNOWN, /*!< The channel supports T38 but the current status is unknown */
901 T38_STATE_NEGOTIATING, /*!< T38 is being negotiated */
902 T38_STATE_REJECTED, /*!< Remote side has rejected our offer */
903 T38_STATE_NEGOTIATED, /*!< T38 established */
904};
@ T38_STATE_UNAVAILABLE
Definition: channel.h:899
@ T38_STATE_UNKNOWN
Definition: channel.h:900
@ T38_STATE_REJECTED
Definition: channel.h:902
@ T38_STATE_NEGOTIATED
Definition: channel.h:903
@ T38_STATE_NEGOTIATING
Definition: channel.h:901

◆ channelreloadreason

Channel reload reasons for manager events at load or reload of configuration.

Enumerator
CHANNEL_MODULE_LOAD 
CHANNEL_MODULE_RELOAD 
CHANNEL_CLI_RELOAD 
CHANNEL_MANAGER_RELOAD 
CHANNEL_ACL_RELOAD 

Definition at line 1186 of file channel.h.

1186 {
1192};
@ CHANNEL_CLI_RELOAD
Definition: channel.h:1189
@ CHANNEL_MODULE_RELOAD
Definition: channel.h:1188
@ CHANNEL_MODULE_LOAD
Definition: channel.h:1187
@ CHANNEL_ACL_RELOAD
Definition: channel.h:1191
@ CHANNEL_MANAGER_RELOAD
Definition: channel.h:1190

Function Documentation

◆ __ast_answer()

int __ast_answer ( struct ast_channel chan,
unsigned int  delay 
)

Answer a channel, with a selectable delay before returning.

Parameters
chanchannel to answer
delaymaximum amount of time to wait for incoming media

This function answers a channel and handles all necessary call setup functions.

Note
The channel passed does not need to be locked, but is locked by the function when needed.
This function will wait up to 'delay' milliseconds for media to arrive on the channel before returning to the caller, so that the caller can properly assume the channel is 'ready' for media flow. If 'delay' is less than 500, the function will wait up to 500 milliseconds.
Return values
0on success
non-zeroon failure

Definition at line 2714 of file channel.c.

2715{
2716 int res = 0;
2717 enum ast_channel_state old_state;
2718 SCOPE_TRACE(1, "%s\n", ast_channel_name(chan));
2719
2720 old_state = ast_channel_state(chan);
2721 if ((res = ast_raw_answer(chan))) {
2722 return res;
2723 }
2724
2725 switch (old_state) {
2726 case AST_STATE_RINGING:
2727 case AST_STATE_RING:
2728 /* wait for media to start flowing, but don't wait any longer
2729 * than 'delay' or 500 milliseconds, whichever is longer
2730 */
2731 do {
2733 struct ast_frame *cur;
2734 struct ast_frame *new_frame;
2735 int timeout_ms = MAX(delay, 500);
2736 unsigned int done = 0;
2737 struct timeval start;
2738
2740
2741 start = ast_tvnow();
2742 for (;;) {
2743 int ms = ast_remaining_ms(start, timeout_ms);
2744 ms = ast_waitfor(chan, ms);
2745 if (ms < 0) {
2746 ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", ast_channel_name(chan), strerror(errno));
2747 res = -1;
2748 break;
2749 }
2750 if (ms == 0) {
2751 ast_debug(2, "Didn't receive a media frame from %s within %u ms of answering. Continuing anyway\n", ast_channel_name(chan), MAX(delay, 500));
2752 break;
2753 }
2754 cur = ast_read(chan);
2755 if (!cur || ((cur->frametype == AST_FRAME_CONTROL) &&
2756 (cur->subclass.integer == AST_CONTROL_HANGUP))) {
2757 if (cur) {
2758 ast_frfree(cur);
2759 }
2760 res = -1;
2761 ast_debug(2, "Hangup of channel %s detected in answer routine\n", ast_channel_name(chan));
2762 break;
2763 }
2764
2765 if ((new_frame = ast_frisolate(cur)) != cur) {
2766 ast_frfree(cur);
2767 }
2768
2770
2771 /* if a specific delay period was requested, continue
2772 * until that delay has passed. don't stop just because
2773 * incoming media has arrived.
2774 */
2775 if (delay) {
2776 continue;
2777 }
2778
2779 switch (new_frame->frametype) {
2780 /* all of these frametypes qualify as 'media' */
2781 case AST_FRAME_VOICE:
2782 case AST_FRAME_VIDEO:
2783 case AST_FRAME_TEXT:
2786 case AST_FRAME_DTMF_END:
2787 case AST_FRAME_IMAGE:
2788 case AST_FRAME_HTML:
2789 case AST_FRAME_MODEM:
2790 case AST_FRAME_RTCP:
2791 done = 1;
2792 break;
2793 case AST_FRAME_CONTROL:
2794 case AST_FRAME_IAX:
2797 case AST_FRAME_NULL:
2798 case AST_FRAME_CNG:
2799 break;
2800 }
2801
2802 if (done) {
2803 break;
2804 }
2805 }
2806
2807 ast_channel_lock(chan);
2808 while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) {
2809 if (res == 0) {
2810 ast_queue_frame_head(chan, cur);
2811 }
2812 ast_frfree(cur);
2813 }
2814 ast_channel_unlock(chan);
2815 } while (0);
2816 break;
2817 default:
2818 break;
2819 }
2820
2821 return res;
2822}
#define ast_log
Definition: astobj2.c:42
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
Definition: channel.c:4276
int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *fin)
Queue one or more frames to the head of a channel's frame queue.
Definition: channel.c:1163
int ast_waitfor(struct ast_channel *c, int ms)
Wait for input on a channel.
Definition: channel.c:3181
int ast_raw_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2709
const char * ast_channel_name(const struct ast_channel *chan)
#define ast_channel_lock(chan)
Definition: channel.h:2968
#define ast_channel_unlock(chan)
Definition: channel.h:2969
ast_channel_state
ast_channel states
Definition: channelstate.h:35
@ AST_STATE_RING
Definition: channelstate.h:40
@ AST_STATE_RINGING
Definition: channelstate.h:41
#define SCOPE_TRACE(__level,...)
#define ast_frisolate(fr)
Makes a frame independent of any static storage.
#define ast_frfree(fr)
@ AST_FRAME_VIDEO
@ AST_FRAME_NULL
@ AST_FRAME_HTML
@ AST_FRAME_IMAGE
@ AST_FRAME_DTMF_END
@ AST_FRAME_DTMF_BEGIN
@ AST_FRAME_BRIDGE_ACTION_SYNC
@ AST_FRAME_VOICE
@ AST_FRAME_RTCP
@ AST_FRAME_MODEM
@ AST_FRAME_TEXT_DATA
@ AST_FRAME_CONTROL
@ AST_FRAME_BRIDGE_ACTION
@ AST_FRAME_TEXT
@ AST_CONTROL_HANGUP
#define ast_debug(level,...)
Log a DEBUG message.
#define LOG_WARNING
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
Definition: linkedlists.h:681
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
Definition: linkedlists.h:225
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Definition: linkedlists.h:711
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:833
int errno
static int frames
Definition: parser.c:51
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
enum ast_frame_type frametype
int done
Definition: test_amihooks.c:48
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
Definition: utils.c:2281
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
#define MAX(a, b)
Definition: utils.h:233

References ast_channel_lock, ast_channel_name(), ast_channel_unlock, AST_CONTROL_HANGUP, ast_debug, AST_FRAME_BRIDGE_ACTION, AST_FRAME_BRIDGE_ACTION_SYNC, AST_FRAME_CNG, AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, AST_FRAME_HTML, AST_FRAME_IAX, AST_FRAME_IMAGE, AST_FRAME_MODEM, AST_FRAME_NULL, AST_FRAME_RTCP, AST_FRAME_TEXT, AST_FRAME_TEXT_DATA, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_frfree, ast_frisolate, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_HEAD_NOLOCK, AST_LIST_INSERT_HEAD, AST_LIST_REMOVE_HEAD, ast_log, ast_queue_frame_head(), ast_raw_answer(), ast_read(), ast_remaining_ms(), AST_STATE_RING, AST_STATE_RINGING, ast_tvnow(), ast_waitfor(), done, errno, frames, ast_frame::frametype, ast_frame_subclass::integer, LOG_WARNING, MAX, SCOPE_TRACE, and ast_frame::subclass.

Referenced by ast_answer(), pbx_builtin_answer(), and pbx_builtin_incomplete().

◆ __ast_channel_alloc()

struct ast_channel * __ast_channel_alloc ( int  needqueue,
int  state,
const char *  cid_num,
const char *  cid_name,
const char *  acctcode,
const char *  exten,
const char *  context,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor,
enum ama_flags  amaflag,
struct ast_endpoint endpoint,
const char *  file,
int  line,
const char *  function,
const char *  name_fmt,
  ... 
)

Create a channel structure.

Since
1.8
Return values
NULLfailure
non-NULLsuccessfully allocated channel
Note
Absolutely NO channel locks should be held before calling this function.
By default, new channels are set to the "s" extension and "default" context.
Since 12.0.0 this function returns with the newly created channel locked.

Definition at line 954 of file channel.c.

961{
962 va_list ap;
963 struct ast_channel *result;
964
965 va_start(ap, name_fmt);
966 result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context,
967 assignedids, requestor, amaflag, endpoint, NULL, file, line, function, name_fmt, ap);
968 va_end(ap);
969
970 return result;
971}
static PGresult * result
Definition: cel_pgsql.c:84
static struct ast_channel * __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, enum ama_flags amaflag, struct ast_endpoint *endpoint, struct ast_channel_initializers *initializers, const char *file, int line, const char *function, const char *name_fmt, va_list ap)
Create a new channel structure.
Definition: channel.c:733
char exten[AST_MAX_EXTENSION]

References __ast_channel_alloc_ap(), voicemailpwcheck::context, ast_channel::exten, make_ari_stubs::file, NULL, and result.

◆ __ast_channel_alloc_with_initializers()

struct ast_channel * __ast_channel_alloc_with_initializers ( int  needqueue,
int  state,
const char *  cid_num,
const char *  cid_name,
const char *  acctcode,
const char *  exten,
const char *  context,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor,
enum ama_flags  amaflag,
struct ast_endpoint endpoint,
struct ast_channel_initializers initializers,
const char *  file,
int  line,
const char *  function,
const char *  name_fmt,
  ... 
)

Create a channel structure.

Since
18.25.0
Return values
NULLfailure
non-NULLsuccessfully allocated channel
Note
Absolutely NO channel locks should be held before calling this function.
By default, new channels are set to the "s" extension and "default" context.
Same as __ast_channel_alloc but with ast_channel_initializers struct.

Definition at line 973 of file channel.c.

980{
981 va_list ap;
982 struct ast_channel *result;
983
984 va_start(ap, name_fmt);
985 result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context,
986 assignedids, requestor, amaflag, endpoint, initializers, file, line, function, name_fmt, ap);
987 va_end(ap);
988
989 return result;
990}

References __ast_channel_alloc_ap(), voicemailpwcheck::context, ast_channel::exten, make_ari_stubs::file, and result.

◆ __ast_dummy_channel_alloc()

struct ast_channel * __ast_dummy_channel_alloc ( const char *  file,
int  line,
const char *  function 
)

Definition at line 994 of file channel.c.

995{
996 struct ast_channel *tmp;
997 struct varshead *headp;
998
1000 file, line, function);
1001 if (!tmp) {
1002 /* Dummy channel structure allocation failure. */
1003 return NULL;
1004 }
1005
1008
1009 /*
1010 * Init file descriptors to unopened state just in case
1011 * autoservice is called on the channel or something tries to
1012 * read a frame from it.
1013 */
1017
1019
1021
1022 headp = ast_channel_varshead(tmp);
1024
1025 return tmp;
1026}
static int tmp()
Definition: bt_open.c:389
static void ast_dummy_channel_destructor(void *obj)
Free a dummy channel structure.
Definition: channel.c:2352
struct varshead * ast_channel_varshead(struct ast_channel *chan)
void ast_channel_internal_fd_clear_all(struct ast_channel *chan)
void ast_channel_hold_state_set(struct ast_channel *chan, int value)
void ast_channel_timingfd_set(struct ast_channel *chan, int value)
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
struct ast_datastore_list * ast_channel_datastores(struct ast_channel *chan)
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)
int ast_channel_internal_setup_topics(struct ast_channel *chan)
@ AST_CONTROL_UNHOLD
void ast_pbx_hangup_handler_init(struct ast_channel *chan)
Init the hangup handler container on a channel.

References __ast_channel_internal_alloc(), ast_channel_datastores(), ast_channel_hold_state_set(), ast_channel_internal_alertpipe_clear(), ast_channel_internal_fd_clear_all(), ast_channel_internal_setup_topics(), ast_channel_timingfd_set(), ast_channel_varshead(), AST_CONTROL_UNHOLD, ast_dummy_channel_destructor(), AST_LIST_HEAD_INIT_NOLOCK, ast_pbx_hangup_handler_init(), make_ari_stubs::file, NULL, and tmp().

◆ __ast_request_and_dial()

struct ast_channel * __ast_request_and_dial ( const char *  type,
struct ast_format_cap cap,
const struct ast_assigned_ids assignedids,
const struct ast_channel requestor,
const char *  addr,
int  timeout,
int *  reason,
const char *  cid_num,
const char *  cid_name,
struct outgoing_helper oh 
)

Request a channel of a given type, with data as optional information used by the low level module and attempt to place a call on it.

Parameters
typetype of channel to request
capformat capabilities for requested channel
assignedidsUnique Id to assign to channel
requestorchannel requesting data
addrdestination of the call
timeoutmaximum amount of time to wait for an answer
reasonwhy unsuccessful (if unsuccessful)
cid_numCaller-ID Number
cid_nameCaller-ID Name (ascii)
ohOutgoing helper
Returns
Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state to know if the call was answered or not.

Definition at line 5995 of file channel.c.

5996{
5997 int dummy_outstate;
5998 int cause = 0;
5999 struct ast_channel *chan;
6000 int res = 0;
6001 int last_subclass = 0;
6003
6004 if (outstate)
6005 *outstate = 0;
6006 else
6007 outstate = &dummy_outstate; /* make outstate always a valid pointer */
6008
6009 chan = ast_request(type, cap, assignedids, requestor, addr, &cause);
6010 if (!chan) {
6011 ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, addr);
6012 handle_cause(cause, outstate);
6013 return NULL;
6014 }
6015
6016 if (oh) {
6017 if (oh->vars) {
6018 ast_channel_lock(chan);
6019 ast_set_variables(chan, oh->vars);
6020 ast_channel_unlock(chan);
6021 }
6022 if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name)) {
6023 /*
6024 * Use the oh values instead of the function parameters for the
6025 * outgoing CallerID.
6026 */
6027 cid_num = oh->cid_num;
6028 cid_name = oh->cid_name;
6029 }
6030 if (oh->parent_channel) {
6031 /* Safely inherit variables and datastores from the parent channel. */
6037 ast_channel_unlock(chan);
6038 }
6039 if (!ast_strlen_zero(oh->account)) {
6040 ast_channel_lock(chan);
6042 ast_channel_accountcode_set(chan, oh->account);
6043 ast_channel_peeraccount_set(chan, oh->account);
6045 ast_channel_unlock(chan);
6046 }
6047 }
6048
6049 /*
6050 * It seems strange to set the CallerID on an outgoing call leg
6051 * to whom we are calling, but this function's callers are doing
6052 * various Originate methods. This call leg goes to the local
6053 * user. Once the local user answers, the dialplan needs to be
6054 * able to access the CallerID from the CALLERID function as if
6055 * the local user had placed this call.
6056 */
6057 ast_set_callerid(chan, cid_num, cid_name, cid_num);
6058
6059 ast_channel_lock(chan);
6061 ast_channel_unlock(chan);
6063 if (cid_num) {
6064 connected.id.number.valid = 1;
6065 connected.id.number.str = (char *) cid_num;
6067 }
6068 if (cid_name) {
6069 connected.id.name.valid = 1;
6070 connected.id.name.str = (char *) cid_name;
6072 }
6074 if (requestor) {
6075 ast_channel_lock_both(chan, (struct ast_channel *) requestor);
6077 ast_channel_unlock(chan);
6078 ast_channel_unlock((struct ast_channel *) requestor);
6079 }
6080
6081 if (ast_call(chan, addr, 0)) { /* ast_call failed... */
6082 ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, addr);
6083 } else {
6084 struct timeval start = ast_tvnow();
6085 res = 1; /* mark success in case chan->_state is already AST_STATE_UP */
6086 while (timeout && ast_channel_state(chan) != AST_STATE_UP) {
6087 struct ast_frame *f;
6088 int ms = ast_remaining_ms(start, timeout);
6089
6090 res = ast_waitfor(chan, ms);
6091 if (res == 0) { /* timeout, treat it like ringing */
6092 *outstate = AST_CONTROL_RINGING;
6093 break;
6094 }
6095 if (res < 0) /* error or done */
6096 break;
6098 if (!(chan = ast_call_forward(NULL, chan, NULL, cap, oh, outstate))) {
6099 return NULL;
6100 }
6101 continue;
6102 }
6103
6104 f = ast_read(chan);
6105 if (!f) {
6106 *outstate = AST_CONTROL_HANGUP;
6107 res = 0;
6108 break;
6109 }
6110 if (f->frametype == AST_FRAME_CONTROL) {
6111 switch (f->subclass.integer) {
6112 case AST_CONTROL_RINGING: /* record but keep going */
6113 *outstate = f->subclass.integer;
6114 break;
6115
6116 case AST_CONTROL_BUSY:
6117 *outstate = f->subclass.integer;
6118 timeout = 0;
6119 break;
6120
6122 *outstate = AST_CONTROL_CONGESTION;
6123 timeout = 0;
6124 break;
6125
6127 *outstate = f->subclass.integer;
6128 timeout = 0;
6129 break;
6130
6131 case AST_CONTROL_ANSWER:
6132 *outstate = f->subclass.integer;
6133 timeout = 0; /* trick to force exit from the while() */
6134 break;
6135
6138 break;
6139
6141 if (oh && oh->connect_on_early_media) {
6142 *outstate = f->subclass.integer;
6143 timeout = 0; /* trick to force exit from the while() */
6144 break;
6145 }
6146 /* Fallthrough */
6147 /* Ignore these */
6149 case AST_CONTROL_HOLD:
6150 case AST_CONTROL_UNHOLD:
6156 case AST_CONTROL_CC:
6157 case -1: /* Ignore -- just stopping indications */
6158 break;
6159
6160 default:
6161 ast_log(LOG_NOTICE, "Don't know what to do with control frame %d\n", f->subclass.integer);
6162 }
6163 last_subclass = f->subclass.integer;
6164 }
6165 ast_frfree(f);
6166 }
6167 }
6168
6169 /* Final fixups */
6170 if (oh) {
6171 if (!ast_strlen_zero(oh->context))
6173 if (!ast_strlen_zero(oh->exten))
6174 ast_channel_exten_set(chan, oh->exten);
6175 if (oh->priority)
6177 }
6178 if (ast_channel_state(chan) == AST_STATE_UP)
6179 *outstate = AST_CONTROL_ANSWER;
6180
6181 if (res <= 0) {
6182 ast_channel_lock(chan);
6183 if (AST_CONTROL_RINGING == last_subclass) {
6185 }
6186 ast_channel_unlock(chan);
6187 ast_hangup(chan);
6188 chan = NULL;
6189 }
6190 return chan;
6191}
#define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED
Definition: callerid.h:437
#define AST_CAUSE_NO_ANSWER
Definition: causes.h:109
static const char type[]
Definition: chan_ooh323.c:109
int ast_call(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
Definition: channel.c:6480
static void handle_cause(int cause, int *outstate)
Definition: channel.c:5868
struct ast_channel * ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, struct ast_format_cap *cap, struct outgoing_helper *oh, int *outstate)
Forwards a call to a new channel specified by the original channel's call_forward str....
Definition: channel.c:5917
void ast_hangup(struct ast_channel *chan)
Hangup a channel.
Definition: channel.c:2560
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
Definition: channel.c:8330
void ast_set_variables(struct ast_channel *chan, struct ast_variable *vars)
adds a list of channel variables to a channel
Definition: channel.c:8137
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
Inherit datastores from a parent to a child.
Definition: channel.c:2387
void ast_channel_req_accountcodes(struct ast_channel *chan, const struct ast_channel *requestor, enum ast_channel_requestor_relationship relationship)
Setup new channel accountcodes from the requestor channel after ast_request().
Definition: channel.c:6453
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
Definition: channel.c:7356
void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
Inherits channel variable from parent to child channel.
Definition: channel.c:6790
void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel.
Definition: channel.c:4365
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation.
Definition: channel.c:2064
struct ast_channel * ast_request(const char *type, struct ast_format_cap *request_cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *addr, int *cause)
Requests a channel.
Definition: channel.c:6373
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
Definition: channel.h:2975
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
const char * ast_channel_call_forward(const struct ast_channel *chan)
void ast_channel_priority_set(struct ast_channel *chan, int value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
@ AST_STATE_UP
Definition: channelstate.h:42
char connected
Definition: eagi_proxy.c:82
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.
@ AST_CONTROL_SRCUPDATE
@ AST_CONTROL_PROGRESS
@ AST_CONTROL_BUSY
@ AST_CONTROL_VIDUPDATE
@ AST_CONTROL_PROCEEDING
@ AST_CONTROL_REDIRECTING
@ AST_CONTROL_CONGESTION
@ AST_CONTROL_CC
@ AST_CONTROL_ANSWER
@ AST_CONTROL_RINGING
@ AST_CONTROL_HOLD
@ AST_CONTROL_CONNECTED_LINE
@ AST_CONTROL_SRCCHANGE
@ AST_CONTROL_INCOMPLETE
@ AST_CONTROL_PVT_CAUSE_CODE
#define LOG_NOTICE
int ast_max_forwards_decrement(struct ast_channel *chan)
Decrement the max forwards count for a particular channel.
Definition: max_forwards.c:135
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
union ast_frame::@226 data
Connected Line/Party information.
Definition: channel.h:458
const char * cid_num
Definition: channel.h:1129
struct ast_variable * vars
Definition: channel.h:1132
int connect_on_early_media
Definition: channel.h:1128
const char * account
Definition: channel.h:1131
const char * cid_name
Definition: channel.h:1130
const char * exten
Definition: channel.h:1126
const char * context
Definition: channel.h:1125
struct ast_channel * parent_channel
Definition: channel.h:1133
#define ast_set_flag(p, flag)
Definition: utils.h:70

References outgoing_helper::account, ast_call(), ast_call_forward(), AST_CAUSE_NO_ANSWER, ast_channel_call_forward(), ast_channel_connected(), ast_channel_context_set(), ast_channel_datastore_inherit(), ast_channel_exten_set(), ast_channel_flags(), ast_channel_hangupcause_hash_set(), ast_channel_hangupcause_set(), ast_channel_inherit_variables(), ast_channel_lock, ast_channel_lock_both, ast_channel_priority_set(), ast_channel_req_accountcodes(), AST_CHANNEL_REQUESTOR_BRIDGE_PEER, ast_channel_set_connected_line(), ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_unlock, AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CC, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_INCOMPLETE, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, AST_CONTROL_VIDUPDATE, AST_FLAG_ORIGINATED, AST_FRAME_CONTROL, ast_frfree, ast_hangup(), ast_log, ast_max_forwards_decrement(), ast_party_connected_line_set_init(), AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, ast_read(), ast_remaining_ms(), ast_request(), ast_set_callerid(), ast_set_flag, ast_set_variables(), AST_STATE_UP, ast_strlen_zero(), ast_tvnow(), ast_waitfor(), outgoing_helper::cid_name, outgoing_helper::cid_num, outgoing_helper::connect_on_early_media, connected, outgoing_helper::context, ast_frame::data, ast_frame::datalen, outgoing_helper::exten, ast_frame::frametype, handle_cause(), ast_frame_subclass::integer, LOG_NOTICE, NULL, outgoing_helper::parent_channel, outgoing_helper::priority, ast_frame::ptr, ast_frame::subclass, type, and outgoing_helper::vars.

Referenced by announce_to_dial(), and ast_request_and_dial().

◆ ast_activate_generator()

int ast_activate_generator ( struct ast_channel chan,
struct ast_generator gen,
void *  params 
)

Activate a given generator

Definition at line 2970 of file channel.c.

2971{
2972 int res = 0;
2973 void *generatordata = NULL;
2974
2975 ast_channel_lock(chan);
2976 if (ast_channel_generatordata(chan)) {
2977 struct ast_generator *generator_old = ast_channel_generator(chan);
2978
2979 if (generator_old && generator_old->release) {
2980 generator_old->release(chan, ast_channel_generatordata(chan));
2981 }
2982 }
2983 if (gen->alloc && !(generatordata = gen->alloc(chan, params))) {
2984 res = -1;
2985 }
2986 ast_channel_generatordata_set(chan, generatordata);
2987 if (!res) {
2988 ast_settimeout(chan, 50, generator_force, chan);
2990 }
2991 ast_channel_unlock(chan);
2992
2993 ast_prod(chan);
2994
2995 return res;
2996}
static struct ast_generator gen
int ast_prod(struct ast_channel *chan)
Send empty audio to prime a channel driver.
Definition: channel.c:5019
static int generator_force(const void *data)
Definition: channel.c:2935
int ast_settimeout(struct ast_channel *c, unsigned int rate, int(*func)(const void *data), void *data)
Enable or disable timer ticks for a channel.
Definition: channel.c:3199
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
void * ast_channel_generatordata(const struct ast_channel *chan)
struct ast_generator * ast_channel_generator(const struct ast_channel *chan)
void *(* alloc)(struct ast_channel *chan, void *params)
Definition: channel.h:228
void(* release)(struct ast_channel *chan, void *data)
Definition: channel.h:230

References ast_generator::alloc, ast_channel_generator(), ast_channel_generator_set(), ast_channel_generatordata(), ast_channel_generatordata_set(), ast_channel_lock, ast_channel_unlock, ast_prod(), ast_settimeout(), gen, generator_force(), ast_channel::generatordata, NULL, and ast_generator::release.

Referenced by app_exec(), ast_channel_start_silence_generator(), ast_linear_stream(), ast_playtones_start(), ast_tonepair_start(), channel_spy(), do_broadcast(), eivr_comm(), local_ast_moh_start(), old_milliwatt_exec(), and spandsp_fax_gateway_start().

◆ ast_active_channels()

int ast_active_channels ( void  )

returns number of active/allocated channels

Returns
number of channels available for lookup

Definition at line 499 of file channel.c.

500{
502}
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
static struct ao2_container * channels
All active channels on the system.
Definition: channel.c:124

References ao2_container_count(), and channels.

Referenced by action_corestatus(), ast_var_channels(), ast_var_channels_table(), dahdi_restart(), handle_chanlist(), handle_show_settings(), and really_quit().

◆ ast_add_fd()

static int ast_add_fd ( struct pollfd *  pfd,
int  fd 
)
inlinestatic

if fd is a valid descriptor, set *pfd with the descriptor

Returns
Return 1 (not -1!) if added, 0 otherwise (so we can add the return value to the index into the array)

Definition at line 2865 of file channel.h.

2866{
2867 pfd->fd = fd;
2868 pfd->events = POLLIN | POLLPRI;
2869 return fd >= 0;
2870}

Referenced by ast_waitfor_nandfds().

◆ ast_answer()

int ast_answer ( struct ast_channel chan)

Answer a channel.

Parameters
chanchannel to answer

This function answers a channel and handles all necessary call setup functions.

Note
The channel passed does not need to be locked, but is locked by the function when needed.
This function will wait up to 500 milliseconds for media to arrive on the channel before returning to the caller, so that the caller can properly assume the channel is 'ready' for media flow.
Return values
0on success
non-zeroon failure

Definition at line 2824 of file channel.c.

2825{
2826 SCOPE_TRACE(1, "%s\n", ast_channel_name(chan));
2827 return __ast_answer(chan, 0);
2828}
int __ast_answer(struct ast_channel *chan, unsigned int delay)
Answer a channel, with a selectable delay before returning.
Definition: channel.c:2714

References __ast_answer(), ast_channel_name(), and SCOPE_TRACE.

Referenced by agent_login_exec(), agi_exec_full(), alarmreceiver_exec(), announce_request(), app_exec(), ast_auto_answer(), ast_bridge_add_channel(), ast_do_pickup(), ast_pickup_call(), auth_exec(), background_detect_exec(), bridge_channel_handle_control(), bridge_parking_push(), bridgeadd_exec(), bridgewait_exec(), common_exec(), conf_exec(), conf_start_record(), confbridge_exec(), count_exec(), dial_exec_full(), dictate_exec(), directory_exec(), disa_exec(), eivr_comm(), handle_answer(), leave_voicemail(), local_call(), media_request_helper(), minivm_accmess_exec(), minivm_greet_exec(), minivm_record_exec(), old_milliwatt_exec(), park_app_exec(), parked_call_app_exec(), pbx_builtin_background(), playback_exec(), privacy_exec(), read_exec(), readexten_exec(), receivefax_exec(), record_exec(), sayunixtime_exec(), send_waveform_to_channel(), sendfax_exec(), setup_privacy_args(), skel_exec(), sla_station_exec(), speech_background(), testclient_exec(), testserver_exec(), vm_exec(), vm_execmain(), vm_playmsgexec(), waitfor_exec(), and zapateller_exec().

◆ ast_auto_answer()

int ast_auto_answer ( struct ast_channel chan)
inline

Answer a channel, if it's not already answered.

Parameters
chanchannel to answer

See ast_answer()

Return values
0on success
non-zeroon failure

Definition at line 2830 of file channel.c.

2831{
2832 if (ast_channel_state(chan) == AST_STATE_UP) {
2833 /* Already answered */
2834 return 0;
2835 }
2836 return ast_answer(chan);
2837}
int ast_answer(struct ast_channel *chan)
Answer a channel.
Definition: channel.c:2824

References ast_answer(), and AST_STATE_UP.

Referenced by record_file(), and senddtmf_exec().

◆ ast_autoservice_chan_hangup_peer()

void ast_autoservice_chan_hangup_peer ( struct ast_channel chan,
struct ast_channel peer 
)

Put chan into autoservice while hanging up peer.

Since
11.0
Parameters
chanChan to put into autoservice.
peerChan to run hangup handlers and hangup.

Definition at line 349 of file autoservice.c.

350{
351 if (chan && !ast_autoservice_start(chan)) {
352 ast_hangup(peer);
354 } else {
355 ast_hangup(peer);
356 }
357}
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
Definition: channel.c:2560

References ast_autoservice_start(), ast_autoservice_stop(), and ast_hangup().

Referenced by app_exec(), bridge_failed_peer_goto(), dial_exec_full(), and try_calling().

◆ ast_autoservice_ignore()

int ast_autoservice_ignore ( struct ast_channel chan,
enum ast_frame_type  ftype 
)

Ignore certain frame types.

Note
Normally, we cache DTMF, IMAGE, HTML, TEXT, and CONTROL frames while a channel is in autoservice and queue them up when taken out of autoservice. When this is not desireable, this API may be used to cause the channel to ignore those frametypes after the channel is put into autoservice, but before autoservice is stopped.
Return values
0success
-1channel is not in autoservice

Definition at line 359 of file autoservice.c.

360{
361 struct asent *as;
362 int res = -1;
363
366 if (as->chan == chan) {
367 res = 0;
368 as->ignore_frame_types |= (1 << ftype);
369 break;
370 }
371 }
373 return res;
374}
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
#define AST_LIST_LOCK(head)
Locks a list.
Definition: linkedlists.h:40
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Definition: linkedlists.h:140
unsigned int ignore_frame_types
Definition: autoservice.c:62
struct asent::@306 list
struct ast_channel * chan
Definition: autoservice.c:55

References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, asent::chan, asent::ignore_frame_types, and asent::list.

◆ ast_autoservice_start()

int ast_autoservice_start ( struct ast_channel chan)

Automatically service a channel for us...

Return values
0success
-1failure, or the channel is already being autoserviced

Definition at line 200 of file autoservice.c.

201{
202 int res = 0;
203 struct asent *as;
204
206 /* User interface threads do not handle channel media. */
207 ast_debug(1, "Thread is a user interface, not putting channel %s into autoservice\n",
209 return 0;
210 }
211
214 if (as->chan == chan) {
215 as->use_count++;
216 break;
217 }
218 }
220
221 if (as) {
222 /* Entry exists, autoservice is already handling this channel */
223 return 0;
224 }
225
226 if (!(as = ast_calloc(1, sizeof(*as))))
227 return -1;
228
229 /* New entry created */
230 as->chan = chan;
231 as->use_count = 1;
232
235 if (!as->orig_end_dtmf_flag)
238
240
243 }
244
246
247 if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
249 ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
250 /* There will only be a single member in the list at this point,
251 the one we just added. */
253 ast_free(as);
255 res = -1;
256 } else {
257 pthread_kill(asthread, SIGURG);
258 }
259 }
260
262
263 return res;
264}
#define ast_free(a)
Definition: astmm.h:180
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:202
static void * autoservice_run(void *ign)
Definition: autoservice.c:78
static ast_cond_t as_cond
Definition: autoservice.c:71
static pthread_t asthread
Definition: autoservice.c:73
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
Definition: linkedlists.h:450
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
Definition: linkedlists.h:856
#define AST_PTHREADT_NULL
Definition: lock.h:66
#define ast_cond_signal(cond)
Definition: lock.h:203
unsigned int use_count
Definition: autoservice.c:59
unsigned int orig_end_dtmf_flag
Definition: autoservice.c:60
#define ast_test_flag(p, flag)
Definition: utils.h:63
int ast_thread_is_user_interface(void)
Indicates whether the current thread is a user interface.
Definition: utils.c:3248
#define ast_pthread_create_background(a, b, c, d)
Definition: utils.h:592

References as_cond, ast_calloc, ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_cond_signal, ast_debug, AST_FLAG_END_DTMF_ONLY, ast_free, AST_LIST_EMPTY, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_REMOVE, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_pthread_create_background, AST_PTHREADT_NULL, ast_set_flag, ast_test_flag, ast_thread_is_user_interface(), asthread, autoservice_run(), asent::chan, asent::list, LOG_WARNING, NULL, asent::orig_end_dtmf_flag, and asent::use_count.

Referenced by acf_curl_helper(), acf_jabberreceive_read(), acf_odbc_read(), acf_odbc_write(), action_toggle_mute_participants(), app_exec(), ast_app_exec_sub(), ast_audiosocket_connect(), ast_autoservice_chan_hangup_peer(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), ast_mf_stream(), ast_sf_stream(), begin_dial_prerun(), conf_play(), confbridge_exec(), dial_exec_full(), exec(), findmeexec(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), join_conference_bridge(), lock_read(), lua_autoservice_start(), lua_get_variable_value(), lua_pbx_exec(), lua_set_variable(), lua_set_variable_value(), mf_stream(), originate_exec(), pbx_find_extension(), playback_common(), post_join_play_begin(), push_announcer(), realtimefield_read(), reload_exec(), ring_one(), sf_stream(), shell_helper(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().

◆ ast_autoservice_stop()

int ast_autoservice_stop ( struct ast_channel chan)

Stop servicing a channel for us...

Note
if chan is locked prior to calling ast_autoservice_stop, it is likely that there will be a deadlock between the thread that calls ast_autoservice_stop and the autoservice thread. It is important that chan is not locked prior to this call
Parameters
chan
Return values
0success
-1error, or the channel has been hungup

Definition at line 266 of file autoservice.c.

267{
268 int res = -1;
269 struct asent *as, *removed = NULL;
270 struct ast_frame *f;
271 int chan_list_state;
272
274 /* User interface threads do not handle channel media. */
275 ast_debug(1, "Thread is a user interface, not removing channel %s from autoservice\n",
276 ast_channel_name(chan));
277 return 0;
278 }
279
281
282 /* Save the autoservice channel list state. We _must_ verify that the channel
283 * list has been rebuilt before we return. Because, after we return, the channel
284 * could get destroyed and we don't want our poor autoservice thread to step on
285 * it after its gone! */
286 chan_list_state = as_chan_list_state;
287
288 /* Find the entry, but do not free it because it still can be in the
289 autoservice thread array */
291 if (as->chan == chan) {
292 as->use_count--;
293 if (as->use_count < 1) {
295 removed = as;
296 }
297 break;
298 }
299 }
301
302 if (removed && asthread != AST_PTHREADT_NULL) {
303 pthread_kill(asthread, SIGURG);
304 }
305
307
308 if (!removed) {
309 return 0;
310 }
311
312 if (asthread != AST_PTHREADT_NULL && pthread_equal(pthread_self(), asthread)) {
313 /* Do not sleep if ast_autoservice_stop is called within the autoservice thread,
314 otherwise the thread will be stuck in an endless sleep. */
315 ast_debug(1, "ast_autoservice_stop is called within the autoservice thread, channel %s\n",
316 ast_channel_name(chan));
317 } else {
318 /* Wait while autoservice thread rebuilds its list. */
319 while (chan_list_state == as_chan_list_state) {
320 usleep(1000);
321 }
322 }
323
324 /* Now autoservice thread should have no references to our entry
325 and we can safely destroy it */
326
328 res = 0;
329 }
330
331 ast_channel_lock(chan);
332 if (!as->orig_end_dtmf_flag) {
334 }
335
336 while ((f = AST_LIST_REMOVE_HEAD(&as->deferred_frames, frame_list))) {
337 if (!((1 << f->frametype) & as->ignore_frame_types)) {
338 ast_queue_frame_head(chan, f);
339 }
340 ast_frfree(f);
341 }
342 ast_channel_unlock(chan);
343
344 ast_free(as);
345
346 return res;
347}
static int as_chan_list_state
Definition: autoservice.c:76
int ast_queue_frame_head(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to the head of a channel's frame queue.
Definition: channel.c:1163
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
struct asent::@305 deferred_frames
#define ast_clear_flag(p, flag)
Definition: utils.h:77

References as_chan_list_state, ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_softhangup_internal_flag(), ast_channel_unlock, ast_clear_flag, ast_debug, AST_FLAG_END_DTMF_ONLY, ast_free, ast_frfree, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, AST_PTHREADT_NULL, ast_queue_frame_head(), ast_thread_is_user_interface(), asthread, asent::chan, asent::deferred_frames, ast_frame::frametype, asent::ignore_frame_types, NULL, asent::orig_end_dtmf_flag, and asent::use_count.

Referenced by acf_curl_helper(), acf_jabberreceive_read(), acf_odbc_read(), acf_odbc_write(), action_toggle_mute_participants(), app_exec(), array(), ast_app_exec_sub(), ast_audiosocket_connect(), ast_autoservice_chan_hangup_peer(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), ast_hangup(), ast_mf_stream(), ast_sf_stream(), begin_dial_prerun(), conf_play(), confbridge_exec(), dial_exec_full(), exec(), findmeexec(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), hangup_playback(), join_conference_bridge(), lock_read(), lua_autoservice_stop(), lua_get_variable_value(), lua_pbx_exec(), lua_set_variable(), lua_set_variable_value(), mf_stream(), originate_exec(), pbx_find_extension(), playback_common(), post_join_play_begin(), realtimefield_read(), reload_exec(), ring_one(), sf_stream(), shell_helper(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().

◆ ast_call()

int ast_call ( struct ast_channel chan,
const char *  addr,
int  timeout 
)

Make a call.

Note
Absolutely NO channel locks should be held before calling this function.
Parameters
chanwhich channel to make the call on
addrdestination of the call
timeouttime to wait on for connect (Doesn't seem to be used.)

Place a call, take no longer than timeout ms.

Return values
0on success
-1on failure

Definition at line 6480 of file channel.c.

6481{
6482 /* Place an outgoing call, but don't wait any longer than timeout ms before returning.
6483 If the remote end does not answer within the timeout, then do NOT hang up, but
6484 return anyway. */
6485 int res = -1;
6486 /* Stop if we're a zombie or need a soft hangup */
6487 ast_channel_lock(chan);
6489 if (ast_channel_tech(chan)->call)
6490 res = ast_channel_tech(chan)->call(chan, addr, timeout);
6492 }
6493 ast_channel_unlock(chan);
6494 return res;
6495}
static int call(void *data)
Definition: chan_pjsip.c:2395
int ast_check_hangup(struct ast_channel *chan)
Checks to see if a channel is needing hang up.
Definition: channel.c:445
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
int(*const call)(struct ast_channel *chan, const char *addr, int timeout)
Make a call.
Definition: channel.h:721

References ast_channel_flags(), ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_check_hangup(), AST_FLAG_OUTGOING, AST_FLAG_ZOMBIE, ast_set_flag, ast_test_flag, call(), and ast_channel_tech::call.

Referenced by __ast_request_and_dial(), app_control_dial(), ast_call_forward(), attended_transfer_bridge(), begin_dial_channel(), blind_transfer_bridge(), dial_exec_full(), do_forward(), feature_attended_transfer(), findmeexec(), park_local_transfer(), retransfer_enter(), ring_entry(), and wait_for_answer().

◆ ast_call_forward()

struct ast_channel * ast_call_forward ( struct ast_channel caller,
struct ast_channel orig,
int *  timeout,
struct ast_format_cap cap,
struct outgoing_helper oh,
int *  outstate 
)

Forwards a call to a new channel specified by the original channel's call_forward str. If possible, the new forwarded channel is created and returned while the original one is terminated.

Parameters
callerin channel that requested orig
origchannel being replaced by the call forward channel
timeoutmaximum amount of time to wait for setup of new forward channel
capformat capabilities for requested channel
ohoutgoing helper used with original channel
outstatereason why unsuccessful (if unsuccessful)
Returns
Returns the forwarded call's ast_channel on success or NULL on failure

Definition at line 5917 of file channel.c.

5918{
5919 char tmpchan[256];
5920 char forwarder[AST_CHANNEL_NAME];
5921 struct ast_channel *new_chan = NULL;
5922 char *data, *type;
5923 int cause = 0;
5924 int res;
5925
5926 /* gather data and request the new forward channel */
5927 ast_copy_string(tmpchan, ast_channel_call_forward(orig), sizeof(tmpchan));
5928 ast_copy_string(forwarder, ast_channel_name(orig), sizeof(forwarder));
5929 if ((data = strchr(tmpchan, '/'))) {
5930 *data++ = '\0';
5931 type = tmpchan;
5932 } else {
5933 const char *forward_context;
5934 ast_channel_lock(orig);
5935 forward_context = pbx_builtin_getvar_helper(orig, "FORWARD_CONTEXT");
5936 snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(orig), S_OR(forward_context, ast_channel_context(orig)));
5937 ast_channel_unlock(orig);
5938 data = tmpchan;
5939 type = "Local";
5940 }
5941 if (!(new_chan = ast_request(type, cap, NULL, orig, data, &cause))) {
5942 ast_log(LOG_NOTICE, "Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause);
5943 handle_cause(cause, outstate);
5944 ast_hangup(orig);
5945 return NULL;
5946 }
5947
5948 /* Copy/inherit important information into new channel */
5949 if (oh) {
5950 if (oh->vars) {
5951 ast_channel_lock(new_chan);
5952 ast_set_variables(new_chan, oh->vars);
5953 ast_channel_unlock(new_chan);
5954 }
5955 if (oh->parent_channel) {
5956 call_forward_inherit(new_chan, oh->parent_channel, orig);
5957 }
5958 if (!ast_strlen_zero(oh->account)) {
5959 ast_channel_lock(new_chan);
5961 ast_channel_accountcode_set(new_chan, oh->account);
5962 ast_channel_peeraccount_set(new_chan, oh->account);
5964 ast_channel_unlock(new_chan);
5965 }
5966 } else if (caller) { /* no outgoing helper so use caller if available */
5967 call_forward_inherit(new_chan, caller, orig);
5968 }
5969
5970 ast_channel_lock_both(orig, new_chan);
5972 pbx_builtin_setvar_helper(new_chan, "FORWARDERNAME", forwarder);
5976 ast_channel_unlock(new_chan);
5977 ast_channel_unlock(orig);
5978
5979 /* call new channel */
5980 res = ast_call(new_chan, data, 0);
5981 if (timeout) {
5982 *timeout = res;
5983 }
5984 if (res) {
5985 ast_log(LOG_NOTICE, "Unable to call forward to channel %s/%s\n", type, (char *)data);
5986 ast_hangup(orig);
5987 ast_hangup(new_chan);
5988 return NULL;
5989 }
5990 ast_hangup(orig);
5991
5992 return new_chan;
5993}
void ast_party_connected_line_copy(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src)
Copy the source connected line information to the destination connected line.
Definition: channel.c:2050
static void call_forward_inherit(struct ast_channel *new_chan, struct ast_channel *parent, struct ast_channel *orig)
Definition: channel.c:5889
void ast_channel_set_flag(struct ast_channel *chan, unsigned int flag)
Set a flag on a channel.
Definition: channel.c:11049
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.
Definition: channel.c:2154
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
#define AST_CHANNEL_NAME
Definition: channel.h:173
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.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition: strings.h:80
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
const char * data
struct ast_party_caller caller
Channel Caller ID information.

References outgoing_helper::account, ast_call(), ast_channel_call_forward(), ast_channel_connected(), ast_channel_context(), ast_channel_lock, ast_channel_lock_both, AST_CHANNEL_NAME, ast_channel_name(), ast_channel_redirecting(), ast_channel_req_accountcodes(), AST_CHANNEL_REQUESTOR_REPLACEMENT, ast_channel_set_flag(), ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_unlock, ast_copy_string(), AST_FLAG_ORIGINATED, ast_hangup(), ast_log, ast_party_connected_line_copy(), ast_party_redirecting_copy(), ast_request(), ast_set_variables(), ast_strlen_zero(), call_forward_inherit(), ast_channel::caller, ast_channel::data, handle_cause(), LOG_NOTICE, NULL, outgoing_helper::parent_channel, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), S_OR, type, and outgoing_helper::vars.

Referenced by __ast_request_and_dial().

◆ ast_cause2str()

const char * ast_cause2str ( int  cause)

Gives the string form of a given cause code.

Parameters
causecause to get the description of
Returns
the text form of the binary cause code given

Gives the string form of a given cause code.

Definition at line 612 of file channel.c.

613{
614 int x;
615
616 for (x = 0; x < ARRAY_LEN(causes); x++) {
617 if (causes[x].cause == cause)
618 return causes[x].desc;
619 }
620
621 return "Unknown";
622}
static const struct causes_map causes[]
Definition: channel.c:136
const char * desc
Definition: channel.c:133
#define ARRAY_LEN(a)
Definition: utils.h:666

References ARRAY_LEN, causes, and causes_map::desc.

Referenced by bridge_dissolve(), channel_destroyed_event(), channel_state_change(), dial_exec_full(), findmeexec(), hangupcause_read(), and rfc3326_add_reason_header().

◆ ast_change_name()

void ast_change_name ( struct ast_channel chan,
const char *  newname 
)

Change channel name.

Precondition
Absolutely all channels MUST be unlocked before calling this function.
Parameters
chanthe channel to change the name of
newnamethe name to change to
Note
this function must NEVER be used when any channels are locked regardless if it is the channel who's name is being changed or not because it invalidates our channel container locking order... lock container first, then the individual channels, never the other way around.

Definition at line 6778 of file channel.c.

6779{
6780 /* We must re-link, as the hash value will change here. */
6782 ast_channel_lock(chan);
6783 ao2_unlink(channels, chan);
6784 __ast_change_name_nolink(chan, newname);
6785 ao2_link(channels, chan);
6786 ast_channel_unlock(chan);
6788}
#define ao2_link(container, obj)
Add an object to a container.
Definition: astobj2.h:1532
#define ao2_unlink(container, obj)
Remove an object from a container.
Definition: astobj2.h:1578
#define ao2_unlock(a)
Definition: astobj2.h:729
#define ao2_lock(a)
Definition: astobj2.h:717
static void __ast_change_name_nolink(struct ast_channel *chan, const char *newname)
this function simply changes the name of the channel and issues a manager_event with out unlinking an...
Definition: channel.c:6761

References __ast_change_name_nolink(), ao2_link, ao2_lock, ao2_unlink, ao2_unlock, ast_channel_lock, ast_channel_unlock, and channels.

◆ ast_channel__bridge()

struct ast_channel * ast_channel__bridge ( const struct ast_channel chan)

◆ ast_channel__bridge_set()

void ast_channel__bridge_set ( struct ast_channel chan,
struct ast_channel value 
)

◆ ast_channel_accountcode()

const char * ast_channel_accountcode ( const struct ast_channel chan)

◆ ast_channel_adsicpe()

enum ast_channel_adsicpe ast_channel_adsicpe ( const struct ast_channel chan)

Definition at line 782 of file channel_internal_api.c.

783{
784 return chan->adsicpe;
785}
enum ast_channel_adsicpe adsicpe

References ast_channel::adsicpe.

◆ ast_channel_adsicpe_set()

void ast_channel_adsicpe_set ( struct ast_channel chan,
enum ast_channel_adsicpe  value 
)

◆ ast_channel_alert_writable()

int ast_channel_alert_writable ( struct ast_channel chan)

Definition at line 1126 of file channel_internal_api.c.

1127{
1128 return ast_alertpipe_writable(chan->alertpipe);
1129}
int ast_alertpipe_writable(int alert_pipe[2])
Determine if the alert pipe is writable.
Definition: alertpipe.h:130

References ast_channel::alertpipe, and ast_alertpipe_writable().

Referenced by __ast_queue_frame().

◆ ast_channel_alert_write()

int ast_channel_alert_write ( struct ast_channel chan)

Definition at line 1111 of file channel_internal_api.c.

1112{
1113 return ast_alertpipe_write(chan->alertpipe);
1114}
ssize_t ast_alertpipe_write(int alert_pipe[2])
Write an event to an alert pipe.
Definition: alertpipe.c:120

References ast_channel::alertpipe, and ast_alertpipe_write().

Referenced by __ast_queue_frame(), __ast_read(), and channel_do_masquerade().

◆ ast_channel_amaflags()

enum ama_flags ast_channel_amaflags ( const struct ast_channel chan)

◆ ast_channel_amaflags2string()

const char * ast_channel_amaflags2string ( enum ama_flags  flags)

Convert the enum representation of an AMA flag to a string representation.

Since
12
Parameters
flagsinteger flag
Return values
Astring representation of the flag

Definition at line 4392 of file channel.c.

4393{
4394 switch (flag) {
4395 case AST_AMA_OMIT:
4396 return "OMIT";
4397 case AST_AMA_BILLING:
4398 return "BILLING";
4400 return "DOCUMENTATION";
4401 default:
4402 return "Unknown";
4403 }
4404}
long int flag
Definition: f2c.h:83

References AST_AMA_BILLING, AST_AMA_DOCUMENTATION, and AST_AMA_OMIT.

Referenced by ast_cdr_format_var(), beanstalk_put(), build_csv_record(), build_radius_record(), cdr_read_callback(), cel_bs_put(), handle_cli_ooh323_show_config(), handle_cli_ooh323_show_peer(), handle_cli_ooh323_show_user(), manager_log(), and tds_log().

◆ ast_channel_amaflags_set()

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

Definition at line 425 of file channel_internal_api.c.

426{
427 if (chan->amaflags == value) {
428 return;
429 }
430 chan->amaflags = value;
432}
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.

References ast_channel::amaflags, ast_channel_publish_snapshot(), and value.

Referenced by __ast_channel_alloc_ap(), ast_cel_fabricate_channel_from_event(), ast_iax2_new(), AST_TEST_DEFINE(), cdr_write(), dahdi_new(), func_channel_write_real(), and ooh323_new().

◆ ast_channel_answertime()

struct timeval ast_channel_answertime ( struct ast_channel chan)

Definition at line 987 of file channel_internal_api.c.

988{
989 return chan->answertime;
990}
struct timeval answertime

Referenced by ast_channel_get_up_time_ms(), and set_channel_answer_time().

◆ ast_channel_answertime_set()

void ast_channel_answertime_set ( struct ast_channel chan,
struct timeval *  value 
)

Definition at line 992 of file channel_internal_api.c.

993{
994 chan->answertime = *value;
995}

References ast_channel::answertime, and value.

Referenced by set_channel_answer_time().

◆ ast_channel_appl()

const char * ast_channel_appl ( const struct ast_channel chan)

◆ ast_channel_appl_set()

void ast_channel_appl_set ( struct ast_channel chan,
const char *  value 
)

Definition at line 335 of file channel_internal_api.c.

336{
337 chan->appl = value;
339}
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.
@ AST_CHANNEL_SNAPSHOT_INVALIDATE_DIALPLAN

References ast_channel::appl, AST_CHANNEL_SNAPSHOT_INVALIDATE_DIALPLAN, ast_channel_snapshot_invalidate_segment(), and value.

Referenced by ast_cel_fabricate_channel_from_event(), AST_TEST_DEFINE(), begin_dial_prerun(), dial_exec_full(), do_forward(), pbx_exec(), realtime_exec(), and ring_entry().

◆ ast_channel_audiohooks()

struct ast_audiohook_list * ast_channel_audiohooks ( const struct ast_channel chan)

◆ ast_channel_audiohooks_set()

void ast_channel_audiohooks_set ( struct ast_channel chan,
struct ast_audiohook_list value 
)

Definition at line 594 of file channel_internal_api.c.

595{
596 chan->audiohooks = value;
597}

References ast_channel::audiohooks, and value.

Referenced by __ast_read(), ast_audiohook_attach(), ast_write_stream(), and destroy_hooks().

◆ ast_channel_autochans()

struct ast_autochan_list * ast_channel_autochans ( struct ast_channel chan)

Definition at line 873 of file channel_internal_api.c.

874{
875 return &chan->autochans;
876}
struct ast_autochan_list autochans

References ast_channel::autochans.

Referenced by __ast_channel_alloc_ap(), ast_autochan_destroy(), ast_autochan_new_channel(), and ast_autochan_setup().

◆ ast_channel_blocker()

pthread_t ast_channel_blocker ( const struct ast_channel chan)

Definition at line 1214 of file channel_internal_api.c.

1215{
1216 return chan->blocker;
1217}

References ast_channel::blocker.

Referenced by __ast_queue_frame(), ast_softhangup_nolock(), and channel_do_masquerade().

◆ ast_channel_blocker_set()

void ast_channel_blocker_set ( struct ast_channel chan,
pthread_t  value 
)

Definition at line 1218 of file channel_internal_api.c.

1219{
1220 chan->blocker = value;
1221}

References ast_channel::blocker, and value.

◆ ast_channel_blocker_tid()

int ast_channel_blocker_tid ( const struct ast_channel chan)

Definition at line 1223 of file channel_internal_api.c.

1224{
1225 return chan->blocker_tid;
1226}

References ast_channel::blocker_tid.

Referenced by ast_hangup().

◆ ast_channel_blocker_tid_set()

void ast_channel_blocker_tid_set ( struct ast_channel chan,
int  tid 
)

Definition at line 1227 of file channel_internal_api.c.

1228{
1229 chan->blocker_tid = value;
1230}

References ast_channel::blocker_tid, and value.

◆ ast_channel_blockproc()

const char * ast_channel_blockproc ( const struct ast_channel chan)

Definition at line 340 of file channel_internal_api.c.

341{
342 return chan->blockproc;
343}
const char * blockproc

References ast_channel::blockproc.

Referenced by ast_hangup(), and serialize_showchan().

◆ ast_channel_blockproc_set()

void ast_channel_blockproc_set ( struct ast_channel chan,
const char *  value 
)

Definition at line 344 of file channel_internal_api.c.

345{
346 chan->blockproc = value;
347}

References ast_channel::blockproc, and value.

◆ ast_channel_bridge_peer()

struct ast_channel * ast_channel_bridge_peer ( struct ast_channel chan)

Get the channel's bridge peer only if the bridge is two-party.

Since
12.0.0
Parameters
chanChannel desiring the bridge peer channel.
Note
The returned peer channel is the current peer in the bridge when called.
Absolutely NO channel locks should be held when calling this function.
Return values
NULLChannel not in a bridge or the bridge is not two-party.
non-NULLReffed peer channel at time of calling.

Definition at line 10586 of file channel.c.

10587{
10588 struct ast_channel *peer;
10589 struct ast_bridge *bridge;
10590
10591 /* Get the bridge the channel is in. */
10592 ast_channel_lock(chan);
10593 bridge = ast_channel_get_bridge(chan);
10594 ast_channel_unlock(chan);
10595 if (!bridge) {
10596 return NULL;
10597 }
10598
10599 peer = ast_bridge_peer(bridge, chan);
10600 ao2_ref(bridge, -1);
10601 return peer;
10602}
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
struct ast_channel * ast_bridge_peer(struct ast_bridge *bridge, struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
Definition: bridge.c:4075
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
Definition: channel.c:10556
Structure that contains information about a bridge.
Definition: bridge.h:349

References ao2_ref, ast_bridge_peer(), ast_channel_get_bridge(), ast_channel_lock, ast_channel_unlock, and NULL.

Referenced by analog_ss_thread(), ast_rtp_instance_set_stats_vars(), ast_set_hangupsource(), ast_unreal_queryoption(), ast_var_channels_table(), attach_barge(), channel_do_masquerade(), create_jb(), fax_detect_framehook(), fax_gateway_framehook(), func_channel_read(), handle_incoming_request(), manager_park(), my_get_sigpvt_bridged_channel(), and spandsp_fax_gateway_start().

◆ ast_channel_call_forward()

const char * ast_channel_call_forward ( const struct ast_channel chan)

◆ ast_channel_callback()

struct ast_channel * ast_channel_callback ( ao2_callback_data_fn cb_fn,
void *  arg,
void *  data,
int  ao2_flags 
)

Call a function with every active channel.

This function executes a callback one time for each active channel on the system. The channel is provided as an argument to the function.

Note
Absolutely NO channel locks should be held before calling this function.
Since
1.8

Definition at line 1297 of file channel.c.

1299{
1300 return ao2_callback_data(channels, ao2_flags, cb_fn, arg, data);
1301}
#define ao2_callback_data(container, flags, cb_fn, arg, data)
Definition: astobj2.h:1723

References ao2_callback_data, channels, and ast_channel::data.

Referenced by ast_channel_get_by_exten(), ast_channel_get_by_name_prefix(), ast_channel_iterator_by_exten_new(), ast_channel_iterator_by_name_new(), ast_pickup_find_by_group(), does_id_conflict(), find_by_channel(), find_by_part(), handle_core_set_debug_channel(), and pickup_by_mark().

◆ ast_channel_caller()

struct ast_party_caller * ast_channel_caller ( struct ast_channel chan)

Definition at line 889 of file channel_internal_api.c.

890{
891 return &chan->caller;
892}

References ast_channel::caller.

Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_channel_alloc_ap(), __ast_goto_if_exists(), __ast_pbx_run(), acf_isexten_exec(), action_meetmelist(), after_bridge_move_channel(), agent_request_exec(), analog_ss_thread(), app_exec(), ast_app_dtget(), ast_ari_channels_dial(), ast_bridge_setup_after_goto(), ast_cel_fabricate_channel_from_event(), ast_channel_destructor(), ast_channel_set_caller(), ast_channel_set_caller_event(), ast_do_pickup(), ast_dummy_channel_destructor(), ast_iax2_new(), ast_pbx_h_exten_run(), ast_set_callerid(), ast_str_retrieve_variable(), AST_TEST_DEFINE(), ast_unreal_call_setup(), ast_var_channels_table(), background_detect_exec(), begin_dial_prerun(), blacklist_read(), bridge_reconfigured_connected_line_update(), callerid_read(), callerid_write(), cc_generic_agent_init(), chan_pjsip_cng_tone_detected(), chan_pjsip_new(), channel_do_masquerade(), channel_snapshot_caller_create(), collect_digits(), console_call(), copy_caller_data(), copy_message(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_new(), dial_exec_full(), dial_trunk(), dialog_info_generate_body_content(), disa_exec(), do_forward(), fax_detect_framehook(), find_matching_endif(), find_matching_endwhile(), findmeexec(), forward_message(), gosub_exec(), gosub_run(), grab_transfer(), handle_cli_confbridge_list_item(), handle_gosub(), handle_setpriority(), handle_showchan(), incoming_in_dialog_request(), isAnsweringMachine(), isexten_function_read(), launch_monitor_thread(), leave_voicemail(), local_call(), manager_queues_status(), meetme_show_cmd(), minivm_greet_exec(), minivm_notify_exec(), my_get_callerid(), my_handle_dtmf(), onModeChanged(), ooh323_rtp_read(), originate_exec(), park_local_transfer(), pbx_builtin_background(), pbx_builtin_waitexten(), pbx_outgoing_attempt(), pbx_parse_location(), privacy_exec(), queue_connected_line_update(), queue_exec(), readexten_exec(), recalling_enter(), ring_entry(), run_externnotify(), serialize_showchan(), setup_env(), setup_privacy_args(), sla_ring_station(), sms_exec(), socket_process_helper(), start_automixmonitor(), try_calling(), unistim_new(), unreal_colp_redirect_indicate(), update_connected_line_from_peer(), update_initial_connected_line(), valid_exit(), vm_authenticate(), wait_for_answer(), waitstream_core(), write_metadata(), and zapateller_exec().

◆ ast_channel_caller_set()

void ast_channel_caller_set ( struct ast_channel chan,
struct ast_party_caller value 
)

◆ ast_channel_callgroup()

ast_group_t ast_channel_callgroup ( const struct ast_channel chan)

◆ ast_channel_callgroup_set()

void ast_channel_callgroup_set ( struct ast_channel chan,
ast_group_t  value 
)
Precondition
chan is locked

Definition at line 1079 of file channel_internal_api.c.

1080{
1081 chan->callgroup = value;
1082}

References ast_channel::callgroup, and value.

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

◆ ast_channel_callid()

ast_callid ast_channel_callid ( const struct ast_channel chan)

◆ ast_channel_callid_cleanup()

void ast_channel_callid_cleanup ( struct ast_channel chan)

Definition at line 1069 of file channel_internal_api.c.

1070{
1071 chan->callid = 0;
1072}

References ast_channel::callid.

Referenced by ast_channel_destructor().

◆ ast_channel_callid_set()

void ast_channel_callid_set ( struct ast_channel chan,
ast_callid  value 
)
Precondition
chan is locked

Definition at line 798 of file channel_internal_api.c.

799{
800 char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
801 char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
802 call_identifier_from[0] = '\0';
803 ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
804 if (chan->callid) {
805 ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
806 ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
807 }
808
809 chan->callid = callid;
810
811 ast_test_suite_event_notify("CallIDChange",
812 "State: CallIDChange\r\n"
813 "Channel: %s\r\n"
814 "CallID: %s\r\n"
815 "PriorCallID: %s",
816 ast_channel_name(chan),
817 call_identifier_to,
818 call_identifier_from);
819}
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
#define AST_CALLID_BUFFER_LENGTH
#define ast_test_suite_event_notify(s, f,...)
Definition: test.h:189

References AST_CALLID_BUFFER_LENGTH, ast_callid_strnprint(), ast_channel_name(), 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(), common_recall_channel_setup(), dahdi_new(), iax2_request(), jingle_new(), and request_channel().

◆ ast_channel_cc_params_init()

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.

Since
1.8
Note
If base_params is NULL, the channel will get the default values for all CCSS parameters.

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 to create the datastore on
base_paramsCCSS parameters we wish to copy into the channel
Return values
0Success
-1Failure

Definition at line 10473 of file channel.c.

10475{
10476 struct ast_cc_config_params *cc_params;
10477 struct ast_datastore *cc_datastore;
10478
10479 if (!(cc_params = ast_cc_config_params_init())) {
10480 return -1;
10481 }
10482
10483 if (!(cc_datastore = ast_datastore_alloc(&cc_channel_datastore_info, NULL))) {
10485 return -1;
10486 }
10487
10488 if (base_params) {
10489 ast_cc_copy_config_params(cc_params, base_params);
10490 }
10491 cc_datastore->data = cc_params;
10492 ast_channel_datastore_add(chan, cc_datastore);
10493 return 0;
10494}
#define ast_cc_config_params_init()
Allocate and initialize an ast_cc_config_params structure.
Definition: ccss.h:135
void ast_cc_config_params_destroy(struct ast_cc_config_params *params)
Free memory from CCSS configuration params.
Definition: ccss.c:692
void ast_cc_copy_config_params(struct ast_cc_config_params *dest, const struct ast_cc_config_params *src)
copy CCSS configuration parameters from one structure to another
Definition: ccss.c:854
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2404
static const struct ast_datastore_info cc_channel_datastore_info
Definition: channel.c:10467
#define ast_datastore_alloc(info, uid)
Definition: datastore.h:85
Structure for a data store object.
Definition: datastore.h:64
void * data
Definition: datastore.h:66

References ast_cc_config_params_destroy(), ast_cc_config_params_init, ast_cc_copy_config_params(), ast_channel_datastore_add(), ast_datastore_alloc, cc_channel_datastore_info, ast_datastore::data, and NULL.

Referenced by ast_channel_get_cc_config_params(), ast_unreal_call_setup(), ast_unreal_new_channels(), and dahdi_new().

◆ ast_channel_cdr()

struct ast_cdr * ast_channel_cdr ( const struct ast_channel chan)

Definition at line 598 of file channel_internal_api.c.

599{
600 return chan->cdr;
601}
struct ast_cdr * cdr

References ast_channel::cdr.

Referenced by ast_channel_destructor(), ast_channel_log(), ast_dummy_channel_destructor(), cdr_read_callback(), and cdr_retrieve_time().

◆ ast_channel_cdr_set()

void ast_channel_cdr_set ( struct ast_channel chan,
struct ast_cdr value 
)

Definition at line 602 of file channel_internal_api.c.

603{
604 chan->cdr = value;
605}

References ast_channel::cdr, and value.

Referenced by ast_channel_destructor(), ast_dummy_channel_destructor(), custom_log(), manager_log(), and write_cdr().

◆ ast_channel_clear_flag()

void ast_channel_clear_flag ( struct ast_channel chan,
unsigned int  flag 
)

Clear a flag on a channel.

Since
13.17.0
Parameters
chanThe channel to clear the flag from
flagThe flag to clear
Note
This will lock the channel internally. If the channel is already locked it is still safe to call.

Definition at line 11056 of file channel.c.

11057{
11058 ast_channel_lock(chan);
11060 ast_channel_unlock(chan);
11061}

References ast_channel_flags(), ast_channel_lock, ast_channel_unlock, and ast_clear_flag.

Referenced by action_redirect(), ast_bridge_setup_after_goto(), ast_channel_undefer_dtmf(), ast_waitfordigit_full(), bridge_channel_internal_pull(), channel_spy(), common_exec(), dial_exec_full(), disa_exec(), do_broadcast(), handle_exec(), and waitstream_core().

◆ ast_channel_clear_softhangup()

void ast_channel_clear_softhangup ( struct ast_channel chan,
int  flag 
)

Clear a set of softhangup flags from a channel.

Never clear a softhangup flag from a channel directly. Instead, use this function. This ensures that all aspects of the softhangup process are aborted.

Parameters
chanthe channel to clear the flag on
flagthe flag or flags to clear

Definition at line 2451 of file channel.c.

2452{
2453 ast_channel_lock(chan);
2454
2456
2458 struct ast_frame *fr;
2459
2460 /* If we have completely cleared the softhangup flag,
2461 * then we need to fully abort the hangup process. This requires
2462 * pulling the END_OF_Q frame out of the channel frame queue if it
2463 * still happens to be there. */
2464
2465 fr = AST_LIST_LAST(ast_channel_readq(chan));
2466 if (fr && fr->frametype == AST_FRAME_CONTROL &&
2469 ast_frfree(fr);
2470 }
2471 }
2472
2473 ast_channel_unlock(chan);
2474}
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value)
struct ast_readq_list * ast_channel_readq(struct ast_channel *chan)
@ AST_CONTROL_END_OF_Q
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
Definition: linkedlists.h:429

References ast_channel_lock, ast_channel_readq(), ast_channel_softhangup_internal_flag(), ast_channel_softhangup_internal_flag_clear(), ast_channel_unlock, AST_CONTROL_END_OF_Q, AST_FRAME_CONTROL, ast_frfree, AST_LIST_LAST, AST_LIST_REMOVE, ast_frame::frametype, ast_frame_subclass::integer, and ast_frame::subclass.

Referenced by __ast_pbx_run(), ast_bridge_setup_after_goto(), chan_cleanup(), collect_digits(), gosub_run(), and stasis_app_exec().

◆ ast_channel_cmpwhentohangup_tv()

int ast_channel_cmpwhentohangup_tv ( struct ast_channel chan,
struct timeval  offset 
)

Compare a offset with the settings of when to hang a channel up.

Parameters
chanchannel on which to check for hangup
offsetoffset in seconds and microseconds from current time
Return values
1
0
-1This function compares a offset from current time with the absolute time out on a channel (when to hang up). If the absolute time out on a channel is earlier than current time plus the offset, it returns 1, if the two time values are equal, it return 0, otherwise, it return -1.
Since
1.6.1

Compare a offset with the settings of when to hang a channel up.

Definition at line 523 of file channel.c.

524{
525 struct timeval whentohangup;
526
528 return ast_tvzero(offset) ? 0 : -1;
529
530 if (ast_tvzero(offset))
531 return 1;
532
533 whentohangup = ast_tvadd(offset, ast_tvnow());
534
535 return ast_tvdiff_ms(whentohangup, *ast_channel_whentohangup(chan));
536}
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
Definition: time.h:117
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Definition: extconf.c:2282
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:107

References ast_channel_whentohangup(), ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), and ast_tvzero().

◆ ast_channel_connected()

struct ast_party_connected_line * ast_channel_connected ( struct ast_channel chan)

◆ ast_channel_connected_effective_id()

struct ast_party_id ast_channel_connected_effective_id ( struct ast_channel chan)

Definition at line 901 of file channel_internal_api.c.

902{
903 return ast_party_id_merge(&chan->connected.id, &chan->connected.