channel.h File Reference

General Asterisk PBX channel definitions. More...

#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/data.h"
#include "asterisk/channelstate.h"
#include "asterisk/ccss.h"
#include "asterisk/framehook.h"
#include "asterisk/stasis.h"
#include "asterisk/json.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_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

Defines

#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.
#define AST_BRIDGE_DTMF_CHANNEL_1   (1 << 1)
 Report DTMF on channel 1.
#define AST_CHAN_WRITE_INFO_T_VERSION   1
 ast_chan_write_info_t version. Must be incremented if structure is changed
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
 Create a channel structure.
#define ast_channel_alloc_with_endpoint(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag, endpoint,...)
#define ast_channel_cleanup(c)   ({ ao2_cleanup(c); (struct ast_channel *) (NULL); })
 Cleanup a channel reference.
#define ast_channel_lock(chan)   ao2_lock(chan)
#define ast_channel_lock_both(chan1, chan2)
 Lock two channels.
#define AST_CHANNEL_NAME   80
#define ast_channel_ref(c)   ({ ao2_ref(c, +1); (c); })
 Increase channel reference count.
#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.
#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   20
#define AST_MAX_CONTEXT   80
#define AST_MAX_EXTENSION   80
#define AST_MAX_FDS   11
#define AST_MAX_PUBLIC_UNIQUEID   149
#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_TIMING_FD   (AST_MAX_FDS-2)
#define CHECK_BLOCKING(c)
#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.
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.
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.
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_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_alert_status_t { AST_ALERT_READ_SUCCESS = 0, AST_ALERT_NOT_READABLE, AST_ALERT_READ_FAIL, AST_ALERT_READ_FATAL }
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_requestor_relationship { AST_CHANNEL_REQUESTOR_BRIDGE_PEER, AST_CHANNEL_REQUESTOR_REPLACEMENT }
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.
struct ast_channel
*attribute_malloc 
__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.
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.
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
static int ast_add_fd (struct pollfd *pfd, int fd)
 if fd is a valid descriptor, set *pfd with the descriptor
int ast_answer (struct ast_channel *chan)
 Answer a channel.
int ast_auto_answer (struct ast_channel *chan)
 Answer a channel, if it's not already answered.
void ast_autoservice_chan_hangup_peer (struct ast_channel *chan, struct ast_channel *peer)
 Put chan into autoservice while hanging up peer.
int ast_autoservice_ignore (struct ast_channel *chan, enum ast_frame_type ftype)
 Ignore certain frame types.
int ast_autoservice_start (struct ast_channel *chan)
 Automatically service a channel for us...
int ast_autoservice_stop (struct ast_channel *chan)
 Stop servicing a channel for us...
int ast_call (struct ast_channel *chan, const char *addr, int timeout)
 Make a call.
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.
const char * ast_cause2str (int state) attribute_pure
 Gives the string form of a given cause code.
void ast_change_name (struct ast_channel *chan, const char *newname)
 Change channel name.
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.
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)
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.
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.
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.
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_softhangup (struct ast_channel *chan, int flag)
 Clear a set of softhangup flags from a channel.
int ast_channel_cmpwhentohangup (struct ast_channel *chan, time_t offset)
 Compare a offset with the settings of when to hang a channel up.
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.
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_macro (struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int is_caller, int frame)
 Run a connected line interception macro and update a channel's connected line information.
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.
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)
int ast_channel_data_add_structure (struct ast_data *tree, struct ast_channel *chan, int add_bridged)
 Insert into an astdata tree, the channel structure.
int ast_channel_data_cmp_structure (const struct ast_data_search *tree, struct ast_channel *chan, const char *structure_name)
 Compare to channel structures using the data api.
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.
struct ast_datastore
*attribute_malloc 
ast_channel_datastore_alloc (const struct ast_datastore_info *info, const char *uid)
 Create a channel data store object.
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.
int ast_channel_datastore_free (struct ast_datastore *datastore)
 Free a channel data store object.
int ast_channel_datastore_inherit (struct ast_channel *from, struct ast_channel *to)
 Inherit datastores from a parent to a child.
int ast_channel_datastore_remove (struct ast_channel *chan, struct ast_datastore *datastore)
 Remove a datastore from a channel.
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.
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.
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.
void ast_channel_dialed_causes_clear (const struct ast_channel *chan)
 Clear all cause information from the channel.
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.
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).
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.
int ast_channel_epfd (const struct ast_channel *chan)
void ast_channel_epfd_set (struct ast_channel *chan, int value)
const char * ast_channel_exten (const struct ast_channel *chan)
void ast_channel_exten_set (struct ast_channel *chan, const char *value)
int ast_channel_fd (const struct ast_channel *chan, int which)
int ast_channel_fd_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.
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.
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.
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.
unsigned int ast_channel_fout (const struct ast_channel *chan)
void ast_channel_fout_set (struct ast_channel *chan, unsigned int value)
struct ast_framehook_listast_channel_framehooks (const struct ast_channel *chan)
void ast_channel_framehooks_set (struct ast_channel *chan, struct ast_framehook_list *value)
struct ast_generatorast_channel_generator (const struct ast_channel *chan)
void ast_channel_generator_set (struct ast_channel *chan, struct ast_generator *value)
void * ast_channel_generatordata (const struct ast_channel *chan)
void ast_channel_generatordata_set (struct ast_channel *chan, void *value)
struct ast_bridgeast_channel_get_bridge (const struct ast_channel *chan)
 Get the bridge associated with a channel.
struct ast_bridge_channelast_channel_get_bridge_channel (struct ast_channel *chan)
 Get a reference to the channel's bridge pointer.
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.
struct ast_cc_config_paramsast_channel_get_cc_config_params (struct ast_channel *chan)
 Get the CCSS parameters from a channel.
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.
int ast_channel_get_duration (struct ast_channel *chan)
 Obtain how long the channel since the channel was created.
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().
static enum ast_t38_state ast_channel_get_t38_state (struct ast_channel *chan)
 Retrieves the current T38 state of a channel.
int ast_channel_get_up_time (struct ast_channel *chan)
 Obtain how long it has been since the channel was answered.
struct varsheadast_channel_get_vars (struct ast_channel *chan)
 Gets the variables for a given channel, as set using pbx_builtin_setvar_helper().
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.
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_audio_frame_or_monitor (struct ast_channel *chan)
 Check if the channel has active audiohooks, active framehooks, or a monitor.
int ast_channel_has_hook_requiring_audio (struct ast_channel *chan)
 Check if the channel has any active hooks that require audio.
int ast_channel_has_manager_vars (void)
 Return whether or not any manager variables have been set.
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.
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_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.
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.
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.
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).
void ast_channel_internal_swap_topics (struct ast_channel *a, struct ast_channel *b)
 Swap topics beteween two channels.
void ast_channel_internal_swap_uniqueid_and_linkedid (struct ast_channel *a, struct ast_channel *b)
 Swap uniqueid and linkedid beteween two channels.
int ast_channel_is_bridged (const struct ast_channel *chan)
 Determine if a channel is in a bridge.
int ast_channel_is_leaving_bridge (struct ast_channel *chan)
 Determine if a channel is leaving a bridge, but not hung up.
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_latest_musicclass (const struct ast_channel *chan)
const char * ast_channel_linkedid (const struct ast_channel *chan)
const char * ast_channel_macrocontext (const struct ast_channel *chan)
void ast_channel_macrocontext_set (struct ast_channel *chan, const char *value)
const char * ast_channel_macroexten (const struct ast_channel *chan)
void ast_channel_macroexten_set (struct ast_channel *chan, const char *value)
int ast_channel_macropriority (const struct ast_channel *chan)
void ast_channel_macropriority_set (struct ast_channel *chan, int value)
int ast_channel_make_compatible (struct ast_channel *chan, struct ast_channel *peer)
 Make the frame formats of two channels compatible.
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)
struct ast_channel_monitorast_channel_monitor (const struct ast_channel *chan)
void ast_channel_monitor_set (struct ast_channel *chan, struct ast_channel_monitor *value)
int ast_channel_move (struct ast_channel *dest, struct ast_channel *source)
 Move a channel from its current location to a new location.
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_set (struct ast_channel *chan, const char *name)
 Set the channel name.
void ast_channel_name_to_dial_string (char *channel_name)
 Removes the trailing identifiers from a channel name string.
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.
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.
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.
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.
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
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)
int ast_channel_redirecting_macro (struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *redirecting_info, int is_caller, int is_frame)
 Run a redirecting interception macro and update a channel's redirecting information.
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.
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.
struct ast_channelast_channel_release (struct ast_channel *chan)
 Unlink and release reference to a channel.
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().
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().
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.
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.
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.
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.
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.
void ast_channel_set_fd (struct ast_channel *chan, int which, int fd)
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.
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.
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.
void ast_channel_set_unbridged_nolock (struct ast_channel *chan, int value)
 Variant of ast_channel_set_unbridged. Use this if the channel is already locked prior to calling.
void ast_channel_set_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.
void ast_channel_setwhentohangup (struct ast_channel *chan, time_t offset)
 Set when to hang a channel up.
void ast_channel_setwhentohangup_tv (struct ast_channel *chan, struct timeval offset)
 Set when to hang a channel up.
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.
struct ast_silence_generatorast_channel_start_silence_generator (struct ast_channel *chan)
 Starts a silence generator on the given channel.
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.
struct ast_filestreamast_channel_stream (const struct ast_channel *chan)
void ast_channel_stream_set (struct ast_channel *chan, struct ast_filestream *value)
int ast_channel_streamid (const struct ast_channel *chan)
void ast_channel_streamid_set (struct ast_channel *chan, int value)
enum ama_flags ast_channel_string2amaflag (const char *flag)
 Convert a string to a detail record AMA flag.
int ast_channel_supports_html (struct ast_channel *channel)
 Checks for HTML support on a channel.
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.
struct ast_channel_techast_channel_tech (const struct ast_channel *chan)
void * ast_channel_tech_pvt (const struct ast_channel *chan)
void ast_channel_tech_pvt_set (struct ast_channel *chan, void *value)
void ast_channel_tech_set (struct ast_channel *chan, const struct ast_channel_tech *value)
struct ast_timerast_channel_timer (const struct ast_channel *chan)
void ast_channel_timer_set (struct ast_channel *chan, struct ast_timer *value)
void * ast_channel_timingdata (const struct ast_channel *chan)
void ast_channel_timingdata_set (struct ast_channel *chan, void *value)
int ast_channel_timingfd (const struct ast_channel *chan)
void ast_channel_timingfd_set (struct ast_channel *chan, int value)
ast_timing_func_t ast_channel_timingfunc (const struct ast_channel *chan)
void ast_channel_timingfunc_set (struct ast_channel *chan, ast_timing_func_t value)
struct stasis_topicast_channel_topic (struct ast_channel *chan)
 A topic which publishes the events for a particular channel.
struct stasis_topicast_channel_topic_cached (struct ast_channel *chan)
 A topic which publishes the events for a particular channel.
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.
int ast_channel_unbridged_nolock (struct ast_channel *chan)
 ast_channel_unbridged variant. Use this if the channel is already locked prior to calling.
void ast_channel_undefer_dtmf (struct ast_channel *chan)
 Unset defer DTMF flag on channel.
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.
void ast_channel_unregister (const struct ast_channel_tech *tech)
 Unregister a channel technology.
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.
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.
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.
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.
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
int ast_check_hangup (struct ast_channel *chan)
 Check to see if a channel is needing hang up.
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.
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.
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.
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.
void ast_deactivate_generator (struct ast_channel *chan)
struct ast_channelast_dummy_channel_alloc (void)
 Create a fake channel structure.
static int ast_fdisset (struct pollfd *pfds, int fd, int maximum, int *start)
 Helper function for migrating select to poll.
struct ast_channel_techast_get_channel_tech (const char *name)
 Get a channel technology structure by name.
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.
void ast_hangup (struct ast_channel *chan)
 Hang up a channel.
int ast_indicate (struct ast_channel *chan, int condition)
 Indicates condition of channel.
int ast_indicate_data (struct ast_channel *chan, int condition, const void *data, size_t datalen)
 Indicates condition of channel, with payload.
int ast_is_deferrable_frame (const struct ast_frame *frame)
 Should we keep this frame for later?
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.
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.
void ast_party_caller_free (struct ast_party_caller *doomed)
 Destroy the caller party contents.
void ast_party_caller_init (struct ast_party_caller *init)
 Initialize the given caller structure.
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.
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.
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.
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.
void ast_party_connected_line_free (struct ast_party_connected_line *doomed)
 Destroy the connected line information contents.
void ast_party_connected_line_init (struct ast_party_connected_line *init)
 Initialize the given connected line structure.
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.
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.
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.
void ast_party_dialed_free (struct ast_party_dialed *doomed)
 Destroy the dialed party contents.
void ast_party_dialed_init (struct ast_party_dialed *init)
 Initialize the given dialed structure.
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.
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.
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.
void ast_party_id_free (struct ast_party_id *doomed)
 Destroy the party id contents.
void ast_party_id_init (struct ast_party_id *init)
 Initialize the given party id structure.
void ast_party_id_invalidate (struct ast_party_id *id)
 Invalidate all components of the given party id.
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.
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.
int ast_party_id_presentation (const struct ast_party_id *id)
 Determine the overall presentation value for the given party.
void ast_party_id_reset (struct ast_party_id *id)
 Destroy and initialize the given party id structure.
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.
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.
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.
void ast_party_name_free (struct ast_party_name *doomed)
 Destroy the party name contents.
void ast_party_name_init (struct ast_party_name *init)
 Initialize the given name structure.
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.
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.
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.
void ast_party_number_free (struct ast_party_number *doomed)
 Destroy the party number contents.
void ast_party_number_init (struct ast_party_number *init)
 Initialize the given number structure.
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.
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.
void ast_party_redirecting_copy (struct ast_party_redirecting *dest, const struct ast_party_redirecting *src)
 Copy the source redirecting information to the destination redirecting.
void ast_party_redirecting_free (struct ast_party_redirecting *doomed)
 Destroy the redirecting information contents.
void ast_party_redirecting_init (struct ast_party_redirecting *init)
 Initialize the given redirecting structure.
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.
void ast_party_redirecting_reason_free (struct ast_party_redirecting_reason *doomed)
 Destroy the redirecting reason contents.
void ast_party_redirecting_reason_init (struct ast_party_redirecting_reason *init)
 Initialize the given redirecting reason structure.
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.
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.
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.
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.
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.
void ast_party_subaddress_free (struct ast_party_subaddress *doomed)
 Destroy the party subaddress contents.
void ast_party_subaddress_init (struct ast_party_subaddress *init)
 Initialize the given subaddress structure.
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.
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.
void ast_poll_channel_add (struct ast_channel *chan0, struct ast_channel *chan1)
void ast_poll_channel_del (struct ast_channel *chan0, struct ast_channel *chan1)
int ast_pre_call (struct ast_channel *chan, const char *sub_args)
 Execute a Gosub call on the channel before a call is placed.
char * ast_print_group (char *buf, int buflen, ast_group_t group)
 Print call and pickup groups into buffer.
char * ast_print_namedgroups (struct ast_str **buf, struct ast_namedgroups *groups)
 Print named call groups and named pickup groups.
int ast_prod (struct ast_channel *chan)
 Send empty audio to prime a channel driver.
int ast_queue_control (struct ast_channel *chan, enum ast_control_frame_type control)
 Queue a control frame without payload.
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.
int ast_queue_frame (struct ast_channel *chan, struct ast_frame *f)
 Queue one or more frames to a channel's frame queue.
int ast_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.
int ast_queue_hangup (struct ast_channel *chan)
 Queue a hangup frame.
int ast_queue_hangup_with_cause (struct ast_channel *chan, int cause)
 Queue a hangup frame with hangupcause set.
int ast_queue_hold (struct ast_channel *chan, const char *musicclass)
 Queue a hold frame.
int ast_queue_unhold (struct ast_channel *chan)
 Queue an unhold frame.
int ast_raw_answer (struct ast_channel *chan)
 Answer a channel.
struct ast_frameast_read (struct ast_channel *chan)
 Reads a frame.
struct ast_frameast_read_noaudio (struct ast_channel *chan)
 Reads a frame, returning AST_FRAME_NULL frame if audio.
int ast_readstring (struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders)
 Reads multiple digits.
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.
char * ast_recvtext (struct ast_channel *chan, int timeout)
 Receives a text string from a channel Read a string of text from a channel.
int ast_redirecting_build_data (unsigned char *data, size_t datalen, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
 Build the redirecting id data frame.
int ast_redirecting_parse_data (const unsigned char *data, size_t datalen, struct ast_party_redirecting *redirecting)
 Parse redirecting indication frame data.
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.
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.
int ast_safe_sleep (struct ast_channel *chan, int ms)
 Wait for a specified amount of time, looking for hangups.
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.
int ast_senddigit (struct ast_channel *chan, char digit, unsigned int duration)
 Send a DTMF digit to a channel.
int ast_senddigit_begin (struct ast_channel *chan, char digit)
 Send a DTMF digit to a channel.
int ast_senddigit_end (struct ast_channel *chan, char digit, unsigned int duration)
 Send a DTMF digit to a channel.
int ast_sendtext (struct ast_channel *chan, const char *text)
 Sends text to a channel.
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.
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.
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.
int ast_set_read_format (struct ast_channel *chan, struct ast_format *format)
 Sets read format on channel chan.
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.
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.
void ast_set_variables (struct ast_channel *chan, struct ast_variable *vars)
 adds a list of channel variables to a channel
int ast_set_write_format (struct ast_channel *chan, struct ast_format *format)
 Sets write format on channel chan.
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.
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.
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 reason)
 Softly hangup up a channel.
void ast_softhangup_all (void)
 Soft hangup all active channels.
int ast_softhangup_nolock (struct ast_channel *chan, int reason)
 Softly hangup up a channel (no channel lock).
const char * ast_state2str (enum ast_channel_state)
 Gives the string form of a given channel state.
int ast_str2cause (const char *name) attribute_pure
 Convert the string form of a cause code to a number.
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).
char * ast_transfercapability2str (int transfercapability) attribute_const
 Gives the string form of a given transfer capability.
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.
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.
int ast_waitfor_n_fd (int *fds, int n, int *ms, int *exception)
 Waits for input on an fd.
struct ast_channelast_waitfor_nandfds (struct ast_channel **chan, int n, int *fds, int nfds, int *exception, int *outfd, int *ms)
 Waits for activity on a group of channels.
int ast_waitfordigit (struct ast_channel *c, int ms)
 Waits for a digit.
int ast_waitfordigit_full (struct ast_channel *c, int ms, 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.
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.
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.
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.
const char * channelreloadreason2txt (enum channelreloadreason reason)
 Convert enum channelreloadreason to text string for manager event.
 DECLARE_STRINGFIELD_SETTERS_FOR (dialcontext)
 DECLARE_STRINGFIELD_SETTERS_FOR (hangupsource)
 DECLARE_STRINGFIELD_SETTERS_FOR (parkinglot)
 DECLARE_STRINGFIELD_SETTERS_FOR (linkedid)
 DECLARE_STRINGFIELD_SETTERS_FOR (uniqueid)
 DECLARE_STRINGFIELD_SETTERS_FOR (call_forward)
 DECLARE_STRINGFIELD_SETTERS_FOR (userfield)
 DECLARE_STRINGFIELD_SETTERS_FOR (peeraccount)
 DECLARE_STRINGFIELD_SETTERS_FOR (accountcode)
 DECLARE_STRINGFIELD_SETTERS_FOR (latest_musicclass)
 DECLARE_STRINGFIELD_SETTERS_FOR (musicclass)
 DECLARE_STRINGFIELD_SETTERS_FOR (language)
 DECLARE_STRINGFIELD_SETTERS_FOR (name)
struct ast_channelast_channel_get_by_exten (const char *exten, const char *context)
 Find a channel by extension and context.
struct ast_channelast_channel_get_by_name (const char *name)
 Find a channel by name.
struct ast_channelast_channel_get_by_name_prefix (const char *name, size_t name_len)
 Find a channel by a name prefix.
struct ast_channel_iteratorast_channel_iterator_all_new (void)
 Create a new channel iterator.
struct ast_channel_iteratorast_channel_iterator_by_exten_new (const char *exten, const char *context)
 Create a new channel iterator based on extension.
struct ast_channel_iteratorast_channel_iterator_by_name_new (const char *name, size_t name_len)
 Create a new channel iterator based on name.
struct ast_channel_iteratorast_channel_iterator_destroy (struct ast_channel_iterator *i)
 Destroy a channel iterator.
struct ast_channelast_channel_iterator_next (struct ast_channel_iterator *i)
 Get the next channel for a channel iterator.

Variables

struct ast_channel_tech ast_kill_tech
 Kill the channel channel driver technology descriptor.
unsigned long global_fin
unsigned long global_fout


Detailed Description

General Asterisk PBX channel definitions.

See also:

Definition in file channel.h.


Define Documentation

#define AST_AGENT_FD   (AST_MAX_FDS-3)

used by agents for pass through

Definition at line 193 of file channel.h.

#define AST_ALERT_FD   (AST_MAX_FDS-1)

used for alertpipe

Definition at line 191 of file channel.h.

Referenced by __ast_channel_alloc_ap().

#define AST_BRIDGE_DTMF_CHANNEL_0   (1 << 0)

Report DTMF on channel 0.

Definition at line 2104 of file channel.h.

Referenced by set_config_flags().

#define AST_BRIDGE_DTMF_CHANNEL_1   (1 << 1)

Report DTMF on channel 1.

Definition at line 2106 of file channel.h.

Referenced by set_config_flags().

#define AST_CHAN_WRITE_INFO_T_VERSION   1

ast_chan_write_info_t version. Must be incremented if structure is changed

Definition at line 574 of file channel.h.

Referenced by ast_unreal_setoption(), and func_channel_write().

#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__)
Create a channel structure.

Return values:
NULL failure
non-NULL successfully 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 1181 of file channel.h.

Referenced by alsa_new(), ast_channel_yank(), ast_iax2_new(), ast_pbx_outgoing_exten(), AST_TEST_DEFINE(), ast_unreal_new_channels(), console_new(), create_msg_q_chan(), dahdi_new(), do_notify(), mbl_new(), mgcp_new(), misdn_new(), multicast_rtp_request(), nbs_new(), ooh323_new(), oss_new(), phone_new(), rec_request(), sip_new(), skinny_new(), stasis_app_control_snoop(), test_vm_api_create_mock_channel(), unicast_rtp_request(), and unistim_new().

#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 1185 of file channel.h.

Referenced by ast_iax2_new(), chan_pjsip_new(), jingle_new(), and sip_new().

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

#define ast_channel_lock ( chan   )     ao2_lock(chan)

Definition at line 2600 of file channel.h.

Referenced by __after_bridge_set_goto(), __analog_handle_event(), __analog_ss_thread(), __ast_answer(), __ast_channel_alloc_ap(), __ast_pbx_run(), __ast_queue_frame(), __ast_read(), __ast_request_and_dial(), __dahdi_exception(), __sip_destroy(), _macro_exec(), _while_exec(), acf_cc_read(), acf_cc_write(), acf_fetch(), acf_odbc_read(), acquire_bridge(), action_add_agi_cmd(), action_atxfer(), action_bridge(), action_dialplan_exec(), action_redirect(), action_status(), action_timeout(), add_features_datastore(), add_to_agi(), after_bridge_goto_remove(), after_bridge_move_channel(), agent_bridge_channel_get_lock(), agent_lock_logged(), agent_login_channel_config(), agent_login_exec(), agent_logout(), agent_request_exec(), alloc_playback_chan(), analog_attempt_transfer(), analog_exception(), analog_ss_thread(), app_exec(), append_expected_event(), ari_channels_handle_originate_with_id(), ast_activate_generator(), ast_async_goto(), ast_audiohook_attach(), ast_audiohook_detach_source(), ast_audiohook_remove(), ast_audiohook_set_mute(), ast_autochan_destroy(), ast_autochan_setup(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_add_channel(), ast_bridge_call_with_flags(), ast_bridge_channel_playfile(), ast_bridge_channel_restore_formats(), ast_bridge_channel_update_linkedids(), ast_bridge_depart(), ast_bridge_features_ds_get_string(), ast_bridge_features_ds_set_string(), ast_bridge_impart(), ast_bridge_join(), ast_bridge_notify_masquerade(), ast_bridge_timelimit(), ast_bridge_transfer_attended(), ast_bridge_transfer_blind(), ast_call(), ast_call_forward(), ast_cc_agent_set_interfaces_chanvar(), ast_cc_call_init(), ast_cc_completed(), ast_cc_extension_monitor_add_dialstring(), ast_cc_get_current_core_id(), ast_cc_is_recall(), ast_cc_offer(), ast_change_name(), ast_channel_bridge_peer(), ast_channel_by_exten_cb(), ast_channel_by_name_cb(), ast_channel_by_uniqueid_cb(), ast_channel_clear_softhangup(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_channel_destructor(), ast_channel_end_dtmf(), ast_channel_publish_dial_forward(), ast_channel_publish_dial_internal(), ast_channel_queryoption(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), ast_channel_set_caller(), ast_channel_set_caller_event(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_channel_set_unbridged(), ast_channel_setoption(), ast_channel_softhangup_withcause_locked(), ast_channel_unbridged(), ast_channel_yank(), ast_check_hangup_locked(), ast_deactivate_generator(), ast_dial_join(), ast_do_pickup(), ast_eivr_getvariable(), ast_explicit_goto(), ast_handle_cc_control_frame(), ast_hangup(), ast_ignore_cc(), ast_indicate_data(), ast_jb_create_framehook(), ast_local_setup_bridge(), ast_local_setup_masquerade(), ast_odbc_retrieve_transaction_obj(), ast_openstream_full(), ast_pbx_h_exten_run(), ast_pbx_hangup_handler_destroy(), ast_pbx_hangup_handler_pop(), ast_pbx_hangup_handler_push(), ast_pbx_hangup_handler_run(), ast_pbx_hangup_handler_show(), ast_pickup_call(), ast_pickup_find_by_group(), ast_pre_call(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_raw_answer(), ast_read_generator_actions(), ast_rtp_instance_make_compatible(), ast_rtp_instance_set_stats_vars(), ast_safe_sleep_conditional(), ast_senddigit_begin(), ast_senddigit_end(), ast_sendtext(), ast_set_callerid(), ast_set_cc_interfaces_chanvar(), ast_set_hangupsource(), ast_settimeout_full(), ast_setup_cc_recall_datastore(), ast_softhangup(), ast_stopstream(), ast_str_retrieve_variable(), AST_TEST_DEFINE(), ast_transfer(), ast_unreal_channel_push_to_bridge(), ast_unreal_hangup(), ast_unreal_lock_all(), ast_unreal_queryoption(), ast_unreal_setoption(), ast_var_channel_bridge(), ast_var_channels_table(), ast_waitfor_nandfds(), ast_write(), attach_barge(), attempt_transfer(), attended_transfer_bridge(), attended_transfer_monitor_thread(), attended_transfer_properties_alloc(), auth_exec(), begin_dial_prerun(), bridge_after_cb(), bridge_channel_change_bridge(), bridge_channel_feature_digit_timeout(), bridge_channel_ind_thread(), bridge_channel_internal_join(), bridge_channel_internal_queue_attended_transfer(), bridge_channel_internal_queue_blind_transfer(), bridge_check_monitor(), bridge_exec(), bridge_move(), bridge_parking_push(), bridge_reconfigured_connected_line_update(), bridge_stasis_push_peek(), bridge_stasis_queue_join_action(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), call_forward_inherit(), caller_id_outgoing_request(), caller_id_outgoing_response(), callerid_read(), callerid_write(), cb_events(), cc_build_payload(), cc_interfaces_datastore_init(), cdr_write_callback(), chan_cleanup(), chan_pjsip_answer(), chan_pjsip_cng_tone_detected(), chan_pjsip_incoming_response(), chan_pjsip_indicate(), channel_do_masquerade(), channel_set_cause(), channel_set_debug(), channel_spy(), check_bridge_play_sound(), clear_dialed_interfaces(), common_exec(), conf_find_bridge_profile(), conf_find_user_profile(), conf_run(), conf_set_menu_to_user(), conf_start_moh(), connectedline_read(), connectedline_write(), control_prestart_dispatch_all(), create_channel_snapshot_message(), create_dynamic_lot_full(), create_msg_q_chan(), create_parked_subscription_full(), crement_function_read(), dahdi_handle_dtmf(), dahdi_handle_event(), data_channels_provider_handler(), deactivate_silence_generator(), dial_exec_full(), dialplan_handle_msg_cb(), disa_exec(), disable_jack_hook(), do_forward(), do_notify(), dundi_query_read(), dundi_result_read(), dynamic_dtmf_hook_trip(), enable_jack_hook(), end_bridge_callback(), enum_query_read(), enum_result_read(), exec_odbcfinish(), expand_gosub_args(), fax_detect_attach(), fax_detect_framehook(), fax_gateway_attach(), fax_gateway_framehook(), fax_gateway_start(), feature_automixmonitor(), feature_automonitor(), feature_blind_transfer(), fetch_bridge_roles_datastore(), fetch_or_create_bridge_roles_datastore(), find_by_mark(), find_by_name(), find_by_uniqueid(), find_channel_by_group(), find_conf_realtime(), find_details(), find_or_create_details(), find_ringing_channel(), find_speech(), find_transaction(), frame_trace_helper(), func_channel_read(), func_channel_write_real(), func_channels_read(), func_confbridge_helper(), func_header_read(), func_mixmonitor_read(), function_ooh323_read(), function_ooh323_write(), gather_softmix_stats(), generate_parked_user(), generator_force(), generator_write_format_change(), generic_fax_exec(), get_agi_cmd(), get_cid_name(), get_device_state_causing_channels(), get_transfer_parties(), gosub_exec(), gosub_run(), grab_transfer(), handle_autohangup(), handle_call_forward(), handle_call_outgoing(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_gosub(), handle_incoming_request(), handle_invite_replaces(), handle_request_bye(), handle_show_chanvar(), handle_showchan(), handle_soft_key_event_message(), handle_softhangup(), handle_stimulus_message(), hangupcause_clear_exec(), hangupcause_keys_read(), hangupcause_read(), hold(), hook_callback(), hook_off(), hook_re_enable(), hook_thread_arg_alloc(), iax2_request(), import_ch(), import_helper(), init_hook(), init_jack_data(), invite_replaces(), is_colp_update_allowed(), jack_hook_callback(), jingle_action_session_initiate(), jingle_session_lock_full(), launch_monitor_thread(), leave_voicemail(), limits_interval_playback(), listfilter(), local_ast_moh_stop(), local_call(), local_read(), local_write(), lua_get_state(), manager_bridge_kick(), manager_mixmonitor(), manager_park(), manager_park_bridged(), mark_transaction_active(), meetme_menu_admin_extended(), meetme_stasis_generate_msg(), mgcp_ss(), minivm_delete_exec(), minivm_notify_exec(), misdn_answer(), misdn_update_caller_id(), mixmonitor_thread(), moh_files_generator(), morsecode_exec(), msg_data_func_read(), msg_data_func_write(), msg_func_read(), msg_func_write(), msg_send_exec(), mute_channel(), my_handle_dtmf(), MYSQL_exec(), native_bridge_is_capable(), native_chan_changed(), native_rtp_bridge_framehook_attach(), native_rtp_bridge_framehook_detach(), native_rtp_framehook(), native_start(), notify_new_message(), ooh323_answer(), park_and_announce_app_exec(), park_app_exec(), park_common_setup(), parked_call_app_exec(), parked_call_payload_from_failure(), parked_call_payload_from_parked_user(), parked_call_retrieve_enable_features(), parker_parked_call_message_response(), parking_duration_callback(), parking_park_call(), pbx_builtin_background(), pbx_builtin_busy(), pbx_builtin_congestion(), pbx_builtin_getvar_helper(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_pushvar_helper(), pbx_builtin_saycharacters(), pbx_builtin_saycharacters_case(), pbx_builtin_saydigits(), pbx_builtin_saynumber(), pbx_builtin_sayphonetic(), pbx_builtin_serialize_variables(), pbx_builtin_setamaflags(), pbx_builtin_setvar_helper(), pbx_exec(), pbx_outgoing_attempt(), peek_read(), phone_new(), pickup_by_exten(), pitchshift_helper(), play_sound(), pop_exec(), pre_bridge_setup(), process_sdp(), publish_dahdichannel(), queue_exec(), queue_publish_multi_channel_blob(), read_config(), realtime_exec(), recall_pull(), receive_ademco_event(), redirecting_read(), redirecting_write(), refer_incoming_invite_request(), refer_outgoing_request(), refer_progress_bridge(), release_transaction(), remove_stasis_end_published(), retrydial_exec(), return_exec(), ringing(), run_agi(), sayunixtime_exec(), send_start_msg(), sendtext_exec(), serialize_showchan(), set_bridge_peer_vars_2party(), set_bridge_peer_vars_holding(), set_bridge_peer_vars_multiparty(), set_caps(), set_config_flags(), set_ext_pri(), set_format(), set_security_requirements(), set_softmix_bridge_data(), set_transfer_variables_all(), setup_bridge_features_builtin(), setup_bridge_features_dynamic(), setup_mixmonitor(), setup_mixmonitor_ds(), setup_park_common_datastore(), setup_peer_after_bridge_goto(), shared_read(), shared_write(), sip_addheader(), sip_dtmfmode(), sip_hangup(), sip_new(), sip_pvt_lock_full(), sip_read(), sip_removeheader(), sipinfo_send(), skinny_locksub(), skinny_newcall(), smdi_msg_read(), smdi_msg_retrieve_read(), softhangup_exec(), softmix_bridge_write_voice(), speech_background(), speech_create(), speech_datastore_destroy(), speex_read(), speex_write(), srv_datastore_setup(), srv_query_read(), srv_result_read(), stackpeek_read(), start_monitor_action(), start_monitor_exec(), stasis_app_channel_is_internal(), stasis_app_channel_is_stasis_end_published(), stasis_app_channel_set_internal(), stasis_app_channel_set_stasis_end_published(), stasis_app_exec(), state_notify_build_xml(), stop_automonitor(), stop_mixmonitor_full(), t38_attach_framehook(), timeout_write(), transfer_pull(), transmit_invite(), try_calling(), try_parking(), unhold(), unistim_ss(), unreal_colp_redirect_indicate(), unreal_queue_frame(), update_initial_connected_line(), userevent_exec(), vm_execmain(), volume_write(), wait_for_answer(), wait_for_bridged(), wait_for_unbridged(), wipe_park_common_datastore(), and wipe_subscription_datastore().

#define ast_channel_lock_both ( chan1,
chan2   ) 

#define AST_CHANNEL_NAME   80

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

Increase channel reference count.

Parameters:
c the channel
Return values:
c always
Since:
1.8

Definition at line 2625 of file channel.h.

Referenced by agent_bridge_channel_get_lock(), agent_lock_logged(), agent_login_exec(), agents_sweep(), analog_attempt_transfer(), ari_channels_handle_originate_with_id(), ast_autochan_new_channel(), ast_autochan_setup(), ast_bridge_add_channel(), ast_bridge_peer_nolock(), ast_bridge_set_single_src_video_mode(), ast_bridge_update_talker_src_video_mode(), ast_local_get_peer(), ast_local_setup_bridge(), ast_local_setup_masquerade(), ast_unreal_channel_push_to_bridge(), ast_unreal_lock_all(), ast_unreal_queryoption(), ast_unreal_setoption(), attempt_transfer(), attended_transfer_properties_alloc(), blond_nonfinal_enter(), bridge_agent_hold_push(), bridge_channel_attended_transfer(), call_pickup_incoming_request(), channel_do_masquerade(), conf_announce_channel_push(), conf_start_record(), export_aoc_vars(), feature_attended_transfer(), find_ringing_channel(), get_device_state_causing_channels(), get_refer_info(), get_sip_pvt_from_replaces(), get_transfer_party_non_transferer_bridge(), handle_getvariablefull(), handle_invite_replaces(), handle_request_bye(), handle_request_refer(), handle_soft_key_event_message(), hangup_data_alloc(), invite_replaces(), jingle_session_lock_full(), misdn_attempt_transfer(), parking_blind_transfer_park(), pbx_outgoing_attempt(), recalling_exit(), refer_attended_alloc(), retransfer_enter(), set_hangup_source_and_cause(), sip_pickup(), sip_pvt_lock_full(), sip_queue_hangup_cause(), snoop_fixup(), socket_process_helper(), stasis_app_control_snoop(), and unreal_queue_frame().

#define ast_channel_trylock ( chan   )     ao2_trylock(chan)

#define ast_channel_unlock ( chan   )     ao2_unlock(chan)

Definition at line 2601 of file channel.h.

Referenced by __after_bridge_set_goto(), __analog_handle_event(), __analog_ss_thread(), __ast_answer(), __ast_pbx_run(), __ast_queue_frame(), __ast_read(), __ast_request_and_dial(), __dahdi_exception(), __sip_autodestruct(), __sip_destroy(), _macro_exec(), _while_exec(), acf_cc_read(), acf_cc_write(), acf_fetch(), acf_odbc_read(), acquire_bridge(), action_add_agi_cmd(), action_agents(), action_atxfer(), action_bridge(), action_dialplan_exec(), action_redirect(), action_status(), action_timeout(), add_features_datastore(), add_to_agi(), after_bridge_goto_remove(), after_bridge_move_channel(), agent_bridge_channel_get_lock(), agent_function_read(), agent_handle_show_specific(), agent_lock_logged(), agent_login_channel_config(), agent_login_exec(), agent_logoff_request(), agent_logout(), agent_request_exec(), agent_show_requested(), alloc_playback_chan(), alsa_call(), alsa_new(), analog_attempt_transfer(), analog_exception(), analog_hangup(), analog_ss_thread(), app_exec(), append_expected_event(), ari_channels_handle_originate_with_id(), ast_activate_generator(), ast_async_goto(), ast_audiohook_attach(), ast_audiohook_detach_source(), ast_audiohook_remove(), ast_audiohook_set_mute(), ast_autochan_destroy(), ast_autochan_setup(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_add_channel(), ast_bridge_call_with_flags(), ast_bridge_channel_playfile(), ast_bridge_channel_restore_formats(), ast_bridge_channel_update_linkedids(), ast_bridge_depart(), ast_bridge_features_ds_get_string(), ast_bridge_features_ds_set_string(), ast_bridge_impart(), ast_bridge_join(), ast_bridge_notify_masquerade(), ast_bridge_timelimit(), ast_bridge_transfer_attended(), ast_bridge_transfer_blind(), ast_bridge_unreal_optimize_out(), ast_call(), ast_call_forward(), ast_cc_agent_set_interfaces_chanvar(), ast_cc_call_init(), ast_cc_completed(), ast_cc_extension_monitor_add_dialstring(), ast_cc_get_current_core_id(), ast_cc_is_recall(), ast_cc_offer(), ast_change_name(), ast_channel_bridge_peer(), ast_channel_by_exten_cb(), ast_channel_by_name_cb(), ast_channel_by_uniqueid_cb(), ast_channel_clear_softhangup(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_channel_destructor(), ast_channel_end_dtmf(), ast_channel_make_compatible_helper(), ast_channel_move(), ast_channel_publish_dial_forward(), ast_channel_publish_dial_internal(), ast_channel_queryoption(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), ast_channel_set_caller(), ast_channel_set_caller_event(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_channel_set_unbridged(), ast_channel_setoption(), ast_channel_softhangup_withcause_locked(), ast_channel_unbridged(), ast_channel_yank(), ast_check_hangup_locked(), ast_deactivate_generator(), ast_dial_join(), ast_do_pickup(), ast_eivr_getvariable(), ast_explicit_goto(), ast_handle_cc_control_frame(), ast_hangup(), ast_iax2_new(), ast_ignore_cc(), ast_indicate_data(), ast_jb_create_framehook(), ast_local_setup_bridge(), ast_local_setup_masquerade(), ast_odbc_retrieve_transaction_obj(), ast_openstream_full(), ast_pbx_h_exten_run(), ast_pbx_hangup_handler_destroy(), ast_pbx_hangup_handler_pop(), ast_pbx_hangup_handler_push(), ast_pbx_hangup_handler_run(), ast_pbx_hangup_handler_show(), ast_pbx_outgoing_exten(), ast_pickup_call(), ast_pickup_find_by_group(), ast_pre_call(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_raw_answer(), ast_read_generator_actions(), ast_request(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_rtp_instance_make_compatible(), ast_rtp_instance_set_stats_vars(), ast_safe_sleep_conditional(), ast_senddigit_begin(), ast_senddigit_end(), ast_sendtext(), ast_set_callerid(), ast_set_cc_interfaces_chanvar(), ast_set_hangupsource(), ast_settimeout_full(), ast_setup_cc_recall_datastore(), ast_softhangup(), ast_stopstream(), ast_str_retrieve_variable(), AST_TEST_DEFINE(), ast_transfer(), ast_unreal_channel_push_to_bridge(), ast_unreal_hangup(), ast_unreal_lock_all(), ast_unreal_new_channels(), ast_unreal_queryoption(), ast_unreal_setoption(), ast_var_channel_bridge(), ast_var_channels_table(), ast_waitfor_nandfds(), ast_write(), attach_barge(), attempt_transfer(), attended_transfer_bridge(), attended_transfer_monitor_thread(), attended_transfer_properties_alloc(), auth_exec(), auto_congest(), begin_dial_prerun(), blind_transfer_bridge(), bridge_after_cb(), bridge_channel_change_bridge(), bridge_channel_feature_digit_timeout(), bridge_channel_ind_thread(), bridge_channel_internal_join(), bridge_channel_internal_queue_attended_transfer(), bridge_channel_internal_queue_blind_transfer(), bridge_channel_update_accountcodes_joining(), bridge_channel_update_accountcodes_leaving(), bridge_check_monitor(), bridge_exec(), bridge_move(), bridge_parking_push(), bridge_reconfigured_connected_line_update(), bridge_stasis_push_peek(), bridge_stasis_queue_join_action(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), call_forward_inherit(), caller_id_outgoing_request(), caller_id_outgoing_response(), callerid_read(), callerid_write(), cb_events(), cc_build_payload(), cc_interfaces_datastore_init(), cdr_write_callback(), chan_cleanup(), chan_pjsip_answer(), chan_pjsip_cng_tone_detected(), chan_pjsip_incoming_response(), chan_pjsip_indicate(), chan_pjsip_new(), channel_do_masquerade(), channel_set_cause(), channel_set_debug(), channel_spy(), check_bridge_play_sound(), check_rtp_timeout(), clear_dialed_interfaces(), close_udptl_connection(), common_exec(), conf_find_bridge_profile(), conf_find_user_profile(), conf_run(), conf_set_menu_to_user(), conf_start_moh(), configure_local_rtp(), connectedline_read(), connectedline_write(), console_answer(), console_hangup(), console_new(), console_sendtext(), control_prestart_dispatch_all(), copy_caller_data(), create_channel_snapshot_message(), create_dynamic_lot_full(), create_msg_q_chan(), create_parked_subscription_full(), crement_function_read(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_new(), dahdi_queue_frame(), dahdi_softhangup_all(), data_channels_provider_handler(), deactivate_silence_generator(), dial_exec_full(), dial_transfer(), dialog_unlink_all(), dialplan_handle_msg_cb(), disa_exec(), disable_jack_hook(), do_forward(), do_monitor(), do_notify(), dundi_query_read(), dundi_result_read(), dynamic_dtmf_hook_trip(), enable_jack_hook(), end_bridge_callback(), enum_query_read(), enum_result_read(), exec_odbcfinish(), expand_gosub_args(), fast_originate(), fax_detect_attach(), fax_detect_framehook(), fax_gateway_attach(), fax_gateway_framehook(), fax_gateway_start(), feature_automixmonitor(), feature_automonitor(), feature_blind_transfer(), fetch_bridge_roles_datastore(), fetch_or_create_bridge_roles_datastore(), find_by_mark(), find_by_name(), find_by_uniqueid(), find_channel_by_group(), find_conf_realtime(), find_details(), find_or_create_details(), find_ringing_channel(), find_speech(), find_transaction(), findmeexec(), frame_trace_helper(), func_channel_read(), func_channel_write_real(), func_channels_read(), func_confbridge_helper(), func_header_read(), func_mixmonitor_read(), function_ooh323_read(), function_ooh323_write(), gather_softmix_stats(), generate_parked_user(), generator_force(), generator_write_format_change(), generic_fax_exec(), get_agi_cmd(), get_cid_name(), get_device_state_causing_channels(), get_refer_info(), get_transfer_parties(), gosub_exec(), gosub_run(), grab_transfer(), handle_autohangup(), handle_call_forward(), handle_call_outgoing(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_gosub(), handle_incoming_request(), handle_invite_replaces(), handle_request_bye(), handle_request_do(), handle_request_invite(), handle_request_refer(), handle_show_chanvar(), handle_showchan(), handle_soft_key_event_message(), handle_softhangup(), handle_stimulus_message(), hangupcause_clear_exec(), hangupcause_keys_read(), hangupcause_read(), hold(), hook_callback(), hook_off(), hook_re_enable(), hook_thread_arg_alloc(), iax2_destroy(), iax2_queue_frame(), iax2_queue_hangup(), iax2_queue_hold(), iax2_queue_unhold(), iax2_request(), import_ch(), import_helper(), init_hook(), init_jack_data(), invite_replaces(), is_colp_update_allowed(), jack_hook_callback(), jingle_action_session_accept(), jingle_action_session_info(), jingle_action_session_initiate(), jingle_action_session_terminate(), jingle_interpret_content(), jingle_new(), jingle_outgoing_hook(), jingle_queue_hangup_with_cause(), jingle_session_lock_full(), launch_monitor_thread(), leave_voicemail(), limits_interval_playback(), listfilter(), local_ast_moh_stop(), local_attended_transfer(), local_call(), local_read(), local_write(), lua_get_state(), manager_bridge_kick(), manager_mixmonitor(), manager_park(), manager_park_bridged(), mark_transaction_active(), mbl_new(), mbl_queue_control(), mbl_queue_hangup(), meetme_menu_admin_extended(), meetme_stasis_generate_msg(), mgcp_new(), mgcp_pktcgate_remove(), mgcp_queue_frame(), mgcp_queue_hangup(), mgcp_ss(), minivm_delete_exec(), minivm_notify_exec(), misdn_answer(), misdn_attempt_transfer(), misdn_new(), misdn_update_caller_id(), mixmonitor_thread(), moh_files_generator(), morsecode_exec(), msg_data_func_read(), msg_data_func_write(), msg_func_read(), msg_func_write(), msg_send_exec(), multicast_rtp_request(), mute_channel(), my_handle_dtmf(), MYSQL_exec(), native_bridge_is_capable(), native_chan_changed(), native_rtp_bridge_framehook_attach(), native_rtp_bridge_framehook_detach(), native_rtp_bridge_start(), native_rtp_bridge_stop(), native_rtp_framehook(), native_start(), nbs_new(), notify_new_message(), onAlerting(), onCallCleared(), onCallEstablished(), onModeChanged(), onProgress(), ooh323_answer(), ooh323_destroy(), ooh323_new(), ooh323_onReceivedDigit(), ooh323_set_read_format(), ooh323_set_write_format(), optimize_lock_peer_stack(), oss_new(), park_and_announce_app_exec(), park_app_exec(), park_common_setup(), park_local_transfer(), parked_call_app_exec(), parked_call_payload_from_failure(), parked_call_payload_from_parked_user(), parked_call_retrieve_enable_features(), parker_parked_call_message_response(), parking_duration_callback(), parking_park_call(), pbx_builtin_background(), pbx_builtin_busy(), pbx_builtin_congestion(), pbx_builtin_getvar_helper(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_pushvar_helper(), pbx_builtin_saycharacters(), pbx_builtin_saycharacters_case(), pbx_builtin_saydigits(), pbx_builtin_saynumber(), pbx_builtin_sayphonetic(), pbx_builtin_serialize_variables(), pbx_builtin_setamaflags(), pbx_builtin_setvar_helper(), pbx_exec(), pbx_outgoing_attempt(), peek_read(), phone_new(), pickup_by_channel(), pickup_by_exten(), pickup_by_group(), pickup_by_mark(), pickup_by_part(), pitchshift_helper(), play_sound(), pop_exec(), pre_bridge_setup(), proc_session_timer(), process_sdp(), publish_dahdichannel(), publish_local_bridge_message(), queue_exec(), queue_publish_multi_channel_blob(), read_config(), realtime_exec(), rec_request(), recall_pull(), recalling_enter(), receive_ademco_event(), redirecting_read(), redirecting_write(), refer_incoming_invite_request(), refer_outgoing_request(), refer_progress_bridge(), reinvite_timeout(), release_chan(), release_chan_early(), release_transaction(), remove_stasis_end_published(), retrans_pkt(), retransfer_enter(), retrydial_exec(), return_exec(), ring_entry(), ringing(), run_agi(), sayunixtime_exec(), send_provisional_keepalive_full(), send_start_msg(), sendtext_exec(), serialize_showchan(), set_bridge_peer_vars_2party(), set_bridge_peer_vars_holding(), set_bridge_peer_vars_multiparty(), set_caps(), set_config_flags(), set_ext_pri(), set_format(), set_hangup_source_and_cause(), set_security_requirements(), set_softmix_bridge_data(), set_transfer_variables_all(), setup_bridge_features_builtin(), setup_bridge_features_dynamic(), setup_mixmonitor(), setup_mixmonitor_ds(), setup_park_common_datastore(), setup_peer_after_bridge_goto(), setup_udptl_connection(), shared_read(), shared_write(), sip_addheader(), sip_dtmfmode(), sip_hangup(), sip_new(), sip_pvt_lock_full(), sip_queue_hangup_cause(), sip_read(), sip_reinvite_retry(), sip_removeheader(), sip_request_call(), sipinfo_send(), skinny_new(), skinny_newcall(), skinny_unlocksub(), smdi_msg_read(), smdi_msg_retrieve_read(), socket_process_helper(), softhangup_exec(), softmix_bridge_write_voice(), speech_background(), speech_create(), speech_datastore_destroy(), speex_read(), speex_write(), srv_datastore_setup(), srv_query_read(), srv_result_read(), stackpeek_read(), start_monitor_action(), start_monitor_exec(), stasis_app_channel_is_internal(), stasis_app_channel_is_stasis_end_published(), stasis_app_channel_set_internal(), stasis_app_channel_set_stasis_end_published(), stasis_app_channel_unreal_set_internal(), stasis_app_control_snoop(), stasis_app_exec(), state_notify_build_xml(), stop_automonitor(), stop_mixmonitor_full(), t38_attach_framehook(), test_vm_api_create_mock_channel(), timeout_write(), transfer_pull(), transmit_invite(), try_calling(), try_parking(), try_swap_optimize_out(), unhold(), unicast_rtp_request(), unistim_new(), unistim_ss(), unreal_colp_redirect_indicate(), unreal_queue_frame(), update_initial_connected_line(), userevent_exec(), vm_execmain(), volume_write(), wait_for_answer(), wait_for_bridged(), wait_for_unbridged(), wakeup_sub(), wipe_park_common_datastore(), and wipe_subscription_datastore().

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

Decrease channel reference count.

Parameters:
c the channel
Return values:
NULL always
Since:
1.8

Definition at line 2636 of file channel.h.

Referenced by __ast_channel_alloc_ap(), __ast_channel_internal_alloc(), __sip_autodestruct(), acf_odbc_read(), acf_odbc_write(), action_add_agi_cmd(), action_agents(), action_aocmessage(), action_atxfer(), action_getvar(), action_hangup(), action_redirect(), action_sendtext(), action_setvar(), action_status(), action_timeout(), agent_bridge_channel_get_lock(), agent_function_read(), agent_handle_show_specific(), agent_lock_logged(), agent_logoff_request(), agent_logout(), agent_pvt_destructor(), agent_show_requested(), agents_sweep(), analog_attempt_transfer(), ari_channels_handle_originate_with_id(), ast_add_extension2_lockopt(), ast_async_goto_by_name(), ast_autochan_destroy(), ast_autochan_new_channel(), ast_bridge_add_channel(), ast_bridge_remove_video_src(), ast_bridge_update_talker_src_video_mode(), ast_cel_fabricate_channel_from_event(), ast_channel_release(), ast_hangup(), ast_parse_device_state(), ast_pickup_call(), ast_pickup_find_by_group(), ast_rtp_instance_set_stats_vars(), ast_str_substitute_variables_full(), AST_TEST_DEFINE(), ast_unreal_channel_push_to_bridge(), ast_unreal_hangup(), ast_unreal_lock_all(), ast_unreal_queryoption(), ast_unreal_setoption(), ast_var_channel_bridge(), ast_var_channel_types_table(), ast_var_channels_table(), asyncgoto_exec(), attempt_transfer(), blond_nonfinal_enter(), blond_nonfinal_exit(), bridge_agent_hold_push(), bridge_channel_attended_transfer(), bridge_exec(), call_forwarded_handler(), call_pickup_incoming_request(), change_monitor_action(), channel_do_masquerade(), cleanup_video_mode(), cli_odbc_read(), cli_odbc_write(), common_exec(), conf_announce_channel_depart(), conf_announce_channel_push(), conf_start_record(), conf_stop_record(), controlplayback_manager(), custom_log(), data_channels_provider_handler(), dialog_unlink_all(), do_pause_or_unpause(), fast_originate(), func_channel_read(), func_channels_read(), func_mchan_read(), func_mchan_write(), get_device_state_causing_channels(), handle_bridge_kick_channel(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_core_set_debug_channel(), handle_getvariablefull(), handle_hangup(), handle_incoming_request(), handle_redirect(), handle_request_do(), handle_set_chanvar(), handle_show_chanvar(), handle_show_hangup_all(), handle_show_hangup_channel(), handle_showchan(), handle_soft_key_event_message(), handle_softhangup(), hangup_data_destroy(), import_helper(), jingle_action_session_accept(), jingle_action_session_info(), jingle_action_session_terminate(), jingle_interpret_content(), jingle_outgoing_hook(), jingle_queue_hangup_with_cause(), jingle_session_lock_full(), local_call(), make_email_file(), manager_log(), manager_mixmonitor(), manager_mute_mixmonitor(), manager_mutestream(), manager_optimize_away(), manager_play_dtmf(), manager_stop_mixmonitor(), misdn_attempt_transfer(), next_channel(), park_local_transfer(), parking_blind_transfer_park(), pbx_builtin_importvar(), pbx_outgoing_attempt(), pbx_substitute_variables_helper_full(), pickup_by_channel(), pickup_by_exten(), pickup_by_group(), pickup_by_mark(), pickup_by_part(), publish_local_bridge_message(), recalling_exit(), refer_incoming_invite_request(), refer_progress_bridge(), reinvite_timeout(), retransfer_enter(), retransfer_exit(), rotate_file(), send_provisional_keepalive_full(), senddtmf_exec(), sendmail(), sendpage(), set_hangup_source_and_cause(), shared_read(), shared_write(), sip_new(), sip_pickup(), sip_pickup_thread(), sip_pvt_lock_full(), sip_queue_hangup_cause(), skinny_new(), snoop_fixup(), socket_process_helper(), softhangup_exec(), start_monitor_action(), stasis_app_channel_unreal_set_internal(), state_notify_build_xml(), stop_monitor_action(), syslog_log(), unreal_colp_redirect_indicate(), unreal_queue_frame(), write_cdr(), and write_cel().

#define AST_FEATURE_DTMF_MASK

#define AST_GENERATOR_FD   (AST_MAX_FDS-4)

used by generator

Definition at line 194 of file channel.h.

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

#define AST_JITTERBUFFER_FD   (AST_MAX_FDS-5)

used by generator

Definition at line 195 of file channel.h.

Referenced by __ast_read(), ast_jb_create_framehook(), and hook_event_cb().

#define AST_MAX_ACCOUNT_CODE   20

Max length of an account code

Definition at line 161 of file channel.h.

#define AST_MAX_CONTEXT   80

#define AST_MAX_EXTENSION   80

#define AST_MAX_FDS   11

#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.

Referenced by action_originate(), and ari_channels_handle_originate_with_id().

#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 159 of file channel.h.

#define AST_MAX_USER_FIELD   256

Max length of the channel user field

Definition at line 165 of file channel.h.

Referenced by ast_rtp_instance_set_stats_vars(), handle_request_bye(), sip_acf_channel_read(), sip_hangup(), and tds_log().

#define AST_MUTE_DIRECTION_READ   (1 << 0)

#define AST_MUTE_DIRECTION_WRITE   (1 << 1)

#define AST_TIMING_FD   (AST_MAX_FDS-2)

used for timingfd

Definition at line 192 of file channel.h.

Referenced by __ast_channel_alloc_ap(), __ast_read(), ast_settimeout_full(), and channel_do_masquerade().

#define CHECK_BLOCKING ( c   ) 

Definition at line 2548 of file channel.h.

Referenced by ast_sendtext(), ast_waitfor_nandfds(), ast_write(), dahdi_read(), and phone_read().

#define DATASTORE_INHERIT_FOREVER   INT_MAX

#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 772 of file channel.h.

Referenced by __ast_read(), ast_write(), channel_set_debug(), handle_core_set_debug_channel(), and serialize_showchan().

#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)))

Definition at line 3913 of file channel.h.

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

Definition at line 775 of file channel.h.

Referenced by __ast_read(), and ast_write().

#define MAX_LANGUAGE   40

Max length of the language setting

Definition at line 163 of file channel.h.

Referenced by ast_readconfig().

#define MAX_MUSICCLASS   80

Max length of the music class setting

Definition at line 164 of file channel.h.


Typedef Documentation

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 563 of file channel.h.

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 557 of file channel.h.

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 569 of file channel.h.

typedef unsigned long long ast_group_t

Definition at line 204 of file channel.h.

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

Definition at line 814 of file channel.h.


Enumeration Type Documentation

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.

Definition at line 870 of file channel.h.

00870      {
00871    /*!
00872     * \brief Channels have this property if they can accept input with jitter;
00873     * i.e. most VoIP channels
00874     */
00875    AST_CHAN_TP_WANTSJITTER = (1 << 0),
00876    /*!
00877     * \brief Channels have this property if they can create jitter;
00878     * i.e. most VoIP channels
00879     */
00880    AST_CHAN_TP_CREATESJITTER = (1 << 1),
00881    /*!
00882     * \brief Channels with this particular technology are an implementation detail of
00883     * Asterisk and should generally not be exposed or manipulated by the outside
00884     * world
00885     */
00886    AST_CHAN_TP_INTERNAL = (1 << 2),
00887 };

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 890 of file channel.h.

00890      {
00891    /*! Queue incoming DTMF, to be released when this flag is turned off */
00892    AST_FLAG_DEFER_DTMF =    (1 << 1),
00893    /*! write should be interrupt generator */
00894    AST_FLAG_WRITE_INT =     (1 << 2),
00895    /*! a thread is blocking on this channel */
00896    AST_FLAG_BLOCKING =      (1 << 3),
00897    /*! This is a zombie channel */
00898    AST_FLAG_ZOMBIE =        (1 << 4),
00899    /*! There is an exception pending */
00900    AST_FLAG_EXCEPTION =     (1 << 5),
00901    /*! Listening to moh XXX anthm promises me this will disappear XXX */
00902    AST_FLAG_MOH =           (1 << 6),
00903    /*! This channel is spying on another channel */
00904    AST_FLAG_SPYING =        (1 << 7),
00905    /*! the channel is in an auto-incrementing dialplan processor,
00906     *  so when ->priority is set, it will get incremented before
00907     *  finding the next priority to run */
00908    AST_FLAG_IN_AUTOLOOP =   (1 << 9),
00909    /*! This is an outgoing call */
00910    AST_FLAG_OUTGOING =      (1 << 10),
00911    /*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */
00912    AST_FLAG_IN_DTMF =       (1 << 12),
00913    /*! A DTMF_END was received when not IN_DTMF, so the length of the digit is
00914     *  currently being emulated */
00915    AST_FLAG_EMULATE_DTMF =  (1 << 13),
00916    /*! This is set to tell the channel not to generate DTMF begin frames, and
00917     *  to instead only generate END frames. */
00918    AST_FLAG_END_DTMF_ONLY = (1 << 14),
00919    /* OBSOLETED in favor of AST_CAUSE_ANSWERED_ELSEWHERE
00920     * Flag to show channels that this call is hangup due to the fact that the call
00921     * was indeed answered, but in another channel */
00922    /* AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), */
00923    /*! This flag indicates that on a masquerade, an active stream should not
00924     *  be carried over */
00925    AST_FLAG_MASQ_NOSTREAM = (1 << 16),
00926    /*! This flag indicates that the hangup exten was run when the bridge terminated,
00927     *  a message aimed at preventing a subsequent hangup exten being run at the pbx_run
00928     *  level */
00929    AST_FLAG_BRIDGE_HANGUP_RUN = (1 << 17),
00930    /*! Disable certain workarounds.  This reintroduces certain bugs, but allows
00931     *  some non-traditional dialplans (like AGI) to continue to function.
00932     */
00933    AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20),
00934    /*!
00935     * Disable device state event caching.  This allows channel
00936     * drivers to selectively prevent device state events from being
00937     * cached by certain channels such as anonymous calls which have
00938     * no persistent represenatation that can be tracked.
00939     */
00940    AST_FLAG_DISABLE_DEVSTATE_CACHE = (1 << 21),
00941    /*!
00942     * This flag indicates that a dual channel redirect is in
00943     * progress.  The bridge needs to wait until the flag is cleared
00944     * to continue.
00945     */
00946    AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT = (1 << 22),
00947    /*!
00948     * This flag indicates that the channel was originated.
00949     */
00950    AST_FLAG_ORIGINATED = (1 << 23),
00951    /*!
00952     * The channel is well and truly dead. Once this is set and published, no further
00953     * actions should be taken upon the channel, and no further publications should
00954     * occur.
00955     */
00956    AST_FLAG_DEAD = (1 << 24),
00957    /*!
00958     * Channel snapshot should not be published, it is being staged for an explicit
00959     * publish.
00960     */
00961    AST_FLAG_SNAPSHOT_STAGE = (1 << 25),
00962    /*!
00963     * The data on chan->timingdata is an astobj2 object.
00964     */
00965    AST_FLAG_TIMINGDATA_IS_AO2_OBJ = (1 << 26),
00966    /*!
00967     * The channel is executing a subroutine or macro
00968     */
00969    AST_FLAG_SUBROUTINE_EXEC = (1 << 27),
00970 };

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 973 of file channel.h.

00973      {
00974    AST_FEATURE_PLAY_WARNING = (1 << 0),
00975    AST_FEATURE_REDIRECT =     (1 << 1),
00976    AST_FEATURE_DISCONNECT =   (1 << 2),
00977    AST_FEATURE_ATXFER =       (1 << 3),
00978    AST_FEATURE_AUTOMON =      (1 << 4),
00979    AST_FEATURE_PARKCALL =     (1 << 5),
00980    AST_FEATURE_AUTOMIXMON =   (1 << 6),
00981 };

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 1023 of file channel.h.

01023      {
01024    /*!
01025     * Soft hangup requested by device or other internal reason.
01026     * Actual hangup needed.
01027     */
01028    AST_SOFTHANGUP_DEV =       (1 << 0),
01029    /*!
01030     * Used to break the normal frame flow so an async goto can be
01031     * done instead of actually hanging up.
01032     */
01033    AST_SOFTHANGUP_ASYNCGOTO = (1 << 1),
01034    /*!
01035     * Soft hangup requested by system shutdown.  Actual hangup
01036     * needed.
01037     */
01038    AST_SOFTHANGUP_SHUTDOWN =  (1 << 2),
01039    /*!
01040     * Used to break the normal frame flow after a timeout so an
01041     * implicit async goto can be done to the 'T' exten if it exists
01042     * instead of actually hanging up.  If the exten does not exist
01043     * then actually hangup.
01044     */
01045    AST_SOFTHANGUP_TIMEOUT =   (1 << 3),
01046    /*!
01047     * Soft hangup requested by application/channel-driver being
01048     * unloaded.  Actual hangup needed.
01049     */
01050    AST_SOFTHANGUP_APPUNLOAD = (1 << 4),
01051    /*!
01052     * Soft hangup requested by non-associated party.  Actual hangup
01053     * needed.
01054     */
01055    AST_SOFTHANGUP_EXPLICIT =  (1 << 5),
01056    /*!
01057     * Used to indicate that the channel is currently executing hangup
01058     * logic in the dialplan. The channel has been hungup when this is
01059     * set.
01060     */
01061    AST_SOFTHANGUP_HANGUP_EXEC = (1 << 7),
01062    /*!
01063     * \brief All softhangup flags.
01064     *
01065     * This can be used as an argument to ast_channel_clear_softhangup()
01066     * to clear all softhangup flags from a channel.
01067     */
01068    AST_SOFTHANGUP_ALL =       (0xFFFFFFFF)
01069 };

enum ama_flags

Channel AMA Flags.

Enumerator:
AST_AMA_NONE 
AST_AMA_OMIT 
AST_AMA_BILLING 
AST_AMA_DOCUMENTATION 

Definition at line 1084 of file channel.h.

01084                {
01085    AST_AMA_NONE = 0,
01086    AST_AMA_OMIT,
01087    AST_AMA_BILLING,
01088    AST_AMA_DOCUMENTATION,
01089 };

Enumerator:
AST_ALERT_READ_SUCCESS 
AST_ALERT_NOT_READABLE 
AST_ALERT_READ_FAIL 
AST_ALERT_READ_FATAL 

Definition at line 4150 of file channel.h.

Enumerator:
AST_BRIDGE_COMPLETE 
AST_BRIDGE_FAILED 
AST_BRIDGE_FAILED_NOWARN 
AST_BRIDGE_RETRY 

Definition at line 197 of file channel.h.

00197                        {
00198    AST_BRIDGE_COMPLETE = 0,
00199    AST_BRIDGE_FAILED = -1,
00200    AST_BRIDGE_FAILED_NOWARN = -2,
00201    AST_BRIDGE_RETRY = -3,
00202 };

Enumerator:
AST_ADSI_UNKNOWN 
AST_ADSI_AVAILABLE 
AST_ADSI_UNAVAILABLE 
AST_ADSI_OFFHOOKONLY 

Definition at line 783 of file channel.h.

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 1390 of file channel.h.

01390                                         {
01391    /*! The requestor is the future bridge peer of the channel. */
01392    AST_CHANNEL_REQUESTOR_BRIDGE_PEER,
01393    /*! The requestor is to be replaced by the channel. */
01394    AST_CHANNEL_REQUESTOR_REPLACEMENT,
01395 };

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 225 of file channel.h.

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 793 of file channel.h.

00793                    {
00794    T38_STATE_UNAVAILABLE,  /*!< T38 is unavailable on this channel or disabled by configuration */
00795    T38_STATE_UNKNOWN,   /*!< The channel supports T38 but the current status is unknown */
00796    T38_STATE_NEGOTIATING,  /*!< T38 is being negotiated */
00797    T38_STATE_REJECTED,  /*!< Remote side has rejected our offer */
00798    T38_STATE_NEGOTIATED,   /*!< T38 established */
00799 };

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 1073 of file channel.h.


Function Documentation

int __ast_answer ( struct ast_channel chan,
unsigned int  delay 
)

Answer a channel, with a selectable delay before returning.

Parameters:
chan channel to answer
delay maximum 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:
0 on success
non-zero on failure

Definition at line 2739 of file channel.c.

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_TEXT, 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(), errno, frames, ast_frame::frametype, ast_frame_subclass::integer, LOG_WARNING, MAX, and ast_frame::subclass.

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

02740 {
02741    int res = 0;
02742    enum ast_channel_state old_state;
02743 
02744    old_state = ast_channel_state(chan);
02745    if ((res = ast_raw_answer(chan))) {
02746       return res;
02747    }
02748 
02749    switch (old_state) {
02750    case AST_STATE_RINGING:
02751    case AST_STATE_RING:
02752       /* wait for media to start flowing, but don't wait any longer
02753        * than 'delay' or 500 milliseconds, whichever is longer
02754        */
02755       do {
02756          AST_LIST_HEAD_NOLOCK(, ast_frame) frames;
02757          struct ast_frame *cur;
02758          struct ast_frame *new_frame;
02759          int timeout_ms = MAX(delay, 500);
02760          unsigned int done = 0;
02761          struct timeval start;
02762 
02763          AST_LIST_HEAD_INIT_NOLOCK(&frames);
02764 
02765          start = ast_tvnow();
02766          for (;;) {
02767             int ms = ast_remaining_ms(start, timeout_ms);
02768             ms = ast_waitfor(chan, ms);
02769             if (ms < 0) {
02770                ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", ast_channel_name(chan), strerror(errno));
02771                res = -1;
02772                break;
02773             }
02774             if (ms == 0) {
02775                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));
02776                break;
02777             }
02778             cur = ast_read(chan);
02779             if (!cur || ((cur->frametype == AST_FRAME_CONTROL) &&
02780                     (cur->subclass.integer == AST_CONTROL_HANGUP))) {
02781                if (cur) {
02782                   ast_frfree(cur);
02783                }
02784                res = -1;
02785                ast_debug(2, "Hangup of channel %s detected in answer routine\n", ast_channel_name(chan));
02786                break;
02787             }
02788 
02789             if ((new_frame = ast_frisolate(cur)) != cur) {
02790                ast_frfree(cur);
02791             }
02792 
02793             AST_LIST_INSERT_HEAD(&frames, new_frame, frame_list);
02794 
02795             /* if a specific delay period was requested, continue
02796              * until that delay has passed. don't stop just because
02797              * incoming media has arrived.
02798              */
02799             if (delay) {
02800                continue;
02801             }
02802 
02803             switch (new_frame->frametype) {
02804                /* all of these frametypes qualify as 'media' */
02805             case AST_FRAME_VOICE:
02806             case AST_FRAME_VIDEO:
02807             case AST_FRAME_TEXT:
02808             case AST_FRAME_DTMF_BEGIN:
02809             case AST_FRAME_DTMF_END:
02810             case AST_FRAME_IMAGE:
02811             case AST_FRAME_HTML:
02812             case AST_FRAME_MODEM:
02813                done = 1;
02814                break;
02815             case AST_FRAME_CONTROL:
02816             case AST_FRAME_IAX:
02817             case AST_FRAME_BRIDGE_ACTION:
02818             case AST_FRAME_BRIDGE_ACTION_SYNC:
02819             case AST_FRAME_NULL:
02820             case AST_FRAME_CNG:
02821                break;
02822             }
02823 
02824             if (done) {
02825                break;
02826             }
02827          }
02828 
02829          ast_channel_lock(chan);
02830          while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) {
02831             if (res == 0) {
02832                ast_queue_frame_head(chan, cur);
02833             }
02834             ast_frfree(cur);
02835          }
02836          ast_channel_unlock(chan);
02837       } while (0);
02838       break;
02839    default:
02840       break;
02841    }
02842 
02843    return res;
02844 }

struct ast_channel* attribute_malloc __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,
  ... 
) [read]

Create a channel structure.

Since:
1.8
Return values:
NULL failure
non-NULL successfully 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 968 of file channel.c.

References __ast_channel_alloc_ap(), and result.

00975 {
00976    va_list ap;
00977    struct ast_channel *result;
00978 
00979    va_start(ap, name_fmt);
00980    result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context,
00981                assignedids, requestor, amaflag, endpoint, file, line, function, name_fmt, ap);
00982    va_end(ap);
00983 
00984    return result;
00985 }

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 
) [read]

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:
type type of channel to request
cap format capabilities for requested channel
assignedids Unique Id to assign to channel
requestor channel requesting data
addr destination of the call
timeout maximum amount of time to wait for an answer
reason why unsuccessful (if unsuccessful)
cid_num Caller-ID Number
cid_name Caller-ID Name (ascii)
oh Outgoing 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 5703 of file channel.c.

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_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, outgoing_helper::context, ast_frame::data, ast_frame::datalen, outgoing_helper::exten, ast_frame::frametype, handle_cause(), ast_party_connected_line::id, ast_frame_subclass::integer, LOG_NOTICE, ast_party_id::name, NULL, ast_party_id::number, outgoing_helper::parent_channel, ast_party_name::presentation, ast_party_number::presentation, outgoing_helper::priority, ast_frame::ptr, ast_party_name::str, ast_party_number::str, ast_frame::subclass, ast_party_name::valid, ast_party_number::valid, and outgoing_helper::vars.

Referenced by announce_to_dial(), and ast_request_and_dial().

05704 {
05705    int dummy_outstate;
05706    int cause = 0;
05707    struct ast_channel *chan;
05708    int res = 0;
05709    int last_subclass = 0;
05710    struct ast_party_connected_line connected;
05711 
05712    if (outstate)
05713       *outstate = 0;
05714    else
05715       outstate = &dummy_outstate;   /* make outstate always a valid pointer */
05716 
05717    chan = ast_request(type, cap, assignedids, requestor, addr, &cause);
05718    if (!chan) {
05719       ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, addr);
05720       handle_cause(cause, outstate);
05721       return NULL;
05722    }
05723 
05724    if (oh) {
05725       if (oh->vars) {
05726          ast_channel_lock(chan);
05727          ast_set_variables(chan, oh->vars);
05728          ast_channel_unlock(chan);
05729       }
05730       if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name)) {
05731          /*
05732           * Use the oh values instead of the function parameters for the
05733           * outgoing CallerID.
05734           */
05735          cid_num = oh->cid_num;
05736          cid_name = oh->cid_name;
05737       }
05738       if (oh->parent_channel) {
05739          /* Safely inherit variables and datastores from the parent channel. */
05740          ast_channel_lock_both(oh->parent_channel, chan);
05741          ast_channel_inherit_variables(oh->parent_channel, chan);
05742          ast_channel_datastore_inherit(oh->parent_channel, chan);
05743          ast_channel_unlock(oh->parent_channel);
05744          ast_channel_unlock(chan);
05745       }
05746       if (!ast_strlen_zero(oh->account)) {
05747          ast_channel_lock(chan);
05748          ast_channel_stage_snapshot(chan);
05749          ast_channel_accountcode_set(chan, oh->account);
05750          ast_channel_peeraccount_set(chan, oh->account);
05751          ast_channel_stage_snapshot_done(chan);
05752          ast_channel_unlock(chan);
05753       }
05754    }
05755 
05756    /*
05757     * I seems strange to set the CallerID on an outgoing call leg
05758     * to whom we are calling, but this function's callers are doing
05759     * various Originate methods.  This call leg goes to the local
05760     * user.  Once the local user answers, the dialplan needs to be
05761     * able to access the CallerID from the CALLERID function as if
05762     * the local user had placed this call.
05763     */
05764    ast_set_callerid(chan, cid_num, cid_name, cid_num);
05765 
05766    ast_set_flag(ast_channel_flags(chan), AST_FLAG_ORIGINATED);
05767    ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
05768    if (cid_num) {
05769       connected.id.number.valid = 1;
05770       connected.id.number.str = (char *) cid_num;
05771       connected.id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
05772    }
05773    if (cid_name) {
05774       connected.id.name.valid = 1;
05775       connected.id.name.str = (char *) cid_name;
05776       connected.id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
05777    }
05778    ast_channel_set_connected_line(chan, &connected, NULL);
05779    if (requestor) {
05780       ast_channel_lock_both(chan, (struct ast_channel *) requestor);
05781       ast_channel_req_accountcodes(chan, requestor, AST_CHANNEL_REQUESTOR_BRIDGE_PEER);
05782       ast_channel_unlock(chan);
05783       ast_channel_unlock((struct ast_channel *) requestor);
05784    }
05785 
05786    if (ast_call(chan, addr, 0)) {   /* ast_call failed... */
05787       ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, addr);
05788    } else {
05789       struct timeval start = ast_tvnow();
05790       res = 1; /* mark success in case chan->_state is already AST_STATE_UP */
05791       while (timeout && ast_channel_state(chan) != AST_STATE_UP) {
05792          struct ast_frame *f;
05793          int ms = ast_remaining_ms(start, timeout);
05794 
05795          res = ast_waitfor(chan, ms);
05796          if (res == 0) { /* timeout, treat it like ringing */
05797             *outstate = AST_CONTROL_RINGING;
05798             break;
05799          }
05800          if (res < 0) /* error or done */
05801             break;
05802          if (!ast_strlen_zero(ast_channel_call_forward(chan))) {
05803             if (!(chan = ast_call_forward(NULL, chan, NULL, cap, oh, outstate))) {
05804                return NULL;
05805             }
05806             continue;
05807          }
05808 
05809          f = ast_read(chan);
05810          if (!f) {
05811             *outstate = AST_CONTROL_HANGUP;
05812             res = 0;
05813             break;
05814          }
05815          if (f->frametype == AST_FRAME_CONTROL) {
05816             switch (f->subclass.integer) {
05817             case AST_CONTROL_RINGING:  /* record but keep going */
05818                *outstate = f->subclass.integer;
05819                break;
05820 
05821             case AST_CONTROL_BUSY:
05822                *outstate = f->subclass.integer;
05823                timeout = 0;
05824                break;
05825 
05826             case AST_CONTROL_INCOMPLETE:
05827                *outstate = AST_CONTROL_CONGESTION;
05828                timeout = 0;
05829                break;
05830 
05831             case AST_CONTROL_CONGESTION:
05832                *outstate = f->subclass.integer;
05833                timeout = 0;
05834                break;
05835 
05836             case AST_CONTROL_ANSWER:
05837                *outstate = f->subclass.integer;
05838                timeout = 0;      /* trick to force exit from the while() */
05839                break;
05840 
05841             case AST_CONTROL_PVT_CAUSE_CODE:
05842                ast_channel_hangupcause_hash_set(chan, f->data.ptr, f->datalen);
05843                break;
05844 
05845             case AST_CONTROL_PROGRESS:
05846                if (oh && oh->connect_on_early_media) {
05847                   *outstate = f->subclass.integer;
05848                   timeout = 0;      /* trick to force exit from the while() */
05849                   break;
05850                }
05851                /* Fallthrough */
05852             /* Ignore these */
05853             case AST_CONTROL_PROCEEDING:
05854             case AST_CONTROL_HOLD:
05855             case AST_CONTROL_UNHOLD:
05856             case AST_CONTROL_VIDUPDATE:
05857             case AST_CONTROL_SRCUPDATE:
05858             case AST_CONTROL_SRCCHANGE:
05859             case AST_CONTROL_CONNECTED_LINE:
05860             case AST_CONTROL_REDIRECTING:
05861             case AST_CONTROL_CC:
05862             case -1:       /* Ignore -- just stopping indications */
05863                break;
05864 
05865             default:
05866                ast_log(LOG_NOTICE, "Don't know what to do with control frame %d\n", f->subclass.integer);
05867             }
05868             last_subclass = f->subclass.integer;
05869          }
05870          ast_frfree(f);
05871       }
05872    }
05873 
05874    /* Final fixups */
05875    if (oh) {
05876       if (!ast_strlen_zero(oh->context))
05877          ast_channel_context_set(chan, oh->context);
05878       if (!ast_strlen_zero(oh->exten))
05879          ast_channel_exten_set(chan, oh->exten);
05880       if (oh->priority)
05881          ast_channel_priority_set(chan, oh->priority);
05882    }
05883    if (ast_channel_state(chan) == AST_STATE_UP)
05884       *outstate = AST_CONTROL_ANSWER;
05885 
05886    if (res <= 0) {
05887       ast_channel_lock(chan);
05888       if (AST_CONTROL_RINGING == last_subclass) {
05889          ast_channel_hangupcause_set(chan, AST_CAUSE_NO_ANSWER);
05890       }
05891       ast_channel_unlock(chan);
05892       ast_hangup(chan);
05893       chan = NULL;
05894    }
05895    return chan;
05896 }

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

Activate a given generator

Examples:
/tmp/asterisk-trunk/trunk/main/app.c.

Definition at line 2950 of file channel.c.

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(), 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(), eivr_comm(), local_ast_moh_start(), old_milliwatt_exec(), spandsp_fax_gateway_start(), and transmit_audio().

02951 {
02952    int res = 0;
02953    void *generatordata = NULL;
02954 
02955    ast_channel_lock(chan);
02956    if (ast_channel_generatordata(chan)) {
02957       struct ast_generator *generator_old = ast_channel_generator(chan);
02958 
02959       if (generator_old && generator_old->release) {
02960          generator_old->release(chan, ast_channel_generatordata(chan));
02961       }
02962    }
02963    if (gen->alloc && !(generatordata = gen->alloc(chan, params))) {
02964       res = -1;
02965    }
02966    ast_channel_generatordata_set(chan, generatordata);
02967    if (!res) {
02968       ast_settimeout(chan, 50, generator_force, chan);
02969       ast_channel_generator_set(chan, gen);
02970    }
02971    ast_channel_unlock(chan);
02972 
02973    ast_prod(chan);
02974 
02975    return res;
02976 }

int ast_active_channels ( void   ) 

returns number of active/allocated channels

Returns:
number of channels available for lookup

Definition at line 513 of file channel.c.

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().

00514 {
00515    return channels ? ao2_container_count(channels) : 0;
00516 }

static int ast_add_fd ( struct pollfd *  pfd,
int  fd 
) [inline, static]

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 2511 of file channel.h.

Referenced by ast_waitfor_nandfds().

02512 {
02513    pfd->fd = fd;
02514    pfd->events = POLLIN | POLLPRI;
02515    return fd >= 0;
02516 }

int ast_answer ( struct ast_channel chan  ) 

Answer a channel.

Parameters:
chan channel 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:
0 on success
non-zero on failure

Definition at line 2846 of file channel.c.

References __ast_answer().

Referenced by agent_login_exec(), agi_exec_full(), alarmreceiver_exec(), announce_request(), answer_trunk_chan(), 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(), bridgewait_exec(), common_exec(), conf_exec(), conf_start_record(), confbridge_exec(), count_exec(), dahdiras_exec(), dial_exec_full(), dictate_exec(), directory_exec(), disa_exec(), eivr_comm(), handle_answer(), ices_exec(), 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(), transmit(), vm_exec(), vm_execmain(), vm_playmsgexec(), waitfor_exec(), and zapateller_exec().

02847 {
02848    return __ast_answer(chan, 0);
02849 }

int ast_auto_answer ( struct ast_channel chan  )  [inline]

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

Parameters:
chan channel to answer
See ast_answer()

Return values:
0 on success
non-zero on failure

Definition at line 2851 of file channel.c.

References ast_answer(), and AST_STATE_UP.

Referenced by record_file().

02852 {
02853    if (ast_channel_state(chan) == AST_STATE_UP) {
02854       /* Already answered */
02855       return 0;
02856    }
02857    return ast_answer(chan);
02858 }

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:
chan Chan to put into autoservice.
peer Chan to run hangup handlers and hangup.
Returns:
Nothing

Definition at line 318 of file autoservice.c.

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

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

00319 {
00320    if (chan && !ast_autoservice_start(chan)) {
00321       ast_hangup(peer);
00322       ast_autoservice_stop(chan);
00323    } else {
00324       ast_hangup(peer);
00325    }
00326 }

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:
0 success
-1 channel is not in autoservice

Definition at line 328 of file autoservice.c.

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

00329 {
00330    struct asent *as;
00331    int res = -1;
00332 
00333    AST_LIST_LOCK(&aslist);
00334    AST_LIST_TRAVERSE(&aslist, as, list) {
00335       if (as->chan == chan) {
00336          res = 0;
00337          as->ignore_frame_types |= (1 << ftype);
00338          break;
00339       }
00340    }
00341    AST_LIST_UNLOCK(&aslist);
00342    return res;
00343 }

int ast_autoservice_start ( struct ast_channel chan  ) 

Automatically service a channel for us...

Return values:
0 success
-1 failure, or the channel is already being autoserviced
Examples:
/tmp/asterisk-trunk/trunk/main/app.c.

Definition at line 190 of file autoservice.c.

References as_cond, ast_calloc, ast_channel_flags(), ast_channel_lock, ast_channel_unlock, ast_cond_signal, 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, asthread, autoservice_run(), asent::chan, asent::list, LOG_WARNING, NULL, asent::orig_end_dtmf_flag, and asent::use_count.

Referenced by _macro_exec(), acf_curl_helper(), acf_jabberreceive_read(), acf_odbc_read(), acf_odbc_write(), action_toggle_mute_participants(), ast_app_exec_macro(), ast_app_exec_sub(), ast_autoservice_chan_hangup_peer(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), 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(), leave_marked(), lock_read(), lua_autoservice_start(), lua_get_variable_value(), lua_pbx_exec(), lua_set_variable(), lua_set_variable_value(), originate_exec(), osplookup_exec(), pbx_find_extension(), post_join_play_begin(), realtimefield_read(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().

00191 {
00192    int res = 0;
00193    struct asent *as;
00194 
00195    AST_LIST_LOCK(&aslist);
00196    AST_LIST_TRAVERSE(&aslist, as, list) {
00197       if (as->chan == chan) {
00198          as->use_count++;
00199          break;
00200       }
00201    }
00202    AST_LIST_UNLOCK(&aslist);
00203 
00204    if (as) {
00205       /* Entry exists, autoservice is already handling this channel */
00206       return 0;
00207    }
00208 
00209    if (!(as = ast_calloc(1, sizeof(*as))))
00210       return -1;
00211 
00212    /* New entry created */
00213    as->chan = chan;
00214    as->use_count = 1;
00215 
00216    ast_channel_lock(chan);
00217    as->orig_end_dtmf_flag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY) ? 1 : 0;
00218    if (!as->orig_end_dtmf_flag)
00219       ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
00220    ast_channel_unlock(chan);
00221 
00222    AST_LIST_LOCK(&aslist);
00223 
00224    if (AST_LIST_EMPTY(&aslist) && asthread != AST_PTHREADT_NULL) {
00225       ast_cond_signal(&as_cond);
00226    }
00227 
00228    AST_LIST_INSERT_HEAD(&aslist, as, list);
00229 
00230    if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
00231       if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) {
00232          ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
00233          /* There will only be a single member in the list at this point,
00234             the one we just added. */
00235          AST_LIST_REMOVE(&aslist, as, list);
00236          ast_free(as);
00237          asthread = AST_PTHREADT_NULL;
00238          res = -1;
00239       } else {
00240          pthread_kill(asthread, SIGURG);
00241       }
00242    }
00243 
00244    AST_LIST_UNLOCK(&aslist);
00245 
00246    return res;
00247 }

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:
0 success
-1 error, or the channel has been hungup
Examples:
/tmp/asterisk-trunk/trunk/main/app.c.

Definition at line 249 of file autoservice.c.

References as_chan_list_state, ast_channel_flags(), ast_channel_lock, ast_channel_softhangup_internal_flag(), ast_channel_unlock, ast_clear_flag, 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(), asthread, asent::chan, asent::deferred_frames, f, ast_frame::frametype, asent::ignore_frame_types, asent::list, NULL, asent::orig_end_dtmf_flag, and asent::use_count.

Referenced by _macro_exec(), acf_curl_helper(), acf_jabberreceive_read(), acf_odbc_read(), acf_odbc_write(), action_toggle_mute_participants(), array(), ast_app_exec_macro(), ast_app_exec_sub(), ast_autoservice_chan_hangup_peer(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), ast_hangup(), 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(), leave_marked(), lock_read(), lua_autoservice_stop(), lua_get_variable_value(), lua_pbx_exec(), lua_set_variable(), lua_set_variable_value(), originate_exec(), osplookup_exec(), pbx_find_extension(), post_join_play_begin(), realtimefield_read(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().

00250 {
00251    int res = -1;
00252    struct asent *as, *removed = NULL;
00253    struct ast_frame *f;
00254    int chan_list_state;
00255 
00256    AST_LIST_LOCK(&aslist);
00257 
00258    /* Save the autoservice channel list state.  We _must_ verify that the channel
00259     * list has been rebuilt before we return.  Because, after we return, the channel
00260     * could get destroyed and we don't want our poor autoservice thread to step on
00261     * it after its gone! */
00262    chan_list_state = as_chan_list_state;
00263 
00264    /* Find the entry, but do not free it because it still can be in the
00265       autoservice thread array */
00266    AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) {
00267       if (as->chan == chan) {
00268          as->use_count--;
00269          if (as->use_count < 1) {
00270             AST_LIST_REMOVE_CURRENT(list);
00271             removed = as;
00272          }
00273          break;
00274       }
00275    }
00276    AST_LIST_TRAVERSE_SAFE_END;
00277 
00278    if (removed && asthread != AST_PTHREADT_NULL) {
00279       pthread_kill(asthread, SIGURG);
00280    }
00281 
00282    AST_LIST_UNLOCK(&aslist);
00283 
00284    if (!removed) {
00285       return 0;
00286    }
00287 
00288    /* Wait while autoservice thread rebuilds its list. */
00289    while (chan_list_state == as_chan_list_state) {
00290       usleep(1000);
00291    }
00292 
00293    /* Now autoservice thread should have no references to our entry
00294       and we can safely destroy it */
00295 
00296    if (!ast_channel_softhangup_internal_flag(chan)) {
00297       res = 0;
00298    }
00299 
00300    if (!as->orig_end_dtmf_flag) {
00301       ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
00302    }
00303 
00304    ast_channel_lock(chan);
00305    while ((f = AST_LIST_REMOVE_HEAD(&as->deferred_frames, frame_list))) {
00306       if (!((1 << f->frametype) & as->ignore_frame_types)) {
00307          ast_queue_frame_head(chan, f);
00308       }
00309       ast_frfree(f);
00310    }
00311    ast_channel_unlock(chan);
00312 
00313    ast_free(as);
00314 
00315    return res;
00316 }

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:
chan which channel to make the call on
addr destination of the call
timeout time to wait on for connect (Doesn't seem to be used.)
Place a call, take no longer than timeout ms.
Return values:
0 on success
-1 on failure

Definition at line 6145 of file channel.c.

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, ast_channel_tech::call, and call().

Referenced by __ast_request_and_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().

06146 {
06147    /* Place an outgoing call, but don't wait any longer than timeout ms before returning.
06148       If the remote end does not answer within the timeout, then do NOT hang up, but
06149       return anyway.  */
06150    int res = -1;
06151    /* Stop if we're a zombie or need a soft hangup */
06152    ast_channel_lock(chan);
06153    if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
06154       if (ast_channel_tech(chan)->call)
06155          res = ast_channel_tech(chan)->call(chan, addr, timeout);
06156       ast_set_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
06157    }
06158    ast_channel_unlock(chan);
06159    return res;
06160 }

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 
) [read]

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:
caller in channel that requested orig
orig channel being replaced by the call forward channel
timeout maximum amount of time to wait for setup of new forward channel
cap format capabilities for requested channel
oh outgoing helper used with original channel
outstate reason why unsuccessful (if uncuccessful)
Returns:
Returns the forwarded call's ast_channel on success or NULL on failure

Definition at line 5628 of file channel.c.

References outgoing_helper::account, ast_call(), ast_channel_call_forward(), ast_channel_connected(), ast_channel_context(), ast_channel_flags(), ast_channel_lock, ast_channel_lock_both, ast_channel_redirecting(), ast_channel_req_accountcodes(), AST_CHANNEL_REQUESTOR_REPLACEMENT, 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_flag, ast_set_variables(), ast_strlen_zero, call_forward_inherit(), handle_cause(), LOG_NOTICE, NULL, outgoing_helper::parent_channel, pbx_builtin_getvar_helper(), S_OR, type, and outgoing_helper::vars.

Referenced by __ast_request_and_dial().

05629 {
05630    char tmpchan[256];
05631    struct ast_channel *new_chan = NULL;
05632    char *data, *type;
05633    int cause = 0;
05634    int res;
05635 
05636    /* gather data and request the new forward channel */
05637    ast_copy_string(tmpchan, ast_channel_call_forward(orig), sizeof(tmpchan));
05638    if ((data = strchr(tmpchan, '/'))) {
05639       *data++ = '\0';
05640       type = tmpchan;
05641    } else {
05642       const char *forward_context;
05643       ast_channel_lock(orig);
05644       forward_context = pbx_builtin_getvar_helper(orig, "FORWARD_CONTEXT");
05645       snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(orig), S_OR(forward_context, ast_channel_context(orig)));
05646       ast_channel_unlock(orig);
05647       data = tmpchan;
05648       type = "Local";
05649    }
05650    if (!(new_chan = ast_request(type, cap, NULL, orig, data, &cause))) {
05651       ast_log(LOG_NOTICE, "Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause);
05652       handle_cause(cause, outstate);
05653       ast_hangup(orig);
05654       return NULL;
05655    }
05656 
05657    /* Copy/inherit important information into new channel */
05658    if (oh) {
05659       if (oh->vars) {
05660          ast_channel_lock(new_chan);
05661          ast_set_variables(new_chan, oh->vars);
05662          ast_channel_unlock(new_chan);
05663       }
05664       if (oh->parent_channel) {
05665          call_forward_inherit(new_chan, oh->parent_channel, orig);
05666       }
05667       if (!ast_strlen_zero(oh->account)) {
05668          ast_channel_lock(new_chan);
05669          ast_channel_stage_snapshot(new_chan);
05670          ast_channel_accountcode_set(new_chan, oh->account);
05671          ast_channel_peeraccount_set(new_chan, oh->account);
05672          ast_channel_stage_snapshot_done(new_chan);
05673          ast_channel_unlock(new_chan);
05674       }
05675    } else if (caller) { /* no outgoing helper so use caller if available */
05676       call_forward_inherit(new_chan, caller, orig);
05677    }
05678    ast_set_flag(ast_channel_flags(new_chan), AST_FLAG_ORIGINATED);
05679 
05680    ast_channel_lock_both(orig, new_chan);
05681    ast_party_connected_line_copy(ast_channel_connected(new_chan), ast_channel_connected(orig));
05682    ast_party_redirecting_copy(ast_channel_redirecting(new_chan), ast_channel_redirecting(orig));
05683    ast_channel_req_accountcodes(new_chan, orig, AST_CHANNEL_REQUESTOR_REPLACEMENT);
05684    ast_channel_unlock(new_chan);
05685    ast_channel_unlock(orig);
05686 
05687    /* call new channel */
05688    res = ast_call(new_chan, data, 0);
05689    if (timeout) {
05690       *timeout = res;
05691    }
05692    if (res) {
05693       ast_log(LOG_NOTICE, "Unable to call forward to channel %s/%s\n", type, (char *)data);
05694       ast_hangup(orig);
05695       ast_hangup(new_chan);
05696       return NULL;
05697    }
05698    ast_hangup(orig);
05699 
05700    return new_chan;
05701 }

const char* ast_cause2str ( int  cause  ) 

Gives the string form of a given cause code.

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

Definition at line 638 of file channel.c.

References ARRAY_LEN, causes, and causes_map::desc.

Referenced by __transmit_response(), ast_channel_data_add_structure(), bridge_dissolve(), channel_destroyed_event(), channel_state_change(), dial_exec_full(), findmeexec(), hangupcause_read(), sip_hangup(), and transmit_request_with_auth().

00639 {
00640    int x;
00641 
00642    for (x = 0; x < ARRAY_LEN(causes); x++) {
00643       if (causes[x].cause == cause)
00644          return causes[x].desc;
00645    }
00646 
00647    return "Unknown";
00648 }

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:
chan the channel to change the name of
newname the name to change to
Returns:
nothing
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 6413 of file channel.c.

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

Referenced by update_name().

06414 {
06415    /* We must re-link, as the hash value will change here. */
06416    ao2_lock(channels);
06417    ast_channel_lock(chan);
06418    ao2_unlink(channels, chan);
06419    __ast_change_name_nolink(chan, newname);
06420    ao2_link(channels, chan);
06421    ast_channel_unlock(chan);
06422    ao2_unlock(channels);
06423 }

struct ast_channel* ast_channel__bridge ( const struct ast_channel chan  )  [read]

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  ) 

Definition at line 905 of file channel_internal_api.c.

References ast_channel::adsicpe.

00906 {
00907    return chan->adsicpe;
00908 }

void ast_channel_adsicpe_set ( struct ast_channel chan,
enum ast_channel_adsicpe  value 
)

int ast_channel_alert_writable ( struct ast_channel chan  ) 

Definition at line 1237 of file channel_internal_api.c.

References ast_channel::alertpipe.

Referenced by __ast_queue_frame(), ast_channel_alert_write(), and ast_channel_internal_alertpipe_close().

01238 {
01239    return chan->alertpipe[1] > -1;
01240 }

int ast_channel_alert_write ( struct ast_channel chan  ) 

Definition at line 1202 of file channel_internal_api.c.

References ast_channel::alertpipe, and ast_channel_alert_writable().

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

01203 {
01204    char blah = 0x7F;
01205    return ast_channel_alert_writable(chan) && write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah);
01206 }

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.

Since:
12
Parameters:
flags integer flag
Return values:
A string representation of the flag

Definition at line 4382 of file channel.c.

References AST_AMA_BILLING, AST_AMA_DOCUMENTATION, and AST_AMA_OMIT.

Referenced by _sip_show_peer(), _skinny_show_line(), ast_cdr_format_var(), ast_channel_data_add_structure(), build_csv_record(), build_radius_record(), cdr_read_callback(), handle_cli_ooh323_show_config(), handle_cli_ooh323_show_peer(), handle_cli_ooh323_show_user(), manager_log(), peers_data_provider_get(), sip_show_user(), tds_log(), and users_data_provider_get().

04383 {
04384    switch (flag) {
04385    case AST_AMA_OMIT:
04386       return "OMIT";
04387    case AST_AMA_BILLING:
04388       return "BILLING";
04389    case AST_AMA_DOCUMENTATION:
04390       return "DOCUMENTATION";
04391    default:
04392       return "Unknown";
04393    }
04394 }

void ast_channel_amaflags_set ( struct ast_channel chan,
enum ama_flags  value 
)

struct timeval ast_channel_answertime ( struct ast_channel chan  )  [read]

Definition at line 1105 of file channel_internal_api.c.

Referenced by ast_channel_get_up_time(), and ospfinished_exec().

01106 {
01107    return chan->answertime;
01108 }

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

Definition at line 1110 of file channel_internal_api.c.

References ast_channel::answertime.

Referenced by ast_raw_answer().

01111 {
01112    chan->answertime = *value;
01113 }

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_list* ast_channel_audiohooks ( const struct ast_channel chan  )  [read]

void ast_channel_audiohooks_set ( struct ast_channel chan,
struct ast_audiohook_list value 
)

Definition at line 773 of file channel_internal_api.c.

References ast_channel::audiohooks.

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

00774 {
00775    chan->audiohooks = value;
00776 }

struct ast_autochan_list* ast_channel_autochans ( struct ast_channel chan  )  [read]

Definition at line 996 of file channel_internal_api.c.

References ast_channel::autochans.

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

00997 {
00998    return &chan->autochans;
00999 }

pthread_t ast_channel_blocker ( const struct ast_channel chan  ) 

Definition at line 1331 of file channel_internal_api.c.

References ast_channel::blocker.

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

01332 {
01333    return chan->blocker;
01334 }

void ast_channel_blocker_set ( struct ast_channel chan,
pthread_t  value 
)

Definition at line 1335 of file channel_internal_api.c.

References ast_channel::blocker.

Referenced by __ast_read().

01336 {
01337    chan->blocker = value;
01338 }

const char* ast_channel_blockproc ( const struct ast_channel chan  ) 

Definition at line 508 of file channel_internal_api.c.

References ast_channel::blockproc.

Referenced by ast_hangup(), and serialize_showchan().

00509 {
00510    return chan->blockproc;
00511 }

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

Definition at line 512 of file channel_internal_api.c.

References ast_channel::blockproc.

00513 {
00514    chan->blockproc = value;
00515 }

struct ast_channel* ast_channel_bridge_peer ( struct ast_channel chan  )  [read]

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

Since:
12.0.0
Parameters:
chan Channel 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:
NULL Channel not in a bridge or the bridge is not two-party.
non-NULL Reffed peer channel at time of calling.

Definition at line 10367 of file channel.c.

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

Referenced by _skinny_show_lines(), analog_ss_thread(), ast_channel_data_add_structure(), ast_rtp_instance_set_stats_vars(), ast_set_hangupsource(), ast_unreal_queryoption(), ast_var_channels_table(), attach_barge(), cb_events(), channel_do_masquerade(), create_jb(), export_aoc_vars(), fax_detect_framehook(), fax_gateway_framehook(), func_channel_read(), get_refer_info(), handle_incoming_request(), handle_request_bye(), manager_park(), mgcp_hangup(), my_get_sigpvt_bridged_channel(), and spandsp_fax_gateway_start().

10368 {
10369    struct ast_channel *peer;
10370    struct ast_bridge *bridge;
10371 
10372    /* Get the bridge the channel is in. */
10373    ast_channel_lock(chan);
10374    bridge = ast_channel_get_bridge(chan);
10375    ast_channel_unlock(chan);
10376    if (!bridge) {
10377       return NULL;
10378    }
10379 
10380    peer = ast_bridge_peer(bridge, chan);
10381    ao2_ref(bridge, -1);
10382    return peer;
10383 }

const char* ast_channel_call_forward ( const struct ast_channel chan  ) 

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

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 1266 of file channel.c.

References ao2_callback_data, and channels.

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(), find_by_channel(), find_by_part(), handle_core_set_debug_channel(), and pickup_by_mark().

01268 {
01269    return ao2_callback_data(channels, ao2_flags, cb_fn, arg, data);
01270 }

struct ast_party_caller* ast_channel_caller ( struct ast_channel chan  )  [read]

Examples:
/tmp/asterisk-trunk/trunk/main/app.c.

Definition at line 1012 of file channel_internal_api.c.

References ast_channel::caller.

Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_channel_alloc_ap(), __ast_goto_if_exists(), __ast_pbx_run(), _macro_exec(), acf_isexten_exec(), action_confbridgelist_item(), action_meetmelist(), agent_request_exec(), analog_ss_thread(), app_exec(), ast_app_dtget(), ast_bridge_setup_after_goto(), ast_cel_fabricate_channel_from_event(), ast_channel_destructor(), ast_channel_set_caller(), ast_channel_set_caller_event(), ast_channel_snapshot_create(), 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(), callerpres_read(), callerpres_write(), cb_events(), cc_generic_agent_init(), chan_pjsip_cng_tone_detected(), chan_pjsip_new(), channel_do_masquerade(), collect_digits(), console_call(), copy_caller_data(), copy_message(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_new(), dial_exec_full(), dial_trunk(), disa_exec(), do_forward(), do_immediate_setup(), fax_detect_framehook(), find_matching_endwhile(), findmeexec(), forward_message(), get_pai(), get_rpid(), gosub_exec(), gosub_run(), handle_cli_confbridge_list_item(), handle_cli_misdn_show_channels(), handle_gosub(), handle_setpriority(), handle_showchan(), isAnsweringMachine(), isexten_function_read(), leave_voicemail(), local_call(), manager_queues_status(), meetme_show_cmd(), mgcp_hangup(), mgcp_new(), mgcp_ss(), minivm_greet_exec(), minivm_notify_exec(), misdn_call(), misdn_hangup(), misdn_new(), misdn_update_caller_id(), misdn_write(), my_handle_dtmf(), onModeChanged(), ooh323_rtp_read(), ospauth_exec(), osplookup_exec(), oss_call(), oss_new(), park_local_transfer(), parse_oli(), pbx_builtin_background(), pbx_builtin_waitexten(), pbx_parseable_goto(), phone_new(), print_bc_info(), privacy_exec(), process_ast_dsp(), process_sdp(), push_callinfo(), queue_connected_line_update(), queue_exec(), readexten_exec(), recalling_enter(), release_chan(), ring_entry(), run_externnotify(), send_callinfo(), serialize_showchan(), setcallerid_pres_exec(), setup_env(), setup_privacy_args(), sip_call(), sip_new(), sip_read(), skinny_new(), skinny_newcall(), sla_ring_station(), sms_exec(), socket_process_helper(), start_automixmonitor(), start_automonitor(), state_notify_build_xml(), try_calling(), unistim_new(), unreal_colp_redirect_indicate(), update_connectedline(), update_initial_connected_line(), valid_exit(), vm_authenticate(), wait_for_answer(), waitstream_core(), write_metadata(), and zapateller_exec().

01013 {
01014    return &chan->caller;
01015 }

void ast_channel_caller_set ( struct ast_channel chan,
struct ast_party_caller value 
)

Definition at line 1068 of file channel_internal_api.c.

References ast_channel::caller.

Referenced by channel_do_masquerade(), dial_trunk(), and sla_ring_station().

01069 {
01070    chan->caller = *value;
01071 }

ast_group_t ast_channel_callgroup ( const struct ast_channel chan  ) 

void ast_channel_callgroup_set ( struct ast_channel chan,
ast_group_t  value 
)

Precondition:
chan is locked

Definition at line 1170 of file channel_internal_api.c.

References ast_channel::callgroup.

Referenced by chan_pjsip_new(), dahdi_new(), func_channel_write_real(), jingle_new(), mgcp_new(), read_config(), sip_new(), skinny_new(), and unistim_new().

01171 {
01172    chan->callgroup = value;
01173 }

ast_callid ast_channel_callid ( const struct ast_channel chan  ) 

void ast_channel_callid_cleanup ( struct ast_channel chan  ) 

Definition at line 1160 of file channel_internal_api.c.

References ast_channel::callid.

Referenced by ast_channel_destructor().

01161 {
01162    chan->callid = 0;
01163 }

void ast_channel_callid_set ( struct ast_channel chan,
ast_callid  value 
)

Precondition:
chan is locked

Definition at line 921 of file channel_internal_api.c.

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_request(), ast_unreal_channel_push_to_bridge(), ast_unreal_new_channels(), common_recall_channel_setup(), dahdi_new(), iax2_request(), jingle_new(), and sip_new().

00922 {
00923    char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
00924    char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
00925    call_identifier_from[0] = '\0';
00926    ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
00927    if (chan->callid) {
00928       ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
00929       ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
00930    }
00931 
00932    chan->callid = callid;
00933 
00934    ast_test_suite_event_notify("CallIDChange",
00935       "State: CallIDChange\r\n"
00936       "Channel: %s\r\n"
00937       "CallID: %s\r\n"
00938       "PriorCallID: %s",
00939       ast_channel_name(chan),
00940       call_identifier_to,
00941       call_identifier_from);
00942 }

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

Definition at line 10254 of file channel.c.

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

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

10256 {
10257    struct ast_cc_config_params *cc_params;
10258    struct ast_datastore *cc_datastore;
10259 
10260    if (!(cc_params = ast_cc_config_params_init())) {
10261       return -1;
10262    }
10263 
10264    if (!(cc_datastore = ast_datastore_alloc(&cc_channel_datastore_info, NULL))) {
10265       ast_cc_config_params_destroy(cc_params);
10266       return -1;
10267    }
10268 
10269    if (base_params) {
10270       ast_cc_copy_config_params(cc_params, base_params);
10271    }
10272    cc_datastore->data = cc_params;
10273    ast_channel_datastore_add(chan, cc_datastore);
10274    return 0;
10275 }

struct ast_cdr* ast_channel_cdr ( const struct ast_channel chan  )  [read]

Definition at line 777 of file channel_internal_api.c.

References ast_channel::cdr.

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

00778 {
00779    return chan->cdr;
00780 }

void ast_channel_cdr_set ( struct ast_channel chan,
struct ast_cdr value 
)

Definition at line 781 of file channel_internal_api.c.

References ast_channel::cdr.

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

00782 {
00783    chan->cdr = value;
00784 }

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:
chan the channel to clear the flag on
flag the flag or flags to clear
Returns:
Nothing.

Definition at line 2505 of file channel.c.

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().

02506 {
02507    ast_channel_lock(chan);
02508 
02509    ast_channel_softhangup_internal_flag_clear(chan, flag);
02510 
02511    if (!ast_channel_softhangup_internal_flag(chan)) {
02512       struct ast_frame *fr;
02513 
02514       /* If we have completely cleared the softhangup flag,
02515        * then we need to fully abort the hangup process.  This requires
02516        * pulling the END_OF_Q frame out of the channel frame queue if it
02517        * still happens to be there. */
02518 
02519       fr = AST_LIST_LAST(ast_channel_readq(chan));
02520       if (fr && fr->frametype == AST_FRAME_CONTROL &&
02521             fr->subclass.integer == AST_CONTROL_END_OF_Q) {
02522          AST_LIST_REMOVE(ast_channel_readq(chan), fr, frame_list);
02523          ast_frfree(fr);
02524       }
02525    }
02526 
02527    ast_channel_unlock(chan);
02528 }

int ast_channel_cmpwhentohangup ( struct ast_channel chan,
time_t  offset 
)

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

Parameters:
chan channel on which to check for hang up
offset offset in seconds from current time
Returns:
1, 0, or -1
This 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.
See also:
ast_channel_cmpwhentohangup_tv()
Version:
1.6.1 deprecated function (only had seconds precision)

Definition at line 558 of file channel.c.

References ast_channel_cmpwhentohangup_tv().

00559 {
00560    struct timeval when = { offset, };
00561    return ast_channel_cmpwhentohangup_tv(chan, when);
00562 }

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:
chan channel on which to check for hangup
offset offset in seconds and microseconds from current time
Returns:
1, 0, or -1 This 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

Definition at line 543 of file channel.c.

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

Referenced by ast_channel_cmpwhentohangup().

00544 {
00545    struct timeval whentohangup;
00546 
00547    if (ast_tvzero(*ast_channel_whentohangup(chan)))
00548       return ast_tvzero(offset) ? 0 : -1;
00549 
00550    if (ast_tvzero(offset))
00551       return 1;
00552 
00553    whentohangup = ast_tvadd(offset, ast_tvnow());
00554 
00555    return ast_tvdiff_ms(whentohangup, *ast_channel_whentohangup(chan));
00556 }

struct ast_party_connected_line* ast_channel_connected ( struct ast_channel chan  )  [read]

struct ast_party_id ast_channel_connected_effective_id ( struct ast_channel chan  )  [read]

struct ast_party_connected_line* ast_channel_connected_indicated ( struct ast_channel chan  )  [read]

int ast_channel_connected_line_macro ( struct ast_channel autoservice_chan,
struct ast_channel macro_chan,
const void *  connected_info,
int  is_caller,
int  frame 
)

Run a connected line interception macro and update a channel's connected line information.

Since:
1.8
Deprecated:
You should use the ast_channel_connected_line_sub() function instead.
Whenever we want to update a channel's connected line information, we may need to run a macro so that an administrator can manipulate the information before sending it out. This function both runs the macro and sends the update to the channel.

Parameters:
autoservice_chan Channel to place into autoservice while the macro is running. It is perfectly safe for this to be NULL
macro_chan The channel to run the macro on. Also the channel from which we determine which macro we need to run.
connected_info Either an ast_party_connected_line or ast_frame pointer of type AST_CONTROL_CONNECTED_LINE
is_caller If true, then run CONNECTED_LINE_CALLER_SEND_MACRO with arguments from CONNECTED_LINE_CALLER_SEND_MACRO_ARGS, otherwise run CONNECTED_LINE_CALLEE_SEND_MACRO with arguments from CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS
frame If true, then connected_info is an ast_frame pointer, otherwise it is an ast_party_connected_line pointer.
Return values:
0 Success
-1 Either the macro does not exist, or there was an error while attempting to run the macro
Todo:
Have multiple return codes based on the MACRO_RESULT
Todo:
Make constants so that caller and frame can be more expressive than just '1' and '0'

Definition at line 10045 of file channel.c.

References ast_app_run_macro(), ast_channel_connected(), ast_channel_lock, ast_channel_unlock, ast_channel_update_connected_line(), ast_connected_line_parse_data(), ast_log, ast_party_connected_line_copy(), ast_party_connected_line_free(), ast_party_connected_line_init(), ast_strdupa, ast_strlen_zero, chanlist::connected, ast_frame::data, ast_frame::datalen, LOG_WARNING, NULL, pbx_builtin_getvar_helper(), ast_frame::ptr, retval, and S_OR.

Referenced by __ast_read(), app_exec(), ast_do_pickup(), bridge_channel_handle_control(), handle_frame(), and wait_for_answer().

10046 {
10047    static int deprecation_warning = 0;
10048    const char *macro;
10049    const char *macro_args;
10050    int retval;
10051 
10052    ast_channel_lock(macro_chan);
10053    macro = pbx_builtin_getvar_helper(macro_chan, is_caller
10054       ? "CONNECTED_LINE_CALLER_SEND_MACRO" : "CONNECTED_LINE_CALLEE_SEND_MACRO");
10055    macro = ast_strdupa(S_OR(macro, ""));
10056    macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
10057       ? "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS" : "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS");
10058    macro_args = ast_strdupa(S_OR(macro_args, ""));
10059 
10060    if (ast_strlen_zero(macro)) {
10061       ast_channel_unlock(macro_chan);
10062       return -1;
10063    }
10064 
10065    if (!deprecation_warning) {
10066       deprecation_warning = 1;
10067       ast_log(LOG_WARNING, "Usage of CONNECTED_LINE_CALLE[ER]_SEND_MACRO is deprecated.  Please use CONNECTED_LINE_SEND_SUB instead.\n");
10068    }
10069    if (is_frame) {
10070       const struct ast_frame *frame = connected_info;
10071 
10072       ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(macro_chan));
10073    } else {
10074       const struct ast_party_connected_line *connected = connected_info;
10075 
10076       ast_party_connected_line_copy(ast_channel_connected(macro_chan), connected);
10077    }
10078    ast_channel_unlock(macro_chan);
10079 
10080    retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args);
10081    if (!retval) {
10082       struct ast_party_connected_line saved_connected;
10083 
10084       ast_party_connected_line_init(&saved_connected);
10085       ast_channel_lock(macro_chan);
10086       ast_party_connected_line_copy(&saved_connected, ast_channel_connected(macro_chan));
10087       ast_channel_unlock(macro_chan);
10088       ast_channel_update_connected_line(macro_chan, &saved_connected, NULL);
10089       ast_party_connected_line_free(&saved_connected);
10090    }
10091 
10092    return retval;
10093 }

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.

Since:
11 Whenever we want to update a channel's connected line information, we may need to run a subroutine so that an administrator can manipulate the information before sending it out. This function both runs the subroutine specified by CONNECTED_LINE_SEND_SUB and sends the update to the channel.
Parameters:
autoservice_chan Channel to place into autoservice while the sub is running. It is perfectly safe for this to be NULL
sub_chan The channel to run the subroutine on. Also the channel from which we determine which subroutine we need to run.
connected_info Either an ast_party_connected_line or ast_frame pointer of type AST_CONTROL_CONNECTED_LINE
frame If true, then connected_info is an ast_frame pointer, otherwise it is an ast_party_connected_line pointer.
Return values:
0 Success
-1 Either the subroutine does not exist, or there was an error while attempting to run the subroutine

Definition at line 10145 of file channel.c.

References ast_app_run_sub(), ast_channel_connected(), ast_channel_lock, ast_channel_unlock, ast_channel_update_connected_line(), ast_connected_line_parse_data(), ast_party_connected_line_copy(), ast_party_connected_line_free(), ast_party_connected_line_init(), ast_strdupa, ast_strlen_zero, chanlist::connected, ast_frame::data, ast_frame::datalen, NULL, pbx_builtin_getvar_helper(), ast_frame::ptr, retval, S_OR, and sub.

Referenced by __ast_read(), app_exec(), ast_do_pickup(), bridge_channel_handle_control(), handle_frame(), and wait_for_answer().

10146 {
10147    const char *sub;
10148    const char *sub_args;
10149    int retval;
10150 
10151    ast_channel_lock(sub_chan);
10152    sub = pbx_builtin_getvar_helper(sub_chan, "CONNECTED_LINE_SEND_SUB");
10153    sub = ast_strdupa(S_OR(sub, ""));
10154    sub_args = pbx_builtin_getvar_helper(sub_chan, "CONNECTED_LINE_SEND_SUB_ARGS");
10155    sub_args = ast_strdupa(S_OR(sub_args, ""));
10156 
10157    if (ast_strlen_zero(sub)) {
10158       ast_channel_unlock(sub_chan);
10159       return -1;
10160    }
10161 
10162    if (is_frame) {
10163       const struct ast_frame *frame = connected_info;
10164 
10165       ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(sub_chan));
10166    } else {
10167       const struct ast_party_connected_line *connected = connected_info;
10168 
10169       ast_party_connected_line_copy(ast_channel_connected(sub_chan), connected);
10170    }
10171    ast_channel_unlock(sub_chan);
10172 
10173    retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args, 0);
10174    if (!retval) {
10175       struct ast_party_connected_line saved_connected;
10176 
10177       ast_party_connected_line_init(&saved_connected);
10178       ast_channel_lock(sub_chan);
10179       ast_party_connected_line_copy(&saved_connected, ast_channel_connected(sub_chan));
10180       ast_channel_unlock(sub_chan);
10181       ast_channel_update_connected_line(sub_chan, &saved_connected, NULL);
10182       ast_party_connected_line_free(&saved_connected);
10183    }
10184 
10185    return retval;
10186 }

void ast_channel_connected_set ( struct ast_channel chan,
struct ast_party_connected_line value 
)

Definition at line 1072 of file channel_internal_api.c.

References ast_channel::connected.

Referenced by channel_do_masquerade().

01073 {
01074    chan->connected = *value;
01075 }

const char* ast_channel_context ( const struct ast_channel chan  ) 

Examples:
/tmp/asterisk-trunk/trunk/main/app.c.

Definition at line 525 of file channel_internal_api.c.

References ast_channel::context.

Referenced by __analog_ss_thread(), __ast_goto_if_exists(), __ast_pbx_run(), _macro_exec(), _while_exec(), acf_isexten_exec(), action_blind_transfer(), action_bridge(), action_dialplan_exec(), analog_ss_thread(), ast_app_exec_macro(), ast_bridge_setup_after_goto(), ast_call_forward(), ast_cc_call_init(), ast_channel_by_exten_cb(), ast_channel_log(), ast_channel_snapshot_create(), ast_channel_yank(), ast_pbx_h_exten_run(), ast_str_retrieve_variable(), AST_TEST_DEFINE(), ast_var_channels_table(), ast_waitstream_exten(), background_detect_exec(), bridge_exec(), cc_generic_agent_init(), cc_interfaces_datastore_init(), chan_pjsip_cng_tone_detected(), collect_digits(), common_exec(), conf_run(), console_transfer(), dahdi_handle_dtmf(), dial_exec_full(), dialout(), do_forward(), do_immediate_setup(), expand_gosub_args(), extenspy_exec(), fax_detect_framehook(), find_matching_endwhile(), forward_message(), func_channel_read(), func_channel_write_real(), get_cid_name(), get_transfer_context(), gosub_exec(), gosub_run(), goto_exten(), handle_call_forward(), handle_gosub(), handle_setpriority(), handle_showchan(), iax2_call(), launch_monitor_thread(), leave_voicemail(), log_exec(), lua_pbx_exec(), mgcp_ss(), minivm_greet_exec(), misdn_call(), misdn_hangup(), my_handle_dtmf(), onedigit_goto(), onModeChanged(), ooh323_rtp_read(), pbx_builtin_background(), pbx_builtin_goto(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pbx_extension_helper(), pbx_parseable_goto(), pickup_exec(), print_bc_info(), process_ast_dsp(), process_sdp(), raise_exception(), readexten_exec(), realtime_exec(), release_chan(), ring_entry(), serialize_showchan(), setsubstate(), setup_env(), setup_peer_after_bridge_goto(), sip_read(), skinny_dialer(), skinny_newcall(), try_calling(), vm_authenticate(), vm_execmain(), vmauthenticate(), and wait_for_answer().

00526 {
00527    return chan->context;
00528 }

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

struct timeval ast_channel_creationtime ( struct ast_channel chan  )  [read]

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

Definition at line 1100 of file channel_internal_api.c.

References ast_channel::creationtime.

Referenced by __ast_channel_alloc_ap().

01101 {
01102    chan->creationtime = *value;
01103 }

const char* ast_channel_data ( const struct ast_channel chan  ) 

int ast_channel_data_add_structure ( struct ast_data tree,
struct ast_channel chan,
int  add_bridged 
)

Insert into an astdata tree, the channel structure.

Parameters:
[in] tree The ast data tree.
[in] chan The channel structure to add to tree.
[in] add_bridged Add the bridged channel to the structure.
Return values:
<0 on error.
0 on success.

Definition at line 298 of file channel_internal_api.c.

References ast_cause2str(), ast_channel_amaflags(), ast_channel_amaflags2string(), ast_channel_bridge_peer(), ast_channel_cleanup, ast_channel_data_add_structure(), ast_channel_hangupcause(), ast_channel_linkedid(), ast_channel_nativeformats(), ast_channel_oldwriteformat(), ast_channel_rawreadformat(), ast_channel_rawwriteformat(), ast_channel_readformat(), ast_channel_softhangup_internal_flag(), ast_channel_transfercapability(), ast_channel_uniqueid(), ast_channel_whentohangup(), ast_channel_writeformat(), ast_channel_zone(), ast_data_add_bool(), ast_data_add_codec(), ast_data_add_codecs(), ast_data_add_int(), ast_data_add_node(), ast_data_add_str(), ast_data_add_structure, ast_data_add_uint(), AST_SOFTHANGUP_APPUNLOAD, AST_SOFTHANGUP_ASYNCGOTO, AST_SOFTHANGUP_DEV, AST_SOFTHANGUP_EXPLICIT, AST_SOFTHANGUP_SHUTDOWN, AST_SOFTHANGUP_TIMEOUT, ast_state2str(), ast_tone_zone_data_add_structure(), ast_transfercapability2str(), bc, channel_data_add_flags(), and RAII_VAR.

Referenced by ast_channel_data_add_structure(), data_channels_provider_handler(), queues_data_provider_get_helper(), and user_add_provider_cb().

00300 {
00301    struct ast_data *data_bridged;
00302    struct ast_data *data_cdr;
00303    struct ast_data *data_flags;
00304    struct ast_data *data_zones;
00305    struct ast_data *enum_node;
00306    struct ast_data *data_softhangup;
00307 #if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
00308    struct ast_data *data_callerid;
00309    char value_str[100];
00310 #endif
00311 
00312    if (!tree) {
00313       return -1;
00314    }
00315 
00316    ast_data_add_structure(ast_channel, tree, chan);
00317 
00318    if (add_bridged) {
00319       RAII_VAR(struct ast_channel *, bc, ast_channel_bridge_peer(chan), ast_channel_cleanup);
00320       if (bc) {
00321          data_bridged = ast_data_add_node(tree, "bridged");
00322          if (!data_bridged) {
00323             return -1;
00324          }
00325          ast_channel_data_add_structure(data_bridged, bc, 0);
00326       }
00327    }
00328 
00329    ast_data_add_str(tree, "uniqueid", ast_channel_uniqueid(chan));
00330    ast_data_add_str(tree, "linkedid", ast_channel_linkedid(chan));
00331 
00332    ast_data_add_codec(tree, "oldwriteformat", ast_channel_oldwriteformat(chan));
00333    ast_data_add_codec(tree, "readformat", ast_channel_readformat(chan));
00334    ast_data_add_codec(tree, "writeformat", ast_channel_writeformat(chan));
00335    ast_data_add_codec(tree, "rawreadformat", ast_channel_rawreadformat(chan));
00336    ast_data_add_codec(tree, "rawwriteformat", ast_channel_rawwriteformat(chan));
00337    ast_data_add_codecs(tree, "nativeformats", ast_channel_nativeformats(chan));
00338 
00339    /* state */
00340    enum_node = ast_data_add_node(tree, "state");
00341    if (!enum_node) {
00342       return -1;
00343    }
00344    ast_data_add_str(enum_node, "text", ast_state2str(ast_channel_state(chan)));
00345    ast_data_add_int(enum_node, "value", ast_channel_state(chan));
00346 
00347    /* hangupcause */
00348    enum_node = ast_data_add_node(tree, "hangupcause");
00349    if (!enum_node) {
00350       return -1;
00351    }
00352    ast_data_add_str(enum_node, "text", ast_cause2str(ast_channel_hangupcause(chan)));
00353    ast_data_add_int(enum_node, "value", ast_channel_hangupcause(chan));
00354 
00355    /* amaflags */
00356    enum_node = ast_data_add_node(tree, "amaflags");
00357    if (!enum_node) {
00358       return -1;
00359    }
00360    ast_data_add_str(enum_node, "text", ast_channel_amaflags2string(ast_channel_amaflags(chan)));
00361    ast_data_add_int(enum_node, "value", ast_channel_amaflags(chan));
00362 
00363    /* transfercapability */
00364    enum_node = ast_data_add_node(tree, "transfercapability");
00365    if (!enum_node) {
00366       return -1;
00367    }
00368    ast_data_add_str(enum_node, "text", ast_transfercapability2str(ast_channel_transfercapability(chan)));
00369    ast_data_add_int(enum_node, "value", ast_channel_transfercapability(chan));
00370 
00371    /* _softphangup */
00372    data_softhangup = ast_data_add_node(tree, "softhangup");
00373    if (!data_softhangup) {
00374       return -1;
00375    }
00376    ast_data_add_bool(data_softhangup, "dev", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_DEV);
00377    ast_data_add_bool(data_softhangup, "asyncgoto", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO);
00378    ast_data_add_bool(data_softhangup, "shutdown", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_SHUTDOWN);
00379    ast_data_add_bool(data_softhangup, "timeout", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_TIMEOUT);
00380    ast_data_add_bool(data_softhangup, "appunload", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_APPUNLOAD);
00381    ast_data_add_bool(data_softhangup, "explicit", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_EXPLICIT);
00382 
00383    /* channel flags */
00384    data_flags = ast_data_add_node(tree, "flags");
00385    if (!data_flags) {
00386       return -1;
00387    }
00388    channel_data_add_flags(data_flags, chan);
00389 
00390    ast_data_add_uint(tree, "timetohangup", ast_channel_whentohangup(chan)->tv_sec);
00391 
00392 #if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
00393    /* callerid */
00394    data_callerid = ast_data_add_node(tree, "callerid");
00395    if (!data_callerid) {
00396       return -1;
00397    }
00398    ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid));
00399    /* insert the callerid ton */
00400    enum_node = ast_data_add_node(data_callerid, "cid_ton");
00401    if (!enum_node) {
00402       return -1;
00403    }
00404    ast_data_add_int(enum_node, "value", chan->cid.cid_ton);
00405    snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s",
00406       party_number_ton2str(chan->cid.cid_ton),
00407       party_number_plan2str(chan->cid.cid_ton));
00408    ast_data_add_str(enum_node, "text", value_str);
00409 #endif
00410 
00411    /* tone zone */
00412    if (ast_channel_zone(chan)) {
00413       data_zones = ast_data_add_node(tree, "zone");
00414       if (!data_zones) {
00415          return -1;
00416       }
00417       ast_tone_zone_data_add_structure(data_zones, ast_channel_zone(chan));
00418    }
00419 
00420    /* insert cdr */
00421    data_cdr = ast_data_add_node(tree, "cdr");
00422    if (!data_cdr) {
00423       return -1;
00424    }
00425 
00426    return 0;
00427 }

int ast_channel_data_cmp_structure ( const struct ast_data_search tree,
struct ast_channel chan,
const char *  structure_name 
)

Compare to channel structures using the data api.

Parameters:
[in] tree The search tree generated by the data api.
[in] chan The channel to compare.
[in] structure_name The name of the node of the channel structure.
Return values:
0 The structure matches.
1 The structure doesn't matches.

Definition at line 429 of file channel_internal_api.c.

References ast_data_search_cmp_structure.

00431 {
00432    return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name);
00433 }

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.

Note:
The channel should be locked before calling this function.
Return values:
0 success
non-zero failure

Definition at line 2386 of file channel.c.

References ast_channel_datastores(), and AST_LIST_INSERT_HEAD.

Referenced by __after_bridge_set_goto(), _macro_exec(), acf_curlopt_write(), acf_iaxvar_write(), acf_odbc_read(), add_features_datastore(), add_masquerade_store(), add_to_agi(), after_bridge_cb_setup(), apply_plc(), ast_cel_fabricate_channel_from_event(), ast_channel_cc_params_init(), ast_channel_suppress(), ast_do_pickup(), ast_iax2_new(), ast_jb_create_framehook(), ast_setup_cc_recall_datastore(), audiohook_volume_get(), authenticate_reply(), bridge_features_ds_set_full(), calendar_query_exec(), cc_interfaces_datastore_init(), chan_cleanup(), channel_feature_hooks_set_full(), command_prestart_queue_command(), create_msg_q_chan(), create_parked_subscription_full(), dial_exec_full(), dial_masquerade_datastore_add(), do_notify(), dundi_query_read(), enable_jack_hook(), enum_query_read(), find_or_create_details(), find_transaction(), frame_trace_helper(), func_channel_write_real(), func_confbridge_helper(), get_feature_ds(), get_lock(), get_replace_channel_store(), gosub_exec(), init_hook(), lua_get_state(), msg_datastore_find_or_create(), MYSQL_exec(), pitchshift_helper(), raise_exception(), set_internal_datastore(), set_talk_detect(), setup_bridge_roles_datastore(), setup_mixmonitor_ds(), setup_park_common_datastore(), shared_write(), smdi_msg_retrieve_read(), socket_process_helper(), speech_create(), speex_write(), srv_datastore_setup(), stasis_app_channel_set_stasis_end_published(), t38_attach_framehook(), try_calling(), and volume_write().

02387 {
02388    int res = 0;
02389 
02390    AST_LIST_INSERT_HEAD(ast_channel_datastores(chan), datastore, entry);
02391 
02392    return res;
02393 }

struct ast_datastore* attribute_malloc ast_channel_datastore_alloc ( const struct ast_datastore_info info,
const char *  uid 
) [read]

Create a channel data store object.

Note:
None of the datastore API calls lock the ast_channel they are using. So, the channel should be locked before calling the functions that take a channel argument.
Deprecated:
You should use the ast_datastore_alloc() generic function instead.
Version:
1.6.1 deprecated

Definition at line 2359 of file channel.c.

References ast_datastore_alloc.

02360 {
02361    return ast_datastore_alloc(info, uid);
02362 }

struct ast_datastore* ast_channel_datastore_find ( struct ast_channel chan,
const struct ast_datastore_info info,
const char *  uid 
) [read]

Find a datastore on a channel.

Note:
The channel should be locked before calling this function.

The datastore returned from this function must not be used if the reference to the channel is released.

Return values:
pointer to the datastore if found
NULL if not found

Definition at line 2400 of file channel.c.

References ast_channel_datastores(), AST_LIST_TRAVERSE, ast_datastore::info, NULL, and ast_datastore::uid.

Referenced by _macro_exec(), acf_curl_helper(), acf_curlopt_helper(), acf_curlopt_write(), acf_exception_read(), acf_fetch(), acf_iaxvar_read(), acf_iaxvar_write(), acf_odbc_read(), add_agi_cmd(), add_features_datastore(), add_masquerade_store(), add_to_agi(), after_bridge_cb_find(), after_bridge_cb_setup(), after_bridge_goto_remove(), apply_plc(), ast_bridge_features_ds_get(), ast_bridge_read_after_goto(), ast_can_pickup(), ast_cc_agent_set_interfaces_chanvar(), ast_cc_call_init(), ast_cc_completed(), ast_cc_extension_monitor_add_dialstring(), ast_cc_get_current_core_id(), ast_cc_is_recall(), ast_cc_offer(), ast_channel_feature_hooks_get(), ast_channel_get_cc_config_params(), ast_channel_suppress(), ast_channel_unsuppress(), ast_handle_cc_control_frame(), ast_ignore_cc(), ast_jb_create_framehook(), ast_odbc_retrieve_transaction_obj(), ast_set_cc_interfaces_chanvar(), audiohook_volume_callback(), audiohook_volume_get(), balance_stack(), bridge_features_ds_set_full(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), cc_build_payload(), chan_cleanup(), channel_feature_hooks_set_full(), clear_dialed_interfaces(), command_prestart_get_container(), command_prestart_queue_command(), conf_find_bridge_profile(), conf_find_user_profile(), conf_set_menu_to_user(), dial_exec_full(), dial_masquerade_datastore_find(), dialplan_handle_msg_cb(), disable_jack_hook(), dundi_result_read(), enable_jack_hook(), enum_result_read(), exec_odbcfinish(), fetch_bridge_roles_datastore(), find_details(), find_speech(), find_transaction(), fixup_callback(), frame_trace_helper(), func_channel_read(), func_channel_write_real(), func_confbridge_helper(), func_mixmonitor_read(), get_agi_cmd(), get_feature_chan_ds(), get_feature_ds(), get_lock(), get_park_common_datastore_copy(), get_replace_channel_store(), gosub_exec(), gosub_run(), handle_gosub(), has_masquerade_store(), hook_off(), hook_re_enable(), iax2_call(), jack_hook_callback(), local_read(), local_write(), lock_fixup(), lua_get_state(), mark_transaction_active(), msg_data_func_read(), msg_datastore_find_or_create(), msg_func_read(), msg_send_exec(), MYSQL_exec(), pitchshift_cb(), pitchshift_helper(), pop_exec(), raise_exception(), release_transaction(), remove_masquerade_store(), remove_stasis_end_published(), remove_talk_detect(), return_exec(), set_internal_datastore(), set_security_requirements(), set_talk_detect(), shared_read(), shared_write(), smdi_msg_read(), speech_datastore_destroy(), speex_callback(), speex_read(), speex_write(), srv_query_read(), srv_result_read(), stackpeek_read(), stasis_app_channel_is_internal(), stasis_app_channel_is_stasis_end_published(), stop_mixmonitor_full(), t38_attach_framehook(), talk_detect_audiohook_cb(), try_calling(), unlock_read(), volume_callback(), volume_write(), wipe_park_common_datastore(), and wipe_subscription_datastore().

02401 {
02402    struct ast_datastore *datastore = NULL;
02403 
02404    if (info == NULL)
02405       return NULL;
02406 
02407    AST_LIST_TRAVERSE(ast_channel_datastores(chan), datastore, entry) {
02408       if (datastore->info != info) {
02409          continue;
02410       }
02411 
02412       if (uid == NULL) {
02413          /* matched by type only */
02414          break;
02415       }
02416 
02417       if ((datastore->uid != NULL) && !strcasecmp(uid, datastore->uid)) {
02418          /* Matched by type AND uid */
02419          break;
02420       }
02421    }
02422 
02423    return datastore;
02424 }

int ast_channel_datastore_free ( struct ast_datastore datastore  ) 

Free a channel data store object.

Deprecated:
You should use the ast_datastore_free() generic function instead.
Version:
1.6.1 deprecated

Definition at line 2364 of file channel.c.

References ast_datastore_free().

02365 {
02366    return ast_datastore_free(datastore);
02367 }

int ast_channel_datastore_inherit ( struct ast_channel from,
struct ast_channel to 
)

Inherit datastores from a parent to a child.

Definition at line 2369 of file channel.c.

References ast_channel_datastores(), ast_datastore_alloc, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_datastore::data, DATASTORE_INHERIT_FOREVER, ast_datastore_info::duplicate, ast_datastore::info, ast_datastore::inheritance, NULL, and ast_datastore::uid.

Referenced by __ast_request_and_dial(), ast_unreal_call_setup(), begin_dial_prerun(), call_forward_inherit(), common_recall_channel_setup(), copy_caller_data(), dial_exec_full(), do_forward(), findmeexec(), park_local_transfer(), ring_entry(), and wait_for_answer().

02370 {
02371    struct ast_datastore *datastore = NULL, *datastore2;
02372 
02373    AST_LIST_TRAVERSE(ast_channel_datastores(from), datastore, entry) {
02374       if (datastore->inheritance > 0) {
02375          datastore2 = ast_datastore_alloc(datastore->info, datastore->uid);
02376          if (datastore2) {
02377             datastore2->data = datastore->info->duplicate ? datastore->info->duplicate(datastore->data) : NULL;
02378             datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1;
02379             AST_LIST_INSERT_TAIL(ast_channel_datastores(to), datastore2, entry);
02380          }
02381       }
02382    }
02383    return 0;
02384 }

int ast_channel_datastore_remove ( struct ast_channel chan,
struct ast_datastore datastore 
)

struct ast_datastore_list* ast_channel_datastores ( struct ast_channel chan  )  [read]

int ast_channel_defer_dtmf ( struct ast_channel chan  ) 

Defers DTMF so that you only read things like hangups and audio.

Returns:
non-zero if channel was already DTMF-deferred or 0 if channel is just now being DTMF-deferred

Definition at line 1248 of file channel.c.

References ast_channel_flags(), AST_FLAG_DEFER_DTMF, ast_set_flag, and ast_test_flag.

Referenced by __adsi_transmit_messages(), and find_cache().

01249 {
01250    int pre = 0;
01251 
01252    if (chan) {
01253       pre = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
01254       ast_set_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
01255    }
01256    return pre;
01257 }

const char* ast_channel_dialcontext ( const struct ast_channel chan  ) 

Referenced by ast_channel_log().

struct ast_party_dialed* ast_channel_dialed ( struct ast_channel chan  )  [read]

int ast_channel_dialed_causes_add ( const struct ast_channel chan,
const struct ast_control_pvt_cause_code cause_code,
int  datalen 
)

Add cause code information to the channel.

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

Parameters:
chan The channel on which to add information
cause_code The cause information to be added to the channel
datalen The total length of the structure since its length is variable
Return values:
0 on success
-1 on error

Definition at line 1400 of file channel_internal_api.c.

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

Referenced by ast_channel_hangupcause_hash_set().

01401 {
01402    struct ast_control_pvt_cause_code *ao2_cause_code;
01403    ao2_find(chan->dialed_causes, cause_code->chan_name, OBJ_KEY | OBJ_UNLINK | OBJ_NODATA);
01404    ao2_cause_code = ao2_alloc(datalen, NULL);
01405 
01406    if (ao2_cause_code) {
01407       memcpy(ao2_cause_code, cause_code, datalen);
01408       ao2_link(chan->dialed_causes, ao2_cause_code);
01409       ao2_ref(ao2_cause_code, -1);
01410       return 0;
01411    } else {
01412       return -1;
01413    }
01414 }

struct ast_str* ast_channel_dialed_causes_channels ( const struct ast_channel chan  )  [read]

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

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

Parameters:
chan The channel from which to retrieve information
Return values:
NULL on allocation failure
Pointer to an ast_str object containing the desired information which must be freed

Definition at line 1382 of file channel_internal_api.c.

References ao2_callback, ast_str_create(), collect_names_cb(), ast_channel::dialed_causes, and NULL.

Referenced by hangupcause_keys_read().

01383 {
01384    struct ast_str *chanlist = ast_str_create(128);
01385 
01386    if (!chanlist) {
01387       return NULL;
01388    }
01389 
01390    ao2_callback(chan->dialed_causes, 0, collect_names_cb, &chanlist);
01391 
01392    return chanlist;
01393 }

void ast_channel_dialed_causes_clear ( const struct ast_channel chan  ) 

Clear all cause information from the channel.

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

Parameters:
chan The channel from which to clear information

Definition at line 1416 of file channel_internal_api.c.

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

Referenced by hangupcause_clear_exec().

01417 {
01418    ao2_callback(chan->dialed_causes, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);
01419 }

struct ast_control_pvt_cause_code* ast_channel_dialed_causes_find ( const struct ast_channel chan,
const char *  chan_name 
) [read]

Retrieve a ref-counted cause code information structure.

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

Parameters:
chan The channel from which to retrieve information
chan_name The name of the channel about which to retrieve information
Return values:
NULL on search failure
Pointer to a ref-counted ast_control_pvt_cause_code object containing the desired information

Definition at line 1395 of file channel_internal_api.c.

References ao2_find, ast_channel::dialed_causes, and OBJ_KEY.

Referenced by hangupcause_read().

01396 {
01397    return ao2_find(chan->dialed_causes, chan_name, OBJ_KEY);
01398 }

void ast_channel_dialed_set ( struct ast_channel chan,
struct ast_party_dialed value 
)

Definition at line 1076 of file channel_internal_api.c.

References ast_channel::dialed.

Referenced by channel_do_masquerade().

01077 {
01078    chan->dialed = *value;
01079 }

char ast_channel_dtmf_digit_to_emulate ( const struct ast_channel chan  ) 

Definition at line 558 of file channel_internal_api.c.

References ast_channel::dtmf_digit_to_emulate.

Referenced by __ast_read().

00559 {
00560    return chan->dtmf_digit_to_emulate;
00561 }

void ast_channel_dtmf_digit_to_emulate_set ( struct ast_channel chan,
char  value 
)

Definition at line 562 of file channel_internal_api.c.

References ast_channel::dtmf_digit_to_emulate.

Referenced by __ast_read().

00563 {
00564    chan->dtmf_digit_to_emulate = value;
00565 }

struct timeval* ast_channel_dtmf_tv ( struct ast_channel chan  )  [read]

Definition at line 1048 of file channel_internal_api.c.

References ast_channel::dtmf_tv.

Referenced by __ast_read(), and should_skip_dtmf().

01049 {
01050    return &chan->dtmf_tv;
01051 }

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

Definition at line 1084 of file channel_internal_api.c.

References ast_channel::dtmf_tv.

Referenced by __ast_read().

01085 {
01086    chan->dtmf_tv = *value;
01087 }

struct ast_frame* ast_channel_dtmff ( struct ast_channel chan  )  [read]

Definition at line 1004 of file channel_internal_api.c.

References ast_channel::dtmff.

Referenced by __ast_read(), and queue_dtmf_readq().

01005 {
01006    return &chan->dtmff;
01007 }

void ast_channel_dtmff_set ( struct ast_channel chan,
struct ast_frame value 
)

Definition at line 1060 of file channel_internal_api.c.

References ast_channel::dtmff.

01061 {
01062    chan->dtmff = *value;
01063 }

int ast_channel_early_bridge ( struct ast_channel c0,
struct ast_channel c1 
)

Bridge two channels together (early).

Parameters:
c0 first channel to bridge
c1 second channel to bridge
Bridge two channels (c0 and c1) together early. This implies either side may not be answered yet.
Returns:
Returns 0 on success and -1 if it could not be done

Definition at line 7047 of file channel.c.

References ast_channel_tech(), and ast_channel_tech::early_bridge.

Referenced by dial_exec_full(), and wait_for_answer().

07048 {
07049    /* Make sure we can early bridge, if not error out */
07050    if (!ast_channel_tech(c0)->early_bridge || (c1 && (!ast_channel_tech(c1)->early_bridge || ast_channel_tech(c0)->early_bridge != ast_channel_tech(c1)->early_bridge)))
07051       return -1;
07052 
07053    return ast_channel_tech(c0)->early_bridge(c0, c1);
07054 }

unsigned int ast_channel_emulate_dtmf_duration ( const struct ast_channel chan  ) 

Definition at line 697 of file channel_internal_api.c.

References ast_channel::emulate_dtmf_duration.

Referenced by __ast_read().

00698 {
00699    return chan->emulate_dtmf_duration;
00700 }

void ast_channel_emulate_dtmf_duration_set ( struct ast_channel chan,
unsigned int  value 
)

Definition at line 701 of file channel_internal_api.c.

References ast_channel::emulate_dtmf_duration.

Referenced by __ast_read().

00702 {
00703    chan->emulate_dtmf_duration = value;
00704 }

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.

Parameters:
chan Channel sending DTMF that has not ended.
digit DTMF digit to stop.
start DTMF digit start time.
why Reason bridge broken.
Returns:
Nothing

Definition at line 10651 of file channel.c.

References ast_channel_flags(), ast_channel_lock, ast_channel_name(), ast_channel_softhangup_internal_flag(), ast_channel_unlock, AST_FLAG_ZOMBIE, ast_log, ast_senddigit_end(), AST_SOFTHANGUP_ASYNCGOTO, ast_test_flag, ast_tvdiff_ms(), ast_tvnow(), LOG_DTMF, and option_dtmfminduration.

Referenced by bridge_channel_internal_join(), and channel_do_masquerade().

10652 {
10653    int dead;
10654    long duration;
10655 
10656    ast_channel_lock(chan);
10657    dead = ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)
10658       || (ast_channel_softhangup_internal_flag(chan)
10659          & ~AST_SOFTHANGUP_ASYNCGOTO);
10660    ast_channel_unlock(chan);
10661    if (dead) {
10662       /* Channel is a zombie or a real hangup. */
10663       return;
10664    }
10665 
10666    duration = ast_tvdiff_ms(ast_tvnow(), start);
10667    if (duration < option_dtmfminduration) {
10668       duration = option_dtmfminduration;
10669    }
10670    ast_senddigit_end(chan, digit, duration);
10671    ast_log(LOG_DTMF, "DTMF end '%c' simulated on %s due to %s, duration %ld ms\n",
10672       digit, ast_channel_name(chan), why, duration);
10673 }

int ast_channel_epfd ( const struct ast_channel chan  )