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"
Go to the source code of this file.
Data Structures | |
| 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_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_BRIDGE_IGNORE_SIGS (1 << 4) |
| Ignore all signal frames except NULL. | |
| #define | AST_BRIDGE_REC_CHANNEL_0 (1 << 2) |
| Return all voice frames on channel 0. | |
| #define | AST_BRIDGE_REC_CHANNEL_1 (1 << 3) |
| Return all voice frames 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, linkedid, amaflag,...) |
| Create a channel structure. | |
| #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_GENERATOR_FD (AST_MAX_FDS-4) |
| #define | AST_JITTERBUFFER_FD (AST_MAX_FDS-5) |
| #define | AST_MAX_CONTEXT 80 |
| #define | AST_MAX_EXTENSION 80 |
| #define | AST_MAX_FDS 11 |
| #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_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_NBRIDGE = (1 << 8), 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_BRIDGE_HANGUP_DONT = (1 << 18), AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20), AST_FLAG_DISABLE_DEVSTATE_CACHE = (1 << 21), AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT = (1 << 22), AST_FLAG_TIMINGDATA_IS_AO2_OBJ = (1 << 23) } |
| 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_FEATURE_NO_H_EXTEN = (1 << 7), AST_FEATURE_WARNING_ACTIVE = (1 << 8) } |
| 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_UNBRIDGE = (1 << 6), AST_SOFTHANGUP_ALL = (0xFFFFFFFF) } |
| 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_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, int cdr_answer) |
| 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 char *linkedid, const int amaflag, 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_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. | |
| 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... | |
| void | ast_begin_shutdown (int hangup) |
| struct ast_format * | ast_best_codec (struct ast_format_cap *cap, struct ast_format *result) |
| Pick the best codec. | |
| struct ast_channel * | ast_bridged_channel (struct ast_channel *chan) |
| Find bridged channel. | |
| int | ast_call (struct ast_channel *chan, const char *addr, int timeout) |
| Make a call. | |
| struct ast_channel * | ast_call_forward (struct ast_channel *caller, struct ast_channel *orig, int *timeout, struct ast_format_cap *cap, struct outgoing_helper *oh, int *outstate) |
| Forwards a call to a new channel specified by the original channel's call_forward str. If possible, the new forwarded channel is created and returned while the original one is terminated. | |
| void | ast_cancel_shutdown (void) |
| Cancel a shutdown in progress. | |
| 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_channel * | ast_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) |
| int | ast_channel_amaflags (const struct ast_channel *chan) |
| void | ast_channel_amaflags_set (struct ast_channel *chan, int 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_list * | ast_channel_audiohooks (const struct ast_channel *chan) |
| void | ast_channel_audiohooks_set (struct ast_channel *chan, struct ast_audiohook_list *value) |
| struct ast_autochan_list * | ast_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) |
| int | ast_channel_bridge (struct ast_channel *c0, struct ast_channel *c1, struct ast_bridge_config *config, struct ast_frame **fo, struct ast_channel **rc) |
| Bridge two channels together. | |
| 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) |
| Call a function with every active channel. | |
| struct ast_party_caller * | ast_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) |
| struct 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, struct 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_cdr * | ast_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_line * | ast_channel_connected (struct ast_channel *chan) |
| struct ast_party_id | ast_channel_connected_effective_id (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_datastore * | ast_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_list * | ast_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_dialed * | ast_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_str * | ast_channel_dialed_causes_channels (const struct ast_channel *chan) |
| Retreive 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_code * | ast_channel_dialed_causes_find (const struct ast_channel *chan, const char *chan_name) |
| Retreive 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_frame * | ast_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) |
| 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) |
| unsigned int | ast_channel_fin (const struct ast_channel *chan) |
| void | ast_channel_fin_set (struct ast_channel *chan, unsigned int value) |
| struct ast_flags * | ast_channel_flags (struct ast_channel *chan) |
| 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_list * | ast_channel_framehooks (const struct ast_channel *chan) |
| void | ast_channel_framehooks_set (struct ast_channel *chan, struct ast_framehook_list *value) |
| struct ast_generator * | ast_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) |
| 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_params * | ast_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. | |
| static enum ast_t38_state | ast_channel_get_t38_state (struct ast_channel *chan) |
| Retrieves the current T38 state of a channel. | |
| struct ast_hangup_handler_list * | ast_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) |
| 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_bridge * | ast_channel_internal_bridge (const struct ast_channel *chan) |
| void | ast_channel_internal_bridge_set (struct ast_channel *chan, struct ast_bridge *value) |
| struct ast_channel * | ast_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_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_jb * | ast_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_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 *c0, struct ast_channel *c1) |
| Makes two channel formats compatible. | |
| struct ast_channel * | ast_channel_masq (const struct ast_channel *chan) |
| void | ast_channel_masq_set (struct ast_channel *chan, struct ast_channel *value) |
| struct ast_channel * | ast_channel_masqr (const struct ast_channel *chan) |
| void | ast_channel_masqr_set (struct ast_channel *chan, struct ast_channel *value) |
| int | ast_channel_masquerade (struct ast_channel *original, struct ast_channel *clone) |
| Weird function made for call transfers. | |
| struct ast_channel_monitor * | ast_channel_monitor (const struct ast_channel *chan) |
| void | ast_channel_monitor_set (struct ast_channel *chan, struct ast_channel_monitor *value) |
| 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. | |
| 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_cap * | ast_channel_nativeformats (const struct ast_channel *chan) |
| void | ast_channel_nativeformats_set (struct ast_channel *chan, struct ast_format_cap *value) |
| struct ast_format * | ast_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_pbx * | ast_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_format * | ast_channel_rawreadformat (struct ast_channel *chan) |
| struct ast_format * | ast_channel_rawwriteformat (struct ast_channel *chan) |
| struct ast_format * | ast_channel_readformat (struct ast_channel *chan) |
| struct ast_readq_list * | ast_channel_readq (struct ast_channel *chan) |
| struct ast_trans_pvt * | ast_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_redirecting * | ast_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_channel * | ast_channel_release (struct ast_channel *chan) |
| Unlink and release reference to a channel. | |
| int | ast_channel_rings (const struct ast_channel *chan) |
| void | ast_channel_rings_set (struct ast_channel *chan, int value) |
| struct ast_sched_context * | ast_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_linkgroup (struct ast_channel *chan, struct ast_channel *peer) |
| propagate the linked id between chan and peer | |
| 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. | |
| 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_generator * | ast_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_filestream * | ast_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) |
| int | ast_channel_supports_html (struct ast_channel *channel) |
| Checks for HTML support on a channel. | |
| struct ast_channel_tech * | ast_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_timer * | ast_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) |
| int | ast_channel_transfer_masquerade (struct ast_channel *target_chan, const struct ast_party_connected_line *target_id, int target_held, struct ast_channel *transferee_chan, const struct ast_party_connected_line *transferee_id, int transferee_held) |
| Setup a masquerade to transfer a call. | |
| unsigned short | ast_channel_transfercapability (const struct ast_channel *chan) |
| void | ast_channel_transfercapability_set (struct ast_channel *chan, unsigned short value) |
| 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. | |
| 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 varshead * | ast_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_filestream * | ast_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_format * | ast_channel_writeformat (struct ast_channel *chan) |
| struct ast_trans_pvt * | ast_channel_writetrans (const struct ast_channel *chan) |
| void | ast_channel_writetrans_set (struct ast_channel *chan, struct ast_trans_pvt *value) |
| struct ast_tone_zone * | ast_channel_zone (const struct ast_channel *chan) |
| void | ast_channel_zone_set (struct ast_channel *chan, struct ast_tone_zone *value) |
| struct ast_variable * | ast_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) |
| int | ast_do_masquerade (struct ast_channel *chan) |
| Start masquerading a channel. | |
| struct ast_channel * | ast_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_tech * | ast_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. | |
| int | 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_internal_timing_enabled (struct ast_channel *chan) |
| Check if the channel can run in internal timing mode. | |
| 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_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 with 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_raw_answer (struct ast_channel *chan, int cdr_answer) |
| Answer a channel. | |
| struct ast_frame * | ast_read (struct ast_channel *chan) |
| Reads a frame. | |
| struct ast_frame * | ast_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_channel * | ast_request (const char *type, struct ast_format_cap *request_cap, const struct ast_channel *requestor, const char *addr, int *cause) |
| Requests a channel. | |
| struct ast_channel * | ast_request_and_dial (const char *type, struct ast_format_cap *cap, 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_by_id (struct ast_channel *chan, enum ast_format_id id) |
| Sets read format on channel chan by id. | |
| 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. | |
| 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_by_id (struct ast_channel *chan, enum ast_format_id id) |
| 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_shutting_down (void) |
| Returns non-zero if Asterisk is being shut down. | |
| int | ast_softhangup (struct ast_channel *chan, int reason) |
| Softly hangup up a channel. | |
| 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_channel * | ast_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_channel * | ast_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 (name) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (language) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (musicclass) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (accountcode) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (peeraccount) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (userfield) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (call_forward) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (uniqueid) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (linkedid) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (parkinglot) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (hangupsource) | |
| DECLARE_STRINGFIELD_SETTERS_FOR (dialcontext) | |
| struct ast_channel_iterator * | ast_channel_iterator_destroy (struct ast_channel_iterator *i) |
| Destroy a channel iterator. | |
| struct ast_channel_iterator * | ast_channel_iterator_by_exten_new (const char *exten, const char *context) |
| Create a new channel iterator based on extension. | |
| struct ast_channel_iterator * | ast_channel_iterator_by_name_new (const char *name, size_t name_len) |
| Create a new channel iterator based on name. | |
| struct ast_channel_iterator * | ast_channel_iterator_all_new (void) |
| Create a new channel iterator. | |
| struct ast_channel * | ast_channel_iterator_next (struct ast_channel_iterator *i) |
| Get the next channel for a channel iterator. | |
| struct ast_channel * | ast_channel_get_by_name (const char *name) |
| Find a channel by name. | |
| struct ast_channel * | ast_channel_get_by_name_prefix (const char *name, size_t name_len) |
| Find a channel by a name prefix. | |
| struct ast_channel * | ast_channel_get_by_exten (const char *exten, const char *context) |
| Find a channel by extension and context. | |
Variables | |
| struct ast_channel_tech | ast_kill_tech |
| unsigned long | global_fin |
| unsigned long | global_fout |
General Asterisk PBX channel definitions.
Definition in file channel.h.
| #define AST_AGENT_FD (AST_MAX_FDS-3) |
used by agents for pass through
Definition at line 164 of file channel.h.
Referenced by agent_read().
| #define AST_ALERT_FD (AST_MAX_FDS-1) |
used for alertpipe
Definition at line 162 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 1941 of file channel.h.
Referenced by ast_generic_bridge(), ast_rtp_instance_bridge(), dahdi_bridge(), iax2_bridge(), local_bridge_loop(), misdn_bridge(), remote_bridge_loop(), and set_config_flags().
| #define AST_BRIDGE_DTMF_CHANNEL_1 (1 << 1) |
Report DTMF on channel 1.
Definition at line 1943 of file channel.h.
Referenced by ast_generic_bridge(), ast_rtp_instance_bridge(), dahdi_bridge(), iax2_bridge(), local_bridge_loop(), misdn_bridge(), remote_bridge_loop(), and set_config_flags().
| #define AST_BRIDGE_IGNORE_SIGS (1 << 4) |
Ignore all signal frames except NULL.
Definition at line 1949 of file channel.h.
Referenced by ast_generic_bridge(), iax2_bridge(), local_bridge_loop(), and remote_bridge_loop().
| #define AST_BRIDGE_REC_CHANNEL_0 (1 << 2) |
| #define AST_BRIDGE_REC_CHANNEL_1 (1 << 3) |
| #define AST_CHAN_WRITE_INFO_T_VERSION 1 |
ast_chan_write_info_t version. Must be incremented if structure is changed
Definition at line 530 of file channel.h.
Referenced by func_channel_write(), and local_setoption().
| #define ast_channel_alloc | ( | needqueue, | |
| state, | |||
| cid_num, | |||
| cid_name, | |||
| acctcode, | |||
| exten, | |||
| context, | |||
| linkedid, | |||
| amaflag, | |||
| ... | |||
| ) |
__ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, \ __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
Create a channel structure.
| NULL | failure |
| non-NULL | successfully allocated channel |
| #define ast_channel_lock | ( | chan | ) | ao2_lock(chan) |
Definition at line 2505 of file channel.h.
Referenced by __analog_handle_event(), __ast_answer(), __ast_pbx_run(), __ast_queue_frame(), __ast_read(), __ast_request_and_dial(), __dahdi_exception(), __oh323_destroy(), __sip_destroy(), _macro_exec(), _while_exec(), acf_cc_read(), acf_cc_write(), acf_fetch(), acf_odbc_read(), action_add_agi_cmd(), action_coreshowchannels(), action_dialplan_exec(), action_redirect(), action_status(), action_timeout(), activatesub(), add_features_datastore(), add_to_agi(), agent_indicate(), agent_lock_owner(), analog_exception(), app_exec(), 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_call(), ast_bridge_end_dtmf(), ast_bridge_timelimit(), 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_cel_report_event(), ast_change_name(), 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_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_setoption(), ast_channel_softhangup_withcause_locked(), ast_check_hangup_locked(), ast_complete_channels(), ast_deactivate_generator(), ast_dial_join(), ast_do_masquerade(), ast_do_pickup(), ast_eivr_getvariable(), ast_explicit_goto(), ast_handle_cc_control_frame(), ast_hangup(), ast_ignore_cc(), ast_indicate_data(), ast_odbc_retrieve_transaction_obj(), 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_app(), ast_pbx_outgoing_exten(), 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_bridge(), ast_rtp_instance_early_bridge(), ast_rtp_instance_make_compatible(), 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_transfer(), ast_udptl_bridge(), ast_var_channel_bridge(), ast_var_channels_table(), ast_waitfor_nandfds(), ast_write(), auth_exec(), awesome_locking(), bridge_exec(), bridge_play_sounds(), bridge_write(), builtin_atxfer(), builtin_automixmonitor(), builtin_blindtransfer(), builtin_feature_get_exten(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), call_forward_inherit(), callerid_read(), callerid_write(), cb_events(), cc_build_payload(), cc_interfaces_datastore_init(), cdr_read(), cdr_write(), chan_cleanup(), channel_set_debug(), channel_spy(), check_bridge(), check_goto_on_transfer(), clear_caller(), clear_dialed_interfaces(), common_exec(), conf_run(), conf_start_moh(), connectedline_read(), connectedline_write(), create_dynamic_parkinglot(), create_msg_q_chan(), crement_function_read(), dahdi_handle_dtmf(), dahdi_handle_event(), data_channels_provider_handler(), dial_exec_full(), disable_jack_hook(), do_forward(), do_notify(), dundi_query_read(), dundi_result_read(), 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(), feature_check(), feature_interpret(), feature_request_and_dial(), feature_write(), featuremap_write(), find_by_mark(), find_by_part(), find_channel_by_group(), find_conf_realtime(), find_details(), find_or_create_details(), find_ringing_channel(), find_transaction(), findmeexec(), frame_trace_helper(), func_channel_read(), func_channel_write_real(), func_channels_read(), func_header_read(), func_inheritance_write(), func_mute_write(), function_agent(), function_sipchaninfo_read(), generator_force(), generator_write_format_change(), generic_fax_exec(), get_agi_cmd(), get_cid_name(), get_device_state_causing_channels(), get_parkingtime(), gosub_exec(), gosub_run(), handle_chanlist(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_gosub(), handle_invite_replaces(), handle_request_bye(), handle_request_refer(), handle_showchan(), handle_softhangup(), hangupcause_clear_exec(), hangupcause_keys_read(), hangupcause_read(), import_ch(), import_helper(), init_jack_data(), internal_deactivate_generator(), jack_hook_callback(), jb_helper(), jingle_session_lock_full(), launch_monitor_thread(), leave_voicemail(), listfilter(), local_ast_moh_stop(), local_call(), local_hangup(), local_queryoption(), local_queue_frame(), local_read(), local_setoption(), local_write(), login_exec(), lua_get_state(), manage_parked_call(), manager_mixmonitor(), manager_mutestream(), mark_transaction_active(), meetme_menu_admin_extended(), minivm_delete_exec(), minivm_notify_exec(), misdn_answer(), misdn_update_caller_id(), moh_files_generator(), morsecode_exec(), msg_data_func_read(), msg_data_func_write(), msg_func_read(), msg_func_write(), msg_q_cb(), msg_send_exec(), mute_callback(), my_handle_dtmf(), notify_new_message(), park_call_full(), parkandannounce_exec(), parked_call_exec(), pbx_builtin_background(), pbx_builtin_getvar_helper(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_pushvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setamaflags(), pbx_builtin_setvar_helper(), peek_read(), pickup_by_exten(), pickup_by_name_cb(), pitchshift_helper(), pop_exec(), pri_dchannel(), process_sdp(), queue_exec(), receivefax_exec(), redirecting_read(), redirecting_write(), release_transaction(), remote_bridge_loop(), report_fax_status(), retrydial_exec(), return_exec(), run_agi(), sendfax_exec(), sendtext_exec(), set_ext_pri(), set_format(), set_security_requirements(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_transfer_datastore(), shared_read(), shared_write(), sip_addheader(), sip_dtmfmode(), sip_new(), sip_pvt_lock_full(), sip_read(), sip_removeheader(), sip_set_rtp_peer(), sip_set_udptl_peer(), sipinfo_send(), smdi_msg_read(), smdi_msg_retrieve_read(), softhangup_exec(), speech_background(), speex_read(), speex_write(), srv_datastore_setup(), srv_query_read(), srv_result_read(), ss7_start_call(), stackpeek_read(), start_monitor_action(), start_monitor_exec(), state_notify_build_xml(), stop_mixmonitor_full(), transmit_invite(), try_calling(), update_bridge_vars(), volume_write(), and wait_for_answer().
| #define ast_channel_lock_both | ( | chan1, | |
| chan2 | |||
| ) |
Lock two channels.
Definition at line 2512 of file channel.h.
Referenced by __ast_channel_masquerade(), __ast_request_and_dial(), ast_bridge_call(), ast_call_forward(), ast_channel_bridge(), ast_do_masquerade(), ast_generic_bridge(), ast_rtp_instance_early_bridge_make_compatible(), awesome_locking(), call_forward_inherit(), dahdi_bridge(), dial_exec_full(), dial_transfer(), do_bridge_masquerade(), do_forward(), findmeexec(), misdn_attempt_transfer(), ring_entry(), and wait_for_answer().
| #define AST_CHANNEL_NAME 80 |
Max length of an ast_channel name
Definition at line 137 of file channel.h.
Referenced by __analog_handle_event(), ast_bridge_call(), ast_cc_call_failed(), ast_cc_is_recall(), ast_channel_destructor(), ast_do_masquerade(), ast_parse_device_state(), ast_queue_cc_frame(), ast_setstate(), cc_core_init_instance(), cc_unique_append(), cccancel_exec(), ccreq_exec(), common_exec(), create_jb(), dahdi_cc_callback(), dahdi_new(), dahdi_r2_on_call_disconnect(), dial_exec_full(), fast_originate(), get_device_state_causing_channels(), handle_incoming(), jingle_action_session_terminate(), page_exec(), park_call_full(), pri_queue_pvt_cause_data(), sig_pri_call(), sig_pri_cc_available(), sig_pri_cc_generic_check(), sip_call(), sip_handle_cc(), socket_process_helper(), softhangup_exec(), ss7_queue_pvt_cause_data(), and wait_for_answer().
| #define ast_channel_ref | ( | c | ) | ({ ao2_ref(c, +1); (c); }) |
Increase channel reference count.
| c | the channel |
| c | always |
Definition at line 2530 of file channel.h.
Referenced by agent_hangup(), agent_lock_owner(), ast_autochan_new_channel(), ast_autochan_setup(), ast_bridge_set_single_src_video_mode(), ast_bridge_update_talker_src_video_mode(), ast_cel_report_event(), ast_do_masquerade(), ast_set_hangupsource(), awesome_locking(), bridge_write(), check_bridge(), conf_stop_record(), find_ringing_channel(), get_device_state_causing_channels(), handle_getvariablefull(), handle_invite_replaces(), handle_request_refer(), jingle_session_lock_full(), local_attended_transfer(), local_queryoption(), local_queue_frame(), local_setoption(), record_thread(), set_hangup_source_and_cause(), sip_pickup(), sip_pvt_lock_full(), sip_queue_hangup_cause(), and socket_process_helper().
| #define ast_channel_trylock | ( | chan | ) | ao2_trylock(chan) |
Definition at line 2507 of file channel.h.
Referenced by __ast_channel_masquerade(), __oh323_rtp_create(), agent_logoff(), agent_read(), analog_lock_sub_owner(), ast_rtp_instance_bridge(), ast_rtp_instance_early_bridge(), ast_udptl_bridge(), ast_write(), auto_congest(), check_bridge(), check_rtp_timeout(), cleanup_connection(), dahdi_handle_event(), dahdi_lock_sub_owner(), dahdi_queue_frame(), dahdi_softhangup_all(), find_channel_by_group(), get_sip_pvt_byid_locked(), grab_owner(), handle_request_bye(), hangup_connection(), iax2_destroy(), iax2_lock_owner(), mgcp_queue_frame(), mgcp_queue_hangup(), oh323_rtp_read(), oh323_simulate_dtmf_end(), proc_session_timer(), receive_digit(), release_chan(), release_chan_early(), remote_hold(), retrans_pkt(), setup_rtp_connection(), sig_pri_lock_owner(), sig_ss7_lock_owner(), sip_hangup(), sip_reinvite_retry(), and update_state().
| #define ast_channel_unlock | ( | chan | ) | ao2_unlock(chan) |
Definition at line 2506 of file channel.h.
Referenced by __analog_handle_event(), __ast_answer(), __ast_channel_masquerade(), __ast_pbx_run(), __ast_queue_frame(), __ast_read(), __ast_request_and_dial(), __dahdi_exception(), __oh323_destroy(), __oh323_rtp_create(), __sip_autodestruct(), __sip_destroy(), _macro_exec(), _while_exec(), acf_cc_read(), acf_cc_write(), acf_fetch(), acf_odbc_read(), action_add_agi_cmd(), action_agents(), action_coreshowchannels(), action_dialplan_exec(), action_redirect(), action_status(), action_timeout(), activatesub(), add_features_datastore(), add_to_agi(), agent_indicate(), agent_lock_owner(), agent_logoff(), agent_read(), agents_data_provider_get(), agents_show(), agents_show_online(), alsa_call(), analog_attempt_transfer(), analog_exception(), analog_hangup(), app_exec(), 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_call(), ast_bridge_end_dtmf(), ast_bridge_timelimit(), 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_cel_report_event(), ast_change_name(), ast_channel_bridge(), 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_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_setoption(), ast_channel_softhangup_withcause_locked(), ast_check_hangup_locked(), ast_complete_channels(), ast_deactivate_generator(), ast_dial_join(), ast_do_masquerade(), ast_do_pickup(), ast_eivr_getvariable(), ast_explicit_goto(), ast_generic_bridge(), ast_handle_cc_control_frame(), ast_hangup(), ast_ignore_cc(), ast_indicate_data(), ast_odbc_retrieve_transaction_obj(), 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_app(), 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_rtp_instance_bridge(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_rtp_instance_make_compatible(), 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_transfer(), ast_udptl_bridge(), ast_var_channel_bridge(), ast_var_channels_table(), ast_waitfor_nandfds(), ast_write(), attempt_transfer(), auth_exec(), auto_congest(), awesome_locking(), bridge_exec(), bridge_play_sounds(), bridge_write(), builtin_atxfer(), builtin_automixmonitor(), builtin_blindtransfer(), builtin_feature_get_exten(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), call_forward_inherit(), callerid_read(), callerid_write(), cb_events(), cc_build_payload(), cc_interfaces_datastore_init(), cdr_read(), cdr_write(), chan_cleanup(), channel_set_debug(), channel_spy(), check_bridge(), check_goto_on_transfer(), check_rtp_timeout(), cleanup_connection(), clear_caller(), clear_dialed_interfaces(), common_exec(), conf_run(), conf_start_moh(), connectedline_read(), connectedline_write(), console_answer(), console_hangup(), console_sendtext(), create_dynamic_parkinglot(), create_msg_q_chan(), crement_function_read(), dahdi_bridge(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_queue_frame(), dahdi_softhangup_all(), data_channels_provider_handler(), dial_exec_full(), dial_transfer(), dialog_unlink_all(), disable_jack_hook(), do_bridge_masquerade(), do_forward(), do_notify(), dundi_query_read(), dundi_result_read(), 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(), feature_check(), feature_interpret(), feature_request_and_dial(), feature_write(), featuremap_write(), find_by_mark(), find_by_part(), find_channel_by_group(), find_conf_realtime(), find_details(), find_or_create_details(), find_ringing_channel(), find_transaction(), findmeexec(), frame_trace_helper(), func_channel_read(), func_channel_write_real(), func_channels_read(), func_header_read(), func_inheritance_write(), func_mute_write(), func_pri_dchannel_chanpos_callid(), func_ss7_linkset_callid(), function_agent(), function_sipchaninfo_read(), generator_force(), generator_write_format_change(), generic_fax_exec(), get_agi_cmd(), get_cid_name(), get_device_state_causing_channels(), get_parkingtime(), gosub_exec(), gosub_run(), handle_chanlist(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_gosub(), handle_invite_replaces(), handle_request_bye(), handle_request_do(), handle_request_invite(), handle_request_refer(), handle_showchan(), handle_softhangup(), hangup_connection(), hangupcause_clear_exec(), hangupcause_keys_read(), hangupcause_read(), iax2_destroy(), iax2_queue_control_data(), iax2_queue_frame(), iax2_queue_hangup(), import_ch(), import_helper(), init_jack_data(), internal_deactivate_generator(), jack_hook_callback(), jb_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(), launch_monitor_thread(), leave_voicemail(), listfilter(), local_ast_moh_stop(), local_attended_transfer(), local_bridge_loop(), local_call(), local_hangup(), local_queryoption(), local_queue_frame(), local_read(), local_setoption(), local_write(), login_exec(), lua_get_state(), manage_parked_call(), manager_mixmonitor(), manager_mutestream(), mark_transaction_active(), meetme_menu_admin_extended(), mgcp_pktcgate_remove(), mgcp_queue_frame(), mgcp_queue_hangup(), minivm_delete_exec(), minivm_notify_exec(), misdn_answer(), misdn_attempt_transfer(), misdn_update_caller_id(), moh_files_generator(), morsecode_exec(), msg_data_func_read(), msg_data_func_write(), msg_func_read(), msg_func_write(), msg_q_cb(), msg_send_exec(), mute_callback(), my_handle_dtmf(), notify_new_message(), oh323_rtp_read(), oh323_simulate_dtmf_end(), park_call_full(), parkandannounce_exec(), parked_call_exec(), pbx_builtin_background(), pbx_builtin_getvar_helper(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_pushvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setamaflags(), pbx_builtin_setvar_helper(), peek_read(), pickup_by_channel(), pickup_by_exten(), pickup_by_group(), pickup_by_mark(), pickup_by_name_cb(), pickup_by_part(), pitchshift_helper(), pop_exec(), pri_dchannel(), pri_fixup_principle(), pri_queue_frame(), pri_queue_pvt_cause_data(), proc_session_timer(), process_sdp(), queue_exec(), receive_digit(), receivefax_exec(), redirecting_read(), redirecting_write(), reinvite_timeout(), release_chan(), release_chan_early(), release_transaction(), remote_bridge_loop(), remote_hold(), report_fax_status(), retrans_pkt(), retrydial_exec(), return_exec(), ring_entry(), run_agi(), schedule_delivery(), send_provisional_keepalive_full(), sendfax_exec(), sendtext_exec(), set_ext_pri(), set_format(), set_hangup_source_and_cause(), set_security_requirements(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_rtp_connection(), setup_transfer_datastore(), shared_read(), shared_write(), sig_pri_attempt_transfer(), sig_pri_cc_generic_check(), sig_pri_cli_show_channels(), sig_pri_handle_hold(), sig_pri_handle_retrieve(), sig_pri_handle_subcmds(), sig_pri_send_aoce_termination_request(), sig_ss7_cli_show_channels(), sig_ss7_queue_frame(), 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(), sip_set_rtp_peer(), sip_set_udptl_peer(), sipinfo_send(), smdi_msg_read(), smdi_msg_retrieve_read(), socket_process_helper(), softhangup_exec(), spandsp_fax_gateway_start(), speech_background(), speex_read(), speex_write(), srv_datastore_setup(), srv_query_read(), srv_result_read(), ss7_hangup_cics(), ss7_linkset(), ss7_start_call(), stackpeek_read(), start_monitor_action(), start_monitor_exec(), state_notify_build_xml(), stop_mixmonitor_full(), transmit_invite(), try_calling(), update_bridge_vars(), update_state(), volume_write(), wait_for_answer(), and wakeup_sub().
| #define ast_channel_unref | ( | c | ) | ({ ao2_ref(c, -1); (struct ast_channel *) (NULL); }) |
Decrease channel reference count.
| c | the channel |
| NULL | always |
Definition at line 2541 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_bridge(), action_coreshowchannels(), action_getvar(), action_hangup(), action_redirect(), action_sendtext(), action_setvar(), action_status(), action_timeout(), agent_hangup(), agent_lock_owner(), agent_logoff(), agent_read(), agents_data_provider_get(), agents_show(), agents_show_online(), ast_add_extension2_lockopt(), ast_async_goto_by_name(), ast_autochan_destroy(), ast_autochan_new_channel(), ast_bridge_call(), ast_bridge_remove_video_src(), ast_bridge_update_talker_src_video_mode(), ast_cel_fabricate_channel_from_event(), ast_cel_report_event(), ast_channel_release(), ast_complete_channels(), ast_do_masquerade(), ast_hangup(), ast_parse_device_state(), ast_pbx_outgoing_cdr_failed(), ast_pickup_call(), ast_pickup_find_by_group(), ast_set_hangupsource(), ast_str_substitute_variables_full(), ast_var_channel_bridge(), ast_var_channel_types_table(), ast_var_channels_table(), asyncgoto_exec(), awesome_locking(), bridge_exec(), bridge_write(), change_monitor_action(), check_bridge(), cleanup_video_mode(), cli_odbc_read(), cli_odbc_write(), common_exec(), conf_stop_record(), conf_stop_record_thread(), custom_log(), data_channels_provider_handler(), dialog_unlink_all(), do_pause_or_unpause(), func_channels_read(), func_mchan_read(), func_mchan_write(), get_device_state_causing_channels(), handle_chanlist(), handle_channelstatus(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_core_set_debug_channel(), handle_getvariablefull(), handle_hangup(), handle_invite_replaces(), handle_redirect(), handle_request_do(), handle_request_refer(), handle_set_chanvar(), handle_show_chanvar(), handle_show_hangup_all(), handle_show_hangup_channel(), handle_showchan(), handle_softhangup(), 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_attended_transfer(), local_call(), local_hangup(), local_queryoption(), local_queue_frame(), local_setoption(), make_email_file(), manager_log(), manager_mixmonitor(), manager_mute_mixmonitor(), manager_mutestream(), manager_optimize_away(), manager_park(), manager_play_dtmf(), manager_stop_mixmonitor(), next_channel(), park_call_full(), pbx_builtin_importvar(), pbx_substitute_variables_helper_full(), pickup_by_channel(), pickup_by_exten(), pickup_by_group(), pickup_by_mark(), pickup_by_part(), reinvite_timeout(), rotate_file(), send_provisional_keepalive_full(), senddtmf_exec(), sendmail(), sendpage(), set_hangup_source_and_cause(), shared_read(), shared_write(), sip_pickup(), sip_pickup_thread(), sip_pvt_lock_full(), sip_queue_hangup_cause(), socket_process_helper(), softhangup_exec(), start_monitor_action(), state_notify_build_xml(), stop_monitor_action(), syslog_log(), and write_cdr().
| #define AST_GENERATOR_FD (AST_MAX_FDS-4) |
used by generator
Definition at line 165 of file channel.h.
Referenced by __ast_read(), ast_deactivate_generator(), ast_do_masquerade(), and internal_deactivate_generator().
| #define AST_JITTERBUFFER_FD (AST_MAX_FDS-5) |
used by generator
Definition at line 166 of file channel.h.
Referenced by __ast_read(), hook_event_cb(), and jb_helper().
| #define AST_MAX_CONTEXT 80 |
Max length of a context
Definition at line 136 of file channel.h.
Referenced by _macro_exec(), aji_publish_mwi(), ast_bridge_call(), cleanup_stale_contexts(), common_exec(), conf_run(), config_parse_variables(), dial_transfer(), do_magic_pickup(), handle_presencechange(), handle_request_invite(), handle_statechange(), park_call_full(), parkinglot_activate(), reload_config(), try_calling(), and xmpp_pubsub_publish_mwi().
| #define AST_MAX_EXTENSION 80 |
Max length of an extension
Definition at line 135 of file channel.h.
Referenced by __analog_ss_thread(), __ast_context_destroy(), add_extensions(), advanced_options(), aji_publish_mwi(), analog_ss_thread(), ast_bridge_call(), ast_device_state_changed(), ast_devstate_changed(), ast_ivr_menu_run_internal(), ast_presence_state_changed(), begin_dial_channel(), build_device(), cc_extension_monitor_init(), conf_run(), destroy_space(), dial_exec_full(), dial_transfer(), disa_exec(), do_magic_pickup(), dundi_lookup_local(), feature_attended_transfer(), feature_blind_transfer(), find_conf_realtime(), forward_message(), function_enum(), get_destination(), handle_presencechange(), handle_request_invite(), handle_statechange(), load_module(), log_exec(), manage_parked_call(), manager_show_dialplan_helper(), mgcp_ss(), park_add_hints(), park_call_exec(), park_call_full(), phone_check_exception(), pri_dchannel(), pri_ss_thread(), process_dahdi(), realtime_common(), realtime_switch_common(), search_directory_sub(), show_dialplan_helper(), sig_pri_party_number_convert(), skinny_extensionstate_cb(), sla_build_station(), sla_station_destructor(), speech_background(), state_notify_build_xml(), try_calling(), vm_authenticate(), vmauthenticate(), and xmpp_pubsub_publish_mwi().
| #define AST_MAX_FDS 11 |
Definition at line 157 of file channel.h.
Referenced by ast_channel_destructor(), ast_channel_internal_fd_clear_all(), ast_do_masquerade(), ast_poll_channel_add(), ast_poll_channel_del(), ast_waitfor_nandfds(), and manage_parked_call().
| #define AST_TIMING_FD (AST_MAX_FDS-2) |
used for timingfd
Definition at line 163 of file channel.h.
Referenced by __ast_channel_alloc_ap(), __ast_read(), agent_read(), ast_do_masquerade(), and ast_settimeout_full().
| #define CHECK_BLOCKING | ( | c | ) |
Definition at line 2453 of file channel.h.
Referenced by ast_sendtext(), ast_waitfor_nandfds(), ast_write(), dahdi_read(), and phone_read().
| #define DATASTORE_INHERIT_FOREVER INT_MAX |
Definition at line 155 of file channel.h.
Referenced by _macro_exec(), acf_iaxvar_write(), add_features_datastore(), ast_channel_datastore_inherit(), ast_iax2_new(), ast_setup_cc_recall_datastore(), authenticate_reply(), calendar_query_exec(), cc_interfaces_datastore_init(), dial_exec_full(), do_notify(), socket_process_helper(), and try_calling().
| #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 730 of file channel.h.
Referenced by __ast_read(), ast_write(), channel_set_debug(), handle_core_set_debug_channel(), handle_showchan(), and serialize_showchan().
| #define DECLARE_STRINGFIELD_SETTERS_FOR | ( | field | ) |
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)))
| #define FRAMECOUNT_INC | ( | x | ) | ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) ) |
Definition at line 733 of file channel.h.
Referenced by __ast_read(), and ast_write().
| #define MAX_LANGUAGE 40 |
Max length of the language setting
Definition at line 138 of file channel.h.
Referenced by ast_readconfig().
| #define MAX_MUSICCLASS 80 |
| typedef int(* ast_acf_read2_fn_t)(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len) |
| typedef int(* ast_acf_read_fn_t)(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len) |
| typedef int(* ast_acf_write_fn_t)(struct ast_channel *chan, const char *function, char *data, const char *value) |
| typedef unsigned long long ast_group_t |
| typedef int(* ast_timing_func_t)(const void *data) |
| anonymous enum |
ast_channel_tech Properties
Definition at line 827 of file channel.h.
{
/*!
* \brief Channels have this property if they can accept input with jitter;
* i.e. most VoIP channels
*/
AST_CHAN_TP_WANTSJITTER = (1 << 0),
/*!
* \brief Channels have this property if they can create jitter;
* i.e. most VoIP channels
*/
AST_CHAN_TP_CREATESJITTER = (1 << 1),
};
| anonymous enum |
ast_channel flags
| 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_NBRIDGE |
This channel is in a native bridge |
| 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_BRIDGE_HANGUP_DONT |
This flag indicates that the hangup exten should NOT be run when the bridge terminates, this will allow the hangup in the pbx loop to be run instead. |
| 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_TIMINGDATA_IS_AO2_OBJ |
The data on chan->timingdata is an astobj2 object. |
Definition at line 841 of file channel.h.
{
/*! Queue incoming DTMF, to be released when this flag is turned off */
AST_FLAG_DEFER_DTMF = (1 << 1),
/*! write should be interrupt generator */
AST_FLAG_WRITE_INT = (1 << 2),
/*! a thread is blocking on this channel */
AST_FLAG_BLOCKING = (1 << 3),
/*! This is a zombie channel */
AST_FLAG_ZOMBIE = (1 << 4),
/*! There is an exception pending */
AST_FLAG_EXCEPTION = (1 << 5),
/*! Listening to moh XXX anthm promises me this will disappear XXX */
AST_FLAG_MOH = (1 << 6),
/*! This channel is spying on another channel */
AST_FLAG_SPYING = (1 << 7),
/*! This channel is in a native bridge */
AST_FLAG_NBRIDGE = (1 << 8),
/*! 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_IN_AUTOLOOP = (1 << 9),
/*! This is an outgoing call */
AST_FLAG_OUTGOING = (1 << 10),
/*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */
AST_FLAG_IN_DTMF = (1 << 12),
/*! A DTMF_END was received when not IN_DTMF, so the length of the digit is
* currently being emulated */
AST_FLAG_EMULATE_DTMF = (1 << 13),
/*! This is set to tell the channel not to generate DTMF begin frames, and
* to instead only generate END frames. */
AST_FLAG_END_DTMF_ONLY = (1 << 14),
/* OBSOLETED in favor of AST_CAUSE_ANSWERED_ELSEWHERE
Flag to show channels that this call is hangup due to the fact that the call
was indeed answered, but in another channel */
/* AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), */
/*! This flag indicates that on a masquerade, an active stream should not
* be carried over */
AST_FLAG_MASQ_NOSTREAM = (1 << 16),
/*! 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_BRIDGE_HANGUP_RUN = (1 << 17),
/*! This flag indicates that the hangup exten should NOT be run when the
* bridge terminates, this will allow the hangup in the pbx loop to be run instead.
* */
AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18),
/*! Disable certain workarounds. This reintroduces certain bugs, but allows
* some non-traditional dialplans (like AGI) to continue to function.
*/
AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20),
/*!
* 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_DISABLE_DEVSTATE_CACHE = (1 << 21),
/*!
* 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_BRIDGE_DUAL_REDIRECT_WAIT = (1 << 22),
/*!
* The data on chan->timingdata is an astobj2 object.
*/
AST_FLAG_TIMINGDATA_IS_AO2_OBJ = (1 << 23),
};
| anonymous enum |
ast_bridge_config flags
Definition at line 911 of file channel.h.
{
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_FEATURE_NO_H_EXTEN = (1 << 7),
AST_FEATURE_WARNING_ACTIVE = (1 << 8),
};
| anonymous enum |
| 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_UNBRIDGE |
Used to break a bridge so the channel can be spied upon instead of actually hanging up. |
| 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 960 of file channel.h.
{
/*!
* Soft hangup requested by device or other internal reason.
* Actual hangup needed.
*/
AST_SOFTHANGUP_DEV = (1 << 0),
/*!
* Used to break the normal frame flow so an async goto can be
* done instead of actually hanging up.
*/
AST_SOFTHANGUP_ASYNCGOTO = (1 << 1),
/*!
* Soft hangup requested by system shutdown. Actual hangup
* needed.
*/
AST_SOFTHANGUP_SHUTDOWN = (1 << 2),
/*!
* 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_TIMEOUT = (1 << 3),
/*!
* Soft hangup requested by application/channel-driver being
* unloaded. Actual hangup needed.
*/
AST_SOFTHANGUP_APPUNLOAD = (1 << 4),
/*!
* Soft hangup requested by non-associated party. Actual hangup
* needed.
*/
AST_SOFTHANGUP_EXPLICIT = (1 << 5),
/*!
* Used to break a bridge so the channel can be spied upon
* instead of actually hanging up.
*/
AST_SOFTHANGUP_UNBRIDGE = (1 << 6),
/*!
* \brief All softhangup flags.
*
* This can be used as an argument to ast_channel_clear_softhangup()
* to clear all softhangup flags from a channel.
*/
AST_SOFTHANGUP_ALL = (0xFFFFFFFF)
};
| enum ast_alert_status_t |
| enum ast_bridge_result |
Definition at line 168 of file channel.h.
{
AST_BRIDGE_COMPLETE = 0,
AST_BRIDGE_FAILED = -1,
AST_BRIDGE_FAILED_NOWARN = -2,
AST_BRIDGE_RETRY = -3,
};
| enum ast_channel_adsicpe |
| enum AST_PARTY_CHAR_SET |
Party name character set enumeration values (values from Q.SIG)
Definition at line 196 of file channel.h.
{
AST_PARTY_CHAR_SET_UNKNOWN = 0,
AST_PARTY_CHAR_SET_ISO8859_1 = 1,
AST_PARTY_CHAR_SET_WITHDRAWN = 2,/* ITU withdrew this enum value. */
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 |
Possible T38 states on channels.
Definition at line 751 of file channel.h.
{
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 */
};
| enum channelreloadreason |
| int __ast_answer | ( | struct ast_channel * | chan, |
| unsigned int | delay, | ||
| int | cdr_answer | ||
| ) |
Answer a channel, with a selectable delay before returning.
| chan | channel to answer |
| delay | maximum amount of time to wait for incoming media |
| cdr_answer | flag to control whether any associated CDR should be marked as 'answered' |
This function answers a channel and handles all necessary call setup functions.
| 0 | on success |
| non-zero | on failure |
Definition at line 2949 of file channel.c.
References ast_channel_lock, ast_channel_name(), ast_channel_unlock, AST_CONTROL_HANGUP, ast_debug, 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().
{
int res = 0;
enum ast_channel_state old_state;
old_state = ast_channel_state(chan);
if ((res = ast_raw_answer(chan, cdr_answer))) {
return res;
}
switch (old_state) {
case AST_STATE_RINGING:
case AST_STATE_RING:
/* wait for media to start flowing, but don't wait any longer
* than 'delay' or 500 milliseconds, whichever is longer
*/
do {
AST_LIST_HEAD_NOLOCK(, ast_frame) frames;
struct ast_frame *cur, *new;
int timeout_ms = MAX(delay, 500);
unsigned int done = 0;
struct timeval start;
AST_LIST_HEAD_INIT_NOLOCK(&frames);
start = ast_tvnow();
for (;;) {
int ms = ast_remaining_ms(start, timeout_ms);
ms = ast_waitfor(chan, ms);
if (ms < 0) {
ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", ast_channel_name(chan), strerror(errno));
res = -1;
break;
}
if (ms == 0) {
ast_debug(2, "Didn't receive a media frame from %s within %d ms of answering. Continuing anyway\n", ast_channel_name(chan), MAX(delay, 500));
break;
}
cur = ast_read(chan);
if (!cur || ((cur->frametype == AST_FRAME_CONTROL) &&
(cur->subclass.integer == AST_CONTROL_HANGUP))) {
if (cur) {
ast_frfree(cur);
}
res = -1;
ast_debug(2, "Hangup of channel %s detected in answer routine\n", ast_channel_name(chan));
break;
}
if ((new = ast_frisolate(cur)) != cur) {
ast_frfree(cur);
}
AST_LIST_INSERT_HEAD(&frames, new, frame_list);
/* if a specific delay period was requested, continue
* until that delay has passed. don't stop just because
* incoming media has arrived.
*/
if (delay) {
continue;
}
switch (new->frametype) {
/* all of these frametypes qualify as 'media' */
case AST_FRAME_VOICE:
case AST_FRAME_VIDEO:
case AST_FRAME_TEXT:
case AST_FRAME_DTMF_BEGIN:
case AST_FRAME_DTMF_END:
case AST_FRAME_IMAGE:
case AST_FRAME_HTML:
case AST_FRAME_MODEM:
done = 1;
break;
case AST_FRAME_CONTROL:
case AST_FRAME_IAX:
case AST_FRAME_NULL:
case AST_FRAME_CNG:
break;
}
if (done) {
break;
}
}
if (res == 0) {
ast_channel_lock(chan);
while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) {
ast_queue_frame_head(chan, cur);
ast_frfree(cur);
}
ast_channel_unlock(chan);
}
} while (0);
break;
default:
break;
}
return res;
}
| 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 char * | linkedid, | ||
| const int | amaflag, | ||
| const char * | file, | ||
| int | line, | ||
| const char * | function, | ||
| const char * | name_fmt, | ||
| ... | |||
| ) | [read] |
Create a channel structure.
| NULL | failure |
| non-NULL | successfully allocated channel |
Definition at line 1179 of file channel.c.
References __ast_channel_alloc_ap().
{
va_list ap;
struct ast_channel *result;
va_start(ap, name_fmt);
result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context,
linkedid, amaflag, file, line, function, name_fmt, ap);
va_end(ap);
return result;
}
| struct ast_channel* __ast_request_and_dial | ( | const char * | type, |
| struct ast_format_cap * | cap, | ||
| 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.
| type | type of channel to request |
| format | capabilities for requested 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 |
Definition at line 5645 of file channel.c.
References outgoing_helper::account, ast_call(), ast_call_forward(), AST_CAUSE_NO_ANSWER, ast_cdr_alloc(), ast_cdr_answer(), ast_cdr_busy(), ast_cdr_disposition(), ast_cdr_end(), ast_cdr_failed(), AST_CDR_FLAG_ORIGINATED, ast_cdr_init(), ast_cdr_setaccount(), ast_cdr_setapp(), ast_cdr_start(), ast_cdr_update(), ast_channel_call_forward(), ast_channel_cdr(), ast_channel_cdr_set(), ast_channel_connected(), ast_channel_context_set(), ast_channel_datastore_inherit(), ast_channel_exten_set(), ast_channel_hangupcause(), 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_set_connected_line(), 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_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(), chanlist::chan, 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, f, ast_frame::frametype, handle_cause(), ast_party_connected_line::id, ast_frame_subclass::integer, LOG_NOTICE, ast_party_id::name, 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 ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_request_and_dial(), and parkandannounce_exec().
{
int dummy_outstate;
int cause = 0;
struct ast_channel *chan;
int res = 0;
int last_subclass = 0;
struct ast_party_connected_line connected;
if (outstate)
*outstate = 0;
else
outstate = &dummy_outstate; /* make outstate always a valid pointer */
chan = ast_request(type, cap, requestor, addr, &cause);
if (!chan) {
ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, addr);
handle_cause(cause, outstate);
return NULL;
}
if (oh) {
if (oh->vars) {
ast_set_variables(chan, oh->vars);
}
if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name)) {
/*
* Use the oh values instead of the function parameters for the
* outgoing CallerID.
*/
cid_num = oh->cid_num;
cid_name = oh->cid_name;
}
if (oh->parent_channel) {
/* Safely inherit variables and datastores from the parent channel. */
ast_channel_lock_both(oh->parent_channel, chan);
ast_channel_inherit_variables(oh->parent_channel, chan);
ast_channel_datastore_inherit(oh->parent_channel, chan);
ast_channel_unlock(oh->parent_channel);
ast_channel_unlock(chan);
}
if (oh->account) {
ast_channel_lock(chan);
ast_cdr_setaccount(chan, oh->account);
ast_channel_unlock(chan);
}
}
/*
* I seems strange to set the CallerID on an outgoing call leg
* to whom we are calling, but this function's callers are doing
* various Originate methods. This call leg goes to the local
* user. Once the local user answers, the dialplan needs to be
* able to access the CallerID from the CALLERID function as if
* the local user had placed this call.
*/
ast_set_callerid(chan, cid_num, cid_name, cid_num);
ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_ORIGINATED);
ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
if (cid_num) {
connected.id.number.valid = 1;
connected.id.number.str = (char *) cid_num;
connected.id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
}
if (cid_name) {
connected.id.name.valid = 1;
connected.id.name.str = (char *) cid_name;
connected.id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
}
ast_channel_set_connected_line(chan, &connected, NULL);
if (ast_call(chan, addr, 0)) { /* ast_call failed... */
ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, addr);
} else {
struct timeval start = ast_tvnow();
res = 1; /* mark success in case chan->_state is already AST_STATE_UP */
while (timeout && ast_channel_state(chan) != AST_STATE_UP) {
struct ast_frame *f;
int ms = ast_remaining_ms(start, timeout);
res = ast_waitfor(chan, ms);
if (res == 0) { /* timeout, treat it like ringing */
*outstate = AST_CONTROL_RINGING;
break;
}
if (res < 0) /* error or done */
break;
if (!ast_strlen_zero(ast_channel_call_forward(chan))) {
if (!(chan = ast_call_forward(NULL, chan, NULL, cap, oh, outstate))) {
return NULL;
}
continue;
}
f = ast_read(chan);
if (!f) {
*outstate = AST_CONTROL_HANGUP;
res = 0;
break;
}
if (f->frametype == AST_FRAME_CONTROL) {
switch (f->subclass.integer) {
case AST_CONTROL_RINGING: /* record but keep going */
*outstate = f->subclass.integer;
break;
case AST_CONTROL_BUSY:
ast_cdr_busy(ast_channel_cdr(chan));
*outstate = f->subclass.integer;
timeout = 0;
break;
case AST_CONTROL_INCOMPLETE:
ast_cdr_failed(ast_channel_cdr(chan));
*outstate = AST_CONTROL_CONGESTION;
timeout = 0;
break;
case AST_CONTROL_CONGESTION:
ast_cdr_failed(ast_channel_cdr(chan));
*outstate = f->subclass.integer;
timeout = 0;
break;
case AST_CONTROL_ANSWER:
ast_cdr_answer(ast_channel_cdr(chan));
*outstate = f->subclass.integer;
timeout = 0; /* trick to force exit from the while() */
break;
case AST_CONTROL_PVT_CAUSE_CODE:
ast_channel_hangupcause_hash_set(chan, f->data.ptr, f->datalen);
break;
case AST_CONTROL_PROGRESS:
if (oh && oh->connect_on_early_media) {
*outstate = f->subclass.integer;
timeout = 0; /* trick to force exit from the while() */
break;
}
/* Fallthrough */
/* Ignore these */
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
case AST_CONTROL_SRCCHANGE:
case AST_CONTROL_CONNECTED_LINE:
case AST_CONTROL_REDIRECTING:
case AST_CONTROL_CC:
case -1: /* Ignore -- just stopping indications */
break;
default:
ast_log(LOG_NOTICE, "Don't know what to do with control frame %d\n", f->subclass.integer);
}
last_subclass = f->subclass.integer;
}
ast_frfree(f);
}
}
/* Final fixups */
if (oh) {
if (!ast_strlen_zero(oh->context))
ast_channel_context_set(chan, oh->context);
if (!ast_strlen_zero(oh->exten))
ast_channel_exten_set(chan, oh->exten);
if (oh->priority)
ast_channel_priority_set(chan, oh->priority);
}
if (ast_channel_state(chan) == AST_STATE_UP)
*outstate = AST_CONTROL_ANSWER;
if (res <= 0) {
struct ast_cdr *chancdr;
ast_channel_lock(chan);
if (AST_CONTROL_RINGING == last_subclass) {
ast_channel_hangupcause_set(chan, AST_CAUSE_NO_ANSWER);
}
if (!ast_channel_cdr(chan) && (chancdr = ast_cdr_alloc())) {
ast_channel_cdr_set(chan, chancdr);
ast_cdr_init(ast_channel_cdr(chan), chan);
}
if (ast_channel_cdr(chan)) {
char tmp[256];
snprintf(tmp, sizeof(tmp), "%s/%s", type, addr);
ast_cdr_setapp(ast_channel_cdr(chan), "Dial", tmp);
ast_cdr_update(chan);
ast_cdr_start(ast_channel_cdr(chan));
ast_cdr_end(ast_channel_cdr(chan));
/* If the cause wasn't handled properly */
if (ast_cdr_disposition(ast_channel_cdr(chan), ast_channel_hangupcause(chan))) {
ast_cdr_failed(ast_channel_cdr(chan));
}
}
ast_channel_unlock(chan);
ast_hangup(chan);
chan = NULL;
}
return chan;
}
| int ast_activate_generator | ( | struct ast_channel * | chan, |
| struct ast_generator * | gen, | ||
| void * | params | ||
| ) |
Activate a given generator
Definition at line 3117 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, 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().
{
int res = 0;
void *generatordata = NULL;
ast_channel_lock(chan);
if (ast_channel_generatordata(chan)) {
if (ast_channel_generator(chan) && ast_channel_generator(chan)->release) {
ast_channel_generator(chan)->release(chan, ast_channel_generatordata(chan));
}
}
if (gen->alloc && !(generatordata = gen->alloc(chan, params))) {
res = -1;
}
ast_channel_generatordata_set(chan, generatordata);
if (!res) {
ast_settimeout(chan, 50, generator_force, chan);
ast_channel_generator_set(chan, gen);
}
ast_channel_unlock(chan);
ast_prod(chan);
return res;
}
| int ast_active_channels | ( | void | ) |
returns number of active/allocated channels
Definition at line 657 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().
{
return channels ? ao2_container_count(channels) : 0;
}
| static int ast_add_fd | ( | struct pollfd * | pfd, |
| int | fd | ||
| ) | [inline, static] |
if fd is a valid descriptor, set *pfd with the descriptor
Definition at line 2416 of file channel.h.
Referenced by ast_waitfor_nandfds().
{
pfd->fd = fd;
pfd->events = POLLIN | POLLPRI;
return fd >= 0;
}
| int ast_answer | ( | struct ast_channel * | chan | ) |
Answer a channel.
| chan | channel to answer |
This function answers a channel and handles all necessary call setup functions.
| 0 | on success |
| non-zero | on failure |
Definition at line 3053 of file channel.c.
References __ast_answer().
Referenced by action_bridge(), agi_exec_full(), alarmreceiver_exec(), answer_trunk_chan(), app_exec(), ast_do_pickup(), ast_pickup_call(), auth_exec(), background_detect_exec(), bridge_exec(), bridge_request(), builtin_parkcall(), common_exec(), conf_exec(), confbridge_exec(), control_streamfile(), count_exec(), dahdiras_exec(), dial_exec_full(), dictate_exec(), directory_exec(), disa_exec(), eivr_comm(), handle_answer(), ices_exec(), login_exec(), minivm_accmess_exec(), minivm_greet_exec(), minivm_record_exec(), old_milliwatt_exec(), park_call_exec(), parked_call_exec(), pbx_builtin_background(), playback_exec(), privacy_exec(), read_exec(), readexten_exec(), receivefax_exec(), record_exec(), record_thread(), 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().
{
return __ast_answer(chan, 0, 1);
}
| void ast_autoservice_chan_hangup_peer | ( | struct ast_channel * | chan, |
| struct ast_channel * | peer | ||
| ) |
Put chan into autoservice while hanging up peer.
| chan | Chan to put into autoservice. |
| peer | Chan to run hangup handlers and hangup. |
Definition at line 313 of file autoservice.c.
References ast_autoservice_start(), ast_autoservice_stop(), and ast_hangup().
Referenced by app_exec(), bridge_call_thread(), bridge_exec(), builtin_atxfer(), check_compat(), dial_exec_full(), parked_call_exec(), and try_calling().
{
if (chan && !ast_autoservice_start(chan)) {
ast_hangup(peer);
ast_autoservice_stop(chan);
} else {
ast_hangup(peer);
}
}
| int ast_autoservice_ignore | ( | struct ast_channel * | chan, |
| enum ast_frame_type | ftype | ||
| ) |
Ignore certain frame types.
| 0 | success |
| -1 | channel is not in autoservice |
Definition at line 323 of file autoservice.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, asent::chan, asent::ignore_frame_types, and asent::list.
Referenced by builtin_automixmonitor(), feature_exec_app(), and play_message_on_chan().
{
struct asent *as;
int res = -1;
AST_LIST_LOCK(&aslist);
AST_LIST_TRAVERSE(&aslist, as, list) {
if (as->chan == chan) {
res = 0;
as->ignore_frame_types |= (1 << ftype);
break;
}
}
AST_LIST_UNLOCK(&aslist);
return res;
}
| int ast_autoservice_start | ( | struct ast_channel * | chan | ) |
Automatically service a channel for us...
| 0 | success |
| -1 | failure, or the channel is already being autoserviced |
Definition at line 185 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_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, free, asent::list, LOG_WARNING, 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_bridge_call(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), ast_masq_park_call_exten(), ast_park_call_exten(), bridge_playfile(), builtin_atxfer(), builtin_automixmonitor(), builtin_blindtransfer(), conf_play(), confbridge_exec(), dial_exec_full(), exec(), feature_exec_app(), feature_request_and_dial(), findmeexec(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), join_conference_bridge(), lock_read(), lua_autoservice_start(), lua_get_variable_value(), lua_pbx_exec(), lua_set_variable(), lua_set_variable_value(), originate_exec(), osplookup_exec(), pbx_find_extension(), play_message_on_chan(), realtimefield_read(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().
{
int res = 0;
struct asent *as;
AST_LIST_LOCK(&aslist);
AST_LIST_TRAVERSE(&aslist, as, list) {
if (as->chan == chan) {
as->use_count++;
break;
}
}
AST_LIST_UNLOCK(&aslist);
if (as) {
/* Entry exists, autoservice is already handling this channel */
return 0;
}
if (!(as = ast_calloc(1, sizeof(*as))))
return -1;
/* New entry created */
as->chan = chan;
as->use_count = 1;
ast_channel_lock(chan);
as->orig_end_dtmf_flag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY) ? 1 : 0;
if (!as->orig_end_dtmf_flag)
ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
ast_channel_unlock(chan);
AST_LIST_LOCK(&aslist);
if (AST_LIST_EMPTY(&aslist) && asthread != AST_PTHREADT_NULL) {
ast_cond_signal(&as_cond);
}
AST_LIST_INSERT_HEAD(&aslist, as, list);
if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) {
ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
/* There will only be a single member in the list at this point,
the one we just added. */
AST_LIST_REMOVE(&aslist, as, list);
free(as);
asthread = AST_PTHREADT_NULL;
res = -1;
} else {
pthread_kill(asthread, SIGURG);
}
}
AST_LIST_UNLOCK(&aslist);
return res;
}
| int ast_autoservice_stop | ( | struct ast_channel * | chan | ) |
Stop servicing a channel for us...
| chan |
| 0 | success |
| -1 | error, or the channel has been hungup |
Definition at line 244 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_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, free, asent::ignore_frame_types, asent::list, 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_bridge_call(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), ast_hangup(), ast_masq_park_call_exten(), ast_park_call_exten(), bridge_playfile(), builtin_atxfer(), builtin_automixmonitor(), conf_play(), confbridge_exec(), dial_exec_full(), exec(), feature_exec_app(), feature_request_and_dial(), findmeexec(), finishup(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), join_conference_bridge(), 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(), play_message_on_chan(), realtimefield_read(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().
{
int res = -1;
struct asent *as, *removed = NULL;
struct ast_frame *f;
int chan_list_state;
AST_LIST_LOCK(&aslist);
/* Save the autoservice channel list state. We _must_ verify that the channel
* list has been rebuilt before we return. Because, after we return, the channel
* could get destroyed and we don't want our poor autoservice thread to step on
* it after its gone! */
chan_list_state = as_chan_list_state;
/* Find the entry, but do not free it because it still can be in the
autoservice thread array */
AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) {
if (as->chan == chan) {
as->use_count--;
if (as->use_count < 1) {
AST_LIST_REMOVE_CURRENT(list);
removed = as;
}
break;
}
}
AST_LIST_TRAVERSE_SAFE_END;
if (removed && asthread != AST_PTHREADT_NULL) {
pthread_kill(asthread, SIGURG);
}
AST_LIST_UNLOCK(&aslist);
if (!removed) {
return 0;
}
/* Wait while autoservice thread rebuilds its list. */
while (chan_list_state == as_chan_list_state) {
usleep(1000);
}
/* Now autoservice thread should have no references to our entry
and we can safely destroy it */
if (!ast_channel_softhangup_internal_flag(chan)) {
res = 0;
}
if (!as->orig_end_dtmf_flag) {
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
}
ast_channel_lock(chan);
while ((f = AST_LIST_REMOVE_HEAD(&as->deferred_frames, frame_list))) {
if (!((1 << f->frametype) & as->ignore_frame_types)) {
ast_queue_frame_head(chan, f);
}
ast_frfree(f);
}
ast_channel_unlock(chan);
free(as);
return res;
}
| void ast_begin_shutdown | ( | int | hangup | ) |
Initiate system shutdown -- prevents new channels from being allocated.
| hangup | If "hangup" is non-zero, all existing channels will receive soft hangups |
Definition at line 647 of file channel.c.
References ao2_callback, ast_channel_softhangup_cb(), channels, OBJ_MULTIPLE, and OBJ_NODATA.
Referenced by can_safely_quit().
{
shutting_down = 1;
if (hangup) {
ao2_callback(channels, OBJ_NODATA | OBJ_MULTIPLE, ast_channel_softhangup_cb, NULL);
}
}
| struct ast_format* ast_best_codec | ( | struct ast_format_cap * | cap, |
| struct ast_format * | result | ||
| ) | [read] |
Pick the best codec.
| capabilities | to pick best codec out of |
| result | stucture to store the best codec in. |
| on | success, pointer to result structure |
| on | failure, NULL |
Okay, ulaw is used by all telephony equipment, so start with it
Unless of course, you're a silly European, so then prefer ALAW
G.722 is better then all below, but not as common as the above... so give ulaw and alaw priority
Okay, well, signed linear is easy to translate into other stuff
G.726 is standard ADPCM, in RFC3551 packing order
G.726 is standard ADPCM, in AAL2 packing order
ADPCM has great sound quality and is still pretty easy to translate
Okay, we're down to vocoders now, so pick GSM because it's small and easier to translate and sounds pretty good
iLBC is not too bad
Speex is free, but computationally more expensive than GSM
SILK is pretty awesome.
CELT supports crazy high sample rates
Ick, LPC10 sounds terrible, but at least we have code for it, if you're tacky enough to use it
G.729a is faster than 723 and slightly less expensive
Down to G.723.1 which is proprietary but at least designed for voice
Definition at line 876 of file channel.c.
References ARRAY_LEN, AST_FORMAT_ADPCM, AST_FORMAT_ALAW, ast_format_cap_best_byid(), AST_FORMAT_CELT, ast_format_clear(), AST_FORMAT_G719, AST_FORMAT_G722, AST_FORMAT_G723_1, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, AST_FORMAT_G729A, AST_FORMAT_GSM, AST_FORMAT_ILBC, AST_FORMAT_LPC10, AST_FORMAT_SILK, AST_FORMAT_SIREN14, AST_FORMAT_SIREN7, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR12, AST_FORMAT_SLINEAR16, AST_FORMAT_SLINEAR192, AST_FORMAT_SLINEAR24, AST_FORMAT_SLINEAR32, AST_FORMAT_SLINEAR44, AST_FORMAT_SLINEAR48, AST_FORMAT_SLINEAR96, AST_FORMAT_SPEEX, AST_FORMAT_SPEEX16, AST_FORMAT_SPEEX32, AST_FORMAT_TESTLAW, AST_FORMAT_ULAW, ast_getformatname_multiple(), ast_log(), LOG_WARNING, and prefs.
Referenced by __oh323_new(), ast_codec_choose(), ast_iax2_new(), ast_speech_new(), bridge_make_compatible(), echo_exec(), feature_request_and_dial(), free_translation(), gtalk_new(), handle_open_receive_channel_ack_message(), iax2_best_codec(), iax2_request(), jingle_new(), local_new(), mgcp_new(), misdn_new(), multicast_rtp_request(), phone_new(), set_format(), skinny_new(), skinny_set_rtp_peer(), start_rtp(), transmit_connect(), and unistim_new().
{
/* This just our opinion, expressed in code. We are asked to choose
the best codec to use, given no information */
static const enum ast_format_id prefs[] =
{
/*! Okay, ulaw is used by all telephony equipment, so start with it */
AST_FORMAT_ULAW,
/*! Unless of course, you're a silly European, so then prefer ALAW */
AST_FORMAT_ALAW,
AST_FORMAT_G719,
AST_FORMAT_SIREN14,
AST_FORMAT_SIREN7,
AST_FORMAT_TESTLAW,
/*! G.722 is better then all below, but not as common as the above... so give ulaw and alaw priority */
AST_FORMAT_G722,
/*! Okay, well, signed linear is easy to translate into other stuff */
AST_FORMAT_SLINEAR192,
AST_FORMAT_SLINEAR96,
AST_FORMAT_SLINEAR48,
AST_FORMAT_SLINEAR44,
AST_FORMAT_SLINEAR32,
AST_FORMAT_SLINEAR24,
AST_FORMAT_SLINEAR16,
AST_FORMAT_SLINEAR12,
AST_FORMAT_SLINEAR,
/*! G.726 is standard ADPCM, in RFC3551 packing order */
AST_FORMAT_G726,
/*! G.726 is standard ADPCM, in AAL2 packing order */
AST_FORMAT_G726_AAL2,
/*! ADPCM has great sound quality and is still pretty easy to translate */
AST_FORMAT_ADPCM,
/*! Okay, we're down to vocoders now, so pick GSM because it's small and easier to
translate and sounds pretty good */
AST_FORMAT_GSM,
/*! iLBC is not too bad */
AST_FORMAT_ILBC,
/*! Speex is free, but computationally more expensive than GSM */
AST_FORMAT_SPEEX32,
AST_FORMAT_SPEEX16,
AST_FORMAT_SPEEX,
/*! SILK is pretty awesome. */
AST_FORMAT_SILK,
/*! CELT supports crazy high sample rates */
AST_FORMAT_CELT,
/*! Ick, LPC10 sounds terrible, but at least we have code for it, if you're tacky enough
to use it */
AST_FORMAT_LPC10,
/*! G.729a is faster than 723 and slightly less expensive */
AST_FORMAT_G729A,
/*! Down to G.723.1 which is proprietary but at least designed for voice */
AST_FORMAT_G723_1,
};
char buf[512];
int x;
/* Find the first preferred codec in the format given */
for (x = 0; x < ARRAY_LEN(prefs); x++) {
if (ast_format_cap_best_byid(cap, prefs[x], result)) {
return result;
}
}
ast_format_clear(result);
ast_log(LOG_WARNING, "Don't know any of %s formats\n", ast_getformatname_multiple(buf, sizeof(buf), cap));
return NULL;
}
| struct ast_channel* ast_bridged_channel | ( | struct ast_channel * | chan | ) | [read] |
Find bridged channel.
| chan | Current channel |
Definition at line 7455 of file channel.c.
References ast_channel_internal_bridged_channel(), ast_channel_tech(), ast_channel::bridged_channel, and ast_channel_tech::bridged_channel.
Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_channel_masquerade(), __ast_read(), __dahdi_exception(), _skinny_show_lines(), action_agents(), action_coreshowchannels(), agents_data_provider_get(), agents_show(), agents_show_online(), analog_attempt_transfer(), analog_exception(), analog_hangup(), analog_ss_thread(), ast_bridge_call(), ast_cel_report_event(), ast_channel_data_add_structure(), ast_channel_set_linkgroup(), ast_do_masquerade(), ast_rtp_instance_set_stats_vars(), ast_set_hangupsource(), ast_var_channel_bridge(), ast_var_channels_table(), attempt_transfer(), cb_events(), channel_spy(), check_bridge(), common_exec(), console_transfer(), create_jb(), dahdi_handle_event(), dahdi_hangup(), export_aoc_vars(), fax_detect_framehook(), fax_gateway_framehook(), func_channel_read(), get_refer_info(), handle_chanlist(), handle_hd_hf(), handle_invite_replaces(), handle_request(), handle_request_bye(), handle_request_info(), handle_request_refer(), handle_showchan(), handle_soft_key_event_message(), handle_stimulus_message(), key_dial_page(), local_attended_transfer(), local_queryoption(), mgcp_hangup(), mgcp_ss(), misdn_attempt_transfer(), mixmonitor_thread(), my_get_sigpvt_bridged_channel(), park_call_full(), pri_dchannel(), schedule_delivery(), serialize_showchan(), sig_pri_attempt_transfer(), sip_hangup(), sip_set_rtp_peer(), skinny_transfer(), socket_process_helper(), spandsp_fax_gateway_start(), start_spying(), startmon(), transfer_call_step1(), transfer_cancel_step2(), and unistim_hangup().
{
struct ast_channel *bridged;
bridged = ast_channel_internal_bridged_channel(chan);
if (bridged && ast_channel_tech(bridged)->bridged_channel)
bridged = ast_channel_tech(bridged)->bridged_channel(chan, bridged);
return bridged;
}
| int ast_call | ( | struct ast_channel * | chan, |
| const char * | addr, | ||
| int | timeout | ||
| ) |
Make a call.
| 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.
| 0 | on success |
| -1 | on failure |
Definition at line 6004 of file channel.c.
References AST_CDR_FLAG_DIALED, ast_channel_cdr(), 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, and ast_channel_tech::call.
Referenced by __ast_request_and_dial(), alloc_playback_chan(), ast_call_forward(), begin_dial_channel(), dial_exec_full(), dial_transfer(), do_forward(), do_idle_thread(), feature_request_and_dial(), findmeexec(), ring_entry(), and wait_for_answer().
{
/* Place an outgoing call, but don't wait any longer than timeout ms before returning.
If the remote end does not answer within the timeout, then do NOT hang up, but
return anyway. */
int res = -1;
/* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan);
if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
if (ast_channel_cdr(chan)) {
ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED);
}
if (ast_channel_tech(chan)->call)
res = ast_channel_tech(chan)->call(chan, addr, timeout);
ast_set_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
}
ast_channel_unlock(chan);
return res;
}
| 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.
| 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 |
| format | capabilities for requested channel |
| oh | outgoing helper used with original channel |
| outstate | reason why unsuccessful (if uncuccessful) |
Definition at line 5575 of file channel.c.
References outgoing_helper::account, ast_call(), AST_CDR_FLAG_ORIGINATED, ast_cdr_setaccount(), ast_channel_accountcode(), ast_channel_call_forward(), ast_channel_cdr(), ast_channel_connected(), ast_channel_context(), ast_channel_lock, ast_channel_lock_both, ast_channel_redirecting(), ast_channel_unlock, ast_copy_flags, ast_copy_string(), ast_hangup(), ast_log(), ast_party_connected_line_copy(), ast_party_redirecting_copy(), ast_request(), ast_set_variables(), call_forward_inherit(), ast_channel::data, handle_cause(), LOG_NOTICE, outgoing_helper::parent_channel, pbx_builtin_getvar_helper(), S_OR, type, and outgoing_helper::vars.
Referenced by __ast_request_and_dial(), and feature_request_and_dial().
{
char tmpchan[256];
struct ast_channel *new_chan = NULL;
char *data, *type;
int cause = 0;
int res;
/* gather data and request the new forward channel */
ast_copy_string(tmpchan, ast_channel_call_forward(orig), sizeof(tmpchan));
if ((data = strchr(tmpchan, '/'))) {
*data++ = '\0';
type = tmpchan;
} else {
const char *forward_context;
ast_channel_lock(orig);
forward_context = pbx_builtin_getvar_helper(orig, "FORWARD_CONTEXT");
snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(orig), S_OR(forward_context, ast_channel_context(orig)));
ast_channel_unlock(orig);
data = tmpchan;
type = "Local";
}
if (!(new_chan = ast_request(type, cap, orig, data, &cause))) {
ast_log(LOG_NOTICE, "Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause);
handle_cause(cause, outstate);
ast_hangup(orig);
return NULL;
}
/* Copy/inherit important information into new channel */
if (oh) {
if (oh->vars) {
ast_set_variables(new_chan, oh->vars);
}
if (oh->parent_channel) {
call_forward_inherit(new_chan, oh->parent_channel, orig);
}
if (oh->account) {
ast_channel_lock(new_chan);
ast_cdr_setaccount(new_chan, oh->account);
ast_channel_unlock(new_chan);
}
} else if (caller) { /* no outgoing helper so use caller if available */
call_forward_inherit(new_chan, caller, orig);
}
ast_channel_lock_both(orig, new_chan);
ast_copy_flags(ast_channel_cdr(new_chan), ast_channel_cdr(orig), AST_CDR_FLAG_ORIGINATED);
ast_channel_accountcode_set(new_chan, ast_channel_accountcode(orig));
ast_party_connected_line_copy(ast_channel_connected(new_chan), ast_channel_connected(orig));
ast_party_redirecting_copy(ast_channel_redirecting(new_chan), ast_channel_redirecting(orig));
ast_channel_unlock(new_chan);
ast_channel_unlock(orig);
/* call new channel */
res = ast_call(new_chan, data, 0);
if (timeout) {
*timeout = res;
}
if (res) {
ast_log(LOG_NOTICE, "Unable to call forward to channel %s/%s\n", type, (char *)data);
ast_hangup(orig);
ast_hangup(new_chan);
return NULL;
}
ast_hangup(orig);
return new_chan;
}
| void ast_cancel_shutdown | ( | void | ) |
Cancel a shutdown in progress.
Cancels an existing shutdown and returns to normal operation
Definition at line 668 of file channel.c.
Referenced by handle_abort_shutdown().
{
shutting_down = 0;
}
| const char* ast_cause2str | ( | int | cause | ) |
Gives the string form of a given cause code.
| state | cause to get the description of |
Definition at line 794 of file channel.c.
References ARRAY_LEN, causes, and causes_map::desc.
Referenced by __transmit_response(), ast_channel_data_add_structure(), ast_hangup(), dial_exec_full(), findmeexec(), hangupcause_read(), sip_hangup(), and transmit_request_with_auth().
| void ast_change_name | ( | struct ast_channel * | chan, |
| const char * | newname | ||
| ) |
Change channel name.
| chan | the channel to change the name of |
| newname | the name to change to |
Definition at line 6485 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().
{
/* We must re-link, as the hash value will change here. */
ao2_lock(channels);
ast_channel_lock(chan);
ao2_unlink(channels, chan);
__ast_change_name_nolink(chan, newname);
ao2_link(channels, chan);
ast_channel_unlock(chan);
ao2_unlock(channels);
}
| 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 | ) |
Referenced by __ast_channel_alloc_ap(), action_coreshowchannels(), action_dahdishowchannels(), action_status(), ast_async_goto(), ast_bridge_call(), ast_call_forward(), ast_cdr_init(), ast_cdr_setaccount(), ast_cdr_update(), ast_cel_report_event(), ast_channel_log(), ast_do_masquerade(), ast_hangup(), ast_set_owners_and_peers(), ast_var_channels_table(), begin_dial_channel(), dial_exec_full(), do_forward(), findmeexec(), func_channel_read(), handle_chanlist(), iax_park(), local_call(), local_new(), masq_park_call(), setup_env(), sip_park(), and wait_for_answer().
| enum ast_channel_adsicpe ast_channel_adsicpe | ( | const struct ast_channel * | chan | ) |
Definition at line 854 of file channel_internal_api.c.
References ast_channel::adsicpe.
{
return chan->adsicpe;
}
| void ast_channel_adsicpe_set | ( | struct ast_channel * | chan, |
| enum ast_channel_adsicpe | value | ||
| ) |
Definition at line 858 of file channel_internal_api.c.
References ast_channel::adsicpe, and value.
Referenced by __adsi_transmit_messages(), adsi_transmit_message_full(), ast_do_masquerade(), ast_iax2_new(), begin_dial_channel(), dahdi_new(), dial_exec_full(), gtalk_new(), jingle_new(), mgcp_new(), ring_entry(), sip_new(), skinny_new(), and unistim_new().
| int ast_channel_alert_writable | ( | struct ast_channel * | chan | ) |
Definition at line 1133 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().
{
return chan->alertpipe[1] > -1;
}
| int ast_channel_alert_write | ( | struct ast_channel * | chan | ) |
Definition at line 1098 of file channel_internal_api.c.
References ast_channel::alertpipe, and ast_channel_alert_writable().
Referenced by __ast_queue_frame(), __ast_read(), and ast_do_masquerade().
{
char blah = 0x7F;
return ast_channel_alert_writable(chan) && write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah);
}
| int ast_channel_amaflags | ( | const struct ast_channel * | chan | ) |
Definition at line 548 of file channel_internal_api.c.
References ast_channel::amaflags.
Referenced by ast_async_goto(), ast_bridge_call(), ast_cdr_init(), ast_cel_report_event(), ast_channel_data_add_structure(), ast_channel_log(), ast_var_channels_table(), func_channel_read(), handle_chanlist(), iax_park(), local_new(), masq_park_call(), and sip_park().
{
return chan->amaflags;
}
| void ast_channel_amaflags_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 552 of file channel_internal_api.c.
References ast_channel::amaflags, and value.
Referenced by __ast_channel_alloc_ap(), __oh323_new(), ast_cel_fabricate_channel_from_event(), ast_iax2_new(), dahdi_new(), func_channel_write_real(), gtalk_new(), jingle_new(), mgcp_new(), sip_new(), and skinny_new().
| const char* ast_channel_appl | ( | const struct ast_channel * | chan | ) |
Definition at line 463 of file channel_internal_api.c.
References ast_channel::appl.
Referenced by action_coreshowchannels(), ast_bridge_call(), ast_cel_report_event(), ast_channel_log(), ast_var_channels_table(), func_channel_read(), handle_chanlist(), handle_showchan(), pbx_exec(), and serialize_showchan().
{
return chan->appl;
}
| void ast_channel_appl_set | ( | struct ast_channel * | chan, |
| const char * | value | ||
| ) |
Definition at line 467 of file channel_internal_api.c.
References ast_channel::appl, and value.
Referenced by ast_cel_fabricate_channel_from_event(), begin_dial_channel(), bridge_call_thread(), dial_exec_full(), do_forward(), park_call_full(), pbx_exec(), and ring_entry().
| struct ast_audiohook_list* ast_channel_audiohooks | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 718 of file channel_internal_api.c.
References ast_channel::audiohooks.
Referenced by __ast_read(), ast_audiohook_attach(), ast_audiohook_detach_source(), ast_audiohook_move_by_source(), ast_audiohook_remove(), ast_audiohook_set_mute(), ast_channel_audiohook_count_by_source(), ast_channel_audiohook_count_by_source_running(), ast_channel_bridge(), ast_write(), check_bridge(), conf_run(), destroy_hooks(), local_bridge_loop(), and remote_bridge_loop().
{
return chan->audiohooks;
}
| void ast_channel_audiohooks_set | ( | struct ast_channel * | chan, |
| struct ast_audiohook_list * | value | ||
| ) |
Definition at line 722 of file channel_internal_api.c.
References ast_channel::audiohooks, and value.
Referenced by __ast_read(), ast_audiohook_attach(), ast_write(), check_bridge(), and destroy_hooks().
{
chan->audiohooks = value;
}
| struct ast_autochan_list* ast_channel_autochans | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 931 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().
{
return &chan->autochans;
}
| pthread_t ast_channel_blocker | ( | const struct ast_channel * | chan | ) |
Definition at line 1227 of file channel_internal_api.c.
References ast_channel::blocker.
Referenced by __ast_queue_frame(), ast_do_masquerade(), ast_hangup(), and ast_softhangup_nolock().
{
return chan->blocker;
}
| void ast_channel_blocker_set | ( | struct ast_channel * | chan, |
| pthread_t | value | ||
| ) |
Definition at line 1231 of file channel_internal_api.c.
References ast_channel::blocker, and value.
Referenced by __ast_read().
| const char* ast_channel_blockproc | ( | const struct ast_channel * | chan | ) |
Definition at line 471 of file channel_internal_api.c.
References ast_channel::blockproc.
Referenced by ast_hangup(), handle_showchan(), and serialize_showchan().
{
return chan->blockproc;
}
| void ast_channel_blockproc_set | ( | struct ast_channel * | chan, |
| const char * | value | ||
| ) |
Definition at line 475 of file channel_internal_api.c.
References ast_channel::blockproc, and value.
| int ast_channel_bridge | ( | struct ast_channel * | c0, |
| struct ast_channel * | c1, | ||
| struct ast_bridge_config * | config, | ||
| struct ast_frame ** | fo, | ||
| struct ast_channel ** | rc | ||
| ) |
Bridge two channels together.
| c0 | first channel to bridge |
| c1 | second channel to bridge |
| config | config for the channels |
| fo | destination frame(?) |
| rc | destination channel(?) |
Bridge two channels (c0 and c1) together. If an important frame occurs, we return that frame in *rf (remember, it could be NULL) and which channel (0 or 1) in rc
Definition at line 7834 of file channel.c.
References AST_BRIDGE_COMPLETE, AST_BRIDGE_FAILED, AST_BRIDGE_FAILED_NOWARN, AST_BRIDGE_RETRY, ast_channel_audiohooks(), ast_channel_clear_softhangup(), ast_channel_flags(), ast_channel_framehooks(), ast_channel_generator(), ast_channel_internal_bridged_channel(), ast_channel_internal_bridged_channel_set(), ast_channel_lock_both, ast_channel_make_compatible(), ast_channel_masq(), ast_channel_masqr(), ast_channel_monitor(), ast_channel_name(), ast_channel_nativeformats(), ast_channel_readformat(), ast_channel_softhangup_internal_flag(), ast_channel_tech(), ast_channel_unlock, ast_channel_writeformat(), ast_check_hangup(), ast_check_hangup_locked(), ast_clear_flag, AST_CONTROL_SRCUPDATE, ast_debug, AST_FEATURE_PLAY_WARNING, AST_FEATURE_WARNING_ACTIVE, AST_FLAG_END_DTMF_ONLY, AST_FLAG_NBRIDGE, AST_FLAG_ZOMBIE, ast_format_cap_copy(), ast_format_cap_destroy(), ast_format_cap_dup(), ast_format_cap_identical(), ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_framehook_list_is_empty(), ast_generic_bridge(), ast_indicate(), ast_log(), ast_samp2tv(), ast_set_flag, ast_set_owners_and_peers(), AST_SOFTHANGUP_UNBRIDGE, ast_test_flag, ast_test_suite_event_notify, ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), ast_tvsub(), ast_tvzero(), ast_verb, bridge_play_sounds(), bridge_playfile(), ast_bridge_config::end_sound, ast_bridge_config::feature_start_time, ast_bridge_config::feature_timer, ast_bridge_config::features_callee, ast_bridge_config::features_caller, ast_bridge_config::flags, LOG_WARNING, manager_bridge_event(), ast_bridge_config::nexteventts, ast_bridge_config::play_warning, ast_bridge_config::start_sound, ast_bridge_config::start_time, ast_bridge_config::timelimit, update_bridge_vars(), ast_bridge_config::warning_freq, and ast_bridge_config::warning_sound.
Referenced by ast_bridge_call().
{
enum ast_bridge_result res = AST_BRIDGE_COMPLETE;
struct ast_format_cap *o0nativeformats;
struct ast_format_cap *o1nativeformats;
long time_left_ms=0;
char caller_warning = 0;
char callee_warning = 0;
*fo = NULL;
if (ast_channel_internal_bridged_channel(c0)) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",
ast_channel_name(c0), ast_channel_name(ast_channel_internal_bridged_channel(c0)));
return -1;
}
if (ast_channel_internal_bridged_channel(c1)) {
ast_log(LOG_WARNING, "%s is already in a bridge with %s\n",
ast_channel_name(c1), ast_channel_name(ast_channel_internal_bridged_channel(c1)));
return -1;
}
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
return -1;
o0nativeformats = ast_format_cap_dup(ast_channel_nativeformats(c0));
o1nativeformats = ast_format_cap_dup(ast_channel_nativeformats(c1));
if (!o0nativeformats || !o1nativeformats) {
ast_format_cap_destroy(o0nativeformats);
ast_format_cap_destroy(o1nativeformats);
ast_log(LOG_WARNING, "failed to copy native formats\n");
return -1;
}
caller_warning = ast_test_flag(&config->features_caller, AST_FEATURE_PLAY_WARNING);
callee_warning = ast_test_flag(&config->features_callee, AST_FEATURE_PLAY_WARNING);
if (ast_tvzero(config->start_time)) {
config->start_time = ast_tvnow();
if (config->start_sound) {
if (caller_warning) {
bridge_playfile(c0, c1, config->start_sound, config->timelimit / 1000);
}
if (callee_warning) {
bridge_playfile(c1, c0, config->start_sound, config->timelimit / 1000);
}
}
}
/* Keep track of bridge */
ast_channel_lock_both(c0, c1);
ast_channel_internal_bridged_channel_set(c0, c1);
ast_channel_internal_bridged_channel_set(c1, c0);
ast_channel_unlock(c0);
ast_channel_unlock(c1);
ast_set_owners_and_peers(c0, c1);
if (config->feature_timer && !ast_tvzero(config->nexteventts)) {
config->nexteventts = ast_tvadd(config->feature_start_time, ast_samp2tv(config->feature_timer, 1000));
} else if (config->timelimit) {
time_left_ms = config->timelimit - ast_tvdiff_ms(ast_tvnow(), config->start_time);
config->nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000));
if ((caller_warning || callee_warning) && config->play_warning) {
long next_warn = config->play_warning;
if (time_left_ms < config->play_warning && config->warning_freq > 0) {
/* At least one warning was played, which means we are returning after feature */
long warns_passed = (config->play_warning - time_left_ms) / config->warning_freq;
/* It is 'warns_passed * warning_freq' NOT '(warns_passed + 1) * warning_freq',
because nexteventts will be updated once again in the 'if (!to)' block */
next_warn = config->play_warning - warns_passed * config->warning_freq;
}
config->nexteventts = ast_tvsub(config->nexteventts, ast_samp2tv(next_warn, 1000));
}
} else {
config->nexteventts.tv_sec = 0;
config->nexteventts.tv_usec = 0;
}
if (!ast_channel_tech(c0)->send_digit_begin)
ast_set_flag(ast_channel_flags(c1), AST_FLAG_END_DTMF_ONLY);
if (!ast_channel_tech(c1)->send_digit_begin)
ast_set_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY);
manager_bridge_event(1, 1, c0, c1);
/* Before we enter in and bridge these two together tell them both the source of audio has changed */
ast_indicate(c0, AST_CONTROL_SRCUPDATE);
ast_indicate(c1, AST_CONTROL_SRCUPDATE);
for (/* ever */;;) {
struct timeval now = { 0, };
int to;
to = -1;
if (!ast_tvzero(config->nexteventts)) {
now = ast_tvnow();
to = ast_tvdiff_ms(config->nexteventts, now);
if (to <= 0) {
if (!config->timelimit) {
res = AST_BRIDGE_COMPLETE;
break;
}
to = 0;
}
}
if (config->timelimit) {
time_left_ms = config->timelimit - ast_tvdiff_ms(now, config->start_time);
if (time_left_ms < to)
to = time_left_ms;
if (time_left_ms <= 0) {
if (caller_warning && config->end_sound)
bridge_playfile(c0, c1, config->end_sound, 0);
if (callee_warning && config->end_sound)
bridge_playfile(c1, c0, config->end_sound, 0);
*fo = NULL;
res = 0;
ast_test_suite_event_notify("BRIDGE_TIMELIMIT", "Channel1: %s\r\nChannel2: %s", ast_channel_name(c0), ast_channel_name(c1));
break;
}
if (!to) {
if (time_left_ms >= 5000 && config->warning_sound && config->play_warning && ast_test_flag(config, AST_FEATURE_WARNING_ACTIVE)) {
int t = (time_left_ms + 500) / 1000; /* round to nearest second */
if (caller_warning)
bridge_playfile(c0, c1, config->warning_sound, t);
if (callee_warning)
bridge_playfile(c1, c0, config->warning_sound, t);
}
if (config->warning_freq && (time_left_ms > (config->warning_freq + 5000))) {
config->nexteventts = ast_tvadd(config->nexteventts, ast_samp2tv(config->warning_freq, 1000));
} else {
config->nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000));
}
}
ast_clear_flag(config, AST_FEATURE_WARNING_ACTIVE);
}
if ((ast_channel_softhangup_internal_flag(c0) | ast_channel_softhangup_internal_flag(c1)) & AST_SOFTHANGUP_UNBRIDGE) {/* Bit operators are intentional. */
if (ast_channel_softhangup_internal_flag(c0) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c0, AST_SOFTHANGUP_UNBRIDGE);
}
if (ast_channel_softhangup_internal_flag(c1) & AST_SOFTHANGUP_UNBRIDGE) {
ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE);
}
ast_channel_lock_both(c0, c1);
ast_channel_internal_bridged_channel_set(c0, c1);
ast_channel_internal_bridged_channel_set(c1, c0);
ast_channel_unlock(c0);
ast_channel_unlock(c1);
ast_debug(1, "Unbridge signal received. Ending native bridge.\n");
continue;
}
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) ||
ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) {
*fo = NULL;
res = 0;
ast_debug(1, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n",
ast_channel_name(c0), ast_channel_name(c1),
ast_test_flag(ast_channel_flags(c0), AST_FLAG_ZOMBIE) ? "Yes" : "No",
ast_check_hangup(c0) ? "Yes" : "No",
ast_test_flag(ast_channel_flags(c1), AST_FLAG_ZOMBIE) ? "Yes" : "No",
ast_check_hangup(c1) ? "Yes" : "No");
break;
}
update_bridge_vars(c0, c1);
bridge_play_sounds(c0, c1);
if (ast_channel_tech(c0)->bridge &&
/* if < 1 ms remains use generic bridging for accurate timing */
(!config->timelimit || to > 1000 || to == 0) &&
(ast_channel_tech(c0)->bridge == ast_channel_tech(c1)->bridge) &&
!ast_channel_monitor(c0) && !ast_channel_monitor(c1) &&
!ast_channel_audiohooks(c0) && !ast_channel_audiohooks(c1) &&
ast_framehook_list_is_empty(ast_channel_framehooks(c0)) && ast_framehook_list_is_empty(ast_channel_framehooks(c1)) &&
!ast_channel_masq(c0) && !ast_channel_masqr(c0) && !ast_channel_masq(c1) && !ast_channel_masqr(c1)) {
int timeoutms = to - 1000 > 0 ? to - 1000 : to;
/* Looks like they share a bridge method and nothing else is in the way */
ast_set_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
ast_set_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
if ((res = ast_channel_tech(c0)->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) {
manager_bridge_event(0, 1, c0, c1);
ast_debug(1, "Returning from native bridge, channels: %s, %s\n", ast_channel_name(c0), ast_channel_name(c1));
ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
ast_clear_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
if ((ast_channel_softhangup_internal_flag(c0) | ast_channel_softhangup_internal_flag(c1)) & AST_SOFTHANGUP_UNBRIDGE) {/* Bit operators are intentional. */
continue;
}
ast_channel_lock_both(c0, c1);
ast_channel_internal_bridged_channel_set(c0, NULL);
ast_channel_internal_bridged_channel_set(c1, NULL);
ast_channel_unlock(c0);
ast_channel_unlock(c1);
ast_format_cap_destroy(o0nativeformats);
ast_format_cap_destroy(o1nativeformats);
return res;
} else {
ast_clear_flag(ast_channel_flags(c0), AST_FLAG_NBRIDGE);
ast_clear_flag(ast_channel_flags(c1), AST_FLAG_NBRIDGE);
}
switch (res) {
case AST_BRIDGE_RETRY:
if (config->play_warning) {
ast_set_flag(config, AST_FEATURE_WARNING_ACTIVE);
}
continue;
default:
ast_verb(3, "Native bridging %s and %s ended\n", ast_channel_name(c0), ast_channel_name(c1));
/* fallthrough */
case AST_BRIDGE_FAILED_NOWARN:
break;
}
}
if (((ast_format_cmp(ast_channel_readformat(c1), ast_channel_writeformat(c0)) == AST_FORMAT_CMP_NOT_EQUAL) ||
(ast_format_cmp(ast_channel_readformat(c0), ast_channel_writeformat(c1)) == AST_FORMAT_CMP_NOT_EQUAL) ||
!ast_format_cap_identical(ast_channel_nativeformats(c0), o0nativeformats) ||
!ast_format_cap_identical(ast_channel_nativeformats(c1), o1nativeformats)) &&
!(ast_channel_generator(c0) || ast_channel_generator(c1))) {
if (ast_channel_make_compatible(c0, c1)) {
ast_log(LOG_WARNING, "Can't make %s and %s compatible\n", ast_channel_name(c0), ast_channel_name(c1));
manager_bridge_event(0, 1, c0, c1);
ast_format_cap_destroy(o0nativeformats);
ast_format_cap_destroy(o1nativeformats);
return AST_BRIDGE_FAILED;
}
ast_format_cap_copy(o0nativeformats, ast_channel_nativeformats(c0));
ast_format_cap_copy(o1nativeformats, ast_channel_nativeformats(c1));
}
update_bridge_vars(c0, c1);
res = ast_generic_bridge(c0, c1, config, fo, rc);
if (res != AST_BRIDGE_RETRY) {
break;
} else if (config->feature_timer) {
/* feature timer expired but has not been updated, sending to ast_bridge_call to do so */
break;
}
}
ast_clear_flag(ast_channel_flags(c0), AST_FLAG_END_DTMF_ONLY);
ast_clear_flag(ast_channel_flags(c1), AST_FLAG_END_DTMF_ONLY);
/* Now that we have broken the bridge the source will change yet again */
ast_indicate(c0, AST_CONTROL_SRCUPDATE);
ast_indicate(c1, AST_CONTROL_SRCUPDATE);
ast_channel_lock_both(c0, c1);
ast_channel_internal_bridged_channel_set(c0, NULL);
ast_channel_internal_bridged_channel_set(c1, NULL);
ast_channel_unlock(c0);
ast_channel_unlock(c1);
manager_bridge_event(0, 1, c0, c1);
ast_debug(1, "Bridge stops bridging channels %s and %s\n", ast_channel_name(c0), ast_channel_name(c1));
ast_format_cap_destroy(o0nativeformats);
ast_format_cap_destroy(o1nativeformats);
return res;
}
| 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.
Definition at line 1457 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(), handle_core_set_debug_channel(), my_ast_get_channel_by_name_locked(), pickup_by_mark(), and pickup_by_part().
{
return ao2_callback_data(channels, ao2_flags, cb_fn, arg, data);
}
| struct ast_party_caller* ast_channel_caller | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 947 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(), __oh323_new(), _macro_exec(), acf_isexten_exec(), action_agents(), action_confbridgelist_item(), action_coreshowchannels(), action_meetmelist(), action_status(), agentmonitoroutgoing_exec(), analog_ss_thread(), app_exec(), ast_app_dtget(), ast_bridge_call(), ast_cel_fabricate_channel_from_event(), ast_cel_report_event(), ast_channel_destructor(), ast_channel_set_caller(), ast_channel_set_caller_event(), ast_do_masquerade(), ast_do_pickup(), ast_dummy_channel_destructor(), ast_hangup(), ast_iax2_new(), ast_pbx_h_exten_run(), ast_set_callerid(), ast_setstate(), ast_str_retrieve_variable(), ast_var_channels_table(), background_detect_exec(), begin_dial_channel(), blacklist_read(), builtin_atxfer(), builtin_automixmonitor(), builtin_automonitor(), callerid_read(), callerid_write(), callerpres_read(), callerpres_write(), cb_events(), cc_generic_agent_init(), check_bridge(), collect_digits(), conf_run(), console_call(), console_transfer(), copy_message(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_new(), dial_exec_full(), dial_transfer(), dial_trunk(), disa_exec(), do_forward(), do_immediate_setup(), fax_detect_framehook(), feature_request_and_dial(), find_matching_endwhile(), findmeexec(), forward_message(), get_pai(), get_rpid(), gosub_exec(), gosub_run(), gtalk_new(), handle_chanlist(), handle_cli_confbridge_list_item(), handle_cli_misdn_show_channels(), handle_gosub(), handle_setpriority(), handle_showchan(), isAnsweringMachine(), isexten_function_read(), jingle_new(), join_queue(), leave_voicemail(), local_call(), local_indicate(), manager_bridge_event(), manager_parking_status(), 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(), ospauth_exec(), osplookup_exec(), oss_call(), oss_new(), park_call_full(), parkandannounce_exec(), parked_call_exec(), parse_oli(), pbx_builtin_background(), pbx_builtin_waitexten(), pbx_parseable_goto(), phase_e_handler(), phone_new(), post_manager_event(), pri_dchannel(), pri_ss_thread(), print_bc_info(), privacy_exec(), process_ast_dsp(), process_sdp(), push_callinfo(), queue_exec(), readexten_exec(), release_chan(), report_new_callerid(), ring_entry(), run_externnotify(), send_callinfo(), send_join_event(), send_leave_event(), senddialevent(), serialize_showchan(), set_one_cid(), setcallerid_pres_exec(), setup_env(), setup_privacy_args(), sig_pri_call(), sig_pri_handle_subcmds(), sip_call(), sip_new(), sip_read(), skinny_new(), skinny_newcall(), sla_ring_station(), sms_exec(), socket_process_helper(), state_notify_build_xml(), try_calling(), unistim_new(), update_connectedline(), valid_exit(), vm_authenticate(), wait_for_answer(), waitstream_core(), write_metadata(), and zapateller_exec().
{
return &chan->caller;
}
| void ast_channel_caller_set | ( | struct ast_channel * | chan, |
| struct ast_party_caller * | value | ||
| ) |
Definition at line 999 of file channel_internal_api.c.
References ast_channel::caller, and value.
Referenced by ast_do_masquerade(), dial_trunk(), and sla_ring_station().
| ast_group_t ast_channel_callgroup | ( | const struct ast_channel * | chan | ) |
Definition at line 1062 of file channel_internal_api.c.
References ast_channel::callgroup.
Referenced by ast_var_channels_table(), find_channel_by_group(), func_channel_read(), handle_showchan(), and serialize_showchan().
{
return chan->callgroup;
}
| void ast_channel_callgroup_set | ( | struct ast_channel * | chan, |
| ast_group_t | value | ||
| ) |
Definition at line 1066 of file channel_internal_api.c.
References ast_channel::callgroup, and value.
Referenced by dahdi_new(), func_channel_write_real(), gtalk_new(), jingle_new(), mgcp_new(), read_config(), sip_new(), skinny_new(), and unistim_new().
| struct ast_callid* ast_channel_callid | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 866 of file channel_internal_api.c.
References ast_callid_ref, and ast_channel::callid.
Referenced by __analog_ss_thread(), __ast_pbx_run(), ast_channel_destructor(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_request(), async_wait(), autoservice_run(), do_idle_thread(), func_pri_dchannel_chanpos_callid(), func_ss7_linkset_callid(), handle_showchan(), pri_ss_thread(), and sig_pri_handle_hold().
{
if (chan->callid) {
ast_callid_ref(chan->callid);
return chan->callid;
}
return NULL;
}
| void ast_channel_callid_cleanup | ( | struct ast_channel * | chan | ) |
Definition at line 1054 of file channel_internal_api.c.
References ast_callid_unref, and ast_channel::callid.
Referenced by ast_channel_destructor().
{
if (chan->callid) {
chan->callid = ast_callid_unref(chan->callid);
}
}
| void ast_channel_callid_set | ( | struct ast_channel * | chan, |
| struct ast_callid * | value | ||
| ) |
Definition at line 874 of file channel_internal_api.c.
References AST_CALLID_BUFFER_LENGTH, ast_callid_ref, ast_callid_strnprint(), ast_callid_unref, ast_channel_name(), ast_debug, ast_test_suite_event_notify, and ast_channel::callid.
Referenced by __ast_pbx_run(), agent_new(), ast_iax2_new(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_request(), dahdi_new(), iax2_request(), jingle_new(), local_new(), parked_call_exec(), and sip_new().
{
char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
call_identifier_from[0] = '\0';
ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
if (chan->callid) {
ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
/* unbind if already set */
ast_callid_unref(chan->callid);
}
chan->callid = ast_callid_ref(callid);
ast_test_suite_event_notify("CallIDChange",
"State: CallIDChange\r\n"
"Channel: %s\r\n"
"CallID: %s\r\n"
"PriorCallID: %s",
ast_channel_name(chan),
call_identifier_to,
call_identifier_from);
}
| 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.
This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function.
| chan | The channel to create the datastore on |
| base_params | CCSS parameters we wish to copy into the channel |
| 0 | Success |
| -1 | Failure |
Definition at line 11079 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(), and ast_datastore::data.
Referenced by ast_channel_get_cc_config_params(), dahdi_new(), local_call(), local_request(), and sip_new().
{
struct ast_cc_config_params *cc_params;
struct ast_datastore *cc_datastore;
if (!(cc_params = ast_cc_config_params_init())) {
return -1;
}
if (!(cc_datastore = ast_datastore_alloc(&cc_channel_datastore_info, NULL))) {
ast_cc_config_params_destroy(cc_params);
return -1;
}
if (base_params) {
ast_cc_copy_config_params(cc_params, base_params);
}
cc_datastore->data = cc_params;
ast_channel_datastore_add(chan, cc_datastore);
return 0;
}
| struct ast_cdr* ast_channel_cdr | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 726 of file channel_internal_api.c.
References ast_channel::cdr.
Referenced by __agent_start_monitoring(), __ast_channel_alloc_ap(), __ast_pbx_run(), __ast_request_and_dial(), action_coreshowchannels(), action_status(), agentmonitoroutgoing_exec(), agi_handle_command(), ast_async_goto(), ast_bridge_call(), ast_call(), ast_call_forward(), ast_cdr_appenduserfield(), ast_cdr_fork(), ast_cdr_setaccount(), ast_cdr_setamaflags(), ast_cdr_setpeeraccount(), ast_cdr_setuserfield(), ast_cdr_update(), ast_channel_data_add_structure(), ast_channel_destructor(), ast_channel_log(), ast_channel_set_caller_event(), ast_do_masquerade(), ast_dummy_channel_destructor(), ast_hangup(), ast_pbx_h_exten_run(), ast_pbx_hangup_handler_run(), ast_pbx_outgoing_app(), ast_pbx_outgoing_cdr_failed(), ast_pbx_outgoing_exten(), ast_raw_answer(), ast_set_callerid(), builtin_blindtransfer(), callerid_write(), cdr_read(), cdr_write(), clear_caller(), dial_exec_full(), disa_exec(), end_bridge_callback(), findmeexec(), forkcdr_exec(), func_channel_read(), handle_cause(), handle_chanlist(), handle_request_info(), handle_showchan(), login_exec(), nocdr_exec(), ospfinished_exec(), parked_call_exec(), pbx_builtin_busy(), pbx_builtin_congestion(), pbx_builtin_resetcdr(), pbx_exec(), ring_entry(), serialize_showchan(), show_chanstats_cb(), start_monitor_exec(), try_calling(), and wait_for_answer().
{
return chan->cdr;
}
| void ast_channel_cdr_set | ( | struct ast_channel * | chan, |
| struct ast_cdr * | value | ||
| ) |
Definition at line 730 of file channel_internal_api.c.
References ast_channel::cdr, and value.
Referenced by __agent_start_monitoring(), __ast_channel_alloc_ap(), __ast_request_and_dial(), ast_async_goto(), ast_bridge_call(), ast_channel_destructor(), ast_do_masquerade(), ast_dummy_channel_destructor(), ast_hangup(), ast_pbx_outgoing_cdr_failed(), builtin_blindtransfer(), clear_caller(), custom_log(), manager_log(), start_monitor_exec(), syslog_log(), and write_cdr().
| 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.
| chan | the channel to clear the flag on |
| flag | the flag or flags to clear |
Definition at line 2633 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_channel_bridge(), ast_generic_bridge(), chan_cleanup(), check_goto_on_transfer(), collect_digits(), and gosub_run().
{
ast_channel_lock(chan);
ast_channel_softhangup_internal_flag_clear(chan, flag);
if (!ast_channel_softhangup_internal_flag(chan)) {
struct ast_frame *fr;
/* If we have completely cleared the softhangup flag,
* then we need to fully abort the hangup process. This requires
* pulling the END_OF_Q frame out of the channel frame queue if it
* still happens to be there. */
fr = AST_LIST_LAST(ast_channel_readq(chan));
if (fr && fr->frametype == AST_FRAME_CONTROL &&
fr->subclass.integer == AST_CONTROL_END_OF_Q) {
AST_LIST_REMOVE(ast_channel_readq(chan), fr, frame_list);
ast_frfree(fr);
}
}
ast_channel_unlock(chan);
}
| int ast_channel_cmpwhentohangup | ( | struct ast_channel * | chan, |
| time_t | offset | ||
| ) |
Compare a offset with the settings of when to hang a channel up.
| chan | channel on which to check for hang up |
| offset | offset in seconds from current time |
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.
Definition at line 714 of file channel.c.
References ast_channel_cmpwhentohangup_tv().
{
struct timeval when = { offset, };
return ast_channel_cmpwhentohangup_tv(chan, when);
}
| 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.
| chan | channel on which to check for hangup |
| offset | offset in seconds and microseconds from current time |
Definition at line 699 of file channel.c.
References ast_channel_whentohangup(), ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), and ast_tvzero().
Referenced by ast_channel_cmpwhentohangup().
{
struct timeval whentohangup;
if (ast_tvzero(*ast_channel_whentohangup(chan)))
return ast_tvzero(offset) ? 0 : -1;
if (ast_tvzero(offset))
return 1;
whentohangup = ast_tvadd(offset, ast_tvnow());
return ast_tvdiff_ms(whentohangup, *ast_channel_whentohangup(chan));
}
| struct ast_party_connected_line* ast_channel_connected | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 951 of file channel_internal_api.c.
References ast_channel::connected.
Referenced by __ast_channel_alloc_ap(), __ast_read(), __ast_request_and_dial(), action_coreshowchannels(), action_meetmelist(), action_status(), analog_attempt_transfer(), analog_call(), ast_call_forward(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_channel_destructor(), ast_channel_set_connected_line(), ast_do_masquerade(), ast_do_pickup(), ast_dummy_channel_destructor(), ast_hangup(), ast_indicate_data(), ast_setstate(), begin_dial_channel(), builtin_atxfer(), conf_run(), connectedline_read(), connectedline_write(), dahdi_call(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), handle_showchan(), iax2_call(), join_queue(), launch_monitor_thread(), local_attended_transfer(), local_call(), local_indicate(), manager_parking_status(), manager_queues_status(), mgcp_call(), misdn_attempt_transfer(), oh323_call(), park_call_full(), parked_call_exec(), phase_e_handler(), phone_call(), post_manager_event(), push_callinfo(), ring_entry(), send_callerid_screen(), send_callinfo(), senddialevent(), serialize_showchan(), sig_pri_attempt_transfer(), sig_pri_call(), sig_pri_mcid_event(), sig_ss7_call(), skinny_newcall(), state_notify_build_xml(), try_calling(), unistim_indicate(), update_config(), update_connectedline(), and wait_for_answer().
{
return &chan->connected;
}
| struct ast_party_id ast_channel_connected_effective_id | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 955 of file channel_internal_api.c.
References ast_party_id_merge().
Referenced by add_rpid(), handle_showchan(), initreqprep(), misdn_call(), misdn_get_connected_line(), sig_pri_call(), sig_pri_indicate(), and update_connectedline().
{
return ast_party_id_merge(&chan->connected.id, &chan->connected.priv);
}
| 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.
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.
| 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. |
| 0 | Success |
| -1 | Either the macro does not exist, or there was an error while attempting to run the macro |
Have multiple return codes based on the MACRO_RESULT
Make constants so that caller and frame can be more expressive than just '1' and '0'
Definition at line 10870 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_strlen_zero(), chanlist::connected, ast_frame::data, ast_frame::datalen, LOG_WARNING, pbx_builtin_getvar_helper(), ast_frame::ptr, and S_OR.
Referenced by __ast_read(), app_exec(), ast_bridge_call(), ast_do_pickup(), ast_generic_bridge(), atxfer_fail_cleanup(), builtin_atxfer(), feature_request_and_dial(), handle_frame(), local_bridge_loop(), parked_call_exec(), remote_bridge_loop(), and wait_for_answer().
{
static int deprecation_warning = 0;
const char *macro;
const char *macro_args;
int retval;
ast_channel_lock(macro_chan);
macro = pbx_builtin_getvar_helper(macro_chan, is_caller
? "CONNECTED_LINE_CALLER_SEND_MACRO" : "CONNECTED_LINE_CALLEE_SEND_MACRO");
macro = ast_strdupa(S_OR(macro, ""));
macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
? "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS" : "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS");
macro_args = ast_strdupa(S_OR(macro_args, ""));
if (ast_strlen_zero(macro)) {
ast_channel_unlock(macro_chan);
return -1;
}
if (!deprecation_warning) {
deprecation_warning = 1;
ast_log(LOG_WARNING, "Usage of CONNECTED_LINE_CALLE[ER]_SEND_MACRO is deprecated. Please use CONNECTED_LINE_SEND_SUB instead.\n");
}
if (is_frame) {
const struct ast_frame *frame = connected_info;
ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(macro_chan));
} else {
const struct ast_party_connected_line *connected = connected_info;
ast_party_connected_line_copy(ast_channel_connected(macro_chan), connected);
}
ast_channel_unlock(macro_chan);
retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args);
if (!retval) {
struct ast_party_connected_line saved_connected;
ast_party_connected_line_init(&saved_connected);
ast_channel_lock(macro_chan);
ast_party_connected_line_copy(&saved_connected, ast_channel_connected(macro_chan));
ast_channel_unlock(macro_chan);
ast_channel_update_connected_line(macro_chan, &saved_connected, NULL);
ast_party_connected_line_free(&saved_connected);
}
return retval;
}
| 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.
| 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. |
| 0 | Success |
| -1 | Either the subroutine does not exist, or there was an error while attempting to run the subroutine |
Definition at line 10970 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_strlen_zero(), chanlist::connected, ast_frame::data, ast_frame::datalen, pbx_builtin_getvar_helper(), ast_frame::ptr, S_OR, and sub.
Referenced by __ast_read(), app_exec(), ast_bridge_call(), ast_do_pickup(), ast_generic_bridge(), atxfer_fail_cleanup(), builtin_atxfer(), feature_request_and_dial(), handle_frame(), local_bridge_loop(), parked_call_exec(), remote_bridge_loop(), and wait_for_answer().
{
const char *sub;
const char *sub_args;
int retval;
ast_channel_lock(sub_chan);
sub = pbx_builtin_getvar_helper(sub_chan, "CONNECTED_LINE_SEND_SUB");
sub = ast_strdupa(S_OR(sub, ""));
sub_args = pbx_builtin_getvar_helper(sub_chan, "CONNECTED_LINE_SEND_SUB_ARGS");
sub_args = ast_strdupa(S_OR(sub_args, ""));
if (ast_strlen_zero(sub)) {
ast_channel_unlock(sub_chan);
return -1;
}
if (is_frame) {
const struct ast_frame *frame = connected_info;
ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ast_channel_connected(sub_chan));
} else {
const struct ast_party_connected_line *connected = connected_info;
ast_party_connected_line_copy(ast_channel_connected(sub_chan), connected);
}
ast_channel_unlock(sub_chan);
retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args, 0);
if (!retval) {
struct ast_party_connected_line saved_connected;
ast_party_connected_line_init(&saved_connected);
ast_channel_lock(sub_chan);
ast_party_connected_line_copy(&saved_connected, ast_channel_connected(sub_chan));
ast_channel_unlock(sub_chan);
ast_channel_update_connected_line(sub_chan, &saved_connected, NULL);
ast_party_connected_line_free(&saved_connected);
}
return retval;
}
| void ast_channel_connected_set | ( | struct ast_channel * | chan, |
| struct ast_party_connected_line * | value | ||
| ) |
Definition at line 1003 of file channel_internal_api.c.
References ast_channel::connected, and value.
Referenced by ast_do_masquerade().
| const char* ast_channel_context | ( | const struct ast_channel * | chan | ) |
Definition at line 488 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_coreshowchannels(), action_dialplan_exec(), action_status(), agent_new(), analog_ss_thread(), ast_app_exec_macro(), ast_async_goto(), ast_bridge_call(), ast_call_forward(), ast_cc_call_init(), ast_cdr_init(), ast_cdr_update(), ast_cel_report_event(), ast_channel_by_exten_cb(), ast_channel_log(), ast_pbx_h_exten_run(), ast_str_retrieve_variable(), ast_var_channels_table(), ast_waitstream_exten(), background_detect_exec(), bridge_exec(), cc_generic_agent_init(), cc_interfaces_datastore_init(), check_availability(), collect_digits(), common_exec(), conf_run(), console_transfer(), dahdi_handle_dtmf(), dial_exec_full(), dialout(), do_bridge_masquerade(), do_forward(), do_idle_thread(), do_immediate_setup(), expand_gosub_args(), extenspy_exec(), fax_detect_framehook(), feature_attended_transfer(), feature_blind_transfer(), find_matching_endwhile(), forward_message(), func_channel_read(), get_cid_name(), gosub_exec(), gosub_run(), goto_exten(), handle_chanlist(), handle_gosub(), handle_setpriority(), handle_showchan(), iax2_call(), iax_park(), launch_monitor_thread(), leave_voicemail(), local_call(), log_exec(), lua_pbx_exec(), manage_parked_call(), masq_park_call(), mgcp_ss(), minivm_greet_exec(), misdn_call(), misdn_hangup(), my_handle_dtmf(), onedigit_goto(), park_call_full(), parkandannounce_exec(), pbx_builtin_background(), pbx_builtin_goto(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pbx_extension_helper(), pbx_parseable_goto(), pickup_exec(), pri_ss_thread(), print_bc_info(), process_ast_dsp(), process_sdp(), queue_transfer_fixup(), raise_exception(), readexten_exec(), real_ctx(), realtime_exec(), release_chan(), ring_entry(), serialize_showchan(), setsubstate(), setup_env(), sip_park(), sip_read(), skinny_dialer(), skinny_newcall(), try_calling(), vm_authenticate(), vm_execmain(), vmauthenticate(), and wait_for_answer().
{
return chan->context;
}
| void ast_channel_context_set | ( | struct ast_channel * | chan, |
| const char * | value | ||
| ) |
Definition at line 492 of file channel_internal_api.c.
References ast_copy_string(), and ast_channel::context.
Referenced by __ast_channel_alloc_ap(), __ast_request_and_dial(), __oh323_new(), _macro_exec(), action_dialplan_exec(), agent_new(), alsa_new(), analog_ss_thread(), ast_add_extension2_lockopt(), ast_bridge_call(), ast_cel_fabricate_channel_from_event(), ast_explicit_goto(), ast_iax2_new(), ast_pbx_h_exten_run(), ast_pbx_outgoing_exten(), async_wait(), check_availability(), dahdi_new(), dial_exec_full(), dialout(), do_idle_thread(), do_notify(), forward_message(), generic_recall(), gosub_exec(), gosub_run(), gtalk_new(), handle_gosub(), handle_setcontext(), iax2_call(), iax_park(), jingle_new(), leave_voicemail(), local_new(), mgcp_new(), minivm_greet_exec(), my_distinctive_ring(), nbs_new(), pbx_builtin_background(), pbx_extension_helper(), phone_new(), read_config(), return_exec(), set_c_e_p(), setsubstate(), sip_new(), sip_park(), and skinny_new().
{
ast_copy_string(chan->context, value, sizeof(chan->context));
}
| struct timeval ast_channel_creationtime | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 1027 of file channel_internal_api.c.
Referenced by ast_pickup_find_by_group(), extensionstate_update(), find_ringing_channel(), get_device_state_causing_channels(), and handle_request_subscribe().
{
return chan->creationtime;
}
| void ast_channel_creationtime_set | ( | struct ast_channel * | chan, |
| struct timeval * | value | ||
| ) |
Definition at line 1031 of file channel_internal_api.c.
References ast_channel::creationtime, and value.
Referenced by __ast_channel_alloc_ap().
{
chan->creationtime = *value;
}
| const char* ast_channel_data | ( | const struct ast_channel * | chan | ) |
Definition at line 479 of file channel_internal_api.c.
References ast_channel::data.
Referenced by action_coreshowchannels(), ast_bridge_call(), ast_cel_report_event(), ast_channel_log(), ast_var_channels_table(), func_channel_read(), handle_chanlist(), handle_showchan(), handle_verbose(), pbx_exec(), and serialize_showchan().
{
return chan->data;
}
| 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.
| [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. |
| <0 | on error. |
| 0 | on success. |
Definition at line 269 of file channel_internal_api.c.
References ast_bridged_channel(), ast_cause2str(), ast_cdr_data_add_structure(), ast_cdr_flags2str(), ast_channel_amaflags(), ast_channel_cdr(), ast_channel_data_add_structure(), ast_channel_hangupcause(), 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_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_SOFTHANGUP_UNBRIDGE, ast_state2str(), ast_tone_zone_data_add_structure(), ast_transfercapability2str(), and channel_data_add_flags().
Referenced by agents_data_provider_get(), ast_channel_data_add_structure(), data_channels_provider_handler(), queues_data_provider_get_helper(), and user_add_provider_cb().
{
struct ast_channel *bc;
struct ast_data *data_bridged;
struct ast_data *data_cdr;
struct ast_data *data_flags;
struct ast_data *data_zones;
struct ast_data *enum_node;
struct ast_data *data_softhangup;
#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
struct ast_data *data_callerid;
char value_str[100];
#endif
if (!tree) {
return -1;
}
ast_data_add_structure(ast_channel, tree, chan);
if (add_bridged) {
bc = ast_bridged_channel(chan);
if (bc) {
data_bridged = ast_data_add_node(tree, "bridged");
if (!data_bridged) {
return -1;
}
ast_channel_data_add_structure(data_bridged, bc, 0);
}
}
ast_data_add_codec(tree, "oldwriteformat", ast_channel_oldwriteformat(chan));
ast_data_add_codec(tree, "readformat", ast_channel_readformat(chan));
ast_data_add_codec(tree, "writeformat", ast_channel_writeformat(chan));
ast_data_add_codec(tree, "rawreadformat", ast_channel_rawreadformat(chan));
ast_data_add_codec(tree, "rawwriteformat", ast_channel_rawwriteformat(chan));
ast_data_add_codecs(tree, "nativeformats", ast_channel_nativeformats(chan));
/* state */
enum_node = ast_data_add_node(tree, "state");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_state2str(ast_channel_state(chan)));
ast_data_add_int(enum_node, "value", ast_channel_state(chan));
/* hangupcause */
enum_node = ast_data_add_node(tree, "hangupcause");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_cause2str(ast_channel_hangupcause(chan)));
ast_data_add_int(enum_node, "value", ast_channel_hangupcause(chan));
/* amaflags */
enum_node = ast_data_add_node(tree, "amaflags");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_cdr_flags2str(ast_channel_amaflags(chan)));
ast_data_add_int(enum_node, "value", ast_channel_amaflags(chan));
/* transfercapability */
enum_node = ast_data_add_node(tree, "transfercapability");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_transfercapability2str(ast_channel_transfercapability(chan)));
ast_data_add_int(enum_node, "value", ast_channel_transfercapability(chan));
/* _softphangup */
data_softhangup = ast_data_add_node(tree, "softhangup");
if (!data_softhangup) {
return -1;
}
ast_data_add_bool(data_softhangup, "dev", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_DEV);
ast_data_add_bool(data_softhangup, "asyncgoto", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO);
ast_data_add_bool(data_softhangup, "shutdown", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_SHUTDOWN);
ast_data_add_bool(data_softhangup, "timeout", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_TIMEOUT);
ast_data_add_bool(data_softhangup, "appunload", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_APPUNLOAD);
ast_data_add_bool(data_softhangup, "explicit", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_EXPLICIT);
ast_data_add_bool(data_softhangup, "unbridge", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_UNBRIDGE);
/* channel flags */
data_flags = ast_data_add_node(tree, "flags");
if (!data_flags) {
return -1;
}
channel_data_add_flags(data_flags, chan);
ast_data_add_uint(tree, "timetohangup", ast_channel_whentohangup(chan)->tv_sec);
#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
/* callerid */
data_callerid = ast_data_add_node(tree, "callerid");
if (!data_callerid) {
return -1;
}
ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid));
/* insert the callerid ton */
enum_node = ast_data_add_node(data_callerid, "cid_ton");
if (!enum_node) {
return -1;
}
ast_data_add_int(enum_node, "value", chan->cid.cid_ton);
snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s",
party_number_ton2str(chan->cid.cid_ton),
party_number_plan2str(chan->cid.cid_ton));
ast_data_add_str(enum_node, "text", value_str);
#endif
/* tone zone */
if (ast_channel_zone(chan)) {
data_zones = ast_data_add_node(tree, "zone");
if (!data_zones) {
return -1;
}
ast_tone_zone_data_add_structure(data_zones, ast_channel_zone(chan));
}
/* insert cdr */
data_cdr = ast_data_add_node(tree, "cdr");
if (!data_cdr) {
return -1;
}
ast_cdr_data_add_structure(data_cdr, ast_channel_cdr(chan), 1);
return 0;
}
| 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.
| [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. |
| 0 | The structure matches. |
| 1 | The structure doesn't matches. |
Definition at line 401 of file channel_internal_api.c.
References ast_data_search_cmp_structure.
{
return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name);
}
| void ast_channel_data_set | ( | struct ast_channel * | chan, |
| const char * | value | ||
| ) |
Definition at line 483 of file channel_internal_api.c.
References ast_channel::data, and value.
Referenced by ast_cel_fabricate_channel_from_event(), begin_dial_channel(), bridge_call_thread(), dial_exec_full(), do_forward(), park_call_full(), pbx_exec(), retrydial_exec(), ring_entry(), and set_chan_app_data().
| int ast_channel_datastore_add | ( | struct ast_channel * | chan, |
| struct ast_datastore * | datastore | ||
| ) |
Add a datastore to a channel.
| 0 | success |
| non-zero | failure |
Definition at line 2514 of file channel.c.
References ast_channel_datastores(), and AST_LIST_INSERT_HEAD.
Referenced by __ast_channel_masquerade(), _macro_exec(), acf_curlopt_write(), acf_iaxvar_write(), acf_odbc_read(), add_features_datastore(), add_to_agi(), apply_plc(), ast_cel_fabricate_channel_from_event(), ast_channel_cc_params_init(), ast_do_pickup(), ast_iax2_new(), ast_setup_cc_recall_datastore(), audiohook_volume_get(), authenticate_reply(), calendar_query_exec(), cc_interfaces_datastore_init(), chan_cleanup(), create_msg_q_chan(), dial_exec_full(), do_notify(), dundi_query_read(), enable_jack_hook(), enum_query_read(), find_or_create_details(), find_transaction(), frame_trace_helper(), func_channel_write_real(), get_feature_ds(), get_lock(), gosub_exec(), jb_helper(), lua_get_state(), msg_datastore_find_or_create(), mute_add_audiohook(), pitchshift_helper(), raise_exception(), set_chan_app_data(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_transfer_datastore(), shared_write(), smdi_msg_retrieve_read(), socket_process_helper(), speech_create(), speex_write(), srv_datastore_setup(), try_calling(), and volume_write().
{
int res = 0;
AST_LIST_INSERT_HEAD(ast_channel_datastores(chan), datastore, entry);
return res;
}
| 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.
Definition at line 2487 of file channel.c.
References ast_datastore_alloc().
{
return ast_datastore_alloc(info, uid);
}
| 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.
| pointer | to the datastore if found |
| NULL | if not found |
Definition at line 2528 of file channel.c.
References ast_channel_datastores(), AST_LIST_TRAVERSE, ast_datastore::info, 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_to_agi(), apply_plc(), 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_get_cc_config_params(), ast_do_masquerade(), ast_handle_cc_control_frame(), ast_ignore_cc(), ast_odbc_retrieve_transaction_obj(), ast_set_cc_interfaces_chanvar(), attended_transfer_occurred(), audiohook_volume_callback(), audiohook_volume_get(), balance_stack(), builtin_atxfer(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), cc_build_payload(), chan_cleanup(), clear_dialed_interfaces(), dial_exec_full(), disable_jack_hook(), dundi_result_read(), enable_jack_hook(), enum_result_read(), exec_odbcfinish(), find_details(), find_speech(), find_transaction(), frame_trace_helper(), func_channel_read(), func_channel_write_real(), func_inheritance_write(), func_mute_write(), get_agi_cmd(), get_feature_ds(), get_lock(), gosub_exec(), gosub_run(), handle_gosub(), iax2_call(), jack_hook_callback(), jb_helper(), local_read(), local_write(), lock_fixup(), lua_get_state(), manage_parked_call(), manager_mutestream(), mark_transaction_active(), msg_data_func_read(), msg_datastore_find_or_create(), msg_func_read(), msg_q_cb(), msg_send_exec(), mute_callback(), parked_call_exec(), pitchshift_cb(), pitchshift_helper(), pop_exec(), queue_transfer_fixup(), raise_exception(), release_transaction(), return_exec(), set_security_requirements(), shared_read(), shared_write(), smdi_msg_read(), speech_background(), speech_destroy(), speex_callback(), speex_read(), speex_write(), srv_query_read(), srv_result_read(), stackpeek_read(), stop_mixmonitor_full(), try_calling(), unlock_read(), volume_callback(), and volume_write().
{
struct ast_datastore *datastore = NULL;
if (info == NULL)
return NULL;
AST_LIST_TRAVERSE(ast_channel_datastores(chan), datastore, entry) {
if (datastore->info != info) {
continue;
}
if (uid == NULL) {
/* matched by type only */
break;
}
if ((datastore->uid != NULL) && !strcasecmp(uid, datastore->uid)) {
/* Matched by type AND uid */
break;
}
}
return datastore;
}
| int ast_channel_datastore_free | ( | struct ast_datastore * | datastore | ) |
Free a channel data store object.
Definition at line 2492 of file channel.c.
References ast_datastore_free().
{
return ast_datastore_free(datastore);
}
| int ast_channel_datastore_inherit | ( | struct ast_channel * | from, |
| struct ast_channel * | to | ||
| ) |
Inherit datastores from a parent to a child.
Definition at line 2497 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, and ast_datastore::uid.
Referenced by __ast_request_and_dial(), begin_dial_channel(), call_forward_inherit(), dial_exec_full(), dial_transfer(), do_forward(), findmeexec(), local_call(), ring_entry(), and wait_for_answer().
{
struct ast_datastore *datastore = NULL, *datastore2;
AST_LIST_TRAVERSE(ast_channel_datastores(from), datastore, entry) {
if (datastore->inheritance > 0) {
datastore2 = ast_datastore_alloc(datastore->info, datastore->uid);
if (datastore2) {
datastore2->data = datastore->info->duplicate ? datastore->info->duplicate(datastore->data) : NULL;
datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1;
AST_LIST_INSERT_TAIL(ast_channel_datastores(to), datastore2, entry);
}
}
}
return 0;
}
| int ast_channel_datastore_remove | ( | struct ast_channel * | chan, |
| struct ast_datastore * | datastore | ||
| ) |
Remove a datastore from a channel.
| 0 | success |
| non-zero | failure |
Definition at line 2523 of file channel.c.
References ast_channel_datastores(), and AST_LIST_REMOVE.
Referenced by acf_fetch(), acf_odbc_read(), adjust_frame_for_plc(), ast_do_masquerade(), ast_do_pickup(), chan_cleanup(), clear_dialed_interfaces(), dial_exec_full(), disable_jack_hook(), exec_odbcfinish(), frame_trace_helper(), jb_helper(), lua_get_state(), queue_transfer_fixup(), speech_background(), speech_destroy(), speex_write(), srv_query_read(), stop_mixmonitor_full(), and try_calling().
{
return AST_LIST_REMOVE(ast_channel_datastores(chan), datastore, entry) ? 0 : -1;
}
| struct ast_datastore_list* ast_channel_datastores | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 927 of file channel_internal_api.c.
References ast_channel::datastores.
Referenced by __ast_channel_alloc_ap(), ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_datastore_inherit(), ast_channel_datastore_remove(), ast_channel_destructor(), ast_do_masquerade(), ast_dummy_channel_alloc(), ast_dummy_channel_destructor(), chan_cleanup(), and handle_cli_mixmonitor().
{
return &chan->datastores;
}
| int ast_channel_defer_dtmf | ( | struct ast_channel * | chan | ) |
Defers DTMF so that you only read things like hangups and audio.
Definition at line 1439 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().
{
int pre = 0;
if (chan) {
pre = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
ast_set_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
}
return pre;
}
| 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] |
Definition at line 959 of file channel_internal_api.c.
References ast_channel::dialed.
Referenced by __ast_channel_alloc_ap(), __oh323_new(), ast_cel_fabricate_channel_from_event(), ast_cel_report_event(), ast_channel_destructor(), ast_do_masquerade(), ast_dummy_channel_destructor(), ast_iax2_new(), ast_str_retrieve_variable(), ast_var_channels_table(), begin_dial_channel(), callerid_read(), callerid_write(), check_bridge(), dahdi_new(), dial_exec_full(), do_forward(), gtalk_new(), handle_showchan(), iax2_call(), jingle_new(), local_call(), mgcp_ss(), oss_call(), oss_new(), pri_dchannel(), pri_ss_thread(), ring_entry(), serialize_showchan(), set_one_cid(), setup_env(), sip_new(), and wait_for_answer().
{
return &chan->dialed;
}
| 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.
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.
| 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 |
| 0 | on success |
| -1 | on error |
Definition at line 1295 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, OBJ_KEY, OBJ_NODATA, and OBJ_UNLINK.
Referenced by ast_channel_hangupcause_hash_set().
{
struct ast_control_pvt_cause_code *ao2_cause_code;
ao2_find(chan->dialed_causes, cause_code->chan_name, OBJ_KEY | OBJ_UNLINK | OBJ_NODATA);
ao2_cause_code = ao2_alloc(datalen, NULL);
if (ao2_cause_code) {
memcpy(ao2_cause_code, cause_code, datalen);
ao2_link(chan->dialed_causes, ao2_cause_code);
ao2_ref(ao2_cause_code, -1);
return 0;
} else {
return -1;
}
}
| struct ast_str* ast_channel_dialed_causes_channels | ( | const struct ast_channel * | chan | ) | [read] |
Retreive a comma-separated list of channels for which dialed cause information is available.
This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function.
| chan | The channel from which to retreive information |
| NULL | on allocation failure |
| Pointer | to an ast_str object containing the desired information which must be freed |
Definition at line 1277 of file channel_internal_api.c.
References ao2_callback, ast_str_create(), collect_names_cb(), and ast_channel::dialed_causes.
Referenced by hangupcause_keys_read().
{
struct ast_str *chanlist = ast_str_create(128);
if (!chanlist) {
return NULL;
}
ao2_callback(chan->dialed_causes, 0, collect_names_cb, &chanlist);
return chanlist;
}
| void ast_channel_dialed_causes_clear | ( | const struct ast_channel * | chan | ) |
Clear all cause information from the channel.
This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function.
| chan | The channel from which to clear information |
Definition at line 1311 of file channel_internal_api.c.
References ao2_callback, ast_channel::dialed_causes, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
Referenced by hangupcause_clear_exec().
{
ao2_callback(chan->dialed_causes, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);
}
| struct ast_control_pvt_cause_code* ast_channel_dialed_causes_find | ( | const struct ast_channel * | chan, |
| const char * | chan_name | ||
| ) | [read] |
Retreive a ref-counted cause code information structure.
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.
| chan | The channel from which to retreive information |
| chan_name | The name of the channel about which to retreive information |
| NULL | on search failure |
| Pointer | to a ref-counted ast_control_pvt_cause_code object containing the desired information |
Definition at line 1290 of file channel_internal_api.c.
References ao2_find, ast_channel::dialed_causes, and OBJ_KEY.
Referenced by hangupcause_read().
{
return ao2_find(chan->dialed_causes, chan_name, OBJ_KEY);
}
| void ast_channel_dialed_set | ( | struct ast_channel * | chan, |
| struct ast_party_dialed * | value | ||
| ) |
Definition at line 1007 of file channel_internal_api.c.
References ast_channel::dialed, and value.
Referenced by ast_do_masquerade().
| char ast_channel_dtmf_digit_to_emulate | ( | const struct ast_channel * | chan | ) |
Definition at line 521 of file channel_internal_api.c.
References ast_channel::dtmf_digit_to_emulate.
Referenced by __ast_read().
{
return chan->dtmf_digit_to_emulate;
}
| void ast_channel_dtmf_digit_to_emulate_set | ( | struct ast_channel * | chan, |
| char | value | ||
| ) |
Definition at line 525 of file channel_internal_api.c.
References ast_channel::dtmf_digit_to_emulate, and value.
Referenced by __ast_read().
{
chan->dtmf_digit_to_emulate = value;
}
| struct timeval* ast_channel_dtmf_tv | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 979 of file channel_internal_api.c.
References ast_channel::dtmf_tv.
Referenced by __ast_read(), and should_skip_dtmf().
{
return &chan->dtmf_tv;
}
| void ast_channel_dtmf_tv_set | ( | struct ast_channel * | chan, |
| struct timeval * | value | ||
| ) |
Definition at line 1015 of file channel_internal_api.c.
References ast_channel::dtmf_tv, and value.
Referenced by __ast_read().
| struct ast_frame* ast_channel_dtmff | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 939 of file channel_internal_api.c.
References ast_channel::dtmff.
Referenced by __ast_read(), jingle_digit(), and queue_dtmf_readq().
{
return &chan->dtmff;
}
| void ast_channel_dtmff_set | ( | struct ast_channel * | chan, |
| struct ast_frame * | value | ||
| ) |
Definition at line 991 of file channel_internal_api.c.
References ast_channel::dtmff, and value.
| int ast_channel_early_bridge | ( | struct ast_channel * | c0, |
| struct ast_channel * | c1 | ||
| ) |
Bridge two channels together (early)
| 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.
Definition at line 7715 of file channel.c.
References ast_channel_tech(), and ast_channel_tech::early_bridge.
Referenced by dial_exec_full(), and wait_for_answer().
{
/* Make sure we can early bridge, if not error out */
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)))
return -1;
return ast_channel_tech(c0)->early_bridge(c0, c1);
}
| unsigned int ast_channel_emulate_dtmf_duration | ( | const struct ast_channel * | chan | ) |
Definition at line 646 of file channel_internal_api.c.
References ast_channel::emulate_dtmf_duration.
Referenced by __ast_read().
{
return chan->emulate_dtmf_duration;
}
| void ast_channel_emulate_dtmf_duration_set | ( | struct ast_channel * | chan, |
| unsigned int | value | ||
| ) |
Definition at line 650 of file channel_internal_api.c.
References ast_channel::emulate_dtmf_duration, and value.
Referenced by __ast_read().
{
chan->emulate_dtmf_duration = value;
}
| int ast_channel_epfd | ( | const struct ast_channel * | chan | ) |
Referenced by ast_channel_destructor(), ast_channel_set_fd(), ast_poll_channel_add(), and ast_poll_channel_del().
| void ast_channel_epfd_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Referenced by __ast_channel_alloc_ap(), and ast_dummy_channel_alloc().
| const char* ast_channel_exten | ( | const struct ast_channel * | chan | ) |
Definition at line 496 of file channel_internal_api.c.
References ast_channel::exten.
Referenced by __ast_goto_if_exists(), __ast_pbx_run(), _macro_exec(), _while_exec(), action_coreshowchannels(), action_dialplan_exec(), action_status(), agent_new(), ast_app_exec_macro(), ast_async_goto(), ast_bridge_call(), ast_cc_call_init(), ast_cdr_init(), ast_cdr_update(), ast_cel_report_event(), ast_channel_by_exten_cb(), ast_channel_log(), ast_pbx_h_exten_run(), ast_str_retrieve_variable(), ast_var_channels_table(), bridge_exec(), cb_events(), cc_generic_agent_init(), cc_interfaces_datastore_init(), dahdi_handle_dtmf(), dial_exec_full(), do_bridge_masquerade(), do_forward(), do_idle_thread(), do_immediate_setup(), dundi_exec(), dundi_helper(), expand_gosub_args(), fax_detect_framehook(), feature_request_and_dial(), find_matching_endwhile(), forward_message(), func_channel_read(), get_cid_name(), gosub_exec(), gosub_run(), handle_chanlist(), handle_cli_misdn_show_channels(), handle_frame(), handle_gosub(), handle_setpriority(), handle_showchan(), iax_park(), launch_monitor_thread(), leave_voicemail(), local_call(), log_exec(), lua_pbx_exec(), manage_parked_call(), masq_park_call(), misdn_bridge(), misdn_hangup(), misdn_update_redirecting(), misdn_write(), my_handle_dtmf(), ospauth_exec(), park_call_exec(), park_call_full(), parkandannounce_exec(), pbx_builtin_goto(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pbx_extension_helper(), pbx_parseable_goto(), phase_e_handler(), print_bc_info(), process_ast_dsp(), process_sdp(), queue_transfer_fixup(), raise_exception(), realtime_exec(), release_chan(), ring_entry(), serialize_showchan(), setup_env(), setup_privacy_args(), sip_park(), sip_read(), skinny_newcall(), try_calling(), and wait_for_answer().
{
return chan->exten;
}
| void ast_channel_exten_set | ( | struct ast_channel * | chan, |
| const char * | value | ||
| ) |
Definition at line 500 of file channel_internal_api.c.
References ast_copy_string(), and ast_channel::exten.
Referenced by __analog_ss_thread(), __ast_channel_alloc_ap(), __ast_request_and_dial(), __oh323_new(), _macro_exec(), action_dialplan_exec(), agent_new(), alsa_new(), analog_ss_thread(), ast_add_extension2_lockopt(), ast_bridge_call(), ast_cel_fabricate_channel_from_event(), ast_explicit_goto(), ast_iax2_new(), ast_pbx_h_exten_run(), async_wait(), cb_events(), dahdi_new(), dial_exec_full(), dialout(), do_idle_thread(), do_immediate_setup(), do_notify(), forward_message(), generic_recall(), gosub_exec(), gosub_run(), gtalk_new(), handle_gosub(), handle_setextension(), iax_park(), jingle_new(), leave_voicemail(), local_new(), mgcp_new(), mgcp_ss(), minivm_greet_exec(), misdn_call(), misdn_digit_end(), misdn_new(), misdn_overlap_dial_task(), nbs_new(), park_call_exec(), pbx_builtin_background(), pbx_extension_helper(), phone_new(), pri_ss_thread(), read_config(), return_exec(), ring_entry(), select_entry(), set_c_e_p(), set_ext_pri(), setsubstate(), sip_new(), sip_park(), skinny_new(), unistim_ss(), and wait_for_answer().
{
ast_copy_string(chan->exten, value, sizeof(chan->exten));
}
| int ast_channel_fd | ( | const struct ast_channel * | chan, |
| int | which | ||
| ) |
Definition at line 1207 of file channel_internal_api.c.
References ast_channel::fds.
Referenced by __dahdi_exception(), analog_exception(), ast_channel_fd_isset(), ast_channel_set_fd(), ast_do_masquerade(), ast_poll_channel_add(), ast_poll_channel_del(), ast_waitfor_nandfds(), build_conf(), conf_run(), dahdi_bridge(), dahdiras_exec(), flash_exec(), handle_showchan(), manage_parked_call(), meetme_menu_admin_extended(), phone_call(), phone_new(), run_ras(), serialize_showchan(), spawn_ras(), and swap_subs().
{
return chan->fds[which];
}
| int ast_channel_fd_isset | ( | const struct ast_channel * | chan, |
| int | which | ||
| ) |
Definition at line 1211 of file channel_internal_api.c.
References ast_channel_fd().
Referenced by __ast_read(), ast_channel_set_fd(), ast_poll_channel_add(), ast_poll_channel_del(), and manage_parked_call().
{
return ast_channel_fd(chan, which) > -1;
}
| int ast_channel_fdno | ( | const struct ast_channel * | chan | ) |
Definition at line 566 of file channel_internal_api.c.
References ast_channel::fdno.
Referenced by __ast_read(), agent_read(), ast_do_masquerade(), ast_settimeout_full(), hook_event_cb(), jingle_read(), oh323_read(), sip_rtp_read(), skinny_rtp_read(), and unistim_rtp_read().
{
return chan->fdno;
}
| void ast_channel_fdno_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 570 of file channel_internal_api.c.
References ast_channel::fdno, and value.
Referenced by __ast_read(), agent_read(), ast_do_masquerade(), ast_settimeout_full(), ast_waitfor_nandfds(), and manage_parked_call().
| unsigned int ast_channel_fin | ( | const struct ast_channel * | chan | ) |
Definition at line 654 of file channel_internal_api.c.
References ast_channel::fin.
Referenced by __ast_read(), channel_set_debug(), handle_showchan(), and serialize_showchan().
{
return chan->fin;
}
| void ast_channel_fin_set | ( | struct ast_channel * | chan, |
| unsigned int | value | ||
| ) |
Definition at line 658 of file channel_internal_api.c.
References ast_channel::fin, and value.
Referenced by __ast_channel_alloc_ap(), __ast_read(), and channel_set_debug().
| struct ast_flags* ast_channel_flags | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 1263 of file channel_internal_api.c.
References ast_channel::flags.
Referenced by __analog_ss_thread(), __ast_channel_masquerade(), __ast_pbx_run(), __ast_queue_frame(), __ast_read(), _macro_exec(), action_redirect(), agent_read(), analog_ss_thread(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_call(), ast_bridge_end_dtmf(), ast_call(), ast_can_pickup(), ast_channel_bridge(), ast_channel_defer_dtmf(), ast_channel_destructor(), ast_channel_undefer_dtmf(), ast_deactivate_generator(), ast_do_masquerade(), ast_explicit_goto(), ast_hangup(), ast_iax2_new(), ast_indicate_data(), ast_pbx_h_exten_run(), ast_quiet_chan(), ast_raw_answer(), ast_readstring_full(), ast_sendtext(), ast_setstate(), ast_settimeout_full(), ast_softhangup_nolock(), ast_streamfile(), ast_transfer(), ast_var_channels_table(), ast_waitfor_nandfds(), ast_waitfordigit_full(), ast_write(), asyncgoto_exec(), bridge_channel_feature(), bridge_exec(), builtin_atxfer(), builtin_blindtransfer(), call_forward_inherit(), channel_data_add_flags(), channel_spy(), check_goto_on_transfer(), common_exec(), dahdi_new(), dahdi_read(), dial_exec_full(), disa_exec(), eivr_comm(), gosub_exec(), gosub_run(), handle_exec(), handle_gosub(), handle_showchan(), internal_deactivate_generator(), linear_alloc(), local_ast_moh_start(), local_ast_moh_stop(), local_new(), manage_parked_call(), park_call_full(), parkandannounce_exec(), pbx_builtin_background(), phone_read(), playtones_alloc(), remote_bridge_loop(), retrydial_exec(), return_exec(), serialize_showchan(), should_skip_dtmf(), sip_fixup(), sip_new(), sip_peer_hold(), start_spying(), startmon(), tonepair_alloc(), unistim_quiet_chan(), and waitstream_core().
{
return &chan->flags;
}
| unsigned int ast_channel_fout | ( | const struct ast_channel * | chan | ) |
Definition at line 662 of file channel_internal_api.c.
References ast_channel::fout.
Referenced by ast_write(), channel_set_debug(), handle_showchan(), and serialize_showchan().
{
return chan->fout;
}
| void ast_channel_fout_set | ( | struct ast_channel * | chan, |
| unsigned int | value | ||
| ) |
Definition at line 666 of file channel_internal_api.c.
References ast_channel::fout, and value.
Referenced by __ast_channel_alloc_ap(), ast_write(), and channel_set_debug().
| struct ast_framehook_list* ast_channel_framehooks | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 782 of file channel_internal_api.c.
References ast_channel::framehooks.
Referenced by __ast_read(), ast_channel_bridge(), ast_framehook_attach(), ast_framehook_detach(), ast_framehook_list_destroy(), ast_indicate_data(), ast_write(), local_bridge_loop(), and remote_bridge_loop().
{
return chan->framehooks;
}
| void ast_channel_framehooks_set | ( | struct ast_channel * | chan, |
| struct ast_framehook_list * | value | ||
| ) |
Definition at line 786 of file channel_internal_api.c.
References ast_channel::framehooks, and value.
Referenced by ast_framehook_attach(), and ast_framehook_list_destroy().
{
chan->framehooks = value;
}
| struct ast_generator* ast_channel_generator | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 790 of file channel_internal_api.c.
References ast_channel::generator.
Referenced by __ast_read(), ast_activate_generator(), ast_channel_bridge(), ast_deactivate_generator(), ast_hangup(), ast_openstream_full(), ast_read_generator_actions(), ast_senddigit_end(), cb_events(), generator_force(), generator_write_format_change(), internal_deactivate_generator(), and local_queue_frame().
{
return chan->generator;
}
| void ast_channel_generator_set | ( | struct ast_channel * | chan, |
| struct ast_generator * | value | ||
| ) |
Definition at line 794 of file channel_internal_api.c.
References ast_channel::generator, and value.
Referenced by ast_activate_generator(), ast_deactivate_generator(), ast_hangup(), and internal_deactivate_generator().
| void* ast_channel_generatordata | ( | const struct ast_channel * | chan | ) |
Definition at line 686 of file channel_internal_api.c.
References ast_channel::generatordata.
Referenced by __ast_read(), ast_activate_generator(), ast_deactivate_generator(), ast_hangup(), ast_quiet_chan(), ast_read_generator_actions(), ast_safe_sleep_conditional(), ast_tonepair(), ast_write(), cb_events(), generator_force(), generator_write_format_change(), internal_deactivate_generator(), manage_parked_call(), set_format(), and unistim_quiet_chan().
{
return chan->generatordata;
}
| void ast_channel_generatordata_set | ( | struct ast_channel * | chan, |
| void * | value | ||
| ) |
Definition at line 690 of file channel_internal_api.c.
References ast_channel::generatordata, and value.
Referenced by __ast_read(), ast_activate_generator(), ast_deactivate_generator(), ast_hangup(), ast_read_generator_actions(), cb_events(), generator_force(), and internal_deactivate_generator().
{
chan->generatordata = value;
}
| struct ast_channel* ast_channel_get_by_exten | ( | const char * | exten, |
| const char * | context | ||
| ) | [read] |
Find a channel by extension and context.
| exten | the extension to search for |
| context | the context to search for |
Return a channel that is currently at the specified extension and context.
| a | channel that is at the specified extension and context |
| NULL | if no channel was found |
Definition at line 1638 of file channel.c.
References ast_channel_by_exten_cb(), and ast_channel_callback().
{
char *l_exten = (char *) exten;
char *l_context = (char *) context;
return ast_channel_callback(ast_channel_by_exten_cb, l_context, l_exten, 0);
}
| struct ast_channel* ast_channel_get_by_name | ( | const char * | name | ) | [read] |
Find a channel by name.
Channel search functions
| name | the name or uniqueid of the channel to search for |
Find a channel that has the same name as the provided argument.
| a | channel with the name specified by the argument |
| NULL | if no channel was found |
Definition at line 1633 of file channel.c.
References ast_channel_get_by_name_prefix().
Referenced by action_add_agi_cmd(), action_aocmessage(), action_atxfer(), action_getvar(), action_hangup(), action_redirect(), action_sendtext(), action_setvar(), action_status(), action_timeout(), ast_async_goto_by_name(), ast_bridge_call(), asyncgoto_exec(), change_monitor_action(), do_pause_or_unpause(), func_mchan_read(), func_mchan_write(), handle_channelstatus(), handle_cli_agi_add_cmd(), handle_core_set_debug_channel(), handle_getvariablefull(), handle_hangup(), handle_redirect(), handle_set_chanvar(), handle_show_chanvar(), handle_show_hangup_channel(), handle_showchan(), handle_softhangup(), import_helper(), manager_mixmonitor(), manager_mute_mixmonitor(), manager_mutestream(), manager_optimize_away(), manager_park(), manager_play_dtmf(), manager_stop_mixmonitor(), park_call_full(), pbx_builtin_importvar(), senddtmf_exec(), shared_read(), shared_write(), start_monitor_action(), and stop_monitor_action().
{
return ast_channel_get_by_name_prefix(name, 0);
}
| struct ast_channel* ast_channel_get_by_name_prefix | ( | const char * | name, |
| size_t | name_len | ||
| ) | [read] |
Find a channel by a name prefix.
| name | The channel name or uniqueid prefix to search for |
| name_len | Only search for up to this many characters from the name |
Find a channel that has the same name prefix as specified by the arguments.
| a | channel with the name prefix specified by the arguments |
| NULL | if no channel was found |
Definition at line 1613 of file channel.c.
References ast_channel_by_name_cb(), ast_channel_by_uniqueid_cb(), ast_channel_callback(), ast_strlen_zero(), chanlist::chan, and OBJ_KEY.
Referenced by action_aocmessage(), action_bridge(), ast_channel_get_by_name(), ast_parse_device_state(), bridge_exec(), cc_generic_agent_stop_ringing(), common_exec(), handle_cli_mixmonitor(), shared_read(), and shared_write().
{
struct ast_channel *chan;
char *l_name = (char *) name;
chan = ast_channel_callback(ast_channel_by_name_cb, l_name, &name_len,
(name_len == 0) /* optimize if it is a complete name match */ ? OBJ_KEY : 0);
if (chan) {
return chan;
}
if (ast_strlen_zero(l_name)) {
/* We didn't have a name to search for so quit. */
return NULL;
}
/* Now try a search for uniqueid. */
return ast_channel_callback(ast_channel_by_uniqueid_cb, l_name, &name_len, 0);
}
| 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.
During call completion, we will need to create a call completion agent structure. To figure out the type of agent to construct, we need to ask the channel driver for the appropriate type.
Prior to adding this function, the call completion core attempted to figure this out for itself by stripping the technology off the channel's name. However, in the case of chan_dahdi, there are multiple agent types registered, and so simply searching for an agent type called "DAHDI" is not possible. In a case where multiple agent types are defined, the channel driver must have a queryoption callback defined in its channel_tech, and the queryoption callback must handle AST_OPTION_CC_AGENT_TYPE
If a channel driver does not have a queryoption callback or if the queryoption callback does not handle AST_OPTION_CC_AGENT_TYPE, then the old behavior of using the technology portion of the channel name is used instead. This is perfectly suitable for channel drivers whose channel technologies are a one-to-one match with the agent types defined within.
Note that this function is only called when the agent policy on a given channel is set to "native." Generic agents' type can be determined automatically by the core.
| chan | The channel for which we wish to retrieve the agent type | |
| [out] | agent_type | The type of agent the channel driver wants us to use |
| size | The size of the buffer to write to |
Definition at line 11141 of file channel.c.
References ast_channel_name(), ast_channel_queryoption(), ast_copy_string(), and AST_OPTION_CC_AGENT_TYPE.
Referenced by find_agent_callbacks().
{
int len = size;
char *slash;
if (!ast_channel_queryoption(chan, AST_OPTION_CC_AGENT_TYPE, agent_type, &len, 0)) {
return 0;
}
ast_copy_string(agent_type, ast_channel_name(chan), size);
if ((slash = strchr(agent_type, '/'))) {
*slash = '\0';
}
return 0;
}
| struct ast_cc_config_params* ast_channel_get_cc_config_params | ( | struct ast_channel * | chan | ) | [read] |
Get the CCSS parameters from a channel.
This function makes use of datastore operations on the channel, so it is important to lock the channel before calling this function.
| chan | Channel to retrieve parameters from |
| NULL | Failure |
| non-NULL | The parameters desired |
Definition at line 11102 of file channel.c.
References ast_assert, ast_channel_cc_params_init(), ast_channel_datastore_find(), and ast_datastore::data.
Referenced by acf_cc_read(), acf_cc_write(), analog_call(), ast_cc_call_failed(), ast_cc_call_init(), ast_queue_cc_frame(), cc_agent_init(), cc_core_init_instance(), find_agent_callbacks(), local_call(), local_request(), sig_pri_cc_available(), and sig_pri_cc_generic_check().
{
struct ast_datastore *cc_datastore;
if (!(cc_datastore = ast_channel_datastore_find(chan, &cc_channel_datastore_info, NULL))) {
/* If we can't find the datastore, it almost definitely means that the channel type being
* used has not had its driver modified to parse CC config parameters. The best action
* to take here is to create the parameters on the spot with the defaults set.
*/
if (ast_channel_cc_params_init(chan, NULL)) {
return NULL;
}
if (!(cc_datastore = ast_channel_datastore_find(chan, &cc_channel_datastore_info, NULL))) {
/* Should be impossible */
return NULL;
}
}
ast_assert(cc_datastore->data != NULL);
return cc_datastore->data;
}
| 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.
A common practice in Asterisk is to determine the device being talked to by dissecting the channel name. For certain channel types, this is not accurate. For instance, an ISDN channel is named based on what B channel is used, not the device being communicated with.
This function interfaces with a channel tech's queryoption callback to retrieve the name of the device being communicated with. If the channel does not implement this specific option, then the traditional method of using the channel name is used instead.
| chan | The channel to retrieve the information from | |
| [out] | device_name | The buffer to place the device's name into |
| name_buffer_length | The allocated space for the device_name |
Definition at line 11124 of file channel.c.
References ast_channel_name(), ast_channel_queryoption(), ast_copy_string(), and AST_OPTION_DEVICE_NAME.
Referenced by ast_cc_call_failed(), ast_cc_is_recall(), ast_queue_cc_frame(), cc_core_init_instance(), cccancel_exec(), ccreq_exec(), dial_exec_full(), sig_pri_call(), sig_pri_cc_available(), sig_pri_cc_generic_check(), sip_call(), and sip_handle_cc().
{
int len = name_buffer_length;
char *dash;
if (!ast_channel_queryoption(chan, AST_OPTION_DEVICE_NAME, device_name, &len, 0)) {
return 0;
}
/* Dang. Do it the old-fashioned way */
ast_copy_string(device_name, ast_channel_name(chan), name_buffer_length);
if ((dash = strrchr(device_name, '-'))) {
*dash = '\0';
}
return 0;
}
| static enum ast_t38_state ast_channel_get_t38_state | ( | struct ast_channel * | chan | ) | [inline, static] |
Retrieves the current T38 state of a channel.
Definition at line 2443 of file channel.h.
References ast_channel_queryoption(), AST_OPTION_T38_STATE, state, and T38_STATE_UNAVAILABLE.
Referenced by fax_gateway_detect_t38(), fax_gateway_detect_v21(), fax_gateway_framehook(), generic_fax_exec(), receivefax_exec(), receivefax_t38_init(), sendfax_exec(), sendfax_t38_init(), set_fax_t38_caps(), spandsp_fax_gateway_start(), transmit(), transmit_audio(), and transmit_t38().
{
enum ast_t38_state state = T38_STATE_UNAVAILABLE;
int datalen = sizeof(state);
ast_channel_queryoption(chan, AST_OPTION_T38_STATE, &state, &datalen, 0);
return state;
}
| struct ast_hangup_handler_list* ast_channel_hangup_handlers | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 923 of file channel_internal_api.c.
References ast_channel::hangup_handlers.
Referenced by ast_do_masquerade(), ast_pbx_hangup_handler_destroy(), ast_pbx_hangup_handler_init(), ast_pbx_hangup_handler_pop(), ast_pbx_hangup_handler_push(), ast_pbx_hangup_handler_run(), and ast_pbx_hangup_handler_show().
{
return &chan->hangup_handlers;
}
| int ast_channel_hangupcause | ( | const struct ast_channel * | chan | ) |
Definition at line 574 of file channel_internal_api.c.
References ast_channel::hangupcause.
Referenced by __ast_request_and_dial(), __transmit_response(), ast_cc_call_failed(), ast_channel_data_add_structure(), ast_channel_softhangup_withcause_locked(), ast_hangup(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_queue_hangup_with_cause(), ast_str_retrieve_variable(), ast_var_channels_table(), clear_caller(), dahdi_hangup(), dahdi_indicate(), dial_exec_full(), feature_request_and_dial(), handle_response(), iax2_hangup(), jingle_hangup(), local_call(), local_hangup(), misdn_hangup(), oh323_hangup(), pbx_builtin_hangup(), retrans_pkt(), sig_pri_hangup(), sig_pri_indicate(), sig_ss7_hangup(), sip_hangup(), try_calling(), unistim_hangup(), and wait_for_answer().
{
return chan->hangupcause;
}
| 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.
| chan | channel on which to set the cause information |
| cause_code | ast_control_pvt_cause_code structure containing cause information |
| datalen | total length of the structure since it may vary |
Definition at line 4452 of file channel.c.
References ast_channel_dialed_causes_add(), ast_channel_name(), ast_func_write(), ast_log(), ast_control_pvt_cause_code::chan_name, ast_control_pvt_cause_code::code, ast_control_pvt_cause_code::emulate_sip_cause, and LOG_WARNING.
Referenced by __analog_handle_event(), __ast_request_and_dial(), ast_indicate_data(), dahdi_bridge(), dahdi_r2_on_call_disconnect(), handle_incoming(), iax2_bridge(), jingle_action_session_terminate(), local_bridge_loop(), misdn_bridge(), pri_queue_pvt_cause_data(), remote_bridge_loop(), socket_process_helper(), and ss7_queue_pvt_cause_data().
{
char causevar[256];
if (ast_channel_dialed_causes_add(chan, cause_code, datalen)) {
ast_log(LOG_WARNING, "Unable to store hangup cause for %s on %s\n", cause_code->chan_name, ast_channel_name(chan));
}
if (cause_code->emulate_sip_cause) {
snprintf(causevar, sizeof(causevar), "HASH(SIP_CAUSE,%s)", cause_code->chan_name);
ast_func_write(chan, causevar, cause_code->code);
}
}
| void ast_channel_hangupcause_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 578 of file channel_internal_api.c.
References ast_channel::hangupcause, and value.
Referenced by __ast_read(), __ast_request_and_dial(), __attempt_transmit(), __oh323_update_info(), ast_channel_softhangup_withcause_locked(), ast_do_pickup(), cb_events(), console_new(), dahdi_indicate(), dahdi_r2_on_protocol_error(), dial_exec_full(), disa_exec(), eivr_comm(), gtalk_new(), handle_call_outgoing(), handle_invite_replaces(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), hangup_connection(), hangupcalls(), hanguptree(), iax2_call(), jingle_indicate(), jingle_new(), local_call(), local_hangup(), misdn_call(), pbx_builtin_hangup(), pri_dchannel(), pri_ss_thread(), receive_dtmf_digits(), retrans_pkt(), ring_entry(), send_cause2ast(), set_hangup_source_and_cause(), sig_pri_indicate(), sig_pri_kill_call(), sig_ss7_indicate(), sip_call(), sip_park_thread(), sip_pickup_thread(), socket_process_helper(), ss7_linkset(), wait_for_answer(), and wait_for_winner().
{
chan->hangupcause = value;
}
| const char* ast_channel_hangupsource | ( | const struct ast_channel * | chan | ) |
Referenced by ast_hangup(), ast_set_hangupsource(), and func_channel_read().
| void ast_channel_inherit_variables | ( | const struct ast_channel * | parent, |
| struct ast_channel * | child | ||
| ) |
Inherits channel variable from parent to child channel.
| parent | Parent channel |
| child | Child channel |
Scans all channel variables in the parent channel, looking for those that should be copied into the child channel. Variables whose names begin with a single '_' are copied into the child channel with the prefix removed. Variables whose names begin with '__' are copied into the child channel with their names unchanged.
Definition at line 6497 of file channel.c.
References ast_channel_name(), ast_channel_varshead(), ast_debug, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_var_assign(), ast_var_full_name(), ast_var_name(), ast_var_value(), and ast_var_t::entries.
Referenced by __ast_request_and_dial(), begin_dial_channel(), call_forward_inherit(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), ring_entry(), and wait_for_answer().
{
struct ast_var_t *current, *newvar;
const char *varname;
AST_LIST_TRAVERSE(ast_channel_varshead((struct ast_channel *) parent), current, entries) {
int vartype = 0;
varname = ast_var_full_name(current);
if (!varname)
continue;
if (varname[0] == '_') {
vartype = 1;
if (varname[1] == '_')
vartype = 2;
}
switch (vartype) {
case 1:
newvar = ast_var_assign(&varname[1], ast_var_value(current));
if (newvar) {
AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries);
ast_debug(1, "Inheriting variable %s from %s to %s.\n",
ast_var_name(newvar), ast_channel_name(parent), ast_channel_name(child));
}
break;
case 2:
newvar = ast_var_assign(varname, ast_var_value(current));
if (newvar) {
AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries);
ast_debug(1, "Inheriting variable %s from %s to %s.\n",
ast_var_name(newvar), ast_channel_name(parent), ast_channel_name(child));
}
break;
default:
break;
}
}
}
| unsigned long ast_channel_insmpl | ( | const struct ast_channel * | chan | ) |
Definition at line 670 of file channel_internal_api.c.
References ast_channel::insmpl.
Referenced by __ast_read(), and ast_write().
{
return chan->insmpl;
}
| void ast_channel_insmpl_set | ( | struct ast_channel * | chan, |
| unsigned long | value | ||
| ) |
Definition at line 674 of file channel_internal_api.c.
References ast_channel::insmpl, and value.
Referenced by __ast_read().
| ast_alert_status_t ast_channel_internal_alert_read | ( | struct ast_channel * | chan | ) |
Definition at line 1104 of file channel_internal_api.c.
References ast_channel::alertpipe, AST_ALERT_NOT_READABLE, AST_ALERT_READ_FAIL, AST_ALERT_READ_FATAL, AST_ALERT_READ_SUCCESS, ast_channel_internal_alert_readable(), ast_channel_name(), ast_log(), errno, LOG_ERROR, and LOG_WARNING.
Referenced by __ast_read().
{
int flags;
char blah;
if (!ast_channel_internal_alert_readable(chan)) {
return AST_ALERT_NOT_READABLE;
}
flags = fcntl(chan->alertpipe[0], F_GETFL);
/* For some odd reason, the alertpipe occasionally loses nonblocking status,
* which immediately causes a deadlock scenario. Detect and prevent this. */
if ((flags & O_NONBLOCK) == 0) {
ast_log(LOG_ERROR, "Alertpipe on channel %s lost O_NONBLOCK?!!\n", ast_channel_name(chan));
if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return AST_ALERT_READ_FATAL;
}
}
if (read(chan->alertpipe[0], &blah, sizeof(blah)) < 0) {
if (errno != EINTR && errno != EAGAIN) {
ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
return AST_ALERT_READ_FAIL;
}
}
return AST_ALERT_READ_SUCCESS;
}
| int ast_channel_internal_alert_readable | ( | struct ast_channel * | chan | ) |
Definition at line 1138 of file channel_internal_api.c.
References ast_channel::alertpipe.
Referenced by ast_channel_internal_alert_read(), and ast_channel_internal_alertpipe_close().
{
return chan->alertpipe[0] > -1;
}
| int ast_channel_internal_alert_readfd | ( | struct ast_channel * | chan | ) |
Definition at line 1178 of file channel_internal_api.c.
References ast_channel::alertpipe.
Referenced by __ast_channel_alloc_ap().
{
return chan->alertpipe[0];
}
| void ast_channel_internal_alertpipe_clear | ( | struct ast_channel * | chan | ) |
Definition at line 1143 of file channel_internal_api.c.
References ast_channel::alertpipe.
Referenced by __ast_channel_alloc_ap(), and ast_dummy_channel_alloc().
| void ast_channel_internal_alertpipe_close | ( | struct ast_channel * | chan | ) |
Definition at line 1148 of file channel_internal_api.c.
References ast_channel::alertpipe, ast_channel_alert_writable(), and ast_channel_internal_alert_readable().
Referenced by ast_channel_destructor().
{
if (ast_channel_internal_alert_readable(chan)) {
close(chan->alertpipe[0]);
}
if (ast_channel_alert_writable(chan)) {
close(chan->alertpipe[1]);
}
}
| int ast_channel_internal_alertpipe_init | ( | struct ast_channel * | chan | ) |
Definition at line 1158 of file channel_internal_api.c.
References ast_channel::alertpipe, ast_log(), errno, and LOG_WARNING.
Referenced by __ast_channel_alloc_ap().
{
if (pipe(chan->alertpipe)) {
ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe! Try increasing max file descriptors with ulimit -n\n");
return -1;
} else {
int flags = fcntl(chan->alertpipe[0], F_GETFL);
if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
flags = fcntl(chan->alertpipe[1], F_GETFL);
if (fcntl(chan->alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
}
return 0;
}
| void ast_channel_internal_alertpipe_swap | ( | struct ast_channel * | chan1, |
| struct ast_channel * | chan2 | ||
| ) |
Swap the interal alertpipe between two channels.
Definition at line 1183 of file channel_internal_api.c.
References ast_channel::alertpipe, ARRAY_LEN, and SWAP.
Referenced by ast_do_masquerade().
| struct ast_bridge* ast_channel_internal_bridge | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 1245 of file channel_internal_api.c.
References ast_channel::bridge.
Referenced by bridge_call(), and multiplexed_thread_function().
{
return chan->bridge;
}
| void ast_channel_internal_bridge_set | ( | struct ast_channel * | chan, |
| struct ast_bridge * | value | ||
| ) |
Definition at line 1249 of file channel_internal_api.c.
References ast_channel::bridge, and value.
Referenced by alloc_playback_chan(), and bridge_channel_join().
| struct ast_channel* ast_channel_internal_bridged_channel | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 1254 of file channel_internal_api.c.
References ast_channel::bridged_channel.
Referenced by __ast_channel_masquerade(), action_agents(), action_status(), agent_bridgedchannel(), agent_read(), ast_bridged_channel(), ast_channel_bridge(), ast_channel_log(), ast_channel_set_linkgroup(), ast_do_masquerade(), check_bridge(), handle_showchan(), local_bridgedchannel(), local_fixup(), serialize_showchan(), and unistim_show_info().
{
return chan->bridged_channel;
}
| void ast_channel_internal_bridged_channel_set | ( | struct ast_channel * | chan, |
| struct ast_channel * | value | ||
| ) |
Definition at line 1258 of file channel_internal_api.c.
References ast_channel::bridged_channel, and value.
Referenced by agent_hangup(), agent_read(), ast_channel_bridge(), and ast_generic_bridge().
{
chan->bridged_channel = value;
}
| void ast_channel_internal_fd_clear | ( | struct ast_channel * | chan, |
| int | which | ||
| ) |
Definition at line 1196 of file channel_internal_api.c.
References ast_channel_internal_fd_set().
Referenced by ast_channel_internal_fd_clear_all().
{
ast_channel_internal_fd_set(chan, which, -1);
}
| void ast_channel_internal_fd_clear_all | ( | struct ast_channel * | chan | ) |
Definition at line 1200 of file channel_internal_api.c.
References ast_channel_internal_fd_clear(), and AST_MAX_FDS.
Referenced by __ast_channel_alloc_ap(), and ast_dummy_channel_alloc().
{
int i;
for (i = 0; i < AST_MAX_FDS; i++) {
ast_channel_internal_fd_clear(chan, i);
}
}
| void ast_channel_internal_fd_set | ( | struct ast_channel * | chan, |
| int | which, | ||
| int | value | ||
| ) |
Definition at line 1192 of file channel_internal_api.c.
References ast_channel::fds, and value.
Referenced by ast_channel_internal_fd_clear(), ast_channel_set_fd(), my_pri_fixup_chans(), start_rtp(), swap_subs(), and unistim_new().
| struct ast_channel_iterator* ast_channel_iterator_all_new | ( | void | ) | [read] |
Create a new channel iterator.
After creating an iterator using this function, the ast_channel_iterator_next() function can be used to iterate through all channels that exist.
| NULL | on failure |
| a | new channel iterator |
Definition at line 1587 of file channel.c.
References ast_channel_iterator::active_iterator, ao2_iterator_init(), ast_calloc, channels, and ast_channel_iterator::simple_iterator.
Referenced by action_coreshowchannels(), action_hangup(), action_status(), ast_complete_channels(), ast_var_channel_bridge(), ast_var_channel_types_table(), ast_var_channels_table(), common_exec(), data_channels_provider_handler(), func_channels_read(), handle_chanlist(), handle_show_hangup_all(), and handle_softhangup().
{
struct ast_channel_iterator *i;
if (!(i = ast_calloc(1, sizeof(*i)))) {
return NULL;
}
i->simple_iterator = ao2_iterator_init(channels, 0);
i->active_iterator = &i->simple_iterator;
return i;
}
| struct ast_channel_iterator* ast_channel_iterator_by_exten_new | ( | const char * | exten, |
| const char * | context | ||
| ) | [read] |
Create a new channel iterator based on extension.
| exten | The extension that channels must be in |
| context | The context that channels must be in |
After creating an iterator using this function, the ast_channel_iterator_next() function can be used to iterate through all channels that are currently in the specified context and extension.
| NULL | on failure |
| a | new channel iterator based on the specified parameters |
Definition at line 1547 of file channel.c.
References ast_channel_iterator::active_iterator, ast_calloc, ast_channel_by_exten_cb(), ast_channel_callback(), ast_free, and OBJ_MULTIPLE.
Referenced by common_exec(), and pickup_by_exten().
{
struct ast_channel_iterator *i;
char *l_exten = (char *) exten;
char *l_context = (char *) context;
if (!(i = ast_calloc(1, sizeof(*i)))) {
return NULL;
}
i->active_iterator = (void *) ast_channel_callback(ast_channel_by_exten_cb,
l_context, l_exten, OBJ_MULTIPLE);
if (!i->active_iterator) {
ast_free(i);
return NULL;
}
return i;
}
| struct ast_channel_iterator* ast_channel_iterator_by_name_new | ( | const char * | name, |
| size_t | name_len | ||
| ) | [read] |
Create a new channel iterator based on name.
| name | channel name or channel uniqueid to match |
| name_len | number of characters in the channel name to match on. This would be used to match based on name prefix. If matching on the full channel name is desired, then this parameter should be 0. |
After creating an iterator using this function, the ast_channel_iterator_next() function can be used to iterate through all channels that exist that have the specified name or name prefix.
| NULL | on failure |
| a | new channel iterator based on the specified parameters |
Definition at line 1567 of file channel.c.
References ast_channel_iterator::active_iterator, ast_calloc, ast_channel_by_name_cb(), ast_channel_callback(), ast_free, OBJ_KEY, and OBJ_MULTIPLE.
Referenced by ast_complete_channels(), common_exec(), get_device_state_causing_channels(), and softhangup_exec().
{
struct ast_channel_iterator *i;
char *l_name = (char *) name;
if (!(i = ast_calloc(1, sizeof(*i)))) {
return NULL;
}
i->active_iterator = (void *) ast_channel_callback(ast_channel_by_name_cb,
l_name, &name_len,
OBJ_MULTIPLE | (name_len == 0 /* match the whole word, so optimize */ ? OBJ_KEY : 0));
if (!i->active_iterator) {
ast_free(i);
return NULL;
}
return i;
}
| struct ast_channel_iterator* ast_channel_iterator_destroy | ( | struct ast_channel_iterator * | i | ) | [read] |
Destroy a channel iterator.
| i | the itereator to destroy |
This function is used to destroy a channel iterator that was retrieved by using one of the channel_iterator_xxx_new() functions.
Definition at line 1539 of file channel.c.
References ast_channel_iterator::active_iterator, ao2_iterator_destroy(), and ast_free.
Referenced by action_coreshowchannels(), action_hangup(), action_status(), ast_complete_channels(), ast_var_channel_bridge(), ast_var_channel_types_table(), ast_var_channels_table(), common_exec(), data_channels_provider_handler(), func_channels_read(), get_device_state_causing_channels(), handle_chanlist(), handle_show_hangup_all(), handle_softhangup(), pickup_by_exten(), and softhangup_exec().
{
ao2_iterator_destroy(i->active_iterator);
ast_free(i);
return NULL;
}
| struct ast_channel* ast_channel_iterator_next | ( | struct ast_channel_iterator * | i | ) | [read] |
Get the next channel for a channel iterator.
| i | the channel iterator that was created using one of the channel_iterator_xxx_new() functions. |
This function should be used to iterate through all channels that match a specified set of parameters that were provided when the iterator was created.
| the | next channel that matches the parameters used when the iterator was created. |
| NULL,if | no more channels match the iterator parameters. |
Definition at line 1601 of file channel.c.
References ast_channel_iterator::active_iterator, and ao2_iterator_next.
Referenced by action_coreshowchannels(), action_hangup(), action_status(), ast_complete_channels(), ast_var_channel_bridge(), ast_var_channel_types_table(), ast_var_channels_table(), data_channels_provider_handler(), func_channels_read(), get_device_state_causing_channels(), handle_chanlist(), handle_show_hangup_all(), handle_softhangup(), next_channel(), pickup_by_exten(), and softhangup_exec().
{
return ao2_iterator_next(i->active_iterator);
}
| struct ast_jb* ast_channel_jb | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 943 of file channel_internal_api.c.
References ast_channel::jb.
Referenced by ast_jb_configure(), ast_jb_destroy(), ast_jb_do_usecheck(), ast_jb_empty_and_reset(), ast_jb_get_and_deliver(), ast_jb_get_config(), ast_jb_get_when_to_wakeup(), ast_jb_put(), create_jb(), jb_choose_impl(), and jb_get_and_deliver().
{
return &chan->jb;
}
| void ast_channel_jb_set | ( | struct ast_channel * | chan, |
| struct ast_jb * | value | ||
| ) |
Definition at line 995 of file channel_internal_api.c.
References ast_channel::jb, and value.
| const char* ast_channel_language | ( | const struct ast_channel * | chan | ) |
Referenced by __analog_ss_thread(), acf_vm_info(), action_bridge(), action_playback_and_continue(), agent_call(), agent_new(), analog_ss_thread(), announce_user_count(), app_exec(), ast_app_getdata(), ast_app_getdata_full(), ast_do_masquerade(), ast_moh_files_next(), ast_play_and_wait(), ast_say_counted_adjective(), ast_say_counted_noun(), ast_say_date_with_format_gr(), ast_say_number_full_gr(), ast_send_image(), ast_stream_and_wait(), ast_var_channels_table(), auth_exec(), background_detect_exec(), begin_dial_channel(), bridge_exec(), bridge_playfile(), builtin_atxfer(), check_availability(), check_beep(), common_exec(), conf_exec(), conf_get_pin(), conf_run(), control_streamfile(), copy_message(), count_exec(), dial_exec_full(), dictate_exec(), do_directory(), eivr_comm(), find_conf_realtime(), findmeexec(), forward_message(), func_channel_read(), gen_nextfile(), get_folder(), handle_getoption(), handle_recordfile(), handle_sayalpha(), handle_saydate(), handle_saydatetime(), handle_saydigits(), handle_saynumber(), handle_sayphonetic(), handle_saytime(), handle_showchan(), handle_speechrecognize(), handle_streamfile(), iax2_call(), invent_message(), leave_voicemail(), local_attended_transfer(), local_call(), login_exec(), meetme_menu_admin(), meetme_menu_admin_extended(), meetme_menu_normal(), mgcp_ss(), minivm_greet_exec(), page_exec(), park_call_full(), parkandannounce_exec(), pbx_builtin_background(), pbx_builtin_saycharacters(), pbx_builtin_saydigits(), pbx_builtin_saynumber(), pbx_builtin_sayphonetic(), play_and_wait(), play_file(), play_mailbox_owner(), play_message(), play_message_callerid(), play_message_datetime(), play_message_duration(), play_record_review(), play_sound_helper(), playback_exec(), privacy_exec(), readexten_exec(), record_exec(), retrydial_exec(), say_position(), sayunixtime_exec(), select_item_menu(), serialize_showchan(), setup_env(), setup_privacy_args(), speech_background(), try_calling(), vm_authenticate(), vm_browse_messages(), vm_execmain(), vm_instructions(), vm_intro(), vm_intro_cs(), vm_intro_de(), vm_intro_en(), vm_intro_es(), vm_intro_fr(), vm_intro_gr(), vm_intro_he(), vm_intro_it(), vm_intro_multilang(), vm_intro_nl(), vm_intro_no(), vm_intro_pl(), vm_intro_pt(), vm_intro_pt_BR(), vm_intro_se(), vm_intro_vi(), vm_intro_zh(), vm_play_folder_name(), vmsayname_exec(), and wait_for_winner().
| const char* ast_channel_linkedid | ( | const struct ast_channel * | chan | ) |
Referenced by action_bridge(), agent_request(), alsa_request(), analog_attempt_transfer(), ast_async_goto(), ast_cdr_init(), ast_cdr_update(), ast_cel_check_retire_linkedid(), ast_cel_report_event(), ast_channel_change_linkedid(), ast_channel_log(), ast_channel_set_linkgroup(), bridge_exec(), bridge_request(), builtin_atxfer(), check_availability(), check_goto_on_transfer(), console_request(), dahdi_request(), func_channel_read(), func_mchan_read(), func_mchan_write(), gtalk_request(), handle_showchan(), iax2_request(), iax_park(), jingle_request(), local_attended_transfer(), local_new(), local_request(), masq_park_call(), mgcp_request(), misdn_request(), multicast_rtp_request(), my_new_analog_ast_channel(), my_new_pri_ast_channel(), my_new_ss7_ast_channel(), nbs_request(), oh323_request(), oss_request(), phone_request(), serialize_showchan(), sip_park(), sip_request_call(), skinny_request(), and unistim_request().
| const char* ast_channel_macrocontext | ( | const struct ast_channel * | chan | ) |
Definition at line 504 of file channel_internal_api.c.
References ast_channel::macrocontext.
Referenced by _macro_exec(), ast_bridge_call(), ast_cc_call_init(), ast_cdr_init(), ast_cdr_update(), ast_channel_by_exten_cb(), ast_channel_log(), ast_var_channels_table(), cc_generic_agent_init(), cc_interfaces_datastore_init(), common_exec(), conf_run(), dahdi_handle_dtmf(), dial_exec_full(), fax_detect_framehook(), get_also_info(), get_cid_name(), get_refer_info(), goto_exten(), launch_monitor_thread(), leave_voicemail(), masq_park_call(), minivm_greet_exec(), my_handle_dtmf(), onedigit_goto(), park_call_full(), process_ast_dsp(), process_sdp(), real_ctx(), and sip_read().
{
return chan->macrocontext;
}
| void ast_channel_macrocontext_set | ( | struct ast_channel * | chan, |
| const char * | value | ||
| ) |
Definition at line 508 of file channel_internal_api.c.
References ast_copy_string(), and ast_channel::macrocontext.
Referenced by _macro_exec(), and masq_park_call().
{
ast_copy_string(chan->macrocontext, value, sizeof(chan->macrocontext));
}
| const char* ast_channel_macroexten | ( | const struct ast_channel * | chan | ) |
Definition at line 512 of file channel_internal_api.c.
References ast_channel::macroexten.
Referenced by _macro_exec(), ast_cc_call_init(), ast_cdr_init(), ast_cdr_update(), ast_channel_by_exten_cb(), ast_channel_log(), ast_var_channels_table(), cc_generic_agent_init(), cc_interfaces_datastore_init(), dial_exec_full(), do_forward(), dundi_exec(), dundi_helper(), get_cid_name(), masq_park_call(), park_call_full(), ring_entry(), and wait_for_answer().
{
return chan->macroexten;
}
| void ast_channel_macroexten_set | ( | struct ast_channel * | chan, |
| const char * | value | ||
| ) |
Definition at line 516 of file channel_internal_api.c.
References ast_copy_string(), and ast_channel::macroexten.
Referenced by _macro_exec(), and masq_park_call().
{
ast_copy_string(chan->macroexten, value, sizeof(chan->macroexten));
}
| int ast_channel_macropriority | ( | const struct ast_channel * | chan | ) |
Definition at line 582 of file channel_internal_api.c.
References ast_channel::macropriority.
Referenced by ast_channel_log(), ast_var_channels_table(), masq_park_call(), and park_call_full().
{
return chan->macropriority;
}
| void ast_channel_macropriority_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 586 of file channel_internal_api.c.
References ast_channel::macropriority, and value.
Referenced by _macro_exec(), and masq_park_call().
{
chan->macropriority = value;
}
| int ast_channel_make_compatible | ( | struct ast_channel * | c0, |
| struct ast_channel * | c1 | ||
| ) |
Makes two channel formats compatible.
| c0 | first channel to make compatible |
| c1 | other channel to make compatible |
Set two channels to compatible formats -- call before ast_channel_bridge in general.
Definition at line 6221 of file channel.c.
References ast_channel_make_compatible_helper().
Referenced by action_bridge(), app_exec(), ast_channel_bridge(), bridge_exec(), check_compat(), dial_exec_full(), do_forward(), fax_detect_framehook(), fax_gateway_framehook(), multiplexed_bridge_join(), parked_call_exec(), simple_bridge_join(), try_calling(), and wait_for_answer().
{
/* Some callers do not check return code, and we must try to set all call legs correctly */
int rc = 0;
/* Set up translation from the chan to the peer */
rc = ast_channel_make_compatible_helper(chan, peer);
if (rc < 0)
return rc;
/* Set up translation from the peer to the chan */
rc = ast_channel_make_compatible_helper(peer, chan);
return rc;
}
| struct ast_channel* ast_channel_masq | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 734 of file channel_internal_api.c.
References ast_channel::masq.
Referenced by __ast_channel_masquerade(), __ast_read(), ast_can_pickup(), ast_channel_bridge(), ast_channel_log(), ast_do_masquerade(), ast_hangup(), ast_udptl_bridge(), ast_var_channels_table(), ast_waitfor_nandfds(), ast_write(), local_bridge_loop(), and remote_bridge_loop().
{
return chan->masq;
}
| void ast_channel_masq_set | ( | struct ast_channel * | chan, |
| struct ast_channel * | value | ||
| ) |
Definition at line 738 of file channel_internal_api.c.
References ast_channel::masq, and value.
Referenced by __ast_channel_masquerade(), and ast_do_masquerade().
| struct ast_channel* ast_channel_masqr | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 742 of file channel_internal_api.c.
References ast_channel::masqr.
Referenced by __ast_channel_masquerade(), ast_channel_bridge(), ast_channel_log(), ast_hangup(), ast_udptl_bridge(), ast_var_channels_table(), ast_write(), local_bridge_loop(), and remote_bridge_loop().
{
return chan->masqr;
}
| void ast_channel_masqr_set | ( | struct ast_channel * | chan, |
| struct ast_channel * | value | ||
| ) |
Definition at line 746 of file channel_internal_api.c.
References ast_channel::masqr, and value.
Referenced by __ast_channel_masquerade(), and ast_do_masquerade().
| int ast_channel_masquerade | ( | struct ast_channel * | original, |
| struct ast_channel * | clone | ||
| ) |
Weird function made for call transfers.
| original | channel to make a copy of |
| clone | copy of the original channel |
This is a very strange and freaky function used primarily for transfer. Suppose that "original" and "clone" are two channels in random situations. This function takes the guts out of "clone" and puts them into the "original" channel, then alerts the channel driver of the change, asking it to fixup any private information (like the p->owner pointer) that is affected by the change. The physical layer of the original channel is hung up.
Definition at line 6361 of file channel.c.
References __ast_channel_masquerade().
Referenced by ast_async_goto(), ast_do_pickup(), attempt_transfer(), builtin_atxfer(), check_availability(), check_bridge(), check_goto_on_transfer(), do_bridge_masquerade(), handle_invite_replaces(), iax_park(), masq_park_call(), sip_park(), and skinny_transfer().
{
return __ast_channel_masquerade(original, clone, NULL);
}
| struct ast_channel_monitor* ast_channel_monitor | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 750 of file channel_internal_api.c.
References ast_channel::monitor.
Referenced by __agent_start_monitoring(), __ast_read(), ast_channel_bridge(), ast_channel_destructor(), ast_do_masquerade(), ast_monitor_change_fname(), ast_monitor_set_state(), ast_monitor_setjoinfiles(), ast_monitor_start(), ast_monitor_stop(), ast_write(), builtin_automonitor(), check_bridge(), conf_run(), local_bridge_loop(), and remote_bridge_loop().
{
return chan->monitor;
}
| void ast_channel_monitor_set | ( | struct ast_channel * | chan, |
| struct ast_channel_monitor * | value | ||
| ) |
Definition at line 754 of file channel_internal_api.c.
References ast_channel::monitor, and value.
Referenced by ast_do_masquerade(), ast_monitor_start(), ast_monitor_stop(), and check_bridge().
| void* ast_channel_music_state | ( | const struct ast_channel * | chan | ) |
Definition at line 694 of file channel_internal_api.c.
References ast_channel::music_state.
Referenced by __ast_read(), ast_channel_destructor(), ast_moh_files_next(), local_ast_moh_cleanup(), local_ast_moh_start(), local_ast_moh_stop(), moh_alloc(), moh_files_alloc(), moh_files_generator(), moh_files_release(), moh_files_write_format_change(), and moh_release().
{
return chan->music_state;
}
| void ast_channel_music_state_set | ( | struct ast_channel * | chan, |
| void * | value | ||
| ) |
Definition at line 698 of file channel_internal_api.c.
References ast_channel::music_state, and value.
Referenced by local_ast_moh_cleanup(), moh_alloc(), and moh_files_alloc().
{
chan->music_state = value;
}
| const char* ast_channel_musicclass | ( | const struct ast_channel * | chan | ) |
| const char* ast_channel_name | ( | const struct ast_channel * | chan | ) |
Referenced by __adsi_transmit_messages(), __analog_handle_event(), __analog_ss_thread(), __ast_answer(), __ast_change_name_nolink(), __ast_channel_alloc_ap(), __ast_channel_masquerade(), __ast_pbx_run(), __ast_play_and_record(), __ast_queue_frame(), __ast_read(), __attempt_transmit(), __dahdi_exception(), __oh323_destroy(), __oh323_new(), __oh323_update_info(), __queues_show(), __sip_autodestruct(), __sip_destroy(), _analog_get_index(), _dahdi_get_index(), _macro_exec(), _skinny_show_lines(), acf_faxopt_read(), acf_faxopt_write(), acf_jabberreceive_read(), action_add_agi_cmd(), action_agents(), action_bridge(), action_confbridgelist_item(), action_confbridgesetsinglevideosrc(), action_coreshowchannels(), action_dahdishowchannels(), action_hangup(), action_kick_last(), action_meetmelist(), action_status(), action_toggle_mute(), add_agi_cmd(), adsi_prog(), agent_bridgedchannel(), agent_call(), agent_read(), agent_write(), agents_show(), agents_show_online(), agi_handle_command(), alarmreceiver_exec(), alsa_indicate(), alsa_new(), analog_answer(), analog_attempt_transfer(), analog_call(), analog_exception(), analog_fixup(), analog_handle_dtmf(), analog_hangup(), analog_ss_thread(), aoc_d_event(), aoc_display_decoded_debug(), aoc_e_event(), aoc_request_event(), aoc_s_event(), app_exec(), append_channel_vars(), aqm_exec(), ast_agi_send(), ast_app_exec_macro(), ast_app_getdata(), ast_async_goto(), ast_autochan_new_channel(), ast_autochan_setup(), ast_bridge_call(), ast_bridge_end_dtmf(), ast_bridge_set_single_src_video_mode(), ast_bridge_update_talker_src_video_mode(), ast_cc_call_init(), ast_cc_offer(), ast_cdr_init(), ast_cdr_setaccount(), ast_cdr_setpeeraccount(), ast_cel_report_event(), ast_channel_bridge(), ast_channel_by_name_cb(), ast_channel_callid_set(), ast_channel_cmp_cb(), ast_channel_destructor(), ast_channel_get_cc_agent_type(), ast_channel_get_device_name(), ast_channel_hangupcause_hash_set(), ast_channel_hash_cb(), ast_channel_inherit_variables(), ast_channel_internal_alert_read(), ast_channel_log(), ast_channel_make_compatible_helper(), ast_channel_softhangup_withcause_locked(), ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), ast_check_hangup(), ast_cli_netstats(), ast_complete_channels(), ast_do_masquerade(), ast_do_pickup(), ast_dsp_process(), ast_generic_bridge(), ast_hangup(), ast_iax2_new(), ast_indicate_data(), ast_jb_destroy(), ast_jb_put(), ast_masq_park_call(), ast_masq_park_call_exten(), ast_moh_files_next(), ast_monitor_change_fname(), ast_monitor_start(), ast_monitor_stop(), ast_pbx_h_exten_run(), ast_pbx_hangup_handler_pop(), ast_pbx_hangup_handler_push(), ast_pbx_hangup_handler_run(), ast_pbx_hangup_handler_show(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run_app(), ast_pickup_call(), ast_play_and_wait(), ast_prod(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_readaudio_callback(), ast_rtp_instance_bridge(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_senddigit_begin(), ast_set_owners_and_peers(), ast_setstate(), ast_softhangup(), ast_softhangup_nolock(), ast_str_retrieve_variable(), ast_stream_and_wait(), ast_streamfile(), ast_udptl_bridge(), ast_var_channels_table(), ast_waitfor_nandfds(), ast_write(), async_agi_read_frame(), async_wait(), attempt_transfer(), audiohook_inheritance_fixup(), background_detect_exec(), bridge_array_add(), bridge_call_thread(), bridge_exec(), bridge_make_compatible(), builtin_atxfer(), builtin_automixmonitor(), builtin_automonitor(), builtin_blindtransfer(), calendar_event_read(), calendar_query_result_exec(), chanavail_exec(), change_hold_state(), change_t38_state(), channel_set_debug(), channel_spy(), check_availability(), check_beep(), check_bridge(), check_compat(), check_goto_on_transfer(), check_rtp_timeout(), clear_dialed_interfaces(), common_exec(), complete_confbridge_participant(), conf_exec(), conf_handle_talker_cb(), conf_play(), conf_queue_dtmf(), conf_run(), conf_update_user_mute(), console_indicate(), console_transfer(), cpeid_exec(), create_channel_name(), create_jb(), dahdi_accept_r2_call_exec(), dahdi_ami_channel_event(), dahdi_bridge(), dahdi_call(), dahdi_digit_begin(), dahdi_digit_end(), dahdi_fake_event(), dahdi_fixup(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_indicate(), dahdi_new(), dahdi_queryoption(), dahdi_r2_get_channel_category(), dahdi_r2_on_call_disconnect(), dahdi_read(), dahdi_send_callrerouting_facility_exec(), dahdi_setoption(), dahdi_show_channel(), dahdi_softhangup_all(), dahdi_write(), dahdiras_exec(), data_channels_provider_handler(), dial_exec_full(), dial_trunk(), dialog_unlink_all(), disa_exec(), disable_t38(), do_forward(), do_idle_thread(), do_waiting(), dumpchan_exec(), dundi_lookup_internal(), eagi_exec(), enable_jack_hook(), fast_originate(), fax_detect_framehook(), fax_gateway_detect_t38(), fax_gateway_detect_v21(), fax_gateway_framehook(), fax_gateway_request_t38(), fax_generator_generate(), fax_session_new(), feature_exec_app(), feature_interpret(), feature_request_and_dial(), find_by_part(), find_details(), find_or_create_details(), flash_exec(), frame_set_var(), func_channel_read(), func_channels_read(), func_inheritance_write(), function_agent(), generic_fax_exec(), generic_mute_unmute_helper(), get_agi_cmd(), get_chan_by_ast_name(), get_lock(), gosub_exec(), gosub_run(), group_count_function_read(), group_show_channels(), gtalk_answer(), gtalk_call(), gtalk_new(), gtalk_show_channels(), handle_call_outgoing(), handle_chanlist(), handle_cli_agi_add_cmd(), handle_cli_confbridge_list_item(), handle_cli_iax2_show_channels(), handle_cli_misdn_show_channel(), handle_frame(), handle_frame_ownerless(), handle_gosub(), handle_incoming(), handle_invite_replaces(), handle_offhook_message(), handle_parkedcalls(), handle_recordfile(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), handle_response_notify(), handle_showchan(), handle_softhangup(), handle_stimulus_message(), hook_event_cb(), iax2_ami_channelupdate(), iax2_call(), iax2_hangup(), iax2_request(), iax2_transfer(), iax_park(), iax_park_thread(), increase_call_count(), init_jack_data(), internal_deactivate_generator(), is_our_turn(), isAnsweringMachine(), jack_hook_callback(), jingle_action_session_terminate(), jingle_call(), jingle_new(), jingle_queue_hangup_with_cause(), jingle_read(), jingle_show_channels(), join_queue(), kick_conference_participant(), launch_asyncagi(), launch_monitor_thread(), leave_queue(), leave_voicemail(), linear_alloc(), linear_release(), local_ast_moh_start(), local_ast_moh_stop(), local_attended_transfer(), local_bridge_loop(), local_bridgedchannel(), local_call(), local_write(), locals_show(), log_jitterstats(), login_exec(), lua_get_state(), lua_pbx_exec(), make_email_file(), manage_parked_call(), manager_bridge_event(), manager_parking_status(), manager_queues_status(), masq_park_call(), meetme_menu_admin(), meetme_show_cmd(), meetmemute(), mgcp_answer(), mgcp_call(), mgcp_fixup(), mgcp_hangup(), mgcp_indicate(), mgcp_new(), mgcp_ss(), milliwatt_generate(), misdn_attempt_transfer(), misdn_bridge(), misdn_call(), misdn_hangup(), misdn_indication(), mixmonitor_thread(), moh_alloc(), moh_files_alloc(), moh_files_generator(), moh_files_release(), moh_generate(), moh_release(), multiplexed_bridge_join(), multiplexed_bridge_leave(), multiplexed_bridge_suspend(), multiplexed_bridge_unsuspend(), mute_add_audiohook(), my_dial_digits(), my_handle_dtmf(), my_set_cadence(), nbs_call(), nbs_hangup(), nbs_new(), nbs_xread(), next_channel(), oh323_answer(), oh323_call(), oh323_destroy(), oh323_digit_begin(), oh323_digit_end(), oh323_hangup(), oh323_indicate(), oh323_read(), old_milliwatt_exec(), oss_indicate(), oss_new(), page_exec(), park_call_exec(), park_call_full(), park_space_reserve(), parkandannounce_exec(), parked_call_exec(), pbx_builtin_background(), pbx_builtin_setvar_helper(), pbx_builtin_waitexten(), pbx_extension_helper(), phase_e_handler(), phone_answer(), phone_call(), phone_hangup(), phone_indicate(), phone_new(), pickup_by_exten(), pickup_by_group(), pickup_by_name_cb(), pickupchan_exec(), play_moh_exec(), play_sound_helper(), playback_exec(), playtones_alloc(), post_manager_event(), pri_dchannel(), pri_fixup_principle(), pri_queue_pvt_cause_data(), pri_ss_thread(), print_bc_info(), proc_session_timer(), process_ast_dsp(), process_sdp(), queue_exec(), readexten_exec(), realtime_exec(), receive_dtmf_digits(), receivefax_exec(), receivefax_t38_init(), record_exec(), remote_bridge_loop(), report_fax_status(), report_new_callerid(), revert_fax_buffers(), ring_entry(), rna(), rqm_exec(), run_agi(), run_ras(), say_number_full(), say_position(), send_agent_complete(), send_digit_to_chan(), send_dtmf_event(), send_join_event(), send_leave_event(), send_talking_event(), send_tone_burst(), senddialendevent(), senddialevent(), sendfax_exec(), sendfax_t38_init(), serialize_showchan(), set_fax_t38_caps(), set_format(), set_hangup_source_and_cause(), setup_env(), setup_privacy_args(), shared_write(), sig_pri_ami_hold_event(), sig_pri_attempt_transfer(), sig_pri_call(), sig_pri_cli_show_channels(), sig_pri_handle_subcmds(), sig_pri_indicate(), sig_pri_mcid_event(), sig_pri_moh_fsm_event(), sig_pri_send_aoce_termination_request(), sig_ss7_cli_show_channels(), sig_ss7_indicate(), sip_answer(), sip_call(), sip_fixup(), sip_hangup(), sip_indicate(), sip_new(), sip_park(), sip_park_thread(), sip_pickup(), sip_queryoption(), sip_queue_hangup_cause(), sip_read(), sip_request_call(), sip_rtp_read(), sip_senddigit_begin(), sip_senddigit_end(), sip_sendtext(), sip_set_rtp_peer(), sip_set_udptl_peer(), sip_setoption(), sip_show_channel(), sip_transfer(), sipinfo_send(), skinny_answer(), skinny_call(), skinny_fixup(), skinny_get_rtp_peer(), skinny_indicate(), skinny_new(), skinny_transfer(), sms_generate(), socket_process_helper(), softhangup_exec(), ss7_queue_pvt_cause_data(), ss7_start_call(), start_moh_exec(), start_monitor_action(), start_spying(), testclient_exec(), testserver_exec(), tonepair_alloc(), transmit(), transmit_audio(), transmit_invite(), transmit_t38(), try_calling(), unistim_answer(), unistim_call(), unistim_fixup(), unistim_hangup(), unistim_indicate(), unistim_new(), update_bridge_vars(), update_connectedline(), update_name(), update_qe_rule(), user_chan_cb(), wait_for_answer(), wait_for_winner(), wait_moh_exec(), and waitstream_core().
| void ast_channel_name_set | ( | struct ast_channel * | chan, |
| const char * | name | ||
| ) |
Set the channel name.
Referenced by __ast_change_name_nolink(), __ast_channel_alloc_ap(), and ast_cel_fabricate_channel_from_event().
| struct ast_namedgroups* ast_channel_named_callgroups | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 1078 of file channel_internal_api.c.
References ast_channel::named_callgroups.
Referenced by find_channel_by_group(), and func_channel_read().
{
return chan->named_callgroups;
}
| void ast_channel_named_callgroups_set | ( | struct ast_channel * | chan, |
| struct ast_namedgroups * | value | ||
| ) |
Definition at line 1082 of file channel_internal_api.c.
References ast_ref_namedgroups(), ast_unref_namedgroups(), and ast_channel::named_callgroups.
Referenced by ast_channel_destructor(), dahdi_new(), func_channel_write_real(), read_config(), and sip_new().
{
ast_unref_namedgroups(chan->named_callgroups);
chan->named_callgroups = ast_ref_namedgroups(value);
}
| struct ast_namedgroups* ast_channel_named_pickupgroups | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 1087 of file channel_internal_api.c.
References ast_channel::named_pickupgroups.
Referenced by find_channel_by_group(), and func_channel_read().
{
return chan->named_pickupgroups;
}
| void ast_channel_named_pickupgroups_set | ( | struct ast_channel * | chan, |
| struct ast_namedgroups * | value | ||
| ) |
Definition at line 1091 of file channel_internal_api.c.
References ast_ref_namedgroups(), ast_unref_namedgroups(), and ast_channel::named_pickupgroups.
Referenced by ast_channel_destructor(), dahdi_new(), func_channel_write_real(), read_config(), and sip_new().
{
ast_unref_namedgroups(chan->named_pickupgroups);
chan->named_pickupgroups = ast_ref_namedgroups(value);
}
| struct ast_format_cap* ast_channel_nativeformats | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 774 of file channel_internal_api.c.
References ast_channel::nativeformats.
Referenced by __ast_read(), __oh323_new(), __oh323_update_info(), agent_call(), agent_new(), alsa_new(), ast_bridge_update_talker_src_video_mode(), ast_channel_bridge(), ast_channel_data_add_structure(), ast_channel_destructor(), ast_channel_make_compatible_helper(), ast_do_masquerade(), ast_generic_bridge(), ast_iax2_new(), ast_openvstream(), ast_sendtext(), ast_streamfile(), ast_write(), begin_dial_channel(), bridge_request(), builtin_atxfer(), chanavail_exec(), console_new(), create_addr(), dahdi_new(), dial_exec_full(), dial_transfer(), do_forward(), do_notify(), echo_exec(), findmeexec(), free_translation(), func_channel_read(), gtalk_new(), gtalk_rtp_read(), gtalk_write(), handle_showchan(), iax2_bridge(), iax2_call(), iax2_request(), jingle_interpret_content(), jingle_new(), jingle_read(), jingle_rtp_read(), jingle_write(), local_new(), login_exec(), mgcp_new(), mgcp_rtp_read(), mgcp_write(), misdn_new(), multicast_rtp_request(), multiplexed_bridge_join(), nbs_new(), oh323_rtp_read(), oh323_write(), oss_new(), phone_new(), process_sdp(), rec_request(), ring_entry(), serialize_showchan(), set_format(), setup_rtp_connection(), show_channels_cb(), simple_bridge_join(), sip_new(), sip_rtp_read(), sip_show_channel(), sip_write(), skinny_new(), skinny_rtp_read(), skinny_write(), socket_process_helper(), speech_create(), start_rtp(), unistim_new(), unistim_rtp_read(), unistim_write(), and wait_for_answer().
{
return chan->nativeformats;
}
| void ast_channel_nativeformats_set | ( | struct ast_channel * | chan, |
| struct ast_format_cap * | value | ||
| ) |
Definition at line 778 of file channel_internal_api.c.
References ast_channel::nativeformats, and value.
Referenced by __ast_channel_alloc_ap(), and ast_channel_destructor().
{
chan->nativeformats = value;
}
| struct ast_format* ast_channel_oldwriteformat | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 903 of file channel_internal_api.c.
References ast_channel::oldwriteformat.
Referenced by ast_channel_data_add_structure(), ast_openstream_full(), and ast_stopstream().
{
return &chan->oldwriteformat;
}
| unsigned long ast_channel_outsmpl | ( | const struct ast_channel * | chan | ) |
Definition at line 678 of file channel_internal_api.c.
References ast_channel::outsmpl.
Referenced by __ast_read(), and ast_write().
{
return chan->outsmpl;
}
| void ast_channel_outsmpl_set | ( | struct ast_channel * | chan, |
| unsigned long | value | ||
| ) |
Definition at line 682 of file channel_internal_api.c.
References ast_channel::outsmpl, and value.
Referenced by ast_write().
| const char* ast_channel_parkinglot | ( | const struct ast_channel * | chan | ) |
Referenced by ast_do_masquerade(), findparkinglotname(), func_channel_read(), get_parkingtime(), iax_park(), serialize_showchan(), and sip_park().
| struct ast_pbx* ast_channel_pbx | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 798 of file channel_internal_api.c.
References ast_channel::pbx.
Referenced by __analog_handle_event(), __ast_pbx_run(), action_dialplan_exec(), action_redirect(), action_status(), ast_app_dtget(), ast_app_getdata(), ast_async_goto(), ast_can_pickup(), ast_channel_destructor(), asyncgoto_exec(), builtin_blindtransfer(), collect_digits(), dahdi_handle_event(), disa_exec(), handle_getoption(), handle_gosub(), ivr_dispatch(), parked_call_exec(), pbx_builtin_waitexten(), read_exec(), read_newoption(), readexten_exec(), speech_background(), timeout_read(), and timeout_write().
{
return chan->pbx;
}
| void ast_channel_pbx_set | ( | struct ast_channel * | chan, |
| struct ast_pbx * | value | ||
| ) |
Definition at line 802 of file channel_internal_api.c.
References ast_channel::pbx, and value.
Referenced by __ast_pbx_run(), action_dialplan_exec(), and handle_gosub().
| const char* ast_channel_peeraccount | ( | const struct ast_channel * | chan | ) |
| ast_group_t ast_channel_pickupgroup | ( | const struct ast_channel * | chan | ) |
Definition at line 1070 of file channel_internal_api.c.
References ast_channel::pickupgroup.
Referenced by ast_var_channels_table(), find_channel_by_group(), func_channel_read(), handle_showchan(), and serialize_showchan().
{
return chan->pickupgroup;
}
| void ast_channel_pickupgroup_set | ( | struct ast_channel * | chan, |
| ast_group_t | value | ||
| ) |
Definition at line 1074 of file channel_internal_api.c.
References ast_channel::pickupgroup, and value.
Referenced by dahdi_new(), func_channel_write_real(), gtalk_new(), jingle_new(), mgcp_new(), read_config(), sip_new(), skinny_new(), and unistim_new().
{
chan->pickupgroup = value;
}
| int ast_channel_priority | ( | const struct ast_channel * | chan | ) |
Definition at line 590 of file channel_internal_api.c.
References ast_channel::priority.
Referenced by __ast_pbx_run(), _macro_exec(), _while_exec(), action_coreshowchannels(), action_dialplan_exec(), action_status(), ast_app_exec_macro(), ast_bridge_call(), ast_channel_log(), ast_pbx_h_exten_run(), ast_str_retrieve_variable(), ast_var_channels_table(), bridge_exec(), dial_exec_full(), do_bridge_masquerade(), find_matching_endwhile(), forward_message(), gosub_exec(), gosub_run(), handle_chanlist(), handle_gosub(), handle_showchan(), iax_park(), launch_monitor_thread(), leave_voicemail(), log_exec(), lua_pbx_exec(), make_email_file(), manage_parked_call(), masq_park_call(), park_call_exec(), park_call_full(), parkandannounce_exec(), pbx_builtin_goto(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pbx_extension_helper(), pbx_parseable_goto(), raise_exception(), realtime_exec(), ring_entry(), serialize_showchan(), setup_env(), sip_park(), and try_calling().
{
return chan->priority;
}
| void ast_channel_priority_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 594 of file channel_internal_api.c.
References ast_channel::priority, and value.
Referenced by __ast_channel_alloc_ap(), __ast_pbx_run(), __ast_request_and_dial(), __oh323_new(), _macro_exec(), _while_exec(), action_dialplan_exec(), agent_new(), ast_bridge_call(), ast_explicit_goto(), ast_pbx_h_exten_run(), async_wait(), dial_exec_full(), dialout(), do_idle_thread(), do_notify(), forward_message(), generic_recall(), gosub_exec(), gosub_run(), gtalk_new(), handle_gosub(), iax_park(), jingle_new(), leave_voicemail(), local_new(), mgcp_new(), minivm_greet_exec(), misdn_new(), park_call_exec(), parkandannounce_exec(), pbx_builtin_background(), pbx_extension_helper(), return_exec(), set_c_e_p(), set_ext_pri(), sip_new(), sip_park(), skinny_new(), and unistim_new().
| int ast_channel_queryoption | ( | struct ast_channel * | channel, |
| int | option, | ||
| void * | data, | ||
| int * | datalen, | ||
| int | block | ||
| ) |
Checks the value of an option.
Query the value of an option Works similarly to setoption except only reads the options.
Definition at line 8131 of file channel.c.
References ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_log(), errno, LOG_ERROR, and ast_channel_tech::queryoption.
Referenced by ast_channel_get_cc_agent_type(), ast_channel_get_device_name(), ast_channel_get_t38_state(), local_queryoption(), rcvfax_exec(), and sndfax_exec().
{
int res;
ast_channel_lock(chan);
if (!ast_channel_tech(chan)->queryoption) {
errno = ENOSYS;
ast_channel_unlock(chan);
return -1;
}
if (block)
ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n");
res = ast_channel_tech(chan)->queryoption(chan, option, data, datalen);
ast_channel_unlock(chan);
return res;
}
| 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.
| chan | Asterisk channel to indicate connected line information |
| connected | Connected line information |
| update | What connected line information to update. NULL if all. |
Definition at line 9729 of file channel.c.
References ast_connected_line_build_data(), AST_CONTROL_CONNECTED_LINE, and ast_queue_control_data().
Referenced by ast_do_pickup(), handle_request_invite(), handle_request_update(), handle_response_invite(), local_attended_transfer(), masquerade_colp_transfer(), misdn_queue_connected_line_update(), sig_pri_handle_subcmds(), and sip_call().
{
unsigned char data[1024]; /* This should be large enough */
size_t datalen;
datalen = ast_connected_line_build_data(data, sizeof(data), connected, update);
if (datalen == (size_t) -1) {
return;
}
ast_queue_control_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen);
}
| 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.
| chan | Asterisk channel to indicate redirecting id information |
| redirecting | Redirecting id information |
| update | What redirecting information to update. NULL if all. |
Definition at line 10857 of file channel.c.
References AST_CONTROL_REDIRECTING, ast_queue_control_data(), and ast_redirecting_build_data().
Referenced by cb_events(), handle_response_invite(), misdn_facility_ie_handler(), and sig_pri_handle_subcmds().
{
unsigned char data[1024]; /* This should be large enough */
size_t datalen;
datalen = ast_redirecting_build_data(data, sizeof(data), redirecting, update);
if (datalen == (size_t) -1) {
return;
}
ast_queue_control_data(chan, AST_CONTROL_REDIRECTING, data, datalen);
}
| struct ast_format* ast_channel_rawreadformat | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 907 of file channel_internal_api.c.
References ast_channel::rawreadformat.
Referenced by __oh323_new(), agent_new(), ast_channel_data_add_structure(), ast_do_masquerade(), ast_iax2_new(), ast_rtp_instance_bridge(), ast_set_read_format(), ast_set_read_format_by_id(), ast_set_read_format_from_cap(), bridge_request(), dahdi_new(), dahdi_read(), do_notify(), free_translation(), gather_softmix_stats(), gtalk_new(), jingle_new(), local_bridge_loop(), local_new(), mgcp_new(), misdn_new(), multicast_rtp_request(), nbs_new(), phone_new(), phone_setup(), rec_request(), serialize_showchan(), set_softmix_bridge_data(), sip_new(), skinny_new(), and unistim_new().
{
return &chan->rawreadformat;
}
| struct ast_format* ast_channel_rawwriteformat | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 911 of file channel_internal_api.c.
References ast_channel::rawwriteformat.
Referenced by __oh323_new(), agent_new(), ast_channel_data_add_structure(), ast_do_masquerade(), ast_iax2_new(), ast_prod(), ast_rtp_instance_bridge(), ast_set_write_format(), ast_set_write_format_by_id(), ast_set_write_format_from_cap(), ast_write(), bridge_request(), conf_run(), dahdi_new(), do_notify(), free_translation(), gather_softmix_stats(), gtalk_new(), jingle_new(), local_bridge_loop(), local_new(), mgcp_new(), misdn_new(), multicast_rtp_request(), nbs_new(), phone_new(), rec_request(), serialize_showchan(), sip_new(), skinny_new(), softmix_bridge_thread(), and unistim_new().
{
return &chan->rawwriteformat;
}
| struct ast_format* ast_channel_readformat | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 915 of file channel_internal_api.c.
References ast_channel::readformat.
Referenced by __ast_play_and_record(), __oh323_new(), __oh323_update_info(), adsi_transmit_message_full(), agent_new(), alsa_new(), ast_async_goto(), ast_channel_bridge(), ast_channel_data_add_structure(), ast_channel_make_compatible_helper(), ast_do_masquerade(), ast_iax2_new(), ast_set_read_format(), ast_set_read_format_by_id(), ast_set_read_format_from_cap(), background_detect_exec(), bridge_channel_join(), bridge_make_compatible(), bridge_request(), builtin_atxfer(), check_goto_on_transfer(), console_new(), dahdi_new(), dictate_exec(), do_bridge_masquerade(), do_notify(), do_waiting(), eagi_exec(), fax_detect_framehook(), fax_gateway_framehook(), func_channel_read(), generic_fax_exec(), gtalk_new(), gtalk_rtp_read(), gtalk_show_channels(), gtalk_write(), handle_recordfile(), handle_showchan(), handle_speechrecognize(), iax2_request(), iax_park(), ices_exec(), isAnsweringMachine(), jingle_new(), jingle_read(), jingle_rtp_read(), jingle_show_channels(), jingle_write(), local_new(), login_exec(), masq_park_call(), measurenoise(), mgcp_new(), mgcp_rtp_read(), mgcp_write(), misdn_new(), multicast_rtp_request(), multiplexed_bridge_join(), nbs_new(), oh323_rtp_read(), oh323_write(), oss_new(), process_sdp(), rec_request(), record_exec(), send_start_rtp(), serialize_showchan(), setup_rtp_connection(), simple_bridge_join(), sip_new(), sip_park(), sip_rtp_read(), sip_write(), skinny_new(), skinny_rtp_read(), skinny_write(), socket_process_helper(), speech_background(), start_rtp(), transmit_audio(), unistim_new(), unistim_rtp_read(), and unistim_write().
{
return &chan->readformat;
}
| struct ast_readq_list* ast_channel_readq | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 935 of file channel_internal_api.c.
References ast_channel::readq.
Referenced by __ast_queue_frame(), __ast_read(), ast_channel_clear_softhangup(), ast_channel_destructor(), ast_do_masquerade(), and check_bridge().
{
return &chan->readq;
}
| struct ast_trans_pvt* ast_channel_readtrans | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 830 of file channel_internal_api.c.
References ast_channel::readtrans.
Referenced by __ast_read(), ast_channel_destructor(), fax_gateway_framehook(), free_translation(), handle_showchan(), and serialize_showchan().
{
return chan->readtrans;
}
| void ast_channel_readtrans_set | ( | struct ast_channel * | chan, |
| struct ast_trans_pvt * | value | ||
| ) |
Definition at line 834 of file channel_internal_api.c.
References ast_channel::readtrans, and value.
Referenced by free_translation().
| const char* ast_channel_reason2str | ( | int | reason | ) |
return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument
| reason | The integer argument, usually taken from AST_CONTROL_ macros |
Definition at line 5501 of file channel.c.
References AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_HANGUP, AST_CONTROL_RING, and AST_CONTROL_RINGING.
Referenced by attempt_thread().
{
switch (reason) /* the following appear to be the only ones actually returned by request_and_dial */
{
case 0:
return "Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)";
case AST_CONTROL_HANGUP:
return "Hangup";
case AST_CONTROL_RING:
return "Local Ring";
case AST_CONTROL_RINGING:
return "Remote end Ringing";
case AST_CONTROL_ANSWER:
return "Remote end has Answered";
case AST_CONTROL_BUSY:
return "Remote end is Busy";
case AST_CONTROL_CONGESTION:
return "Congestion (circuits busy)";
default:
return "Unknown Reason!!";
}
}
| struct ast_party_redirecting* ast_channel_redirecting | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 963 of file channel_internal_api.c.
References ast_channel::redirecting.
Referenced by __ast_channel_alloc_ap(), __oh323_new(), add_diversion(), ast_call_forward(), ast_cel_fabricate_channel_from_event(), ast_cel_report_event(), ast_channel_destructor(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), ast_channel_set_redirecting(), ast_do_masquerade(), ast_dummy_channel_destructor(), ast_iax2_new(), ast_indicate_data(), ast_var_channels_table(), begin_dial_channel(), call_forward_inherit(), callerid_read(), callerid_write(), cb_events(), check_bridge(), dahdi_new(), dial_exec_full(), do_forward(), iax2_call(), isAnsweringMachine(), leave_voicemail(), local_call(), local_indicate(), misdn_copy_redirecting_from_ast(), misdn_copy_redirecting_to_ast(), misdn_facility_ie_handler(), oh323_call(), oss_call(), redirecting_read(), redirecting_write(), ring_entry(), serialize_showchan(), setup_env(), sig_pri_handle_subcmds(), sig_pri_redirecting_update(), sip_new(), and wait_for_answer().
{
return &chan->redirecting;
}
| struct ast_party_id ast_channel_redirecting_effective_from | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 971 of file channel_internal_api.c.
References ast_party_id_merge().
Referenced by add_diversion(), misdn_copy_redirecting_from_ast(), and sig_pri_redirecting_update().
{
return ast_party_id_merge(&chan->redirecting.from, &chan->redirecting.priv_from);
}
| struct ast_party_id ast_channel_redirecting_effective_orig | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 967 of file channel_internal_api.c.
References ast_party_id_merge().
Referenced by sig_pri_redirecting_update().
{
return ast_party_id_merge(&chan->redirecting.orig, &chan->redirecting.priv_orig);
}
| struct ast_party_id ast_channel_redirecting_effective_to | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 975 of file channel_internal_api.c.
References ast_party_id_merge().
Referenced by misdn_copy_redirecting_from_ast(), and sig_pri_redirecting_update().
{
return ast_party_id_merge(&chan->redirecting.to, &chan->redirecting.priv_to);
}
| 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.
Whenever we want to update a channel's redirecting 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.
| 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. |
| redirecting_info | Either an ast_party_redirecting or ast_frame pointer of type AST_CONTROL_REDIRECTING |
| is_caller | If true, then run REDIRECTING_CALLER_SEND_MACRO with arguments from REDIRECTING_CALLER_SEND_MACRO_ARGS, otherwise run REDIRECTING_CALLEE_SEND_MACRO with arguments from REDIRECTING_CALLEE_SEND_MACRO_ARGS |
| is_frame | If true, then redirecting_info is an ast_frame pointer, otherwise it is an ast_party_redirecting pointer. |
| 0 | Success |
| -1 | Either the macro does not exist, or there was an error while attempting to run the macro |
Have multiple return codes based on the MACRO_RESULT
Make constants so that caller and frame can be more expressive than just '1' and '0'
Definition at line 10920 of file channel.c.
References ast_app_run_macro(), ast_channel_lock, ast_channel_redirecting(), ast_channel_unlock, ast_channel_update_redirecting(), ast_log(), ast_party_redirecting_copy(), ast_party_redirecting_free(), ast_party_redirecting_init(), ast_redirecting_parse_data(), ast_strlen_zero(), ast_frame::data, ast_frame::datalen, LOG_WARNING, pbx_builtin_getvar_helper(), ast_frame::ptr, and S_OR.
Referenced by ast_bridge_call(), ast_generic_bridge(), call_forward_inherit(), do_forward(), feature_request_and_dial(), handle_frame(), local_bridge_loop(), remote_bridge_loop(), and wait_for_answer().
{
static int deprecation_warning = 0;
const char *macro;
const char *macro_args;
int retval;
ast_channel_lock(macro_chan);
macro = pbx_builtin_getvar_helper(macro_chan, is_caller
? "REDIRECTING_CALLER_SEND_MACRO" : "REDIRECTING_CALLEE_SEND_MACRO");
macro = ast_strdupa(S_OR(macro, ""));
macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller
? "REDIRECTING_CALLER_SEND_MACRO_ARGS" : "REDIRECTING_CALLEE_SEND_MACRO_ARGS");
macro_args = ast_strdupa(S_OR(macro_args, ""));
if (ast_strlen_zero(macro)) {
ast_channel_unlock(macro_chan);
return -1;
}
if (!deprecation_warning) {
deprecation_warning = 1;
ast_log(LOG_WARNING, "Usage of REDIRECTING_CALLE[ER]_SEND_MACRO is deprecated. Please use REDIRECTING_SEND_SUB instead.\n");
}
if (is_frame) {
const struct ast_frame *frame = redirecting_info;
ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ast_channel_redirecting(macro_chan));
} else {
const struct ast_party_redirecting *redirecting = redirecting_info;
ast_party_redirecting_copy(ast_channel_redirecting(macro_chan), redirecting);
}
ast_channel_unlock(macro_chan);
retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args);
if (!retval) {
struct ast_party_redirecting saved_redirecting;
ast_party_redirecting_init(&saved_redirecting);
ast_channel_lock(macro_chan);
ast_party_redirecting_copy(&saved_redirecting, ast_channel_redirecting(macro_chan));
ast_channel_unlock(macro_chan);
ast_channel_update_redirecting(macro_chan, &saved_redirecting, NULL);
ast_party_redirecting_free(&saved_redirecting);
}
return retval;
}
| void ast_channel_redirecting_set | ( | struct ast_channel * | chan, |
| struct ast_party_redirecting * | value | ||
| ) |
Definition at line 1011 of file channel_internal_api.c.
References ast_channel::redirecting, and value.
Referenced by ast_do_masquerade().
{
chan->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.
Whenever we want to update a channel's redirecting 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 REDIRECTING_SEND_SUB and sends the update to the channel.
| autoservice_chan | Channel to place into autoservice while the subroutine 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. |
| redirecting_info | Either an ast_party_redirecting or ast_frame pointer of type AST_CONTROL_REDIRECTING |
| is_frame | If true, then redirecting_info is an ast_frame pointer, otherwise it is an ast_party_redirecting pointer. |
| 0 | Success |
| -1 | Either the subroutine does not exist, or there was an error while attempting to run the subroutine |
Definition at line 11013 of file channel.c.
References ast_app_run_sub(), ast_channel_lock, ast_channel_redirecting(), ast_channel_unlock, ast_channel_update_redirecting(), ast_party_redirecting_copy(), ast_party_redirecting_free(), ast_party_redirecting_init(), ast_redirecting_parse_data(), ast_strlen_zero(), ast_frame::data, ast_frame::datalen, pbx_builtin_getvar_helper(), ast_frame::ptr, S_OR, and sub.
Referenced by ast_bridge_call(), ast_generic_bridge(), call_forward_inherit(), do_forward(), feature_request_and_dial(), handle_frame(), local_bridge_loop(), remote_bridge_loop(), and wait_for_answer().
{
const char *sub;
const char *sub_args;
int retval;
ast_channel_lock(sub_chan);
sub = pbx_builtin_getvar_helper(sub_chan, "REDIRECTING_SEND_SUB");
sub = ast_strdupa(S_OR(sub, ""));
sub_args = pbx_builtin_getvar_helper(sub_chan, "REDIRECTING_SEND_SUB_ARGS");
sub_args = ast_strdupa(S_OR(sub_args, ""));
if (ast_strlen_zero(sub)) {
ast_channel_unlock(sub_chan);
return -1;
}
if (is_frame) {
const struct ast_frame *frame = redirecting_info;
ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ast_channel_redirecting(sub_chan));
} else {
const struct ast_party_redirecting *redirecting = redirecting_info;
ast_party_redirecting_copy(ast_channel_redirecting(sub_chan), redirecting);
}
ast_channel_unlock(sub_chan);
retval = ast_app_run_sub(autoservice_chan, sub_chan, sub, sub_args, 0);
if (!retval) {
struct ast_party_redirecting saved_redirecting;
ast_party_redirecting_init(&saved_redirecting);
ast_channel_lock(sub_chan);
ast_party_redirecting_copy(&saved_redirecting, ast_channel_redirecting(sub_chan));
ast_channel_unlock(sub_chan);
ast_channel_update_redirecting(sub_chan, &saved_redirecting, NULL);
ast_party_redirecting_free(&saved_redirecting);
}
return retval;
}
| 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.
| tech | Structure defining channel technology or "type" |
Definition at line 721 of file channel.c.
References ast_calloc, ast_debug, ast_log(), AST_RWLIST_INSERT_HEAD, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, chanlist::chan, LOG_WARNING, chanlist::tech, and ast_channel_tech::type.
Referenced by load_module(), and unload_module().
{
struct chanlist *chan;
AST_RWLIST_WRLOCK(&backends);
AST_RWLIST_TRAVERSE(&backends, chan, list) {
if (!strcasecmp(tech->type, chan->tech->type)) {
ast_log(LOG_WARNING, "Already have a handler for type '%s'\n", tech->type);
AST_RWLIST_UNLOCK(&backends);
return -1;
}
}
if (!(chan = ast_calloc(1, sizeof(*chan)))) {
AST_RWLIST_UNLOCK(&backends);
return -1;
}
chan->tech = tech;
AST_RWLIST_INSERT_HEAD(&backends, chan, list);
ast_debug(1, "Registered handler for '%s' (%s)\n", chan->tech->type, chan->tech->description);
ast_verb(2, "Registered channel type '%s' (%s)\n", chan->tech->type, chan->tech->description);
AST_RWLIST_UNLOCK(&backends);
return 0;
}
| struct ast_channel* ast_channel_release | ( | struct ast_channel * | chan | ) | [read] |
Unlink and release reference to a channel.
This function will unlink the channel from the global channels container if it is still there and also release the current reference to the channel.
Definition at line 1749 of file channel.c.
References ao2_unlink, ast_channel_unref, and channels.
Referenced by agent_cleanup(), ast_iax2_new(), ast_request(), bridge_request(), destroy_msg_q_chan(), do_notify(), gtalk_newcall(), local_new(), and local_request().
{
/* Safe, even if already unlinked. */
ao2_unlink(channels, chan);
return ast_channel_unref(chan);
}
| int ast_channel_rings | ( | const struct ast_channel * | chan | ) |
Definition at line 598 of file channel_internal_api.c.
References ast_channel::rings.
Referenced by __analog_handle_event(), ast_var_channels_table(), handle_showchan(), and serialize_showchan().
{
return chan->rings;
}
| void ast_channel_rings_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 602 of file channel_internal_api.c.
References ast_channel::rings, and value.
Referenced by __analog_handle_event(), __analog_ss_thread(), __oh323_new(), analog_ss_thread(), cb_events(), dahdi_handle_event(), dahdi_new(), gtalk_new(), jingle_new(), mgcp_new(), misdn_new(), nbs_new(), phone_answer(), phone_new(), sip_new(), skinny_new(), and unistim_new().
| struct ast_sched_context* ast_channel_sched | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 806 of file channel_internal_api.c.
References ast_channel::sched.
Referenced by ast_channel_destructor(), ast_hangup(), ast_readaudio_callback(), ast_readvideo_callback(), background_detect_exec(), dial_exec_full(), filestream_close(), handle_speechrecognize(), speech_background(), wait_for_winner(), and waitstream_core().
{
return chan->sched;
}
| void ast_channel_sched_set | ( | struct ast_channel * | chan, |
| struct ast_sched_context * | value | ||
| ) |
Definition at line 810 of file channel_internal_api.c.
References ast_channel::sched, and value.
Referenced by __ast_channel_alloc_ap(), and ast_hangup().
| 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.
Definition at line 6150 of file channel.c.
References ast_channel_tech(), and ast_channel_tech::send_html.
Referenced by agent_sendhtml(), ast_channel_sendurl(), and wait_for_answer().
{
if (ast_channel_tech(chan)->send_html)
return ast_channel_tech(chan)->send_html(chan, subclass, data, datalen);
return -1;
}
| char ast_channel_sending_dtmf_digit | ( | const struct ast_channel * | chan | ) |
Definition at line 530 of file channel_internal_api.c.
References ast_channel::sending_dtmf_digit.
Referenced by ast_bridge_call(), ast_do_masquerade(), and ast_senddigit_end().
{
return chan->sending_dtmf_digit;
}
| void ast_channel_sending_dtmf_digit_set | ( | struct ast_channel * | chan, |
| char | value | ||
| ) |
Definition at line 534 of file channel_internal_api.c.
References ast_channel::sending_dtmf_digit, and value.
Referenced by ast_senddigit_begin(), and ast_senddigit_end().
{
chan->sending_dtmf_digit = value;
}
| struct timeval ast_channel_sending_dtmf_tv | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 539 of file channel_internal_api.c.
Referenced by ast_bridge_call(), and ast_do_masquerade().
{
return chan->sending_dtmf_tv;
}
| void ast_channel_sending_dtmf_tv_set | ( | struct ast_channel * | chan, |
| struct timeval | value | ||
| ) |
Definition at line 543 of file channel_internal_api.c.
References ast_channel::sending_dtmf_tv, and value.
Referenced by ast_senddigit_begin().
{
chan->sending_dtmf_tv = value;
}
| int ast_channel_sendurl | ( | struct ast_channel * | channel, |
| const char * | url | ||
| ) |
Sends a URL on a given link Send URL on link.
Definition at line 6157 of file channel.c.
References ast_channel_sendhtml(), and AST_HTML_URL.
Referenced by dial_exec_full(), sendurl_exec(), and try_calling().
{
return ast_channel_sendhtml(chan, AST_HTML_URL, url, strlen(url) + 1);
}
| 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.
| chan | Asterisk channel to set caller id information |
| caller | Caller id information |
| update | What caller information to update. NULL if all. |
Definition at line 7349 of file channel.c.
References ast_channel_caller(), ast_channel_lock, ast_channel_unlock, and ast_party_caller_set().
{
if (ast_channel_caller(chan) == caller) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
ast_party_caller_set(ast_channel_caller(chan), caller, update);
ast_channel_unlock(chan);
}
| 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.
| chan | Asterisk channel to set caller id information |
| caller | Caller id information |
| update | What caller information to update. NULL if all. |
Definition at line 7361 of file channel.c.
References ast_cdr_setcid(), ast_channel_caller(), ast_channel_cdr(), ast_channel_lock, ast_channel_unlock, ast_party_caller_set(), name, report_new_callerid(), and S_COR.
Referenced by callerid_write(), dial_exec_full(), do_forward(), misdn_update_caller_id(), ring_entry(), and sig_pri_handle_subcmds().
{
const char *pre_set_number;
const char *pre_set_name;
if (ast_channel_caller(chan) == caller) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
pre_set_number =
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL);
pre_set_name = S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL);
ast_party_caller_set(ast_channel_caller(chan), caller, update);
if (S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL)
!= pre_set_number
|| S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL)
!= pre_set_name) {
/* The caller id name or number changed. */
report_new_callerid(chan);
}
if (ast_channel_cdr(chan)) {
ast_cdr_setcid(ast_channel_cdr(chan), chan);
}
ast_channel_unlock(chan);
}
| 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.
| chan | Asterisk channel to set connected line information |
| connected | Connected line information |
| update | What connected line information to update. NULL if all. |
Definition at line 8933 of file channel.c.
References ast_channel_connected(), ast_channel_lock, ast_channel_unlock, and ast_party_connected_line_set().
Referenced by __ast_request_and_dial(), ast_indicate_data(), connectedline_write(), dial_exec_full(), and feature_request_and_dial().
{
if (ast_channel_connected(chan) == connected) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
ast_party_connected_line_set(ast_channel_connected(chan), connected, update);
ast_channel_unlock(chan);
}
| void ast_channel_set_fd | ( | struct ast_channel * | chan, |
| int | which, | ||
| int | fd | ||
| ) |
Set the file descriptor on the channel
Definition at line 2555 of file channel.c.
References ast_calloc, ast_channel_epfd(), ast_channel_fd(), ast_channel_fd_isset(), ast_channel_internal_fd_set(), ast_free, ast_epoll_data::chan, chanlist::chan, and ast_epoll_data::which.
Referenced by __ast_channel_alloc_ap(), __oh323_new(), __oh323_rtp_create(), __oh323_update_info(), alsa_new(), ast_deactivate_generator(), ast_do_masquerade(), dahdi_new(), gtalk_new(), initialize_udptl(), internal_deactivate_generator(), jb_helper(), jingle_enable_video(), jingle_new(), mgcp_new(), misdn_new(), my_swap_subchannels(), nbs_new(), oss_new(), phone_new(), process_sdp(), setformat(), sip_new(), sip_set_rtp_peer(), skinny_new(), start_rtp(), and swap_subs().
{
#ifdef HAVE_EPOLL
struct epoll_event ev;
struct ast_epoll_data *aed = NULL;
if (ast_channel_fd_isset(chan, which)) {
epoll_ctl(ast_channel_epfd(chan), EPOLL_CTL_DEL, ast_channel_fd(chan, which), &ev);
aed = ast_channel_internal_epfd_data(chan, which);
}
/* If this new fd is valid, add it to the epoll */
if (fd > -1) {
if (!aed && (!(aed = ast_calloc(1, sizeof(*aed)))))
return;
ast_channel_internal_epfd_data_set(chan, which, aed);
aed->chan = chan;
aed->which = which;
ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP;
ev.data.ptr = aed;
epoll_ctl(ast_channel_epfd(chan), EPOLL_CTL_ADD, fd, &ev);
} else if (aed) {
/* We don't have to keep around this epoll data structure now */
ast_free(aed);
ast_channel_epfd_data_set(chan, which, NULL);
}
#endif
ast_channel_internal_fd_set(chan, which, fd);
return;
}
| void ast_channel_set_linkgroup | ( | struct ast_channel * | chan, |
| struct ast_channel * | peer | ||
| ) |
propagate the linked id between chan and peer
Definition at line 6643 of file channel.c.
References ast_bridged_channel(), ast_channel_change_linkedid(), ast_channel_internal_bridged_channel(), ast_channel_linkedid(), ast_channel_uniqueid(), and oldest_linkedid().
Referenced by ast_bridge_call(), and ast_do_masquerade().
{
const char* linkedid=NULL;
struct ast_channel *bridged;
linkedid = oldest_linkedid(ast_channel_linkedid(chan), ast_channel_linkedid(peer));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(chan));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(peer));
if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan);
if (bridged && bridged != peer) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged));
}
}
if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer);
if (bridged && bridged != chan) {
linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged));
linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged));
}
}
/* just in case setting a stringfield to itself causes problems */
linkedid = ast_strdupa(linkedid);
ast_channel_change_linkedid(chan, linkedid);
ast_channel_change_linkedid(peer, linkedid);
if (ast_channel_internal_bridged_channel(chan)) {
bridged = ast_bridged_channel(chan);
if (bridged && bridged != peer) {
ast_channel_change_linkedid(bridged, linkedid);
}
}
if (ast_channel_internal_bridged_channel(peer)) {
bridged = ast_bridged_channel(peer);
if (bridged && bridged != chan) {
ast_channel_change_linkedid(bridged, linkedid);
}
}
}
| 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.
| chan | Asterisk channel to set redirecting id information |
| redirecting | Redirecting id information |
| update | What redirecting information to update. NULL if all. |
Definition at line 9742 of file channel.c.
References ast_channel_lock, ast_channel_redirecting(), ast_channel_unlock, and ast_party_redirecting_set().
Referenced by ast_indicate_data(), handle_request_invite(), handle_response(), misdn_copy_redirecting_to_ast(), redirecting_write(), and sig_pri_handle_subcmds().
{
if (ast_channel_redirecting(chan) == redirecting) {
/* Don't set to self */
return;
}
ast_channel_lock(chan);
ast_party_redirecting_set(ast_channel_redirecting(chan), redirecting, update);
ast_channel_unlock(chan);
}
| int ast_channel_setoption | ( | struct ast_channel * | channel, |
| int | option, | ||
| void * | data, | ||
| int | datalen, | ||
| int | block | ||
| ) |
Sets an option on a channel.
| channel | channel to set options on |
| option | option to change |
| data | data specific to option |
| datalen | length of the data |
| block | blocking or not |
Set an option on a channel (see frame.h), optionally blocking awaiting the reply
Definition at line 8111 of file channel.c.
References ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_log(), errno, LOG_ERROR, and ast_channel_tech::setoption.
Referenced by analog_hangup(), ast_bridge_call(), ast_channel_make_compatible_helper(), common_exec(), conf_run(), dahdi_hangup(), dial_exec_full(), func_channel_write(), func_channel_write_real(), handle_tddmode(), play_record_review(), rcvfax_exec(), reset_volumes(), set_format(), set_listen_volume(), set_security_requirements(), set_talk_volume(), sndfax_exec(), try_calling(), and vm_forwardoptions().
{
int res;
ast_channel_lock(chan);
if (!ast_channel_tech(chan)->setoption) {
errno = ENOSYS;
ast_channel_unlock(chan);
return -1;
}
if (block)
ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n");
res = ast_channel_tech(chan)->setoption(chan, option, data, datalen);
ast_channel_unlock(chan);
return res;
}
| void ast_channel_setwhentohangup | ( | struct ast_channel * | chan, |
| time_t | offset | ||
| ) |
Set when to hang a channel up.
| chan | channel on which to check for hang up |
| offset | offset in seconds relative to the current time of when to hang up |
This function sets the absolute time out on a channel (when to hang up).
Definition at line 692 of file channel.c.
References ast_channel_setwhentohangup_tv().
{
struct timeval when = { offset, };
ast_channel_setwhentohangup_tv(chan, when);
}
| void ast_channel_setwhentohangup_tv | ( | struct ast_channel * | chan, |
| struct timeval | offset | ||
| ) |
Set when to hang a channel up.
| chan | channel on which to check for hang up |
| offset | offset in seconds and useconds relative to the current time of when to hang up |
This function sets the absolute time out on a channel (when to hang up).
Definition at line 680 of file channel.c.
References ast_channel_whentohangup_set(), ast_null_frame, ast_queue_frame(), ast_tvadd(), ast_tvnow(), and ast_tvzero().
Referenced by action_timeout(), ast_channel_setwhentohangup(), handle_autohangup(), sig_pri_send_aoce_termination_request(), and timeout_write().
{
if (ast_tvzero(offset)) {
ast_channel_whentohangup_set(chan, &offset);
} else {
struct timeval tv = ast_tvadd(offset, ast_tvnow());
ast_channel_whentohangup_set(chan, &tv);
}
ast_queue_frame(chan, &ast_null_frame);
return;
}
| int ast_channel_softhangup_internal_flag | ( | struct ast_channel * | chan | ) |
Definition at line 1037 of file channel_internal_api.c.
References ast_channel::softhangup.
Referenced by __ast_pbx_run(), __ast_read(), ast_autoservice_stop(), ast_bridge_call(), ast_bridge_end_dtmf(), ast_channel_bridge(), ast_channel_clear_softhangup(), ast_channel_data_add_structure(), ast_check_hangup(), ast_generic_bridge(), collect_digits(), gosub_run(), try_calling(), and waitstream_core().
{
return chan->softhangup;
}
| void ast_channel_softhangup_internal_flag_add | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 1045 of file channel_internal_api.c.
References ast_channel::softhangup, and value.
Referenced by __ast_read(), __oh323_update_info(), __sip_destroy(), ast_check_hangup(), ast_dsp_process(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_softhangup_nolock(), ast_waitfor_nandfds(), ast_write(), attempt_transfer(), cleanup_connection(), dahdi_handle_event(), dahdi_r2_on_call_disconnect(), dahdi_r2_on_protocol_error(), hangup_connection(), iax2_bridge(), pri_dchannel(), sig_pri_chan_alarm_notify(), and sig_pri_indicate().
{
chan->softhangup |= value;
}
| void ast_channel_softhangup_internal_flag_clear | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 1049 of file channel_internal_api.c.
References ast_channel::softhangup.
Referenced by ast_channel_clear_softhangup().
{
chan ->softhangup &= ~value;
}
| void ast_channel_softhangup_internal_flag_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 1041 of file channel_internal_api.c.
References ast_channel::softhangup, and value.
Referenced by ast_do_masquerade().
{
chan->softhangup = 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.
| chan | channel on which to hang up |
| causecode | cause code to use (Zero if don't use cause code) |
Definition at line 622 of file channel.c.
References ast_channel_hangupcause(), ast_channel_hangupcause_set(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_debug, AST_SOFTHANGUP_EXPLICIT, and ast_softhangup_nolock().
Referenced by action_hangup().
{
ast_channel_lock(chan);
if (causecode > 0) {
ast_debug(1, "Setting hangupcause of channel %s to %d (is %d now)\n",
ast_channel_name(chan), causecode, ast_channel_hangupcause(chan));
ast_channel_hangupcause_set(chan, causecode);
}
ast_softhangup_nolock(chan, AST_SOFTHANGUP_EXPLICIT);
ast_channel_unlock(chan);
}
| struct ast_silence_generator* ast_channel_start_silence_generator | ( | struct ast_channel * | chan | ) | [read] |
Starts a silence generator on the given channel.
| chan | The channel to generate silence on |
This function will cause SLINEAR silence to be generated on the supplied channel until it is disabled; if the channel cannot be put into SLINEAR mode then the function will fail.
Definition at line 8780 of file channel.c.
References ast_activate_generator(), ast_calloc, ast_channel_name(), ast_channel_writeformat(), ast_debug, ast_format_copy(), AST_FORMAT_SLINEAR, ast_free, ast_log(), ast_set_write_format_by_id(), LOG_ERROR, ast_silence_generator::old_write_format, and state.
Referenced by __ast_play_and_record(), ast_bridge_call(), ast_dtmf_stream(), ast_readstring_full(), ast_safe_sleep_conditional(), channel_spy(), record_exec(), sub_start_silence(), waitfor_exec(), and waitforring_exec().
{
struct ast_silence_generator *state;
if (!(state = ast_calloc(1, sizeof(*state)))) {
return NULL;
}
ast_format_copy(&state->old_write_format, ast_channel_writeformat(chan));
if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) {
ast_log(LOG_ERROR, "Could not set write format to SLINEAR\n");
ast_free(state);
return NULL;
}
ast_activate_generator(chan, &silence_generator, state);
ast_debug(1, "Started silence generator on '%s'\n", ast_channel_name(chan));
return state;
}
| enum ast_channel_state ast_channel_state | ( | const struct ast_channel * | chan | ) |
Definition at line 862 of file channel_internal_api.c.
References ast_channel::state.
{
return chan->state;
}
| void ast_channel_state_set | ( | struct ast_channel * | chan, |
| enum | ast_channel_state | ||
| ) |
Definition at line 899 of file channel_internal_api.c.
References ast_channel::state, and value.
Referenced by __ast_channel_alloc_ap(), ast_do_masquerade(), ast_setstate(), builtin_atxfer(), and check_goto_on_transfer().
| 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.
| chan | The channel to operate on |
| state | The ast_silence_generator pointer return by a previous call to ast_channel_start_silence_generator. |
This function will stop the operating silence generator and return the channel to its previous write format.
Definition at line 8832 of file channel.c.
References ast_channel_name(), ast_debug, ast_free, ast_log(), ast_set_write_format(), internal_deactivate_generator(), LOG_ERROR, and ast_silence_generator::old_write_format.
Referenced by __ast_play_and_record(), ast_bridge_call(), ast_dtmf_stream(), ast_readstring_full(), ast_safe_sleep_conditional(), channel_spy(), record_exec(), sub_stop_silence(), waitfor_exec(), and waitforring_exec().
{
if (!state)
return;
if (internal_deactivate_generator(chan, &silence_generator)) {
ast_debug(1, "Stopped silence generator on '%s'\n", ast_channel_name(chan));
if (ast_set_write_format(chan, &state->old_write_format) < 0)
ast_log(LOG_ERROR, "Could not return write format to its original state\n");
}
ast_free(state);
}
| struct ast_filestream* ast_channel_stream | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 758 of file channel_internal_api.c.
References ast_channel::stream.
Referenced by ast_hangup(), ast_moh_files_next(), ast_openstream_full(), ast_readstring_full(), ast_stopstream(), background_detect_exec(), control_streamfile(), dial_exec_full(), filehelper(), handle_getoption(), handle_speechrecognize(), handle_streamfile(), local_ast_moh_stop(), moh_files_readframe(), moh_files_release(), speech_background(), wait_for_winner(), and waitstream_core().
{
return chan->stream;
}
| void ast_channel_stream_set | ( | struct ast_channel * | chan, |
| struct ast_filestream * | value | ||
| ) |
Definition at line 762 of file channel_internal_api.c.
References ast_channel::stream, and value.
Referenced by ast_hangup(), ast_moh_files_next(), ast_stopstream(), dictate_exec(), filehelper(), filestream_close(), gen_closestream(), handle_recordfile(), local_ast_moh_stop(), and moh_files_release().
| int ast_channel_streamid | ( | const struct ast_channel * | chan | ) |
Definition at line 606 of file channel_internal_api.c.
References ast_channel::streamid.
Referenced by filestream_close(), handle_speechrecognize(), and speech_background().
{
return chan->streamid;
}
| void ast_channel_streamid_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 610 of file channel_internal_api.c.
References ast_channel::streamid, and value.
Referenced by __ast_channel_alloc_ap(), ast_readaudio_callback(), and filestream_close().
| int ast_channel_supports_html | ( | struct ast_channel * | channel | ) |
Checks for HTML support on a channel.
Definition at line 6145 of file channel.c.
References ast_channel_tech().
Referenced by dial_exec_full(), sendurl_exec(), and try_calling().
{
return (ast_channel_tech(chan)->send_html) ? 1 : 0;
}
| struct ast_channel_tech* ast_channel_tech | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 846 of file channel_internal_api.c.
References ast_channel::tech.
Referenced by __ast_channel_masquerade(), __ast_read(), acf_channel_read(), agent_indicate(), agent_read(), analog_ss_thread(), ast_bridged_channel(), ast_call(), ast_channel_bridge(), ast_channel_early_bridge(), ast_channel_make_compatible_helper(), ast_channel_queryoption(), ast_channel_sendhtml(), ast_channel_setoption(), ast_channel_supports_html(), ast_do_masquerade(), ast_hangup(), ast_indicate_data(), ast_jb_do_usecheck(), ast_pre_call(), ast_raw_answer(), ast_rtp_dtmf_compatible(), ast_rtp_instance_bridge(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_rtp_instance_make_compatible(), ast_send_image(), ast_senddigit(), ast_senddigit_begin(), ast_senddigit_end(), ast_sendtext(), ast_supports_images(), ast_transfer(), ast_var_channel_types_table(), ast_var_channels_table(), ast_write(), ast_write_video(), conf_run(), dahdi_accept_r2_call_exec(), dahdi_pri_cc_agent_init(), dahdi_send_callrerouting_facility_exec(), dahdi_setoption(), dahdiras_exec(), destroy_conference_bridge(), flash_exec(), func_channel_read(), func_channel_write_real(), func_header_read(), function_iaxpeer(), function_sipchaninfo_read(), handle_request_bye(), handle_showchan(), iax2_bridge(), iax2_prov_app(), misdn_facility_exec(), misdn_set_opt_exec(), my_get_sigpvt_bridged_channel(), park_call_full(), play_sound_helper(), remote_bridge_loop(), sendtext_exec(), serialize_showchan(), setup_env(), sip_acf_channel_read(), sip_cc_agent_init(), sip_dtmfmode(), sip_hangup(), sipinfo_send(), softhangup_exec(), transfer_exec(), try_calling(), and update_bridge_vars().
{
return chan->tech;
}
| void* ast_channel_tech_pvt | ( | const struct ast_channel * | chan | ) |
Definition at line 702 of file channel_internal_api.c.
References ast_channel::tech_pvt.
Referenced by __analog_ss_thread(), __dahdi_exception(), acf_channel_read(), agent_bridgedchannel(), agent_call(), agent_digit_begin(), agent_digit_end(), agent_fixup(), agent_get_base_channel(), agent_hangup(), agent_indicate(), agent_read(), agent_sendhtml(), agent_sendtext(), agent_start_monitoring(), agent_write(), alsa_fixup(), analog_hangup(), analog_ss_thread(), ast_channel_destructor(), ast_do_masquerade(), ast_generic_bridge(), ast_rtp_instance_bridge(), ast_udptl_bridge(), bridge_bridgedchannel(), bridge_call(), bridge_hangup(), bridge_write(), channel_to_session(), console_answer(), console_call(), console_fixup(), console_hangup(), console_indicate(), console_write(), dahdi_accept_r2_call_exec(), dahdi_answer(), dahdi_bridge(), dahdi_call(), dahdi_callwait(), dahdi_digit_begin(), dahdi_digit_end(), dahdi_exception(), dahdi_fixup(), dahdi_func_read(), dahdi_func_write(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_indicate(), dahdi_pri_cc_agent_init(), dahdi_queryoption(), dahdi_r2_get_channel_category(), dahdi_read(), dahdi_send_callrerouting_facility_exec(), dahdi_send_keypad_facility_exec(), dahdi_sendtext(), dahdi_setoption(), dahdi_write(), dialog_unlink_all(), func_header_read(), function_iaxpeer(), function_sipchaninfo_read(), get_video_desc(), gtalk_answer(), gtalk_call(), gtalk_digit_begin(), gtalk_digit_end(), gtalk_fixup(), gtalk_get_codec(), gtalk_get_rtp_peer(), gtalk_hangup(), gtalk_read(), gtalk_sendtext(), gtalk_set_rtp_peer(), gtalk_write(), handle_enbloc_call_message(), handle_offhook_message(), handle_request_bye(), handle_soft_key_event_message(), handle_stimulus_message(), handle_transfer_button(), iax2_answer(), iax2_bridge(), iax2_call(), iax2_digit_begin(), iax2_digit_end(), iax2_fixup(), iax2_hangup(), iax2_indicate(), iax2_prov_app(), iax2_queryoption(), iax2_sendhtml(), iax2_sendimage(), iax2_sendtext(), iax2_setoption(), iax2_transfer(), iax2_write(), jingle_answer(), jingle_call(), jingle_digit(), jingle_digit_begin(), jingle_digit_end(), jingle_fixup(), jingle_get_codec(), jingle_get_rtp_peer(), jingle_hangup(), jingle_indicate(), jingle_read(), jingle_sendtext(), jingle_set_rtp_peer(), jingle_write(), local_answer(), local_bridge_loop(), local_bridgedchannel(), local_call(), local_digit_begin(), local_digit_end(), local_fixup(), local_hangup(), local_indicate(), local_queryoption(), local_sendhtml(), local_sendtext(), local_setoption(), local_write(), manager_optimize_away(), mgcp_answer(), mgcp_call(), mgcp_fixup(), mgcp_get_codec(), mgcp_get_rtp_peer(), mgcp_hangup(), mgcp_indicate(), mgcp_read(), mgcp_senddigit_begin(), mgcp_senddigit_end(), mgcp_set_rtp_peer(), mgcp_ss(), mgcp_write(), multicast_rtp_call(), multicast_rtp_hangup(), multicast_rtp_write(), my_get_sigpvt_bridged_channel(), nbs_call(), nbs_hangup(), nbs_xread(), nbs_xwrite(), oh323_answer(), oh323_call(), oh323_digit_begin(), oh323_digit_end(), oh323_fixup(), oh323_get_rtp_peer(), oh323_hangup(), oh323_indicate(), oh323_read(), oh323_set_rtp_peer(), oh323_update_info(), oh323_write(), oss_answer(), oss_call(), oss_fixup(), oss_hangup(), oss_indicate(), oss_read(), oss_write(), phone_answer(), phone_call(), phone_digit_end(), phone_exception(), phone_fixup(), phone_hangup(), phone_indicate(), phone_read(), phone_send_text(), phone_setup(), phone_write(), pri_ss_thread(), remote_bridge_loop(), sig_pri_hangup(), sig_ss7_hangup(), sip_acf_channel_read(), sip_allow_anyrtp_remote(), sip_answer(), sip_call(), sip_cc_agent_init(), sip_dtmfmode(), sip_fixup(), sip_get_callid(), sip_get_codec(), sip_get_rtp_peer(), sip_get_trtp_peer(), sip_get_udptl_peer(), sip_get_vrtp_peer(), sip_hangup(), sip_indicate(), sip_park_thread(), sip_queryoption(), sip_read(), sip_senddigit_begin(), sip_senddigit_end(), sip_sendhtml(), sip_sendtext(), sip_set_rtp_peer(), sip_set_udptl_peer(), sip_setoption(), sip_transfer(), sip_write(), sipinfo_send(), skinny_answer(), skinny_call(), skinny_fixup(), skinny_get_rtp_peer(), skinny_get_vrtp_peer(), skinny_hangup(), skinny_indicate(), skinny_newcall(), skinny_read(), skinny_request(), skinny_set_rtp_peer(), skinny_write(), unistim_answer(), unistim_call(), unistim_fixup(), unistim_get_rtp_peer(), unistim_hangup(), unistim_indicate(), unistim_read(), unistim_set_rtp_peer(), unistim_ss(), and unistim_write().
{
return chan->tech_pvt;
}
| void ast_channel_tech_pvt_set | ( | struct ast_channel * | chan, |
| void * | value | ||
| ) |
Definition at line 706 of file channel_internal_api.c.
References ast_channel::tech_pvt, and value.
Referenced by __oh323_destroy(), __oh323_new(), __sip_destroy(), agent_cleanup(), agent_hangup(), agent_new(), alsa_hangup(), alsa_new(), ast_do_masquerade(), ast_iax2_new(), bridge_hangup(), bridge_request(), console_hangup(), console_new(), dahdi_hangup(), dahdi_new(), destroy_dahdi_pvt(), dialog_unlink_all(), gtalk_hangup(), gtalk_new(), iax2_hangup(), iax2_predestroy(), jingle_hangup(), jingle_new(), kill_hangup(), local_hangup(), local_new(), mgcp_hangup(), mgcp_new(), multicast_rtp_hangup(), multicast_rtp_request(), my_pri_fixup_chans(), nbs_hangup(), nbs_new(), oh323_hangup(), oss_hangup(), oss_new(), phone_hangup(), phone_new(), sip_hangup(), sip_new(), skinny_hangup(), skinny_new(), unistim_hangup_clean(), and unistim_new().
| void ast_channel_tech_set | ( | struct ast_channel * | chan, |
| const struct ast_channel_tech * | value | ||
| ) |
Definition at line 850 of file channel_internal_api.c.
References ast_channel::tech, and value.
Referenced by __ast_channel_alloc_ap(), __oh323_new(), agent_new(), alsa_new(), ast_do_masquerade(), ast_iax2_new(), bridge_request(), console_new(), create_msg_q_chan(), dahdi_new(), do_notify(), gtalk_new(), jingle_new(), local_new(), mgcp_new(), misdn_new(), multicast_rtp_request(), nbs_new(), oss_new(), phone_new(), rec_request(), sip_new(), skinny_new(), and unistim_new().
| struct ast_timer* ast_channel_timer | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 814 of file channel_internal_api.c.
References ast_channel::timer.
Referenced by __ast_channel_alloc_ap(), __ast_queue_frame(), __ast_read(), ast_channel_destructor(), and ast_settimeout_full().
{
return chan->timer;
}
| void ast_channel_timer_set | ( | struct ast_channel * | chan, |
| struct ast_timer * | value | ||
| ) |
Definition at line 818 of file channel_internal_api.c.
References ast_channel::timer, and value.
Referenced by __ast_channel_alloc_ap(), and ast_channel_destructor().
| void* ast_channel_timingdata | ( | const struct ast_channel * | chan | ) |
Definition at line 710 of file channel_internal_api.c.
References ast_channel::timingdata.
Referenced by __ast_read(), and ast_settimeout_full().
{
return chan->timingdata;
}
| void ast_channel_timingdata_set | ( | struct ast_channel * | chan, |
| void * | value | ||
| ) |
Definition at line 714 of file channel_internal_api.c.
References ast_channel::timingdata, and value.
Referenced by ast_settimeout_full().
{
chan->timingdata = value;
}
| int ast_channel_timingfd | ( | const struct ast_channel * | chan | ) |
Definition at line 614 of file channel_internal_api.c.
References ast_channel::timingfd.
Referenced by __ast_channel_alloc_ap(), __ast_queue_frame(), __ast_read(), ast_do_masquerade(), ast_internal_timing_enabled(), ast_read_generator_actions(), ast_readaudio_callback(), and ast_settimeout_full().
{
return chan->timingfd;
}
| void ast_channel_timingfd_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 618 of file channel_internal_api.c.
References ast_channel::timingfd, and value.
Referenced by __ast_channel_alloc_ap(), and ast_dummy_channel_alloc().
| ast_timing_func_t ast_channel_timingfunc | ( | const struct ast_channel * | chan | ) |
Definition at line 1236 of file channel_internal_api.c.
References ast_channel::timingfunc.
Referenced by __ast_read(), ast_read_generator_actions(), background_detect_exec(), dial_exec_full(), handle_speechrecognize(), speech_background(), wait_for_winner(), and waitstream_core().
{
return chan->timingfunc;
}
| void ast_channel_timingfunc_set | ( | struct ast_channel * | chan, |
| ast_timing_func_t | value | ||
| ) |
Definition at line 1240 of file channel_internal_api.c.
References ast_channel::timingfunc, and value.
Referenced by ast_settimeout_full().
{
chan->timingfunc = value;
}
| int ast_channel_transfer_masquerade | ( | struct ast_channel * | target_chan, |
| const struct ast_party_connected_line * | target_id, | ||
| int | target_held, | ||
| struct ast_channel * | transferee_chan, | ||
| const struct ast_party_connected_line * | transferee_id, | ||
| int | transferee_held | ||
| ) |
Setup a masquerade to transfer a call.
| target_chan | Target of the call transfer. (Masquerade original channel) |
| target_id | New connected line information for the target channel. |
| target_held | TRUE if the target call is on hold. |
| transferee_chan | Transferee of the call transfer. (Masquerade clone channel) |
| transferee_id | New connected line information for the transferee channel. |
| transferee_held | TRUE if the transferee call is on hold. |
Party A - Transferee Party B - Transferer Party C - Target of transfer
Party B transfers A to C.
Party A is connected to bridged channel B1. Party B is connected to channels C1 and C2. Party C is connected to bridged channel B2.
Party B -- C1 == B1 -- Party A __/ / Party B -- C2 == B2 -- Party C
Bridged channel B1 is masqueraded into channel C2. Where B1 is the masquerade clone channel and C2 is the masquerade original channel.
| 0 | on success. |
| -1 | on error. |
Definition at line 6435 of file channel.c.
References __ast_channel_masquerade(), ast_calloc, ast_datastore_alloc(), ast_datastore_free(), ast_datastore::data, party_connected_line_copy_transfer(), xfer_masquerade_ds::target_held, xfer_masquerade_ds::target_id, xfer_masquerade_ds::transferee_held, and xfer_masquerade_ds::transferee_id.
Referenced by analog_attempt_transfer(), misdn_attempt_transfer(), and sig_pri_attempt_transfer().
{
struct ast_datastore *xfer_ds;
struct xfer_masquerade_ds *xfer_colp;
int res;
xfer_ds = ast_datastore_alloc(&xfer_ds_info, NULL);
if (!xfer_ds) {
return -1;
}
xfer_colp = ast_calloc(1, sizeof(*xfer_colp));
if (!xfer_colp) {
ast_datastore_free(xfer_ds);
return -1;
}
party_connected_line_copy_transfer(&xfer_colp->target_id, target_id);
xfer_colp->target_held = target_held;
party_connected_line_copy_transfer(&xfer_colp->transferee_id, transferee_id);
xfer_colp->transferee_held = transferee_held;
xfer_ds->data = xfer_colp;
res = __ast_channel_masquerade(target_chan, transferee_chan, xfer_ds);
if (res) {
ast_datastore_free(xfer_ds);
}
return res;
}
| unsigned short ast_channel_transfercapability | ( | const struct ast_channel * | chan | ) |
Definition at line 638 of file channel_internal_api.c.
References ast_channel::transfercapability.
Referenced by ast_channel_data_add_structure(), ast_var_channels_table(), begin_dial_channel(), dahdi_call(), dial_exec_full(), func_channel_read(), misdn_call(), oh323_call(), and sig_pri_call().
{
return chan->transfercapability;
}
| void ast_channel_transfercapability_set | ( | struct ast_channel * | chan, |
| unsigned short | value | ||
| ) |
Definition at line 642 of file channel_internal_api.c.
References ast_channel::transfercapability, and value.
Referenced by __oh323_new(), begin_dial_channel(), cb_events(), dial_exec_full(), func_channel_write_real(), sig_pri_new_ast_channel(), and sig_ss7_new_ast_channel().
{
chan->transfercapability = value;
}
| void ast_channel_undefer_dtmf | ( | struct ast_channel * | chan | ) |
Unset defer DTMF flag on channel.
Undo defer. ast_read will return any DTMF characters that were queued
Definition at line 1451 of file channel.c.
References ast_channel_flags(), ast_clear_flag, and AST_FLAG_DEFER_DTMF.
Referenced by __adsi_transmit_messages(), and find_cache().
{
if (chan)
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF);
}
| const char* ast_channel_uniqueid | ( | const struct ast_channel * | chan | ) |
Referenced by __agent_start_monitoring(), __ast_change_name_nolink(), __ast_channel_alloc_ap(), action_coreshowchannels(), action_dahdishowchannels(), action_status(), aoc_d_event(), aoc_e_event(), aoc_request_event(), aoc_s_event(), app_exec(), aqm_exec(), ast_bridge_call(), ast_cdr_init(), ast_cdr_setaccount(), ast_cdr_setpeeraccount(), ast_cel_report_event(), ast_channel_by_uniqueid_cb(), ast_channel_log(), ast_channel_set_linkgroup(), ast_hangup(), ast_monitor_start(), ast_monitor_stop(), ast_pbx_hangup_handler_pop(), ast_pbx_hangup_handler_push(), ast_pbx_hangup_handler_run(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_setstate(), ast_softhangup(), ast_str_retrieve_variable(), ast_var_channels_table(), build_conf(), change_hold_state(), check_rtp_timeout(), conf_handle_talker_cb(), conf_rec_name(), conf_run(), dahdi_ami_channel_event(), fast_originate(), fax_session_new(), find_conf_realtime(), frame_set_var(), func_channel_read(), handle_chanlist(), handle_request_refer(), handle_response_invite(), handle_showchan(), join_queue(), leave_queue(), local_ast_moh_start(), local_ast_moh_stop(), local_attended_transfer(), local_call(), login_exec(), manager_bridge_event(), manager_queues_status(), meetme_menu_admin_extended(), meetmemute(), park_call_full(), parked_call_exec(), pbx_builtin_setvar_helper(), pbx_extension_helper(), post_manager_event(), proc_session_timer(), queue_exec(), queue_transfer_fixup(), realtime_exec(), record_abandoned(), report_new_callerid(), ring_entry(), rna(), rqm_exec(), send_agent_complete(), send_dtmf_event(), send_join_event(), send_leave_event(), send_talking_event(), senddialendevent(), senddialevent(), serialize_showchan(), setup_env(), shared_write(), sig_pri_ami_hold_event(), sig_pri_mcid_event(), sip_new(), socket_process_helper(), try_calling(), userevent_exec(), and wait_our_turn().
| void ast_channel_unlink | ( | struct ast_channel * | chan | ) |
Remove a channel from the global channels container.
| chan | channel to remove |
In a case where it is desired that a channel not be available in any lookups in the global channels conatiner, use this function.
Definition at line 11191 of file channel.c.
References ao2_unlink, and channels.
Referenced by create_msg_q_chan().
{
ao2_unlink(channels, chan);
}
| void ast_channel_unregister | ( | const struct ast_channel_tech * | tech | ) |
Unregister a channel technology.
| tech | Structure defining channel technology or "type" that was previously registered |
Definition at line 752 of file channel.c.
References ast_debug, ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_END, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, chanlist::chan, chanlist::tech, and ast_channel_tech::type.
Referenced by __unload_module(), load_module(), and unload_module().
{
struct chanlist *chan;
ast_debug(1, "Unregistering channel type '%s'\n", tech->type);
AST_RWLIST_WRLOCK(&backends);
AST_RWLIST_TRAVERSE_SAFE_BEGIN(&backends, chan, list) {
if (chan->tech == tech) {
AST_LIST_REMOVE_CURRENT(list);
ast_free(chan);
ast_verb(2, "Unregistered channel type '%s'\n", tech->type);
break;
}
}
AST_LIST_TRAVERSE_SAFE_END;
AST_RWLIST_UNLOCK(&backends);
}
| 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.
| chan | Asterisk channel to indicate connected line information |
| connected | Connected line information |
| update | What connected line information to update. NULL if all. |
Definition at line 9716 of file channel.c.
References ast_connected_line_build_data(), AST_CONTROL_CONNECTED_LINE, and ast_indicate_data().
Referenced by app_exec(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_do_pickup(), atxfer_fail_cleanup(), builtin_atxfer(), connectedline_write(), parked_call_exec(), and wait_for_answer().
{
unsigned char data[1024]; /* This should be large enough */
size_t datalen;
datalen = ast_connected_line_build_data(data, sizeof(data), connected, update);
if (datalen == (size_t) -1) {
return;
}
ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen);
}
| 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.
| chan | Asterisk channel to indicate redirecting id information |
| redirecting | Redirecting id information |
| update | What redirecting information to update. NULL if all. |
Definition at line 10844 of file channel.c.
References AST_CONTROL_REDIRECTING, ast_indicate_data(), and ast_redirecting_build_data().
Referenced by ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), call_forward_inherit(), do_forward(), handle_request_refer(), redirecting_write(), and wait_for_answer().
{
unsigned char data[1024]; /* This should be large enough */
size_t datalen;
datalen = ast_redirecting_build_data(data, sizeof(data), redirecting, update);
if (datalen == (size_t) -1) {
return;
}
ast_indicate_data(chan, AST_CONTROL_REDIRECTING, data, datalen);
}
| const char* ast_channel_userfield | ( | const struct ast_channel * | chan | ) |
Referenced by ast_cel_report_event(), and func_channel_read().
| struct varshead* ast_channel_varshead | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 987 of file channel_internal_api.c.
References ast_channel::varshead.
Referenced by __ast_channel_alloc_ap(), ast_cel_fabricate_channel_from_event(), ast_channel_destructor(), ast_channel_inherit_variables(), ast_dummy_channel_alloc(), ast_dummy_channel_destructor(), ast_str_retrieve_variable(), ast_str_substitute_variables_full(), chan_cleanup(), clearvar_prefix(), clone_variables(), hashkeys_read(), hashkeys_read2(), local_call(), lua_get_variable(), lua_get_variable_value(), mgcp_call(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), pbx_builtin_getvar_helper(), pbx_builtin_pushvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setvar_helper(), pbx_substitute_variables_helper(), pbx_substitute_variables_helper_full(), peek_read(), sip_call(), sip_removeheader(), skinny_call(), and transmit_invite().
{
return &chan->varshead;
}
| void ast_channel_varshead_set | ( | struct ast_channel * | chan, |
| struct varshead * | value | ||
| ) |
Definition at line 1023 of file channel_internal_api.c.
References value, and ast_channel::varshead.
| int ast_channel_visible_indication | ( | const struct ast_channel * | chan | ) |
Definition at line 622 of file channel_internal_api.c.
References ast_channel::visible_indication.
Referenced by ast_bridge_call(), and ast_do_masquerade().
{
return chan->visible_indication;
}
| void ast_channel_visible_indication_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 626 of file channel_internal_api.c.
References value, and ast_channel::visible_indication.
Referenced by ast_indicate_data(), builtin_atxfer(), and dial_exec_full().
{
chan->visible_indication = value;
}
| struct ast_filestream* ast_channel_vstream | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 766 of file channel_internal_api.c.
References ast_channel::vstream.
Referenced by ast_hangup(), ast_openvstream(), ast_stopstream(), and filehelper().
{
return chan->vstream;
}
| void ast_channel_vstream_set | ( | struct ast_channel * | chan, |
| struct ast_filestream * | value | ||
| ) |
Definition at line 770 of file channel_internal_api.c.
References value, and ast_channel::vstream.
Referenced by ast_hangup(), ast_stopstream(), filehelper(), and filestream_close().
| int ast_channel_vstreamid | ( | const struct ast_channel * | chan | ) |
Definition at line 630 of file channel_internal_api.c.
References ast_channel::vstreamid.
Referenced by filestream_close().
{
return chan->vstreamid;
}
| void ast_channel_vstreamid_set | ( | struct ast_channel * | chan, |
| int | value | ||
| ) |
Definition at line 634 of file channel_internal_api.c.
References value, and ast_channel::vstreamid.
Referenced by ast_readvideo_callback(), and filestream_close().
| struct timeval* ast_channel_whentohangup | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 983 of file channel_internal_api.c.
References ast_channel::whentohangup.
Referenced by __ast_pbx_run(), ast_channel_cmpwhentohangup_tv(), ast_channel_data_add_structure(), ast_check_hangup(), ast_var_channels_table(), ast_waitfor_nandfds(), begin_dial_channel(), dial_exec_full(), handle_showchan(), ring_entry(), serialize_showchan(), timeout_read(), and timeout_write().
{
return &chan->whentohangup;
}
| void ast_channel_whentohangup_set | ( | struct ast_channel * | chan, |
| struct timeval * | value | ||
| ) |
Definition at line 1019 of file channel_internal_api.c.
References value, and ast_channel::whentohangup.
Referenced by ast_channel_setwhentohangup_tv(), and dial_exec_full().
{
chan->whentohangup = *value;
}
| struct ast_format* ast_channel_writeformat | ( | struct ast_channel * | chan | ) | [read] |
Definition at line 919 of file channel_internal_api.c.
References ast_channel::writeformat.
Referenced by __oh323_new(), __oh323_update_info(), adsi_transmit_message_full(), agent_new(), agent_write(), alsa_new(), ast_async_goto(), ast_channel_bridge(), ast_channel_data_add_structure(), ast_channel_make_compatible_helper(), ast_channel_start_silence_generator(), ast_do_masquerade(), ast_iax2_new(), ast_openstream_full(), ast_read_generator_actions(), ast_set_write_format(), ast_set_write_format_by_id(), ast_set_write_format_from_cap(), ast_streamfile(), ast_write(), bridge_channel_join(), bridge_make_compatible(), bridge_request(), builtin_atxfer(), chanspy_exec(), check_goto_on_transfer(), console_new(), dahdi_new(), dahdiscan_exec(), do_bridge_masquerade(), do_notify(), extenspy_exec(), filehelper(), func_channel_read(), generator_force(), generic_fax_exec(), gtalk_new(), gtalk_rtp_read(), gtalk_show_channels(), gtalk_write(), handle_showchan(), iax2_request(), iax_park(), jingle_new(), jingle_read(), jingle_rtp_read(), jingle_show_channels(), jingle_write(), linear_alloc(), local_new(), login_exec(), masq_park_call(), mgcp_new(), mgcp_rtp_read(), mgcp_write(), misdn_new(), moh_alloc(), moh_files_alloc(), moh_files_write_format_change(), mp3_exec(), multicast_rtp_request(), multiplexed_bridge_join(), nbs_new(), NBScat_exec(), oh323_rtp_read(), oh323_write(), oss_new(), playtones_alloc(), process_sdp(), rec_request(), send_waveform_to_channel(), serialize_showchan(), setup_rtp_connection(), simple_bridge_join(), sip_new(), sip_park(), sip_rtp_read(), sip_write(), skinny_new(), skinny_rtp_read(), skinny_write(), socket_process_helper(), start_rtp(), tonepair_alloc(), transmit_audio(), unistim_new(), unistim_rtp_read(), and unistim_write().
{
return &chan->writeformat;
}
| struct ast_trans_pvt* ast_channel_writetrans | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 838 of file channel_internal_api.c.
References ast_channel::writetrans.
Referenced by ast_channel_destructor(), ast_write(), free_translation(), handle_showchan(), and serialize_showchan().
{
return chan->writetrans;
}
| void ast_channel_writetrans_set | ( | struct ast_channel * | chan, |
| struct ast_trans_pvt * | value | ||
| ) |
Definition at line 842 of file channel_internal_api.c.
References value, and ast_channel::writetrans.
Referenced by free_translation().
{
chan->writetrans = value;
}
| struct ast_tone_zone* ast_channel_zone | ( | const struct ast_channel * | chan | ) | [read] |
Definition at line 822 of file channel_internal_api.c.
References ast_channel::zone.
Referenced by ast_app_dtget(), ast_channel_data_add_structure(), ast_channel_destructor(), ast_indicate_data(), ast_var_channels_table(), dial_handle_playtones(), dialtone_indicate(), func_channel_read(), func_channel_write_real(), handle_playtones(), pbx_builtin_waitexten(), play_dialtone(), read_exec(), readexten_exec(), and skinny_transfer().
{
return chan->zone;
}
| void ast_channel_zone_set | ( | struct ast_channel * | chan, |
| struct ast_tone_zone * | value | ||
| ) |
Definition at line 826 of file channel_internal_api.c.
References value, and ast_channel::zone.
Referenced by ast_channel_destructor(), func_channel_write_real(), and sip_new().
| struct ast_variable* ast_channeltype_list | ( | void | ) | [read] |
return an ast_variable list of channeltypes
Definition at line 217 of file channel.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_variable_new(), chanlist::tech, and var.
Referenced by ast_var_channel_types(), and ast_var_channel_types_table().
{
struct chanlist *cl;
struct ast_variable *var = NULL, *prev = NULL;
AST_RWLIST_RDLOCK(&backends);
AST_RWLIST_TRAVERSE(&backends, cl, list) {
if (prev) {
if ((prev->next = ast_variable_new(cl->tech->type, cl->tech->description, "")))
prev = prev->next;
} else {
var = ast_variable_new(cl->tech->type, cl->tech->description, "");
prev = var;
}
}
AST_RWLIST_UNLOCK(&backends);
return var;
}
| int ast_check_hangup | ( | struct ast_channel * | chan | ) |
Check to see if a channel is needing hang up.
| chan | channel on which to check for hang up This function determines if the channel is being requested to be hung up. |
Definition at line 599 of file channel.c.
References ast_channel_name(), ast_channel_softhangup_internal_flag(), ast_channel_softhangup_internal_flag_add(), ast_channel_whentohangup(), ast_debug, AST_SOFTHANGUP_TIMEOUT, ast_test_suite_event_notify, ast_tvdiff_ms(), ast_tvnow(), and ast_tvzero().
Referenced by __ast_pbx_run(), __ast_read(), _macro_exec(), agent_indicate(), agi_exec(), agi_handle_command(), announce_thread(), ast_bridge_call(), ast_call(), ast_channel_bridge(), ast_check_hangup_locked(), ast_indicate_data(), ast_raw_answer(), ast_readstring_full(), ast_recvtext(), ast_rtp_instance_bridge(), ast_sendtext(), ast_transfer(), ast_udptl_bridge(), ast_waitfordigit_full(), ast_write(), autoservice_run(), bridge_call_thread(), bridge_exec(), builtin_atxfer(), call_forward_inherit(), channel_spy(), check_bridge(), common_exec(), conf_play(), conf_run(), dahdi_accept_r2_call_exec(), dahdi_sendtext(), dahdi_setoption(), dial_exec_full(), dundi_lookup_internal(), eagi_exec(), eivr_comm(), feature_request_and_dial(), findmeexec(), func_channel_read(), gosub_run(), handle_sendimage(), iax2_bridge(), join_conference_bridge(), launch_asyncagi(), local_bridge_loop(), local_fixup(), login_exec(), lua_check_hangup(), ospfinished_exec(), pbx_builtin_incomplete(), pbx_builtin_waitexten(), pbx_exec(), read_exec(), readexten_exec(), remote_bridge_loop(), run_agi(), run_ras(), try_calling(), and wait_for_answer().
{
if (ast_channel_softhangup_internal_flag(chan)) /* yes if soft hangup flag set */
return 1;
if (ast_tvzero(*ast_channel_whentohangup(chan))) /* no if no hangup scheduled */
return 0;
if (ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow()) > 0) /* no if hangup time has not come yet. */
return 0;
ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(*ast_channel_whentohangup(chan), ast_tvnow()));
ast_test_suite_event_notify("HANGUP_TIME", "Channel: %s", ast_channel_name(chan));
ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_TIMEOUT); /* record event */
return 1;
}
| int ast_check_hangup_locked | ( | struct ast_channel * | chan | ) |
Definition at line 613 of file channel.c.
References ast_channel_lock, ast_channel_unlock, and ast_check_hangup().
Referenced by action_redirect(), ast_channel_bridge(), and bridge_channel_feature().
{
int res;
ast_channel_lock(chan);
res = ast_check_hangup(chan);
ast_channel_unlock(chan);
return res;
}
| 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.
| data | Buffer to fill with the frame data |
| datalen | Size of the buffer to fill |
| connected | Connected line information |
| update | What connected line information to build. NULL if all. |
| -1 | if error |
| Amount | of data buffer used |
Definition at line 9320 of file channel.c.
References AST_CONNECTED_LINE_ID_PRESENTATION, AST_CONNECTED_LINE_NAME, AST_CONNECTED_LINE_NAME_CHAR_SET, AST_CONNECTED_LINE_NAME_PRESENTATION, AST_CONNECTED_LINE_NAME_VALID, AST_CONNECTED_LINE_NUMBER, AST_CONNECTED_LINE_NUMBER_PLAN, AST_CONNECTED_LINE_NUMBER_PRESENTATION, AST_CONNECTED_LINE_NUMBER_VALID, AST_CONNECTED_LINE_PRIV_NAME, AST_CONNECTED_LINE_PRIV_NAME_CHAR_SET, AST_CONNECTED_LINE_PRIV_NAME_PRESENTATION, AST_CONNECTED_LINE_PRIV_NAME_VALID, AST_CONNECTED_LINE_PRIV_NUMBER, AST_CONNECTED_LINE_PRIV_NUMBER_PLAN, AST_CONNECTED_LINE_PRIV_NUMBER_PRESENTATION, AST_CONNECTED_LINE_PRIV_NUMBER_VALID, AST_CONNECTED_LINE_PRIV_SUBADDRESS, AST_CONNECTED_LINE_PRIV_SUBADDRESS_ODD_EVEN, AST_CONNECTED_LINE_PRIV_SUBADDRESS_TYPE, AST_CONNECTED_LINE_PRIV_SUBADDRESS_VALID, AST_CONNECTED_LINE_PRIV_TAG, AST_CONNECTED_LINE_SOURCE, AST_CONNECTED_LINE_SUBADDRESS, AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN, AST_CONNECTED_LINE_SUBADDRESS_TYPE, AST_CONNECTED_LINE_SUBADDRESS_VALID, AST_CONNECTED_LINE_TAG, AST_CONNECTED_LINE_VERSION, ast_log(), ast_party_connected_line::id, ast_set_party_connected_line::id, LOG_WARNING, ast_party_id_ies::name, party_id_build_data(), ast_party_connected_line::priv, ast_set_party_connected_line::priv, ast_party_connected_line::source, ast_party_name_ies::str, and value.
Referenced by ast_channel_queue_connected_line_update(), ast_channel_update_connected_line(), local_attended_transfer(), local_indicate(), and masquerade_colp_transfer().
{
int32_t value;
size_t pos = 0;
int res;
static const struct ast_party_id_ies ies = {
.name.str = AST_CONNECTED_LINE_NAME,
.name.char_set = AST_CONNECTED_LINE_NAME_CHAR_SET,
.name.presentation = AST_CONNECTED_LINE_NAME_PRESENTATION,
.name.valid = AST_CONNECTED_LINE_NAME_VALID,
.number.str = AST_CONNECTED_LINE_NUMBER,
.number.plan = AST_CONNECTED_LINE_NUMBER_PLAN,
.number.presentation = AST_CONNECTED_LINE_NUMBER_PRESENTATION,
.number.valid = AST_CONNECTED_LINE_NUMBER_VALID,
.subaddress.str = AST_CONNECTED_LINE_SUBADDRESS,
.subaddress.type = AST_CONNECTED_LINE_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_CONNECTED_LINE_SUBADDRESS_VALID,
.tag = AST_CONNECTED_LINE_TAG,
.combined_presentation = AST_CONNECTED_LINE_ID_PRESENTATION,
};
static const struct ast_party_id_ies priv_ies = {
.name.str = AST_CONNECTED_LINE_PRIV_NAME,
.name.char_set = AST_CONNECTED_LINE_PRIV_NAME_CHAR_SET,
.name.presentation = AST_CONNECTED_LINE_PRIV_NAME_PRESENTATION,
.name.valid = AST_CONNECTED_LINE_PRIV_NAME_VALID,
.number.str = AST_CONNECTED_LINE_PRIV_NUMBER,
.number.plan = AST_CONNECTED_LINE_PRIV_NUMBER_PLAN,
.number.presentation = AST_CONNECTED_LINE_PRIV_NUMBER_PRESENTATION,
.number.valid = AST_CONNECTED_LINE_PRIV_NUMBER_VALID,
.subaddress.str = AST_CONNECTED_LINE_PRIV_SUBADDRESS,
.subaddress.type = AST_CONNECTED_LINE_PRIV_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_CONNECTED_LINE_PRIV_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_CONNECTED_LINE_PRIV_SUBADDRESS_VALID,
.tag = AST_CONNECTED_LINE_PRIV_TAG,
.combined_presentation = 0,/* Not sent. */
};
/*
* The size of integer values must be fixed in case the frame is
* shipped to another machine.
*/
/* Connected line frame version */
if (datalen < pos + (sizeof(data[0]) * 2) + 1) {
ast_log(LOG_WARNING, "No space left for connected line frame version\n");
return -1;
}
data[pos++] = AST_CONNECTED_LINE_VERSION;
data[pos++] = 1;
data[pos++] = 2;/* Version 1 did not have a version ie */
res = party_id_build_data(data + pos, datalen - pos, &connected->id,
"connected line", &ies, update ? &update->id : NULL);
if (res < 0) {
return -1;
}
pos += res;
res = party_id_build_data(data + pos, datalen - pos, &connected->priv,
"connected line priv", &priv_ies, update ? &update->priv : NULL);
if (res < 0) {
return -1;
}
pos += res;
/* Connected line source */
if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) {
ast_log(LOG_WARNING, "No space left for connected line source\n");
return -1;
}
data[pos++] = AST_CONNECTED_LINE_SOURCE;
data[pos++] = sizeof(value);
value = htonl(connected->source);
memcpy(data + pos, &value, sizeof(value));
pos += sizeof(value);
return pos;
}
| 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.
| dest | Destination connected line information |
| src | Source caller information |
Definition at line 8918 of file channel.c.
References ast_party_caller::ani, ast_party_connected_line::ani, ast_party_caller::ani2, ast_party_connected_line::ani2, ast_party_id_copy(), ast_party_caller::id, and ast_party_connected_line::id.
Referenced by app_exec(), ast_do_pickup(), begin_dial_channel(), builtin_atxfer(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), local_call(), parked_call_exec(), ring_entry(), and wait_for_answer().
{
ast_party_id_copy(&dest->id, &src->id);
ast_party_id_copy(&dest->ani, &src->ani);
dest->ani2 = src->ani2;
}
| 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.
| dest | Destination caller information |
| src | Source connected line information |
Definition at line 8925 of file channel.c.
References ast_party_caller::ani, ast_party_connected_line::ani, ast_party_caller::ani2, ast_party_connected_line::ani2, ast_party_id_copy(), ast_party_caller::id, and ast_party_connected_line::id.
Referenced by local_call(), and local_indicate().
{
ast_party_id_copy(&dest->id, &src->id);
ast_party_id_copy(&dest->ani, &src->ani);
dest->ani2 = src->ani2;
}
| 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.
| data | Buffer with the frame data to parse |
| datalen | Size of the buffer |
| connected | Extracted connected line information |
| 0 | on success. |
| -1 | on error. |
Definition at line 9408 of file channel.c.
References AST_CONNECTED_LINE_ID_PRESENTATION, AST_CONNECTED_LINE_NAME, AST_CONNECTED_LINE_NAME_CHAR_SET, AST_CONNECTED_LINE_NAME_PRESENTATION, AST_CONNECTED_LINE_NAME_VALID, AST_CONNECTED_LINE_NUMBER, AST_CONNECTED_LINE_NUMBER_PLAN, AST_CONNECTED_LINE_NUMBER_PRESENTATION, AST_CONNECTED_LINE_NUMBER_VALID, AST_CONNECTED_LINE_PRIV_NAME, AST_CONNECTED_LINE_PRIV_NAME_CHAR_SET, AST_CONNECTED_LINE_PRIV_NAME_PRESENTATION, AST_CONNECTED_LINE_PRIV_NAME_VALID, AST_CONNECTED_LINE_PRIV_NUMBER, AST_CONNECTED_LINE_PRIV_NUMBER_PLAN, AST_CONNECTED_LINE_PRIV_NUMBER_PRESENTATION, AST_CONNECTED_LINE_PRIV_NUMBER_VALID, AST_CONNECTED_LINE_PRIV_SUBADDRESS, AST_CONNECTED_LINE_PRIV_SUBADDRESS_ODD_EVEN, AST_CONNECTED_LINE_PRIV_SUBADDRESS_TYPE, AST_CONNECTED_LINE_PRIV_SUBADDRESS_VALID, AST_CONNECTED_LINE_PRIV_TAG, AST_CONNECTED_LINE_SOURCE, AST_CONNECTED_LINE_SUBADDRESS, AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN, AST_CONNECTED_LINE_SUBADDRESS_TYPE, AST_CONNECTED_LINE_SUBADDRESS_VALID, AST_CONNECTED_LINE_TAG, AST_CONNECTED_LINE_VERSION, ast_debug, ast_free, ast_log(), ast_malloc, AST_PARTY_CHAR_SET_ISO8859_1, ast_party_name::char_set, ast_party_id_ies::combined_presentation, ast_party_connected_line::id, LOG_WARNING, ast_party_id::name, ast_party_id::number, ast_party_subaddress::odd_even_indicator, ast_party_number::plan, ast_party_name::presentation, ast_party_number::presentation, ast_party_connected_line::priv, ast_party_connected_line::source, ast_party_name::str, ast_party_number::str, ast_party_subaddress::str, ast_party_id::subaddress, ast_party_id::tag, ast_party_subaddress::type, ast_party_name::valid, ast_party_number::valid, ast_party_subaddress::valid, and value.
Referenced by __ast_read(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_indicate_data(), feature_request_and_dial(), socket_process_helper(), wait_for_answer(), and wait_for_winner().
{
size_t pos;
unsigned char ie_len;
unsigned char ie_id;
int32_t value;
int frame_version = 1;
int combined_presentation = 0;
int got_combined_presentation = 0;/* TRUE if got a combined name and number presentation value. */
for (pos = 0; pos < datalen; pos += ie_len) {
if (datalen < pos + sizeof(ie_id) + sizeof(ie_len)) {
ast_log(LOG_WARNING, "Invalid connected line update\n");
return -1;
}
ie_id = data[pos++];
ie_len = data[pos++];
if (datalen < pos + ie_len) {
ast_log(LOG_WARNING, "Invalid connected line update\n");
return -1;
}
switch (ie_id) {
/* Connected line party frame version */
case AST_CONNECTED_LINE_VERSION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line frame version (%u)\n",
(unsigned) ie_len);
break;
}
frame_version = data[pos];
break;
/* Connected line party id name */
case AST_CONNECTED_LINE_NAME:
ast_free(connected->id.name.str);
connected->id.name.str = ast_malloc(ie_len + 1);
if (connected->id.name.str) {
memcpy(connected->id.name.str, data + pos, ie_len);
connected->id.name.str[ie_len] = 0;
}
break;
case AST_CONNECTED_LINE_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line name char set (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.name.char_set = data[pos];
break;
case AST_CONNECTED_LINE_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line name presentation (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.name.presentation = data[pos];
break;
case AST_CONNECTED_LINE_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line name valid (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.name.valid = data[pos];
break;
/* Connected line party id number */
case AST_CONNECTED_LINE_NUMBER:
ast_free(connected->id.number.str);
connected->id.number.str = ast_malloc(ie_len + 1);
if (connected->id.number.str) {
memcpy(connected->id.number.str, data + pos, ie_len);
connected->id.number.str[ie_len] = 0;
}
break;
case AST_CONNECTED_LINE_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.number.plan = data[pos];
break;
case AST_CONNECTED_LINE_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line number presentation (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.number.presentation = data[pos];
break;
case AST_CONNECTED_LINE_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line number valid (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.number.valid = data[pos];
break;
/* Connected line party id subaddress */
case AST_CONNECTED_LINE_SUBADDRESS:
ast_free(connected->id.subaddress.str);
connected->id.subaddress.str = ast_malloc(ie_len + 1);
if (connected->id.subaddress.str) {
memcpy(connected->id.subaddress.str, data + pos, ie_len);
connected->id.subaddress.str[ie_len] = 0;
}
break;
case AST_CONNECTED_LINE_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.subaddress.type = data[pos];
break;
case AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid connected line subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.subaddress.odd_even_indicator = data[pos];
break;
case AST_CONNECTED_LINE_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
connected->id.subaddress.valid = data[pos];
break;
/* Connected line party tag */
case AST_CONNECTED_LINE_TAG:
ast_free(connected->id.tag);
connected->id.tag = ast_malloc(ie_len + 1);
if (connected->id.tag) {
memcpy(connected->id.tag, data + pos, ie_len);
connected->id.tag[ie_len] = 0;
}
break;
/* Connected line party id combined presentation */
case AST_CONNECTED_LINE_ID_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line combined presentation (%u)\n",
(unsigned) ie_len);
break;
}
combined_presentation = data[pos];
got_combined_presentation = 1;
break;
/* Private connected line party id name */
case AST_CONNECTED_LINE_PRIV_NAME:
ast_free(connected->priv.name.str);
connected->priv.name.str = ast_malloc(ie_len + 1);
if (connected->priv.name.str) {
memcpy(connected->priv.name.str, data + pos, ie_len);
connected->priv.name.str[ie_len] = 0;
}
break;
case AST_CONNECTED_LINE_PRIV_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private name char set (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.name.char_set = data[pos];
break;
case AST_CONNECTED_LINE_PRIV_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private name presentation (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.name.presentation = data[pos];
break;
case AST_CONNECTED_LINE_PRIV_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private name valid (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.name.valid = data[pos];
break;
/* Private connected line party id number */
case AST_CONNECTED_LINE_PRIV_NUMBER:
ast_free(connected->priv.number.str);
connected->priv.number.str = ast_malloc(ie_len + 1);
if (connected->priv.number.str) {
memcpy(connected->priv.number.str, data + pos, ie_len);
connected->priv.number.str[ie_len] = 0;
}
break;
case AST_CONNECTED_LINE_PRIV_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.number.plan = data[pos];
break;
case AST_CONNECTED_LINE_PRIV_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private number presentation (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.number.presentation = data[pos];
break;
case AST_CONNECTED_LINE_PRIV_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private number valid (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.number.valid = data[pos];
break;
/* Private connected line party id subaddress */
case AST_CONNECTED_LINE_PRIV_SUBADDRESS:
ast_free(connected->priv.subaddress.str);
connected->priv.subaddress.str = ast_malloc(ie_len + 1);
if (connected->priv.subaddress.str) {
memcpy(connected->priv.subaddress.str, data + pos, ie_len);
connected->priv.subaddress.str[ie_len] = 0;
}
break;
case AST_CONNECTED_LINE_PRIV_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.subaddress.type = data[pos];
break;
case AST_CONNECTED_LINE_PRIV_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid connected line private subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.subaddress.odd_even_indicator = data[pos];
break;
case AST_CONNECTED_LINE_PRIV_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid connected line private subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
connected->priv.subaddress.valid = data[pos];
break;
/* Private connected line party tag */
case AST_CONNECTED_LINE_PRIV_TAG:
ast_free(connected->priv.tag);
connected->priv.tag = ast_malloc(ie_len + 1);
if (connected->priv.tag) {
memcpy(connected->priv.tag, data + pos, ie_len);
connected->priv.tag[ie_len] = 0;
}
break;
/* Connected line party source */
case AST_CONNECTED_LINE_SOURCE:
if (ie_len != sizeof(value)) {
ast_log(LOG_WARNING, "Invalid connected line source (%u)\n",
(unsigned) ie_len);
break;
}
memcpy(&value, data + pos, sizeof(value));
connected->source = ntohl(value);
break;
/* Connected line party unknown element */
default:
ast_debug(1, "Unknown connected line element: %u (%u)\n",
(unsigned) ie_id, (unsigned) ie_len);
break;
}
}
switch (frame_version) {
case 1:
/*
* The other end is an earlier version that we need to adjust
* for compatibility.
*/
connected->id.name.valid = 1;
connected->id.name.char_set = AST_PARTY_CHAR_SET_ISO8859_1;
connected->id.number.valid = 1;
if (got_combined_presentation) {
connected->id.name.presentation = combined_presentation;
connected->id.number.presentation = combined_presentation;
}
break;
case 2:
/* The other end is at the same level as we are. */
break;
default:
/*
* The other end is newer than we are.
* We need to assume that they are compatible with us.
*/
ast_debug(1, "Connected line frame has newer version: %u\n",
(unsigned) frame_version);
break;
}
return 0;
}
| void ast_deactivate_generator | ( | struct ast_channel * | chan | ) |
Deactivate an active generator
Definition at line 3058 of file channel.c.
References ast_channel_flags(), ast_channel_generator(), ast_channel_generator_set(), ast_channel_generatordata(), ast_channel_generatordata_set(), ast_channel_lock, ast_channel_set_fd(), ast_channel_unlock, ast_clear_flag, AST_FLAG_WRITE_INT, AST_GENERATOR_FD, ast_settimeout(), and ast_generator::release.
Referenced by __ast_read(), app_exec(), ast_openstream_full(), ast_playtones_stop(), ast_quiet_chan(), ast_read_generator_actions(), ast_tonepair_stop(), ast_write(), cb_events(), channel_spy(), dial_exec_full(), generator_force(), local_ast_moh_stop(), old_milliwatt_exec(), transmit_audio(), unistim_quiet_chan(), and wait_for_answer().
{
ast_channel_lock(chan);
if (ast_channel_generatordata(chan)) {
if (ast_channel_generator(chan) && ast_channel_generator(chan)->release) {
ast_channel_generator(chan)->release(chan, ast_channel_generatordata(chan));
}
ast_channel_generatordata_set(chan, NULL);
ast_channel_generator_set(chan, NULL);
ast_channel_set_fd(chan, AST_GENERATOR_FD, -1);
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT);
ast_settimeout(chan, 0, NULL, NULL);
}
ast_channel_unlock(chan);
}
| int ast_do_masquerade | ( | struct ast_channel * | original | ) |
Start masquerading a channel.
XXX This is a seriously whacked out operation. We're essentially putting the guts of the clone channel into the original channel. Start by killing off the original channel's backend. I'm not sure we're going to keep this function, because while the features are nice, the cost is very high in terms of pure nastiness. XXX
| chan | Channel to masquerade |
Start masquerading a channel.
< TRUE if the clonechan was a zombie before the masquerade.
Definition at line 6817 of file channel.c.
References __ast_change_name_nolink(), ao2_link, ao2_lock, ao2_unlink, ao2_unlock, ast_app_group_update(), ast_autochan_new_channel(), ast_bridge_end_dtmf(), ast_bridged_channel(), AST_CEL_BRIDGE_UPDATE, ast_cel_report_event(), ast_channel_accountcode(), ast_channel_adsicpe_set(), ast_channel_alert_write(), ast_channel_blocker(), ast_channel_caller(), ast_channel_caller_set(), ast_channel_cdr(), ast_channel_cdr_set(), ast_channel_connected(), ast_channel_connected_set(), ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_datastores(), ast_channel_dialed(), ast_channel_dialed_set(), ast_channel_fd(), ast_channel_fdno(), ast_channel_fdno_set(), ast_channel_flags(), ast_channel_hangup_handlers(), ast_channel_internal_alertpipe_swap(), ast_channel_internal_bridged_channel(), ast_channel_language(), ast_channel_lock, ast_channel_lock_both, ast_channel_masq(), ast_channel_masq_set(), ast_channel_masqr_set(), ast_channel_monitor(), ast_channel_monitor_set(), ast_channel_musicclass(), AST_CHANNEL_NAME, ast_channel_name(), ast_channel_nativeformats(), ast_channel_parkinglot(), ast_channel_rawreadformat(), ast_channel_rawwriteformat(), ast_channel_readformat(), ast_channel_readq(), ast_channel_redirecting(), ast_channel_redirecting_set(), ast_channel_ref, ast_channel_sending_dtmf_digit(), ast_channel_sending_dtmf_tv(), ast_channel_set_fd(), ast_channel_set_linkgroup(), ast_channel_softhangup_internal_flag_set(), ast_channel_state_set(), ast_channel_tech(), ast_channel_tech_pvt(), ast_channel_tech_pvt_set(), ast_channel_tech_set(), ast_channel_timingfd(), ast_channel_unlock, ast_channel_unref, ast_channel_visible_indication(), ast_channel_writeformat(), ast_clear_flag, AST_CONTROL_SRCCHANGE, AST_CONTROL_UNHOLD, ast_copy_string(), ast_datastore_free(), ast_debug, AST_FLAG_BLOCKING, AST_FLAG_DISABLE_DEVSTATE_CACHE, AST_FLAG_EXCEPTION, AST_FLAG_MOH, AST_FLAG_OUTGOING, AST_FLAG_ZOMBIE, ast_format_cap_copy(), ast_format_copy(), AST_GENERATOR_FD, ast_getformatname(), ast_hangup(), ast_indicate(), AST_LIST_APPEND_LIST, AST_LIST_FIRST, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_HEAD_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log(), ast_manager_event_multichan, AST_MAX_FDS, ast_moh_start(), ast_null_frame, ast_party_id_reset(), ast_queue_frame(), ast_set_flag, ast_set_read_format(), ast_set_write_format(), AST_SOFTHANGUP_DEV, ast_state2str(), ast_test_flag, AST_TIMING_FD, ast_channel::caller, ast_datastore_info::chan_fixup, channels, clone_variables(), ast_channel::connected, ast_datastore::data, ast_channel::dialed, errno, EVENT_FLAG_CALL, free_translation(), ast_datastore::info, LOG_WARNING, masquerade_colp_transfer(), ast_channel::redirecting, report_new_callerid(), S_OR, xfer_masquerade_ds::transferee_held, and type.
Referenced by __ast_read(), ast_async_goto(), ast_do_pickup(), ast_hangup(), ast_waitfor_nandfds(), ast_write(), builtin_atxfer(), check_bridge(), check_goto_on_transfer(), do_bridge_masquerade(), handle_invite_replaces(), iax_park(), local_attended_transfer(), masq_park_call(), and sip_park().
{
int x;
int origstate;
unsigned int orig_disablestatecache;
unsigned int clone_disablestatecache;
int visible_indication;
int moh_is_playing;
int clone_was_zombie = 0;/*!< TRUE if the clonechan was a zombie before the masquerade. */
struct ast_frame *current;
const struct ast_channel_tech *t;
void *t_pvt;
union {
struct ast_hangup_handler_list handlers;
struct ast_party_dialed dialed;
struct ast_party_caller caller;
struct ast_party_connected_line connected;
struct ast_party_redirecting redirecting;
} exchange;
struct ast_channel *clonechan, *chans[2];
struct ast_channel *bridged;
struct ast_cdr *cdr;
struct ast_datastore *xfer_ds;
struct xfer_masquerade_ds *xfer_colp;
struct ast_format rformat;
struct ast_format wformat;
struct ast_format tmp_format;
char newn[AST_CHANNEL_NAME];
char orig[AST_CHANNEL_NAME];
char masqn[AST_CHANNEL_NAME];
char zombn[AST_CHANNEL_NAME];
char clone_sending_dtmf_digit;
struct timeval clone_sending_dtmf_tv;
/* XXX This operation is a bit odd. We're essentially putting the guts of
* the clone channel into the original channel. Start by killing off the
* original channel's backend. While the features are nice, which is the
* reason we're keeping it, it's still awesomely weird. XXX */
/*
* The reasoning for the channels ao2_container lock here is
* complex.
*
* There is a race condition that exists for this function.
* Since all pvt and channel locks must be let go before calling
* ast_do_masquerade, it is possible that it could be called
* multiple times for the same channel. In order to prevent the
* race condition with competing threads to do the masquerade
* and new masquerade attempts, the channels container must be
* locked for the entire masquerade. The original and clonechan
* need to be unlocked earlier to avoid potential deadlocks with
* the chan_local deadlock avoidance method.
*
* The container lock blocks competing masquerade attempts from
* starting as well as being necessary for proper locking order
* because the channels must to be unlinked to change their
* names.
*
* The original and clonechan locks must be held while the
* channel contents are shuffled around for the masquerade.
*
* The masq and masqr pointers need to be left alone until the
* masquerade has restabilized the channels to prevent another
* masquerade request until the AST_FLAG_ZOMBIE can be set on
* the clonechan.
*/
ao2_lock(channels);
/*
* Lock the original channel to determine if the masquerade is
* still required.
*/
ast_channel_lock(original);
clonechan = ast_channel_masq(original);
if (!clonechan) {
/*
* The masq is already completed by another thread or never
* needed to be done to begin with.
*/
ast_channel_unlock(original);
ao2_unlock(channels);
return 0;
}
/* Bump the refs to ensure that they won't dissapear on us. */
ast_channel_ref(original);
ast_channel_ref(clonechan);
/* unlink from channels container as name (which is the hash value) will change */
ao2_unlink(channels, original);
ao2_unlink(channels, clonechan);
/* Get any transfer masquerade connected line exchange data. */
xfer_ds = ast_channel_datastore_find(original, &xfer_ds_info, NULL);
if (xfer_ds) {
ast_channel_datastore_remove(original, xfer_ds);
xfer_colp = xfer_ds->data;
} else {
xfer_colp = NULL;
}
moh_is_playing = ast_test_flag(ast_channel_flags(original), AST_FLAG_MOH);
/*
* Stop any visible indication on the original channel so we can
* transfer it to the clonechan taking the original's place.
*/
visible_indication = ast_channel_visible_indication(original);
ast_channel_unlock(original);
ast_indicate(original, -1);
/*
* Release any hold on the transferee channel before going any
* further with the masquerade.
*/
if (xfer_colp && xfer_colp->transferee_held) {
ast_indicate(clonechan, AST_CONTROL_UNHOLD);
}
/* Start the masquerade channel contents rearangement. */
ast_channel_lock_both(original, clonechan);
ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n",
ast_channel_name(clonechan), ast_channel_state(clonechan), ast_channel_name(original), ast_channel_state(original));
chans[0] = clonechan;
chans[1] = original;
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when a masquerade occurs between two channels, wherein the Clone channel's internal information replaces the Original channel's information.</synopsis>
<syntax>
<parameter name="Clone">
<para>The name of the channel whose information will be going into the Original channel.</para>
</parameter>
<parameter name="CloneState">
<para>The current state of the clone channel.</para>
</parameter>
<parameter name="Original">
<para>The name of the channel whose information will be replaced by the Clone channel's information.</para>
</parameter>
<parameter name="OriginalState">
<para>The current state of the original channel.</para>
</parameter>
</syntax>
</managerEventInstance>
***/
ast_manager_event_multichan(EVENT_FLAG_CALL, "Masquerade", 2, chans,
"Clone: %s\r\n"
"CloneState: %s\r\n"
"Original: %s\r\n"
"OriginalState: %s\r\n",
ast_channel_name(clonechan), ast_state2str(ast_channel_state(clonechan)), ast_channel_name(original), ast_state2str(ast_channel_state(original)));
/*
* Remember the original read/write formats. We turn off any
* translation on either one
*/
ast_format_copy(&rformat, ast_channel_readformat(original));
ast_format_copy(&wformat, ast_channel_writeformat(original));
free_translation(clonechan);
free_translation(original);
/* Save the current DTMF digit being sent if any. */
clone_sending_dtmf_digit = ast_channel_sending_dtmf_digit(clonechan);
clone_sending_dtmf_tv = ast_channel_sending_dtmf_tv(clonechan);
/* Save the original name */
ast_copy_string(orig, ast_channel_name(original), sizeof(orig));
/* Save the new name */
ast_copy_string(newn, ast_channel_name(clonechan), sizeof(newn));
/* Create the masq name */
snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn);
/* Mangle the name of the clone channel */
__ast_change_name_nolink(clonechan, masqn);
/* Copy the name from the clone channel */
__ast_change_name_nolink(original, newn);
/* share linked id's */
ast_channel_set_linkgroup(original, clonechan);
/* Swap the technologies */
t = ast_channel_tech(original);
ast_channel_tech_set(original, ast_channel_tech(clonechan));
ast_channel_tech_set(clonechan, t);
t_pvt = ast_channel_tech_pvt(original);
ast_channel_tech_pvt_set(original, ast_channel_tech_pvt(clonechan));
ast_channel_tech_pvt_set(clonechan, t_pvt);
/* Swap the cdrs */
cdr = ast_channel_cdr(original);
ast_channel_cdr_set(original, ast_channel_cdr(clonechan));
ast_channel_cdr_set(clonechan, cdr);
/* Swap the alertpipes */
ast_channel_internal_alertpipe_swap(original, clonechan);
/*
* Swap the readq's. The end result should be this:
*
* 1) All frames should be on the new (original) channel.
* 2) Any frames that were already on the new channel before this
* masquerade need to be at the end of the readq, after all of the
* frames on the old (clone) channel.
* 3) The alertpipe needs to get poked for every frame that was already
* on the new channel, since we are now using the alert pipe from the
* old (clone) channel.
*/
{
AST_LIST_HEAD_NOLOCK(, ast_frame) tmp_readq;
AST_LIST_HEAD_INIT_NOLOCK(&tmp_readq);
AST_LIST_APPEND_LIST(&tmp_readq, ast_channel_readq(original), frame_list);
AST_LIST_APPEND_LIST(ast_channel_readq(original), ast_channel_readq(clonechan), frame_list);
while ((current = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) {
AST_LIST_INSERT_TAIL(ast_channel_readq(original), current, frame_list);
if (ast_channel_alert_write(original)) {
ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
}
}
}
/* Swap the raw formats */
ast_format_copy(&tmp_format, ast_channel_rawreadformat(original));
ast_format_copy(ast_channel_rawreadformat(original), ast_channel_rawreadformat(clonechan));
ast_format_copy(ast_channel_rawreadformat(clonechan), &tmp_format);
ast_format_copy(&tmp_format, ast_channel_rawwriteformat(original));
ast_format_copy(ast_channel_rawwriteformat(original), ast_channel_rawwriteformat(clonechan));
ast_format_copy(ast_channel_rawwriteformat(clonechan), &tmp_format);
ast_channel_softhangup_internal_flag_set(clonechan, AST_SOFTHANGUP_DEV);
/* And of course, so does our current state. Note we need not
call ast_setstate since the event manager doesn't really consider
these separate. We do this early so that the clone has the proper
state of the original channel. */
origstate = ast_channel_state(original);
ast_channel_state_set(original, ast_channel_state(clonechan));
ast_channel_state_set(clonechan, origstate);
/* And the swap the cachable state too. Otherwise we'd start caching
* Local channels and ignoring real ones. */
orig_disablestatecache = ast_test_flag(ast_channel_flags(original), AST_FLAG_DISABLE_DEVSTATE_CACHE);
clone_disablestatecache = ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
if (orig_disablestatecache != clone_disablestatecache) {
if (orig_disablestatecache) {
ast_clear_flag(ast_channel_flags(original), AST_FLAG_DISABLE_DEVSTATE_CACHE);
ast_set_flag(ast_channel_flags(clonechan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
} else {
ast_set_flag(ast_channel_flags(original), AST_FLAG_DISABLE_DEVSTATE_CACHE);
ast_clear_flag(ast_channel_flags(clonechan), AST_FLAG_DISABLE_DEVSTATE_CACHE);
}
}
/* Mangle the name of the clone channel */
snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig); /* quick, hide the brains! */
__ast_change_name_nolink(clonechan, zombn);
/* Update the type. */
t_pvt = ast_channel_monitor(original);
ast_channel_monitor_set(original, ast_channel_monitor(clonechan));
ast_channel_monitor_set(clonechan, t_pvt);
/* Keep the same language. */
ast_channel_language_set(original, ast_channel_language(clonechan));
/* Keep the same parkinglot. */
ast_channel_parkinglot_set(original, ast_channel_parkinglot(clonechan));
/* Copy the FD's other than the generator fd */
for (x = 0; x < AST_MAX_FDS; x++) {
if (x != AST_GENERATOR_FD)
ast_channel_set_fd(original, x, ast_channel_fd(clonechan, x));
}
ast_app_group_update(clonechan, original);
/* Swap hangup handlers. */
exchange.handlers = *ast_channel_hangup_handlers(original);
*ast_channel_hangup_handlers(original) = *ast_channel_hangup_handlers(clonechan);
*ast_channel_hangup_handlers(clonechan) = exchange.handlers;
/* Move data stores over */
if (AST_LIST_FIRST(ast_channel_datastores(clonechan))) {
struct ast_datastore *ds;
/* We use a safe traversal here because some fixup routines actually
* remove the datastore from the list and free them.
*/
AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_datastores(clonechan), ds, entry) {
if (ds->info->chan_fixup)
ds->info->chan_fixup(ds->data, clonechan, original);
}
AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_APPEND_LIST(ast_channel_datastores(original), ast_channel_datastores(clonechan), entry);
}
ast_autochan_new_channel(clonechan, original);
clone_variables(original, clonechan);
/* Presense of ADSI capable CPE follows clone */
ast_channel_adsicpe_set(original, ast_channel_adsicpe(clonechan));
/* Bridge remains the same */
/* CDR fields remain the same */
/* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */
/* Application and data remain the same */
/* Clone exception becomes real one, as with fdno */
ast_set_flag(ast_channel_flags(original), ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_EXCEPTION | AST_FLAG_OUTGOING));
ast_channel_fdno_set(original, ast_channel_fdno(clonechan));
/* Schedule context remains the same */
/* Stream stuff stays the same */
/* Keep the original state. The fixup code will need to work with it most likely */
/*
* Just swap the whole structures, nevermind the allocations,
* they'll work themselves out.
*/
exchange.dialed = *ast_channel_dialed(original);
ast_channel_dialed_set(original, ast_channel_dialed(clonechan));
ast_channel_dialed_set(clonechan, &exchange.dialed);
/* Reset any earlier private caller id representations */
ast_party_id_reset(&ast_channel_caller(original)->priv);
ast_party_id_reset(&ast_channel_caller(clonechan)->priv);
exchange.caller = *ast_channel_caller(original);
ast_channel_caller_set(original, ast_channel_caller(clonechan));
ast_channel_caller_set(clonechan, &exchange.caller);
/* Reset any earlier private connected id representations */
ast_party_id_reset(&ast_channel_connected(original)->priv);
ast_party_id_reset(&ast_channel_connected(clonechan)->priv);
exchange.connected = *ast_channel_connected(original);
ast_channel_connected_set(original, ast_channel_connected(clonechan));
ast_channel_connected_set(clonechan, &exchange.connected);
/* Reset any earlier private redirecting orig, from or to representations */
ast_party_id_reset(&ast_channel_redirecting(original)->priv_orig);
ast_party_id_reset(&ast_channel_redirecting(clonechan)->priv_orig);
ast_party_id_reset(&ast_channel_redirecting(original)->priv_from);
ast_party_id_reset(&ast_channel_redirecting(clonechan)->priv_from);
ast_party_id_reset(&ast_channel_redirecting(original)->priv_to);
ast_party_id_reset(&ast_channel_redirecting(clonechan)->priv_to);
exchange.redirecting = *ast_channel_redirecting(original);
ast_channel_redirecting_set(original, ast_channel_redirecting(clonechan));
ast_channel_redirecting_set(clonechan, &exchange.redirecting);
report_new_callerid(original);
/* Restore original timing file descriptor */
ast_channel_set_fd(original, AST_TIMING_FD, ast_channel_timingfd(original));
/* Our native formats are different now */
ast_format_cap_copy(ast_channel_nativeformats(original), ast_channel_nativeformats(clonechan));
/* Context, extension, priority, app data, jump table, remain the same */
/* pvt switches. pbx stays the same, as does next */
/* Set the write format */
ast_set_write_format(original, &wformat);
/* Set the read format */
ast_set_read_format(original, &rformat);
/* Copy the music class */
ast_channel_musicclass_set(original, ast_channel_musicclass(clonechan));
/* copy over accuntcode and set peeraccount across the bridge */
ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), ""));
if (ast_channel_internal_bridged_channel(original)) {
/* XXX - should we try to lock original's bridged channel here? */
ast_channel_peeraccount_set(ast_channel_internal_bridged_channel(original), S_OR(ast_channel_accountcode(clonechan), ""));
ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL);
}
ast_debug(1, "Putting channel %s in %s/%s formats\n", ast_channel_name(original),
ast_getformatname(&wformat), ast_getformatname(&rformat));
/* Fixup the original clonechan's physical side */
if (ast_channel_tech(original)->fixup && ast_channel_tech(original)->fixup(clonechan, original)) {
ast_log(LOG_WARNING, "Channel type '%s' could not fixup channel %s, strange things may happen. (clonechan)\n",
ast_channel_tech(original)->type, ast_channel_name(original));
}
/* Fixup the original original's physical side */
if (ast_channel_tech(clonechan)->fixup && ast_channel_tech(clonechan)->fixup(original, clonechan)) {
ast_log(LOG_WARNING, "Channel type '%s' could not fixup channel %s, strange things may happen. (original)\n",
ast_channel_tech(clonechan)->type, ast_channel_name(clonechan));
}
/*
* Now, at this point, the "clone" channel is totally F'd up.
* We mark it as a zombie so nothing tries to touch it. If it's
* already been marked as a zombie, then we must free it (since
* it already is considered invalid).
*
* This must be done before we unlock clonechan to prevent
* setting up another masquerade on the clonechan.
*/
if (ast_test_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE)) {
clone_was_zombie = 1;
} else {
ast_set_flag(ast_channel_flags(clonechan), AST_FLAG_ZOMBIE);
ast_queue_frame(clonechan, &ast_null_frame);
}
/* clear the masquerade channels */
ast_channel_masq_set(original, NULL);
ast_channel_masqr_set(clonechan, NULL);
/*
* When we unlock original here, it can be immediately setup to
* masquerade again or hungup. The new masquerade or hangup
* will not actually happen until we release the channels
* container lock.
*/
ast_channel_unlock(original);
ast_channel_unlock(clonechan);
if (clone_sending_dtmf_digit) {
/*
* The clonechan was sending a DTMF digit that was not completed
* before the masquerade.
*/
ast_bridge_end_dtmf(original, clone_sending_dtmf_digit, clone_sending_dtmf_tv,
"masquerade");
}
/*
* If an indication is currently playing, maintain it on the
* channel that is taking the place of original.
*
* This is needed because the masquerade is swapping out the
* internals of the channel, and the new channel private data
* needs to be made aware of the current visible indication
* (RINGING, CONGESTION, etc.)
*/
if (visible_indication) {
ast_indicate(original, visible_indication);
}
/* if moh is playing on the original channel then it needs to be
maintained on the channel that is replacing it. */
if (moh_is_playing) {
ast_moh_start(original, NULL, NULL);
}
ast_channel_lock(original);
/* Signal any blocker */
if (ast_test_flag(ast_channel_flags(original), AST_FLAG_BLOCKING)) {
pthread_kill(ast_channel_blocker(original), SIGURG);
}
ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original));
if ((bridged = ast_bridged_channel(original))) {
ast_channel_ref(bridged);
ast_channel_unlock(original);
ast_indicate(bridged, AST_CONTROL_SRCCHANGE);
ast_channel_unref(bridged);
} else {
ast_channel_unlock(original);
}
ast_indicate(original, AST_CONTROL_SRCCHANGE);
if (xfer_colp) {
/*
* After the masquerade, the original channel pointer actually
* points to the new transferee channel and the bridged channel
* is still the intended transfer target party.
*/
masquerade_colp_transfer(original, xfer_colp);
}
if (xfer_ds) {
ast_datastore_free(xfer_ds);
}
if (!clone_was_zombie) {
ao2_link(channels, clonechan);
}
ao2_link(channels, original);
ao2_unlock(channels);
if (clone_was_zombie) {
/* Restart the ast_hangup() that was deferred because of this masquerade. */
ast_debug(1, "Destroying channel clone '%s'\n", ast_channel_name(clonechan));
ast_hangup(clonechan);
}
/* Release our held safety references. */
ast_channel_unref(original);
ast_channel_unref(clonechan);
return 0;
}
| struct ast_channel* ast_dummy_channel_alloc | ( | void | ) | [read] |
Create a fake channel structure.
| NULL | failure |
| non-NULL | successfully allocated channel |
Definition at line 1202 of file channel.c.
References ast_channel_datastores(), ast_channel_epfd_set(), ast_channel_internal_alertpipe_clear(), ast_channel_internal_alloc, ast_channel_internal_fd_clear_all(), ast_channel_timingfd_set(), ast_channel_varshead(), ast_dummy_channel_destructor(), AST_LIST_HEAD_INIT_NOLOCK, and ast_pbx_hangup_handler_init().
Referenced by acf_odbc_read(), acf_odbc_write(), action_getvar(), ast_add_extension2_lockopt(), ast_cel_fabricate_channel_from_event(), ast_pbx_outgoing_cdr_failed(), ast_str_substitute_variables_full(), cli_odbc_read(), cli_odbc_write(), custom_log(), make_email_file(), manager_log(), pbx_substitute_variables_helper_full(), rotate_file(), sendmail(), sendpage(), syslog_log(), and write_cdr().
{
struct ast_channel *tmp;
struct varshead *headp;
if (!(tmp = ast_channel_internal_alloc(ast_dummy_channel_destructor))) {
/* Dummy channel structure allocation failure. */
return NULL;
}
ast_pbx_hangup_handler_init(tmp);
AST_LIST_HEAD_INIT_NOLOCK(ast_channel_datastores(tmp));
/*
* Init file descriptors to unopened state just in case
* autoservice is called on the channel or something tries to
* read a frame from it.
*/
ast_channel_timingfd_set(tmp, -1);
ast_channel_internal_alertpipe_clear(tmp);
ast_channel_internal_fd_clear_all(tmp);
#ifdef HAVE_EPOLL
ast_channel_epfd_set(tmp, -1);
#endif
headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp);
return tmp;
}
| static int ast_fdisset | ( | struct pollfd * | pfds, |
| int | fd, | ||
| int | maximum, | ||
| int * | start | ||
| ) | [inline, static] |
Helper function for migrating select to poll.
Definition at line 2424 of file channel.h.
References dummy().
Referenced by do_monitor().
| struct ast_channel_tech* ast_get_channel_tech | ( | const char * | name | ) | [read] |
Get a channel technology structure by name.
| name | name of technology to find |
Definition at line 774 of file channel.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, and chanlist::tech.
Referenced by __ast_channel_alloc_ap(), _ast_device_state(), ast_cc_callback(), and ast_var_channel_types_table().
{
struct chanlist *chanls;
const struct ast_channel_tech *ret = NULL;
AST_RWLIST_RDLOCK(&backends);
AST_RWLIST_TRAVERSE(&backends, chanls, list) {
if (!strcasecmp(name, chanls->tech->type)) {
ret = chanls->tech;
break;
}
}
AST_RWLIST_UNLOCK(&backends);
return ret;
}
| ast_group_t ast_get_group | ( | const char * | s | ) |
Definition at line 8303 of file channel.c.
References ast_log(), ast_strlen_zero(), group, LOG_ERROR, and LOG_WARNING.
Referenced by _parse(), build_device(), build_gateway(), build_peer(), config_parse_variables(), custom_group_handler(), func_channel_write_real(), process_dahdi(), and read_agent_config().
{
char *piece;
char *c;
int start=0, finish=0, x;
ast_group_t group = 0;
if (ast_strlen_zero(s))
return 0;
c = ast_strdupa(s);
while ((piece = strsep(&c, ","))) {
if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) {
/* Range */
} else if (sscanf(piece, "%30d", &start)) {
/* Just one */
finish = start;
} else {
ast_log(LOG_ERROR, "Syntax error parsing group configuration '%s' at '%s'. Ignoring.\n", s, piece);
continue;
}
for (x = start; x <= finish; x++) {
if ((x > 63) || (x < 0)) {
ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 63)\n", x);
} else
group |= ((ast_group_t) 1 << x);
}
}
return group;
}
| struct ast_namedgroups* ast_get_namedgroups | ( | const char * | s | ) | [read] |
Create an ast_namedgroups set with group names from comma separated string.
Remove leading and trailing whitespace
Definition at line 8360 of file channel.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_container_alloc_options, ao2_container_count(), ao2_find, ao2_link, ao2_ref, ast_skip_blanks(), ast_str_hash(), ast_strip(), ast_strlen_zero(), ast_trim_blanks(), namedgroup_member::hash, len(), namedgroup_member::name, namedgroup_cmp_cb(), namedgroup_hash_cb(), OBJ_NODATA, OBJ_POINTER, and OBJ_UNLINK.
Referenced by _parse(), build_peer(), func_channel_write_real(), and process_dahdi().
{
struct ao2_container *namedgroups;
char *piece;
char *c;
if (!s) {
return NULL;
}
/*! \brief Remove leading and trailing whitespace */
c = ast_trim_blanks(ast_strdupa(ast_skip_blanks(s)));
if (ast_strlen_zero(c)) {
return NULL;
}
namedgroups = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 19,
namedgroup_hash_cb, namedgroup_cmp_cb);
if (!namedgroups) {
return NULL;
}
while ((piece = strsep(&c, ","))) {
struct namedgroup_member *member;
size_t len;
/* remove leading/trailing whitespace */
piece = ast_strip(piece);
len = strlen(piece);
if (!len) {
continue;
}
member = ao2_alloc_options(sizeof(*member) + len, NULL, AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!member) {
ao2_ref(namedgroups, -1);
return NULL;
}
strcpy(member->name, piece);/* Safe */
member->hash = ast_str_hash(member->name);
/* every group name may exist only once, delete duplicates */
ao2_find(namedgroups, member, OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
ao2_link(namedgroups, member);
ao2_ref(member, -1);
}
if (!ao2_container_count(namedgroups)) {
/* There were no group names specified. */
ao2_ref(namedgroups, -1);
namedgroups = NULL;
}
return (struct ast_namedgroups *) namedgroups;
}
| int ast_hangup | ( | struct ast_channel * | chan | ) |
Hang up a channel.
| chan | channel to hang up |
Definition at line 2752 of file channel.c.
References ao2_unlink, ast_assert, ast_autoservice_stop(), ast_cause2str(), ast_cc_offer(), ast_cdr_detach(), ast_cdr_end(), AST_CDR_FLAG_BRIDGED, AST_CDR_FLAG_DIALED, AST_CDR_FLAG_POST_DISABLED, AST_CDR_NULL, AST_CEL_HANGUP, ast_cel_report_event(), ast_channel_accountcode(), ast_channel_blocker(), ast_channel_blockproc(), ast_channel_caller(), ast_channel_cdr(), ast_channel_cdr_set(), ast_channel_connected(), ast_channel_flags(), ast_channel_generator(), ast_channel_generator_set(), ast_channel_generatordata(), ast_channel_generatordata_set(), ast_channel_hangupcause(), ast_channel_hangupsource(), ast_channel_lock, ast_channel_masq(), ast_channel_masqr(), ast_channel_name(), ast_channel_sched(), ast_channel_sched_set(), ast_channel_stream(), ast_channel_stream_set(), ast_channel_tech(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_unref, ast_channel_vstream(), ast_channel_vstream_set(), ast_closestream(), ast_debug, ast_do_masquerade(), AST_FLAG_BLOCKING, AST_FLAG_ZOMBIE, ast_log(), ast_manager_event, ast_pbx_hangup_handler_run(), ast_sched_context_destroy(), ast_set_flag, ast_test_flag, channels, destroy_hooks(), EVENT_FLAG_CALL, free_translation(), ast_channel_tech::hangup, LOG_WARNING, name, pbx_builtin_getvar_helper(), ast_generator::release, S_COR, and S_OR.
Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_pbx_run(), __ast_request_and_dial(), __oh323_new(), action_bridge(), agent_request(), alloc_playback_chan(), alsa_new(), analog_handle_init_event(), analog_ss_thread(), answer_exec_run(), ast_async_goto(), ast_autoservice_chan_hangup_peer(), ast_call_forward(), ast_dial_destroy(), ast_dial_hangup(), ast_do_masquerade(), ast_iax2_new(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run_app(), async_wait(), begin_dial_channel(), bridge_call_thread(), bridge_call_thread_launch(), bridge_channel_thread(), bridge_exec(), build_conf(), builtin_atxfer(), chanavail_exec(), check_availability(), check_goto_on_transfer(), clear_caller(), conf_free(), conf_run(), console_new(), create_msg_q_chan(), dahdi_handle_event(), dahdi_new(), destroy_conference_bridge(), dial_exec_full(), dial_transfer(), do_forward(), do_hang(), do_idle_thread(), do_monitor(), feature_attended_transfer(), feature_request_and_dial(), generic_recall(), gtalk_new(), handle_call_forward(), handle_call_outgoing(), handle_callforward_button(), handle_frame(), handle_frame_ownerless(), handle_hd_hf(), handle_init_event(), handle_invite_replaces(), handle_request_invite(), handle_timeout_trip(), hangup_chan(), hangupcalls(), hanguptree(), iax2_request(), iax_park(), iax_park_thread(), jingle_action_session_initiate(), jingle_new(), local_hangup(), manage_parked_call(), masq_park_call(), meetme_menu_admin_extended(), mgcp_new(), mgcp_ss(), monitor_dial(), mwi_thread(), my_distinctive_ring(), my_handle_notify_message(), nbs_new(), oss_new(), parkandannounce_exec(), phone_new(), pri_dchannel(), pri_ss_thread(), record_thread(), setsubstate(), sip_park(), sip_park_thread(), sip_pickup_thread(), skinny_new(), ss7_start_call(), unistim_new(), and wait_for_answer().
{
char extra_str[64]; /* used for cel logging below */
ast_autoservice_stop(chan);
ast_channel_lock(chan);
/*
* Do the masquerade if someone is setup to masquerade into us.
*
* NOTE: We must hold the channel lock after testing for a
* pending masquerade and setting the channel as a zombie to
* prevent __ast_channel_masquerade() from setting up a
* masquerade with a dead channel.
*/
while (ast_channel_masq(chan)) {
ast_channel_unlock(chan);
ast_do_masquerade(chan);
ast_channel_lock(chan);
}
if (ast_channel_masqr(chan)) {
/*
* This channel is one which will be masqueraded into something.
* Mark it as a zombie already so ast_do_masquerade() will know
* to free it later.
*/
ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
destroy_hooks(chan);
ast_channel_unlock(chan);
return 0;
}
/* Mark as a zombie so a masquerade cannot be setup on this channel. */
ast_set_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE);
ast_channel_unlock(chan);
/*
* XXX if running the hangup handlers here causes problems
* because the handlers take too long to execute, we could move
* the meat of this function into another thread. A thread
* where channels go to die.
*
* If this is done, ast_autoservice_chan_hangup_peer() will no
* longer be needed.
*/
ast_pbx_hangup_handler_run(chan);
ao2_unlink(channels, chan);
ast_channel_lock(chan);
destroy_hooks(chan);
free_translation(chan);
/* Close audio stream */
if (ast_channel_stream(chan)) {
ast_closestream(ast_channel_stream(chan));
ast_channel_stream_set(chan, NULL);
}
/* Close video stream */
if (ast_channel_vstream(chan)) {
ast_closestream(ast_channel_vstream(chan));
ast_channel_vstream_set(chan, NULL);
}
if (ast_channel_sched(chan)) {
ast_sched_context_destroy(ast_channel_sched(chan));
ast_channel_sched_set(chan, NULL);
}
if (ast_channel_generatordata(chan)) { /* Clear any tone stuff remaining */
if (ast_channel_generator(chan) && ast_channel_generator(chan)->release) {
ast_channel_generator(chan)->release(chan, ast_channel_generatordata(chan));
}
}
ast_channel_generatordata_set(chan, NULL);
ast_channel_generator_set(chan, NULL);
snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", ast_channel_hangupcause(chan), ast_channel_hangupsource(chan), S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), ""));
ast_cel_report_event(chan, AST_CEL_HANGUP, NULL, extra_str, NULL);
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)) {
ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
"is blocked by thread %ld in procedure %s! Expect a failure\n",
(long) pthread_self(), ast_channel_name(chan), (long)ast_channel_blocker(chan), ast_channel_blockproc(chan));
ast_assert(ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING) == 0);
}
ast_debug(1, "Hanging up channel '%s'\n", ast_channel_name(chan));
if (ast_channel_tech(chan)->hangup) {
ast_channel_tech(chan)->hangup(chan);
}
ast_channel_unlock(chan);
ast_cc_offer(chan);
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when a channel is hung up.</synopsis>
<syntax>
<parameter name="Cause">
<para>A numeric cause code for why the channel was hung up.</para>
</parameter>
<parameter name="Cause-txt">
<para>A description of why the channel was hung up.</para>
</parameter>
</syntax>
</managerEventInstance>
***/
ast_manager_event(chan, EVENT_FLAG_CALL, "Hangup",
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
"CallerIDNum: %s\r\n"
"CallerIDName: %s\r\n"
"ConnectedLineNum: %s\r\n"
"ConnectedLineName: %s\r\n"
"AccountCode: %s\r\n"
"Cause: %d\r\n"
"Cause-txt: %s\r\n",
ast_channel_name(chan),
ast_channel_uniqueid(chan),
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, "<unknown>"),
S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, "<unknown>"),
S_COR(ast_channel_connected(chan)->id.number.valid, ast_channel_connected(chan)->id.number.str, "<unknown>"),
S_COR(ast_channel_connected(chan)->id.name.valid, ast_channel_connected(chan)->id.name.str, "<unknown>"),
ast_channel_accountcode(chan),
ast_channel_hangupcause(chan),
ast_cause2str(ast_channel_hangupcause(chan))
);
if (ast_channel_cdr(chan) && !ast_test_flag(ast_channel_cdr(chan), AST_CDR_FLAG_BRIDGED) &&
!ast_test_flag(ast_channel_cdr(chan), AST_CDR_FLAG_POST_DISABLED) &&
(ast_channel_cdr(chan)->disposition != AST_CDR_NULL || ast_test_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED))) {
ast_channel_lock(chan);
ast_cdr_end(ast_channel_cdr(chan));
ast_cdr_detach(ast_channel_cdr(chan));
ast_channel_cdr_set(chan, NULL);
ast_channel_unlock(chan);
}
ast_channel_unref(chan);
return 0;
}
| int ast_indicate | ( | struct ast_channel * | chan, |
| int | condition | ||
| ) |
Indicates condition of channel.
| chan | channel to change the indication |
| condition | which condition to indicate on the channel |
Definition at line 4396 of file channel.c.
References ast_indicate_data().
Referenced by __ast_play_and_record(), agent_request(), alsa_call(), answer_trunk_chan(), app_exec(), ast_bridge_call(), ast_bridge_set_single_src_video_mode(), ast_bridge_update_talker_src_video_mode(), ast_channel_bridge(), ast_do_masquerade(), ast_dtmf_stream(), ast_raw_answer(), attempt_transfer(), builtin_atxfer(), builtin_blindtransfer(), cli_console_answer(), conf_run(), console_call(), dial_exec_full(), dial_trunk(), dialandactivatesub(), disa_exec(), do_forward(), feature_request_and_dial(), finishup(), handle_callforward_button(), handle_frame(), handle_recordfile(), handle_request_refer(), local_attended_transfer(), manage_parked_call(), mgcp_ss(), monitor_dial(), oss_call(), park_call_full(), parked_call_exec(), pbx_builtin_busy(), pbx_builtin_congestion(), pbx_builtin_incomplete(), pbx_builtin_proceeding(), pbx_builtin_progress(), pbx_builtin_ringing(), pbx_builtin_waitexten(), queue_exec(), record_exec(), rna(), say_periodic_announcement(), say_position(), send_waveform_to_channel(), sla_handle_hold_event(), sla_station_exec(), sla_trunk_exec(), try_calling(), and wait_for_answer().
{
return ast_indicate_data(chan, condition, NULL, 0);
}
| int ast_indicate_data | ( | struct ast_channel * | chan, |
| int | condition, | ||
| const void * | data, | ||
| size_t | datalen | ||
| ) |
Indicates condition of channel, with payload.
| chan | channel to change the indication |
| condition | which condition to indicate on the channel |
| data | pointer to payload data |
| datalen | size of payload data |
Definition at line 4466 of file channel.c.
References _XXX_AST_CONTROL_T38, ast_channel_connected(), ast_channel_flags(), ast_channel_framehooks(), ast_channel_hangupcause_hash_set(), ast_channel_lock, ast_channel_name(), ast_channel_redirecting(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_channel_tech(), ast_channel_unlock, ast_channel_visible_indication_set(), ast_channel_zone(), ast_check_hangup(), ast_connected_line_parse_data(), AST_CONTROL_ANSWER, AST_CONTROL_AOC, AST_CONTROL_BUSY, AST_CONTROL_CC, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_END_OF_Q, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_INCOMPLETE, AST_CONTROL_MCID, AST_CONTROL_OFFHOOK, AST_CONTROL_OPTION, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_RADIO_KEY, AST_CONTROL_RADIO_UNKEY, AST_CONTROL_READ_ACTION, AST_CONTROL_REDIRECTING, AST_CONTROL_RING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_T38_PARAMETERS, AST_CONTROL_TAKEOFFHOOK, AST_CONTROL_TRANSFER, AST_CONTROL_UNHOLD, AST_CONTROL_UPDATE_RTP_PEER, AST_CONTROL_VIDUPDATE, AST_CONTROL_WINK, ast_debug, AST_FLAG_ZOMBIE, AST_FRAME_CONTROL, ast_framehook_list_is_empty(), ast_framehook_list_write_event(), ast_frdup(), ast_frfree, ast_get_indication_tone(), ast_log(), ast_party_connected_line_free(), ast_party_connected_line_set_init(), ast_party_redirecting_free(), ast_party_redirecting_set_init(), ast_playtones_start(), ast_playtones_stop(), ast_redirecting_parse_data(), AST_STATE_UP, ast_test_flag, ast_tone_zone_sound_unref(), ast_tone_zone_sound::data, ast_frame::data, ast_frame::datalen, ast_frame::frametype, ast_channel_tech::indicate, ast_frame_subclass::integer, is_visible_indication(), LOG_WARNING, ast_frame::ptr, and ast_frame::subclass.
Referenced by __ast_read(), action_aocmessage(), agent_hangup(), app_exec(), ast_bridge_call(), ast_channel_update_connected_line(), ast_channel_update_redirecting(), ast_generic_bridge(), ast_handle_cc_control_frame(), ast_indicate(), disable_t38(), fax_gateway_indicate_t38(), feature_request_and_dial(), generic_fax_exec(), handle_frame(), local_bridge_loop(), login_exec(), manage_parked_call(), park_call_full(), pbx_builtin_waitexten(), receivefax_t38_init(), remote_bridge_loop(), sendfax_t38_init(), set_fax_t38_caps(), transmit_audio(), transmit_t38(), wait_for_answer(), and wait_for_winner().
{
/* By using an enum, we'll get compiler warnings for values not handled
* in switch statements. */
enum ast_control_frame_type condition = _condition;
struct ast_tone_zone_sound *ts = NULL;
int res;
/* this frame is used by framehooks. if it is set, we must free it at the end of this function */
struct ast_frame *awesome_frame = NULL;
ast_channel_lock(chan);
/* Don't bother if the channel is about to go away, anyway. */
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
res = -1;
goto indicate_cleanup;
}
if (!ast_framehook_list_is_empty(ast_channel_framehooks(chan))) {
/* Do framehooks now, do it, go, go now */
struct ast_frame frame = {
.frametype = AST_FRAME_CONTROL,
.subclass.integer = condition,
.data.ptr = (void *) data, /* this cast from const is only okay because we do the ast_frdup below */
.datalen = datalen
};
/* we have now committed to freeing this frame */
awesome_frame = ast_frdup(&frame);
/* who knows what we will get back! the anticipation is killing me. */
if (!(awesome_frame = ast_framehook_list_write_event(ast_channel_framehooks(chan), awesome_frame))
|| awesome_frame->frametype != AST_FRAME_CONTROL) {
res = 0;
goto indicate_cleanup;
}
condition = awesome_frame->subclass.integer;
data = awesome_frame->data.ptr;
datalen = awesome_frame->datalen;
}
switch (condition) {
case AST_CONTROL_CONNECTED_LINE:
{
struct ast_party_connected_line connected;
ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
res = ast_connected_line_parse_data(data, datalen, &connected);
if (!res) {
ast_channel_set_connected_line(chan, &connected, NULL);
}
ast_party_connected_line_free(&connected);
}
break;
case AST_CONTROL_REDIRECTING:
{
struct ast_party_redirecting redirecting;
ast_party_redirecting_set_init(&redirecting, ast_channel_redirecting(chan));
res = ast_redirecting_parse_data(data, datalen, &redirecting);
if (!res) {
ast_channel_set_redirecting(chan, &redirecting, NULL);
}
ast_party_redirecting_free(&redirecting);
}
break;
default:
break;
}
if (is_visible_indication(condition)) {
/* A new visible indication is requested. */
ast_channel_visible_indication_set(chan, condition);
} else if (condition == AST_CONTROL_UNHOLD || _condition < 0) {
/* Visible indication is cleared/stopped. */
ast_channel_visible_indication_set(chan, 0);
}
if (ast_channel_tech(chan)->indicate) {
/* See if the channel driver can handle this condition. */
res = ast_channel_tech(chan)->indicate(chan, condition, data, datalen);
} else {
res = -1;
}
if (!res) {
/* The channel driver successfully handled this indication */
res = 0;
goto indicate_cleanup;
}
/* The channel driver does not support this indication, let's fake
* it by doing our own tone generation if applicable. */
/*!\note If we compare the enumeration type, which does not have any
* negative constants, the compiler may optimize this code away.
* Therefore, we must perform an integer comparison here. */
if (_condition < 0) {
/* Stop any tones that are playing */
ast_playtones_stop(chan);
res = 0;
goto indicate_cleanup;
}
/* Handle conditions that we have tones for. */
switch (condition) {
case _XXX_AST_CONTROL_T38:
/* deprecated T.38 control frame */
res = -1;
goto indicate_cleanup;
case AST_CONTROL_T38_PARAMETERS:
/* there is no way to provide 'default' behavior for these
* control frames, so we need to return failure, but there
* is also no value in the log message below being emitted
* since failure to handle these frames is not an 'error'
* so just return right now. in addition, we want to return
* whatever value the channel driver returned, in case it
* has some meaning.*/
goto indicate_cleanup;
case AST_CONTROL_RINGING:
ts = ast_get_indication_tone(ast_channel_zone(chan), "ring");
/* It is common practice for channel drivers to return -1 if trying
* to indicate ringing on a channel which is up. The idea is to let the
* core generate the ringing inband. However, we don't want the
* warning message about not being able to handle the specific indication
* to print nor do we want ast_indicate_data to return an "error" for this
* condition
*/
if (ast_channel_state(chan) == AST_STATE_UP) {
res = 0;
}
break;
case AST_CONTROL_BUSY:
ts = ast_get_indication_tone(ast_channel_zone(chan), "busy");
break;
case AST_CONTROL_INCOMPLETE:
case AST_CONTROL_CONGESTION:
ts = ast_get_indication_tone(ast_channel_zone(chan), "congestion");
break;
case AST_CONTROL_PVT_CAUSE_CODE:
ast_channel_hangupcause_hash_set(chan, data, datalen);
res = 0;
break;
case AST_CONTROL_PROGRESS:
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_VIDUPDATE:
case AST_CONTROL_SRCUPDATE:
case AST_CONTROL_SRCCHANGE:
case AST_CONTROL_RADIO_KEY:
case AST_CONTROL_RADIO_UNKEY:
case AST_CONTROL_OPTION:
case AST_CONTROL_WINK:
case AST_CONTROL_FLASH:
case AST_CONTROL_OFFHOOK:
case AST_CONTROL_TAKEOFFHOOK:
case AST_CONTROL_ANSWER:
case AST_CONTROL_HANGUP:
case AST_CONTROL_RING:
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
case AST_CONTROL_TRANSFER:
case AST_CONTROL_CONNECTED_LINE:
case AST_CONTROL_REDIRECTING:
case AST_CONTROL_CC:
case AST_CONTROL_READ_ACTION:
case AST_CONTROL_AOC:
case AST_CONTROL_END_OF_Q:
case AST_CONTROL_MCID:
case AST_CONTROL_UPDATE_RTP_PEER:
/* Nothing left to do for these. */
res = 0;
break;
}
if (ts) {
/* We have a tone to play, yay. */
ast_debug(1, "Driver for channel '%s' does not support indication %d, emulating it\n", ast_channel_name(chan), condition);
res = ast_playtones_start(chan, 0, ts->data, 1);
ts = ast_tone_zone_sound_unref(ts);
}
if (res) {
/* not handled */
ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, ast_channel_name(chan));
}
indicate_cleanup:
ast_channel_unlock(chan);
if (awesome_frame) {
ast_frfree(awesome_frame);
}
return res;
}
| int ast_internal_timing_enabled | ( | struct ast_channel * | chan | ) |
Check if the channel can run in internal timing mode.
| chan | The channel to check |
This function will return 1 if internal timing is enabled and the timing device is available.
Definition at line 4381 of file channel.c.
References ast_channel_timingfd(), and ast_opt_internal_timing.
Referenced by add_sdp(), and ast_read_generator_actions().
{
return (ast_opt_internal_timing && ast_channel_timingfd(chan) > -1);
}
| int ast_is_deferrable_frame | ( | const struct ast_frame * | frame | ) |
Should we keep this frame for later?
There are functions such as ast_safe_sleep which will service a channel to ensure that it does not have a large backlog of queued frames. When this happens, we want to hold on to specific frame types and just drop others. This function will tell if the frame we just read should be held onto.
| frame | The frame we just read |
| 1 | frame should be kept |
| 0 | frame should be dropped |
Definition at line 1646 of file channel.c.
References 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, and ast_frame::frametype.
Referenced by ast_safe_sleep_conditional(), autoservice_run(), and feature_request_and_dial().
{
/* Do not add a default entry in this switch statement. Each new
* frame type should be addressed directly as to whether it should
* be queued up or not.
*/
switch (frame->frametype) {
case AST_FRAME_CONTROL:
case AST_FRAME_TEXT:
case AST_FRAME_IMAGE:
case AST_FRAME_HTML:
return 1;
case AST_FRAME_DTMF_END:
case AST_FRAME_DTMF_BEGIN:
case AST_FRAME_VOICE:
case AST_FRAME_VIDEO:
case AST_FRAME_NULL:
case AST_FRAME_IAX:
case AST_FRAME_CNG:
case AST_FRAME_MODEM:
return 0;
}
return 0;
}
| 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.
Definition at line 8707 of file channel.c.
References ao2_callback, ao2_cleanup, ao2_container_count(), match(), namedgroup_match(), and SWAP.
Referenced by find_channel_by_group().
{
void *match;
struct ao2_container *group_a = (struct ao2_container *) a;
struct ao2_container *group_b = (struct ao2_container *) b;
if (!a || !b) {
return 0;
}
/*
* Do groups a and b intersect? Since a and b are hash tables,
* the average time complexity is:
* O(a.count <= b.count ? a.count : b.count)
*/
if (ao2_container_count(group_b) < ao2_container_count(group_a)) {
/* Traverse over the smaller group. */
SWAP(group_a, group_b);
}
match = ao2_callback(group_a, 0, namedgroup_match, group_b);
ao2_cleanup(match);
return match != NULL;
}
| 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.
| dest | Destination caller |
| src | Source caller |
Definition at line 2151 of file channel.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_copy(), ast_party_caller::id, and ast_party_caller::priv.
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_party_id_copy(&dest->id, &src->id);
ast_party_id_copy(&dest->ani, &src->ani);
ast_party_id_copy(&dest->priv, &src->priv);
dest->ani2 = src->ani2;
}
| void ast_party_caller_free | ( | struct ast_party_caller * | doomed | ) |
Destroy the caller party contents.
| doomed | The caller party to destroy. |
Definition at line 2180 of file channel.c.
References ast_party_caller::ani, ast_party_id_free(), ast_party_caller::id, and ast_party_caller::priv.
Referenced by ast_channel_destructor(), ast_dummy_channel_destructor(), callerid_write(), dial_trunk(), and sla_ring_station().
{
ast_party_id_free(&doomed->id);
ast_party_id_free(&doomed->ani);
ast_party_id_free(&doomed->priv);
}
| void ast_party_caller_init | ( | struct ast_party_caller * | init | ) |
Initialize the given caller structure.
| init | Caller structure to initialize. |
Definition at line 2143 of file channel.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_init(), ast_party_caller::id, and ast_party_caller::priv.
Referenced by __ast_channel_alloc_ap(), dial_trunk(), sig_pri_set_caller_id(), sig_ss7_set_caller_id(), and sla_ring_station().
{
ast_party_id_init(&init->id);
ast_party_id_init(&init->ani);
ast_party_id_init(&init->priv);
init->ani2 = 0;
}
| 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.
This is similar to ast_party_caller_copy, except that NULL values for strings in the src parameter indicate not to update the corresponding dest values.
| dest | The caller one wishes to update |
| src | The new caller values to update the dest |
| update | What caller information to update. NULL if all. |
Definition at line 2172 of file channel.c.
References ast_party_caller::ani, ast_set_party_caller::ani, ast_party_caller::ani2, ast_party_id_set(), ast_party_caller::id, ast_set_party_caller::id, ast_party_caller::priv, and ast_set_party_caller::priv.
Referenced by ast_channel_set_caller(), ast_channel_set_caller_event(), and callerid_write().
{
ast_party_id_set(&dest->id, &src->id, update ? &update->id : NULL);
ast_party_id_set(&dest->ani, &src->ani, update ? &update->ani : NULL);
ast_party_id_set(&dest->priv, &src->priv, update ? &update->priv : NULL);
dest->ani2 = src->ani2;
}
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Caller structure to initialize. |
| guide | Source caller to use as a guide in initializing. |
Definition at line 2164 of file channel.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_set_init(), ast_party_caller::id, and ast_party_caller::priv.
Referenced by callerid_write(), dial_exec_full(), do_forward(), misdn_update_caller_id(), ring_entry(), and sig_pri_handle_subcmds().
{
ast_party_id_set_init(&init->id, &guide->id);
ast_party_id_set_init(&init->ani, &guide->ani);
ast_party_id_set_init(&init->priv, &guide->priv);
init->ani2 = guide->ani2;
}
| 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.
| connected | Collected caller information for the connected line |
| caller | Caller information. |
Definition at line 2228 of file channel.c.
References ast_party_caller::ani, ast_party_connected_line::ani, ast_party_caller::ani2, ast_party_connected_line::ani2, AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN, ast_party_caller::id, ast_party_connected_line::id, ast_party_caller::priv, ast_party_connected_line::priv, and ast_party_connected_line::source.
| 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.
| dest | Destination connected line |
| src | Source connected line |
Definition at line 2196 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_party_id_copy(), ast_party_connected_line::id, ast_party_connected_line::priv, and ast_party_connected_line::source.
Referenced by __ast_read(), ast_call_forward(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_do_pickup(), builtin_atxfer(), dial_exec_full(), do_forward(), local_attended_transfer(), misdn_attempt_transfer(), party_connected_line_copy_transfer(), try_calling(), and wait_for_answer().
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_party_id_copy(&dest->id, &src->id);
ast_party_id_copy(&dest->ani, &src->ani);
ast_party_id_copy(&dest->priv, &src->priv);
dest->ani2 = src->ani2;
dest->source = src->source;
}
| void ast_party_connected_line_free | ( | struct ast_party_connected_line * | doomed | ) |
Destroy the connected line information contents.
| doomed | The connected line information to destroy. |
Definition at line 2237 of file channel.c.
References ast_party_connected_line::ani, ast_party_id_free(), ast_party_connected_line::id, and ast_party_connected_line::priv.
Referenced by __ast_read(), app_exec(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_channel_destructor(), ast_do_pickup(), ast_dummy_channel_destructor(), ast_indicate_data(), atxfer_fail_cleanup(), builtin_atxfer(), callattempt_free(), chanlist_free(), connectedline_write(), destroy_calling_node(), feature_request_and_dial(), local_attended_transfer(), misdn_attempt_transfer(), parked_call_exec(), sig_pri_handle_subcmds(), socket_process_helper(), wait_for_answer(), wait_for_winner(), and xfer_ds_destroy().
{
ast_party_id_free(&doomed->id);
ast_party_id_free(&doomed->ani);
ast_party_id_free(&doomed->priv);
}
| void ast_party_connected_line_init | ( | struct ast_party_connected_line * | init | ) |
Initialize the given connected line structure.
| init | Connected line structure to initialize. |
Definition at line 2187 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN, ast_party_id_init(), ast_party_connected_line::id, ast_party_connected_line::priv, and ast_party_connected_line::source.
Referenced by __ast_channel_alloc_ap(), __ast_read(), ast_channel_connected_line_macro(), ast_channel_connected_line_sub(), ast_do_pickup(), builtin_atxfer(), do_forward(), handle_request_invite(), handle_request_update(), handle_response_invite(), local_attended_transfer(), misdn_attempt_transfer(), misdn_queue_connected_line_update(), parked_call_exec(), sig_pri_handle_subcmds(), sip_call(), socket_process_helper(), and wait_for_answer().
{
ast_party_id_init(&init->id);
ast_party_id_init(&init->ani);
ast_party_id_init(&init->priv);
init->ani2 = 0;
init->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
}
| 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.
| dest | The connected line one wishes to update |
| src | The new connected line values to update the dest |
| update | What connected line information to update. NULL if all. |
Definition at line 2219 of file channel.c.
References ast_party_connected_line::ani, ast_set_party_connected_line::ani, ast_party_connected_line::ani2, ast_party_id_set(), ast_party_connected_line::id, ast_set_party_connected_line::id, ast_party_connected_line::priv, ast_set_party_connected_line::priv, and ast_party_connected_line::source.
Referenced by ast_channel_set_connected_line(), wait_for_answer(), and wait_for_winner().
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Connected line structure to initialize. |
| guide | Source connected line to use as a guide in initializing. |
Definition at line 2210 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_party_id_set_init(), ast_party_connected_line::id, ast_party_connected_line::priv, and ast_party_connected_line::source.
Referenced by __ast_request_and_dial(), ast_indicate_data(), connectedline_write(), dial_exec_full(), feature_request_and_dial(), wait_for_answer(), and wait_for_winner().
{
ast_party_id_set_init(&init->id, &guide->id);
ast_party_id_set_init(&init->ani, &guide->ani);
ast_party_id_set_init(&init->priv, &guide->priv);
init->ani2 = guide->ani2;
init->source = guide->source;
}
| 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.
| dest | Destination dialed party |
| src | Source dialed party |
Definition at line 2101 of file channel.c.
References ast_free, ast_party_subaddress_copy(), ast_strdup, ast_party_dialed::number, ast_party_dialed::plan, ast_party_dialed::str, ast_party_dialed::subaddress, and ast_party_dialed::transit_network_select.
Referenced by local_call().
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_free(dest->number.str);
dest->number.str = ast_strdup(src->number.str);
dest->number.plan = src->number.plan;
ast_party_subaddress_copy(&dest->subaddress, &src->subaddress);
dest->transit_network_select = src->transit_network_select;
}
| void ast_party_dialed_free | ( | struct ast_party_dialed * | doomed | ) |
Destroy the dialed party contents.
| doomed | The dialed party to destroy. |
Definition at line 2136 of file channel.c.
References ast_free, ast_party_subaddress_free(), ast_party_dialed::number, ast_party_dialed::str, and ast_party_dialed::subaddress.
Referenced by ast_channel_destructor(), ast_dummy_channel_destructor(), and callerid_write().
{
ast_free(doomed->number.str);
doomed->number.str = NULL;
ast_party_subaddress_free(&doomed->subaddress);
}
| void ast_party_dialed_init | ( | struct ast_party_dialed * | init | ) |
Initialize the given dialed structure.
| init | Dialed structure to initialize. |
Definition at line 2093 of file channel.c.
References ast_party_subaddress_init(), ast_party_dialed::number, ast_party_dialed::plan, ast_party_dialed::str, ast_party_dialed::subaddress, and ast_party_dialed::transit_network_select.
Referenced by __ast_channel_alloc_ap().
{
init->number.str = NULL;
init->number.plan = 0;/* Unknown */
ast_party_subaddress_init(&init->subaddress);
init->transit_network_select = 0;
}
| 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.
This is similar to ast_party_dialed_copy, except that NULL values for strings in the src parameter indicate not to update the corresponding dest values.
| dest | The dialed one wishes to update |
| src | The new dialed values to update the dest |
Definition at line 2123 of file channel.c.
References ast_free, ast_party_subaddress_set(), ast_strdup, ast_party_dialed::number, ast_party_dialed::plan, ast_party_dialed::str, ast_party_dialed::subaddress, and ast_party_dialed::transit_network_select.
Referenced by callerid_write().
{
if (src->number.str && src->number.str != dest->number.str) {
ast_free(dest->number.str);
dest->number.str = ast_strdup(src->number.str);
}
dest->number.plan = src->number.plan;
ast_party_subaddress_set(&dest->subaddress, &src->subaddress);
dest->transit_network_select = src->transit_network_select;
}
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Caller structure to initialize. |
| guide | Source dialed to use as a guide in initializing. |
Definition at line 2115 of file channel.c.
References ast_party_subaddress_set_init(), ast_party_dialed::number, ast_party_dialed::plan, ast_party_dialed::str, ast_party_dialed::subaddress, and ast_party_dialed::transit_network_select.
Referenced by callerid_write().
{
init->number.str = NULL;
init->number.plan = guide->number.plan;
ast_party_subaddress_set_init(&init->subaddress, &guide->subaddress);
init->transit_network_select = guide->transit_network_select;
}
| 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.
| dest | Destination party id |
| src | Source party id |
Definition at line 1930 of file channel.c.
References ast_free, ast_party_name_copy(), ast_party_number_copy(), ast_party_subaddress_copy(), ast_strdup, ast_party_id::name, ast_party_id::number, ast_party_id::subaddress, and ast_party_id::tag.
Referenced by ast_connected_line_copy_from_caller(), ast_connected_line_copy_to_caller(), ast_party_caller_copy(), ast_party_connected_line_copy(), ast_party_id_merge_copy(), ast_party_redirecting_copy(), and parkandannounce_exec().
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_party_name_copy(&dest->name, &src->name);
ast_party_number_copy(&dest->number, &src->number);
ast_party_subaddress_copy(&dest->subaddress, &src->subaddress);
ast_free(dest->tag);
dest->tag = ast_strdup(src->tag);
}
| void ast_party_id_free | ( | struct ast_party_id * | doomed | ) |
Destroy the party id contents.
| doomed | The party id to destroy. |
Definition at line 1976 of file channel.c.
References ast_free, ast_party_name_free(), ast_party_number_free(), ast_party_subaddress_free(), ast_party_id::name, ast_party_id::number, ast_party_id::subaddress, and ast_party_id::tag.
Referenced by ast_party_caller_free(), ast_party_connected_line_free(), ast_party_id_reset(), ast_party_redirecting_free(), parkandannounce_exec(), and sig_pri_mcid_event().
{
ast_party_name_free(&doomed->name);
ast_party_number_free(&doomed->number);
ast_party_subaddress_free(&doomed->subaddress);
ast_free(doomed->tag);
doomed->tag = NULL;
}
| void ast_party_id_init | ( | struct ast_party_id * | init | ) |
Initialize the given party id structure.
| init | Party id structure to initialize. |
Definition at line 1922 of file channel.c.
References ast_party_name_init(), ast_party_number_init(), ast_party_subaddress_init(), ast_party_id::name, ast_party_id::number, ast_party_id::subaddress, and ast_party_id::tag.
Referenced by ast_party_caller_init(), ast_party_connected_line_init(), ast_party_id_reset(), ast_party_redirecting_init(), dial_exec_full(), parkandannounce_exec(), and sig_pri_mcid_event().
{
ast_party_name_init(&init->name);
ast_party_number_init(&init->number);
ast_party_subaddress_init(&init->subaddress);
init->tag = NULL;
}
| void ast_party_id_invalidate | ( | struct ast_party_id * | id | ) |
Invalidate all components of the given party id.
| id | The party id to invalidate. |
Definition at line 2054 of file channel.c.
Referenced by sig_pri_handle_subcmds().
{
id->name.valid = 0;
id->number.valid = 0;
id->subaddress.valid = 0;
}
| struct ast_party_id ast_party_id_merge | ( | struct ast_party_id * | base, |
| struct ast_party_id * | overlay | ||
| ) | [read] |
Merge a given party id into another given party id.
This function will generate an effective party id.
Each party id component of the party id 'base' is overwritten by components of the party id 'overlay' if the overlay component is marked as valid. However the component 'tag' of the base party id remains untouched.
| base | The party id which is merged. |
| overlay | The party id which is used to merge into. |
Definition at line 2067 of file channel.c.
References ast_party_id::name.
Referenced by ast_channel_connected_effective_id(), ast_channel_redirecting_effective_from(), ast_channel_redirecting_effective_orig(), ast_channel_redirecting_effective_to(), and ast_party_id_merge_copy().
{
struct ast_party_id merged;
merged = *base;
if (overlay->name.valid) {
merged.name = overlay->name;
}
if (overlay->number.valid) {
merged.number = overlay->number;
}
if (overlay->subaddress.valid) {
merged.subaddress = overlay->subaddress;
}
/* Note the actual structure is returned and not a pointer to it! */
return merged;
}
| 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.
Each party id component of the party id 'base' is overwritten by components of the party id 'overlay' if the 'overlay' component is marked as valid. However the component 'tag' of the 'base' party id remains untouched. The result is copied into the given party id 'dest'.
| dest | The resulting merged party id. |
| base | The party id which is merged. |
| overlay | The party id which is used to merge into. |
Definition at line 2085 of file channel.c.
References ast_party_id_copy(), and ast_party_id_merge().
{
struct ast_party_id merged;
merged = ast_party_id_merge(base, overlay);
ast_party_id_copy(dest, &merged);
}
| int ast_party_id_presentation | ( | const struct ast_party_id * | id | ) |
Determine the overall presentation value for the given party.
| id | Party to determine the overall presentation value. |
Definition at line 1986 of file channel.c.
References AST_PRES_ALLOWED, AST_PRES_NUMBER_NOT_AVAILABLE, AST_PRES_NUMBER_TYPE, AST_PRES_RESTRICTED, AST_PRES_RESTRICTION, AST_PRES_UNAVAILABLE, AST_PRES_USER_NUMBER_UNSCREENED, ast_party_id::name, ast_party_id::number, ast_party_name::valid, and ast_party_number::valid.
Referenced by add_rpid(), ast_str_retrieve_variable(), ast_var_channels_table(), callerpres_read(), iax2_call(), initreqprep(), my_set_callerid(), oh323_call(), party_id_build_data(), party_id_read(), redirecting_read(), report_new_callerid(), setup_env(), sig_pri_event_party_id(), sig_pri_handle_subcmds(), sip_call(), and socket_process_helper().
{
int number_priority;
int number_value;
int number_screening;
int name_priority;
int name_value;
/* Determine name presentation priority. */
if (!id->name.valid) {
name_value = AST_PRES_UNAVAILABLE;
name_priority = 3;
} else {
name_value = id->name.presentation & AST_PRES_RESTRICTION;
switch (name_value) {
case AST_PRES_RESTRICTED:
name_priority = 0;
break;
case AST_PRES_ALLOWED:
name_priority = 1;
break;
case AST_PRES_UNAVAILABLE:
name_priority = 2;
break;
default:
name_value = AST_PRES_UNAVAILABLE;
name_priority = 3;
break;
}
}
/* Determine number presentation priority. */
if (!id->number.valid) {
number_screening = AST_PRES_USER_NUMBER_UNSCREENED;
number_value = AST_PRES_UNAVAILABLE;
number_priority = 3;
} else {
number_screening = id->number.presentation & AST_PRES_NUMBER_TYPE;
number_value = id->number.presentation & AST_PRES_RESTRICTION;
switch (number_value) {
case AST_PRES_RESTRICTED:
number_priority = 0;
break;
case AST_PRES_ALLOWED:
number_priority = 1;
break;
case AST_PRES_UNAVAILABLE:
number_priority = 2;
break;
default:
number_screening = AST_PRES_USER_NUMBER_UNSCREENED;
number_value = AST_PRES_UNAVAILABLE;
number_priority = 3;
break;
}
}
/* Select the wining presentation value. */
if (name_priority < number_priority) {
number_value = name_value;
}
if (number_value == AST_PRES_UNAVAILABLE) {
return AST_PRES_NUMBER_NOT_AVAILABLE;
}
return number_value | number_screening;
}
| void ast_party_id_reset | ( | struct ast_party_id * | id | ) |
Destroy and initialize the given party id structure.
| id | The party id to reset. |
Definition at line 2061 of file channel.c.
References ast_party_id_free(), and ast_party_id_init().
Referenced by ast_do_masquerade(), ast_do_pickup(), cb_events(), local_attended_transfer(), masquerade_colp_transfer(), misdn_attempt_transfer(), and misdn_facility_ie_handler().
{
ast_party_id_free(id);
ast_party_id_init(id);
}
| 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.
| dest | The id one wishes to update |
| src | The new id values to update the dest |
| update | What id information to update. NULL if all. |
Definition at line 1953 of file channel.c.
References ast_free, ast_party_name_set(), ast_party_number_set(), ast_party_subaddress_set(), ast_strdup, ast_party_id::name, ast_set_party_id::name, ast_party_id::number, ast_set_party_id::number, ast_party_id::subaddress, ast_set_party_id::subaddress, and ast_party_id::tag.
Referenced by ast_party_caller_set(), ast_party_connected_line_set(), and ast_party_redirecting_set().
{
if (dest == src) {
/* Don't set to self */
return;
}
if (!update || update->name) {
ast_party_name_set(&dest->name, &src->name);
}
if (!update || update->number) {
ast_party_number_set(&dest->number, &src->number);
}
if (!update || update->subaddress) {
ast_party_subaddress_set(&dest->subaddress, &src->subaddress);
}
if (src->tag && src->tag != dest->tag) {
ast_free(dest->tag);
dest->tag = ast_strdup(src->tag);
}
}
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Party id structure to initialize. |
| guide | Source party id to use as a guide in initializing. |
Definition at line 1945 of file channel.c.
References ast_party_name_set_init(), ast_party_number_set_init(), ast_party_subaddress_set_init(), ast_party_id::name, ast_party_id::number, ast_party_id::subaddress, and ast_party_id::tag.
Referenced by ast_party_caller_set_init(), ast_party_connected_line_set_init(), ast_party_redirecting_set_init(), and dial_exec_full().
{
ast_party_name_set_init(&init->name, &guide->name);
ast_party_number_set_init(&init->number, &guide->number);
ast_party_subaddress_set_init(&init->subaddress, &guide->subaddress);
init->tag = NULL;
}
| 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.
| dest | Destination party name |
| src | Source party name |
Definition at line 1764 of file channel.c.
References ast_free, ast_strdup, ast_party_name::char_set, ast_party_name::presentation, ast_party_name::str, and ast_party_name::valid.
Referenced by ast_party_id_copy().
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_free(dest->str);
dest->str = ast_strdup(src->str);
dest->char_set = src->char_set;
dest->presentation = src->presentation;
dest->valid = src->valid;
}
| void ast_party_name_free | ( | struct ast_party_name * | doomed | ) |
Destroy the party name contents.
| doomed | The party name to destroy. |
Definition at line 1803 of file channel.c.
References ast_free, and ast_party_name::str.
Referenced by __analog_ss_thread(), analog_ss_thread(), ast_party_id_free(), and skinny_newcall().
| void ast_party_name_init | ( | struct ast_party_name * | init | ) |
Initialize the given name structure.
| init | Name structure to initialize. |
Definition at line 1756 of file channel.c.
References AST_PARTY_CHAR_SET_ISO8859_1, AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, ast_party_name::char_set, ast_party_name::presentation, ast_party_name::str, and ast_party_name::valid.
Referenced by __analog_ss_thread(), analog_ss_thread(), ast_party_id_init(), and skinny_newcall().
{
init->str = NULL;
init->char_set = AST_PARTY_CHAR_SET_ISO8859_1;
init->presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
init->valid = 0;
}
| 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.
| dest | The name one wishes to update |
| src | The new name values to update the dest |
Definition at line 1786 of file channel.c.
References ast_free, ast_strdup, ast_party_name::char_set, ast_party_name::presentation, ast_party_name::str, and ast_party_name::valid.
Referenced by ast_party_id_set().
{
if (dest == src) {
/* Don't set to self */
return;
}
if (src->str && src->str != dest->str) {
ast_free(dest->str);
dest->str = ast_strdup(src->str);
}
dest->char_set = src->char_set;
dest->presentation = src->presentation;
dest->valid = src->valid;
}
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Party name structure to initialize. |
| guide | Source party name to use as a guide in initializing. |
Definition at line 1778 of file channel.c.
References ast_party_name::char_set, ast_party_name::presentation, ast_party_name::str, and ast_party_name::valid.
Referenced by ast_party_id_set_init().
{
init->str = NULL;
init->char_set = guide->char_set;
init->presentation = guide->presentation;
init->valid = guide->valid;
}
| 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.
| dest | Destination party number |
| src | Source party number |
Definition at line 1817 of file channel.c.
References ast_free, ast_strdup, ast_party_number::plan, ast_party_number::presentation, ast_party_number::str, and ast_party_number::valid.
Referenced by ast_party_id_copy().
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_free(dest->str);
dest->str = ast_strdup(src->str);
dest->plan = src->plan;
dest->presentation = src->presentation;
dest->valid = src->valid;
}
| void ast_party_number_free | ( | struct ast_party_number * | doomed | ) |
Destroy the party number contents.
| doomed | The party number to destroy. |
Definition at line 1856 of file channel.c.
References ast_free, and ast_party_number::str.
Referenced by __analog_ss_thread(), analog_ss_thread(), ast_party_id_free(), do_forward(), skinny_newcall(), and wait_for_answer().
| void ast_party_number_init | ( | struct ast_party_number * | init | ) |
Initialize the given number structure.
| init | Number structure to initialize. |
Definition at line 1809 of file channel.c.
References AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, ast_party_number::plan, ast_party_number::presentation, ast_party_number::str, and ast_party_number::valid.
Referenced by __analog_ss_thread(), analog_ss_thread(), ast_party_id_init(), do_forward(), skinny_newcall(), and wait_for_answer().
{
init->str = NULL;
init->plan = 0;/* Unknown */
init->presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
init->valid = 0;
}
| 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.
| dest | The number one wishes to update |
| src | The new number values to update the dest |
Definition at line 1839 of file channel.c.
References ast_free, ast_strdup, ast_party_number::plan, ast_party_number::presentation, ast_party_number::str, and ast_party_number::valid.
Referenced by ast_party_id_set().
{
if (dest == src) {
/* Don't set to self */
return;
}
if (src->str && src->str != dest->str) {
ast_free(dest->str);
dest->str = ast_strdup(src->str);
}
dest->plan = src->plan;
dest->presentation = src->presentation;
dest->valid = src->valid;
}
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Party number structure to initialize. |
| guide | Source party number to use as a guide in initializing. |
Definition at line 1831 of file channel.c.
References ast_party_number::plan, ast_party_number::presentation, ast_party_number::str, and ast_party_number::valid.
Referenced by ast_party_id_set_init().
{
init->str = NULL;
init->plan = guide->plan;
init->presentation = guide->presentation;
init->valid = guide->valid;
}
| 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.
| dest | Destination redirecting |
| src | Source redirecting |
Definition at line 2257 of file channel.c.
References ast_party_id_copy(), ast_party_redirecting::count, ast_party_redirecting::from, ast_party_redirecting::orig, ast_party_redirecting::orig_reason, ast_party_redirecting::priv_from, ast_party_redirecting::priv_orig, ast_party_redirecting::priv_to, ast_party_redirecting::reason, and ast_party_redirecting::to.
Referenced by ast_call_forward(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), begin_dial_channel(), call_forward_inherit(), cb_events(), dial_exec_full(), do_forward(), local_call(), misdn_facility_ie_handler(), ring_entry(), and wait_for_answer().
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_party_id_copy(&dest->orig, &src->orig);
ast_party_id_copy(&dest->from, &src->from);
ast_party_id_copy(&dest->to, &src->to);
ast_party_id_copy(&dest->priv_orig, &src->priv_orig);
ast_party_id_copy(&dest->priv_from, &src->priv_from);
ast_party_id_copy(&dest->priv_to, &src->priv_to);
dest->count = src->count;
dest->reason = src->reason;
dest->orig_reason = src->orig_reason;
}
| void ast_party_redirecting_free | ( | struct ast_party_redirecting * | doomed | ) |
Destroy the redirecting information contents.
| doomed | The redirecting information to destroy. |
Definition at line 2301 of file channel.c.
References ast_party_id_free(), ast_party_redirecting::from, ast_party_redirecting::orig, ast_party_redirecting::priv_from, ast_party_redirecting::priv_orig, ast_party_redirecting::priv_to, and ast_party_redirecting::to.
Referenced by ast_channel_destructor(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), ast_dummy_channel_destructor(), ast_indicate_data(), call_forward_inherit(), cb_events(), do_forward(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), misdn_facility_ie_handler(), redirecting_write(), sig_pri_handle_subcmds(), and wait_for_answer().
{
ast_party_id_free(&doomed->orig);
ast_party_id_free(&doomed->from);
ast_party_id_free(&doomed->to);
ast_party_id_free(&doomed->priv_orig);
ast_party_id_free(&doomed->priv_from);
ast_party_id_free(&doomed->priv_to);
}
| void ast_party_redirecting_init | ( | struct ast_party_redirecting * | init | ) |
Initialize the given redirecting structure.
| init | Redirecting structure to initialize. |
Definition at line 2244 of file channel.c.
References ast_party_id_init(), AST_REDIRECTING_REASON_UNKNOWN, ast_party_redirecting::count, ast_party_redirecting::from, ast_party_redirecting::orig, ast_party_redirecting::orig_reason, ast_party_redirecting::priv_from, ast_party_redirecting::priv_orig, ast_party_redirecting::priv_to, ast_party_redirecting::reason, and ast_party_redirecting::to.
Referenced by __ast_channel_alloc_ap(), ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), call_forward_inherit(), cb_events(), do_forward(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), misdn_facility_ie_handler(), and wait_for_answer().
{
ast_party_id_init(&init->orig);
ast_party_id_init(&init->from);
ast_party_id_init(&init->to);
ast_party_id_init(&init->priv_orig);
ast_party_id_init(&init->priv_from);
ast_party_id_init(&init->priv_to);
init->count = 0;
init->reason = AST_REDIRECTING_REASON_UNKNOWN;
init->orig_reason = AST_REDIRECTING_REASON_UNKNOWN;
}
| 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.
This is similar to ast_party_redirecting_copy, except that NULL values for strings in the src parameter indicate not to update the corresponding dest values.
| dest | The redirecting one wishes to update |
| src | The new redirecting values to update the dest |
| update | What redirecting information to update. NULL if all. |
Definition at line 2288 of file channel.c.
References ast_party_id_set(), ast_party_redirecting::count, ast_party_redirecting::from, ast_set_party_redirecting::from, ast_party_redirecting::orig, ast_set_party_redirecting::orig, ast_party_redirecting::orig_reason, ast_party_redirecting::priv_from, ast_set_party_redirecting::priv_from, ast_party_redirecting::priv_orig, ast_set_party_redirecting::priv_orig, ast_party_redirecting::priv_to, ast_set_party_redirecting::priv_to, ast_party_redirecting::reason, ast_party_redirecting::to, and ast_set_party_redirecting::to.
Referenced by ast_channel_set_redirecting().
{
ast_party_id_set(&dest->orig, &src->orig, update ? &update->orig : NULL);
ast_party_id_set(&dest->from, &src->from, update ? &update->from : NULL);
ast_party_id_set(&dest->to, &src->to, update ? &update->to : NULL);
ast_party_id_set(&dest->priv_orig, &src->priv_orig, update ? &update->priv_orig : NULL);
ast_party_id_set(&dest->priv_from, &src->priv_from, update ? &update->priv_from : NULL);
ast_party_id_set(&dest->priv_to, &src->priv_to, update ? &update->priv_to : NULL);
dest->count = src->count;
dest->reason = src->reason;
dest->orig_reason = src->orig_reason;
}
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Redirecting id structure to initialize. |
| guide | Source redirecting id to use as a guide in initializing. |
Definition at line 2275 of file channel.c.
References ast_party_id_set_init(), ast_party_redirecting::count, ast_party_redirecting::from, ast_party_redirecting::orig, ast_party_redirecting::orig_reason, ast_party_redirecting::priv_from, ast_party_redirecting::priv_orig, ast_party_redirecting::priv_to, ast_party_redirecting::reason, and ast_party_redirecting::to.
Referenced by ast_indicate_data(), misdn_copy_redirecting_to_ast(), redirecting_write(), and sig_pri_redirecting_convert().
{
ast_party_id_set_init(&init->orig, &guide->orig);
ast_party_id_set_init(&init->from, &guide->from);
ast_party_id_set_init(&init->to, &guide->to);
ast_party_id_set_init(&init->priv_orig, &guide->priv_orig);
ast_party_id_set_init(&init->priv_from, &guide->priv_from);
ast_party_id_set_init(&init->priv_to, &guide->priv_to);
init->count = guide->count;
init->reason = guide->reason;
init->orig_reason = guide->orig_reason;
}
| 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.
| dest | Destination party subaddress |
| src | Source party subaddress |
Definition at line 1870 of file channel.c.
References ast_free, ast_strdup, ast_party_subaddress::odd_even_indicator, ast_party_subaddress::str, ast_party_subaddress::type, and ast_party_subaddress::valid.
Referenced by ast_party_dialed_copy(), and ast_party_id_copy().
{
if (dest == src) {
/* Don't copy to self */
return;
}
ast_free(dest->str);
dest->str = ast_strdup(src->str);
dest->type = src->type;
dest->odd_even_indicator = src->odd_even_indicator;
dest->valid = src->valid;
}
| void ast_party_subaddress_free | ( | struct ast_party_subaddress * | doomed | ) |
Destroy the party subaddress contents.
| doomed | The party subaddress to destroy. |
Definition at line 1909 of file channel.c.
References ast_free, and ast_party_subaddress::str.
Referenced by ast_party_dialed_free(), ast_party_id_free(), and pri_dchannel().
| void ast_party_subaddress_init | ( | struct ast_party_subaddress * | init | ) |
Initialize the given subaddress structure.
| init | Subaddress structure to initialize. |
Definition at line 1862 of file channel.c.
References ast_party_subaddress::odd_even_indicator, ast_party_subaddress::str, ast_party_subaddress::type, and ast_party_subaddress::valid.
Referenced by ast_party_dialed_init(), ast_party_id_init(), pri_dchannel(), sig_pri_call(), and sig_pri_set_subaddress().
{
init->str = NULL;
init->type = 0;
init->odd_even_indicator = 0;
init->valid = 0;
}
| 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.
| dest | The subaddress one wishes to update |
| src | The new subaddress values to update the dest |
Definition at line 1892 of file channel.c.
References ast_free, ast_strdup, ast_party_subaddress::odd_even_indicator, ast_party_subaddress::str, ast_party_subaddress::type, and ast_party_subaddress::valid.
Referenced by ast_party_dialed_set(), and ast_party_id_set().
{
if (dest == src) {
/* Don't set to self */
return;
}
if (src->str && src->str != dest->str) {
ast_free(dest->str);
dest->str = ast_strdup(src->str);
}
dest->type = src->type;
dest->odd_even_indicator = src->odd_even_indicator;
dest->valid = src->valid;
}
| 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.
The initialization is needed to allow a set operation to know if a value needs to be updated. Simple integers need the guide's original value in case the set operation is not trying to set a new value. String values are simply set to NULL pointers if they are not going to be updated.
| init | Party subaddress structure to initialize. |
| guide | Source party subaddress to use as a guide in initializing. |
Definition at line 1884 of file channel.c.
References ast_party_subaddress::odd_even_indicator, ast_party_subaddress::str, ast_party_subaddress::type, and ast_party_subaddress::valid.
Referenced by ast_party_dialed_set_init(), and ast_party_id_set_init().
{
init->str = NULL;
init->type = guide->type;
init->odd_even_indicator = guide->odd_even_indicator;
init->valid = guide->valid;
}
| void ast_poll_channel_add | ( | struct ast_channel * | chan0, |
| struct ast_channel * | chan1 | ||
| ) |
Add a channel to an optimized waitfor
Definition at line 2589 of file channel.c.
References ast_channel_epfd(), ast_channel_fd(), ast_channel_fd_isset(), and AST_MAX_FDS.
Referenced by ast_generic_bridge(), begin_dial_channel(), feature_request_and_dial(), local_bridge_loop(), remote_bridge_loop(), and wait_for_answer().
{
#ifdef HAVE_EPOLL
struct epoll_event ev;
int i = 0;
if (ast_channel_epfd(chan0) == -1)
return;
/* Iterate through the file descriptors on chan1, adding them to chan0 */
for (i = 0; i < AST_MAX_FDS; i++) {
if (!ast_channel_fd_isset(chan1, i)) {
continue;
}
ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP;
ev.data.ptr = ast_channel_internal_epfd_data(chan1, i);
epoll_ctl(ast_channel_epfd(chan0), EPOLL_CTL_ADD, ast_channel_fd(chan1, i), &ev);
}
#endif
return;
}
| void ast_poll_channel_del | ( | struct ast_channel * | chan0, |
| struct ast_channel * | chan1 | ||
| ) |
Delete a channel from an optimized waitfor
Definition at line 2613 of file channel.c.
References ast_channel_epfd(), ast_channel_fd(), ast_channel_fd_isset(), and AST_MAX_FDS.
Referenced by ast_generic_bridge(), feature_request_and_dial(), local_bridge_loop(), monitor_dial(), remote_bridge_loop(), and wait_for_answer().
{
#ifdef HAVE_EPOLL
struct epoll_event ev;
int i = 0;
if (ast_channel_epfd(chan0) == -1)
return;
for (i = 0; i < AST_MAX_FDS; i++) {
if (!ast_channel_fd_isset(chan1, i)) {
continue;
}
epoll_ctl(ast_channel_epfd(chan0), EPOLL_CTL_DEL, ast_channel_fd(chan1, i), &ev);
}
#endif
return;
}
| int ast_pre_call | ( | struct ast_channel * | chan, |
| const char * | sub_args | ||
| ) |
Execute a Gosub call on the channel before a call is placed.
This is called between ast_request() and ast_call() to execute a predial routine on the newly created channel.
| chan | Channel to execute Gosub. |
| sub_args | Gosub application parameter string. |
| 0 | on success. |
| -1 | on error. |
Definition at line 5987 of file channel.c.
References ast_app_exec_sub(), ast_channel_lock, ast_channel_tech(), ast_channel_unlock, chanlist::chan, and ast_channel_tech::pre_call.
Referenced by dial_exec_full(), and findmeexec().
{
int (*pre_call)(struct ast_channel *chan, const char *sub_args);
ast_channel_lock(chan);
pre_call = ast_channel_tech(chan)->pre_call;
if (pre_call) {
int res;
res = pre_call(chan, sub_args);
ast_channel_unlock(chan);
return res;
}
ast_channel_unlock(chan);
return ast_app_exec_sub(NULL, chan, sub_args, 0);
}
| char* ast_print_group | ( | char * | buf, |
| int | buflen, | ||
| ast_group_t | group | ||
| ) |
Print call and pickup groups into buffer.
Definition at line 8648 of file channel.c.
References first.
Referenced by _sip_show_peer(), _skinny_show_line(), func_channel_read(), function_sippeer(), misdn_cfg_get_config_string(), print_group(), read_config(), and serialize_showchan().
{
unsigned int i;
int first = 1;
char num[3];
buf[0] = '\0';
if (!group) /* Return empty string if no group */
return buf;
for (i = 0; i <= 63; i++) { /* Max group is 63 */
if (group & ((ast_group_t) 1 << i)) {
if (!first) {
strncat(buf, ", ", buflen - strlen(buf) - 1);
} else {
first = 0;
}
snprintf(num, sizeof(num), "%u", i);
strncat(buf, num, buflen - strlen(buf) - 1);
}
}
return buf;
}
| char* ast_print_namedgroups | ( | struct ast_str ** | buf, |
| struct ast_namedgroups * | groups | ||
| ) |
Print named call groups and named pickup groups.
Definition at line 8673 of file channel.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_str_append(), ast_str_buffer(), first, and namedgroup_member::name.
Referenced by _sip_show_peer(), func_channel_read(), function_sippeer(), misdn_cfg_get_config_string(), print_named_groups(), and read_config().
{
struct ao2_container *grp = (struct ao2_container *) group;
struct namedgroup_member *ng;
int first = 1;
struct ao2_iterator it;
if (!grp) {
return ast_str_buffer(*buf);
}
for (it = ao2_iterator_init(grp, 0); (ng = ao2_iterator_next(&it)); ao2_ref(ng, -1)) {
if (!first) {
ast_str_append(buf, 0, ", ");
} else {
first = 0;
}
ast_str_append(buf, 0, "%s", ng->name);
}
ao2_iterator_destroy(&it);
return ast_str_buffer(*buf);
}
| int ast_prod | ( | struct ast_channel * | chan | ) |
Send empty audio to prime a channel driver.
Definition at line 4828 of file channel.c.
References ast_channel_name(), ast_channel_rawwriteformat(), ast_debug, ast_format_copy(), AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, ast_log(), AST_STATE_UP, ast_write(), ast_frame::data, ast_frame_subclass::format, LOG_WARNING, ast_frame::ptr, ast_frame::src, and ast_frame::subclass.
Referenced by ast_activate_generator().
{
struct ast_frame a = { AST_FRAME_VOICE };
char nothing[128];
/* Send an empty audio frame to get things moving */
if (ast_channel_state(chan) != AST_STATE_UP) {
ast_debug(1, "Prodding channel '%s'\n", ast_channel_name(chan));
ast_format_copy(&a.subclass.format, ast_channel_rawwriteformat(chan));
a.data.ptr = nothing + AST_FRIENDLY_OFFSET;
a.src = "ast_prod"; /* this better match check in ast_write */
if (ast_write(chan, &a))
ast_log(LOG_WARNING, "Prodding channel '%s' failed\n", ast_channel_name(chan));
}
return 0;
}
| int ast_queue_control | ( | struct ast_channel * | chan, |
| enum ast_control_frame_type | control | ||
| ) |
Queue a control frame with payload.
| chan | channel to queue frame onto |
| control | type of control frame |
| zero | on success |
| non-zero | on failure |
Definition at line 1424 of file channel.c.
References AST_FRAME_CONTROL, and ast_queue_frame().
Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_read(), __dahdi_exception(), __oh323_update_info(), analog_call(), analog_exception(), analog_hangup(), analog_ss_thread(), ast_do_pickup(), attempt_transfer(), auto_congest(), cb_events(), cli_console_answer(), cli_console_flash(), console_answer(), console_call(), console_sendtext(), dahdi_handle_event(), dahdi_hangup(), gtalk_is_answered(), gtalk_ringing_ack(), handle_call_incoming(), handle_hd_hf(), handle_incoming(), handle_request(), handle_request_bye(), handle_request_info(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), handle_response_refer(), jingle_action_session_accept(), jingle_action_session_info(), jingle_is_answered(), jingle_outgoing_hook(), jingle_ringing_ack(), masquerade_colp_transfer(), misdn_facility_ie_handler(), multicast_rtp_call(), nbs_call(), phone_call(), process_sdp(), receive_digit(), remote_hold(), send_cause2ast(), setsubstate(), setup_rtp_connection(), sig_pri_mcid_event(), skinny_call(), skinny_transfer(), unistim_call(), and update_state().
{
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = control };
return ast_queue_frame(chan, &f);
}
| 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.
| chan | channel to queue frame onto |
| control | type of control frame |
| data | pointer to payload data to be included in frame |
| datalen | number of bytes of payload data |
| 0 | success |
| non-zero | failure |
The supplied payload data is copied into the frame, so the caller's copy is not modified nor freed, and the resulting frame will retain a copy of the data even if the caller frees their local copy.
Definition at line 1431 of file channel.c.
References AST_FRAME_CONTROL, and ast_queue_frame().
Referenced by __analog_handle_event(), analog_hangup(), ast_channel_queue_connected_line_update(), ast_channel_queue_redirecting_update(), change_t38_state(), dahdi_handle_event(), dahdi_hangup(), dahdi_r2_on_call_disconnect(), fax_gateway_indicate_t38(), handle_incoming(), handle_request_notify(), handle_response_refer(), iax2_queue_control_data(), iax2_transfer(), interpret_t38_parameters(), jingle_action_session_terminate(), local_attended_transfer(), masquerade_colp_transfer(), pri_queue_pvt_cause_data(), process_sdp(), setsubstate(), sig_pri_aoc_d_from_pri(), sig_pri_aoc_e_from_pri(), sig_pri_aoc_s_from_pri(), sig_pri_send_aoce_termination_request(), sip_sipredirect(), socket_process_helper(), ss7_queue_pvt_cause_data(), sub_hold(), and sub_unhold().
{
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = control, .data.ptr = (void *) data, .datalen = datalen };
return ast_queue_frame(chan, &f);
}
| int ast_queue_frame | ( | struct ast_channel * | chan, |
| struct ast_frame * | f | ||
| ) |
Queue one or more frames to a channel's frame queue.
| chan | the channel to queue the frame(s) on |
| f | the frame(s) to queue. Note that the frame(s) will be duplicated by this function. It is the responsibility of the caller to handle freeing the memory associated with the frame(s) being passed if necessary. |
| 0 | success |
| non-zero | failure |
Definition at line 1351 of file channel.c.
References __ast_queue_frame().
Referenced by __ast_channel_masquerade(), __ast_read(), __oh323_rtp_create(), __oh323_update_info(), action_atxfer(), agent_request(), alsa_call(), ast_channel_setwhentohangup_tv(), ast_do_masquerade(), ast_dsp_process(), ast_queue_cc_frame(), ast_queue_control(), ast_queue_control_data(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_softhangup_nolock(), bridge_write(), cb_events(), cli_console_dial(), cli_console_sendtext(), conf_stop_record(), console_dial(), console_do_answer(), console_flash(), console_sendtext(), dahdi_queue_frame(), dahdi_read(), dictate_exec(), do_immediate_setup(), gtalk_handle_dtmf(), handle_keypad_button_message(), handle_request_info(), handle_request_invite(), handle_response_invite(), iax2_queue_frame(), jingle_handle_dtmf(), keypad_digit(), local_queue_frame(), mgcp_queue_frame(), oh323_simulate_dtmf_end(), oss_call(), pri_queue_frame(), process_sdp(), queue_dtmf_readq(), receive_digit(), receive_message(), sig_pri_dial_complete(), sig_pri_handle_subcmds(), sig_ss7_queue_frame(), stream_monitor(), t38_tx_packet_handler(), unistim_do_senddigit(), unistim_senddigit_end(), and wakeup_sub().
{
return __ast_queue_frame(chan, fin, 0, NULL);
}
| 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.
| chan | the channel to queue the frame(s) on |
| f | the frame(s) to queue. Note that the frame(s) will be duplicated by this function. It is the responsibility of the caller to handle freeing the memory associated with the frame(s) being passed if necessary. |
| 0 | success |
| non-zero | failure |
Definition at line 1356 of file channel.c.
References __ast_queue_frame().
Referenced by __ast_answer(), __ast_read(), ast_autoservice_stop(), ast_safe_sleep_conditional(), and feature_request_and_dial().
{
return __ast_queue_frame(chan, fin, 1, NULL);
}
| int ast_queue_hangup | ( | struct ast_channel * | chan | ) |
Queue a hangup frame.
Definition at line 1362 of file channel.c.
References ast_channel_lock, ast_channel_name(), ast_channel_softhangup_internal_flag_add(), ast_channel_uniqueid(), ast_channel_unlock, AST_CONTROL_HANGUP, AST_FRAME_CONTROL, ast_queue_frame(), AST_SOFTHANGUP_DEV, EVENT_FLAG_CALL, and manager_event.
Referenced by cleanup_connection(), cli_console_hangup(), close_call(), gtalk_hangup_farend(), gtalk_is_answered(), handle_request_bye(), iax2_destroy(), iax2_queue_hangup(), jingle_hangup_farend(), local_fixup(), local_hangup(), mgcp_queue_hangup(), setsubstate(), and sip_queue_hangup_cause().
{
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_HANGUP };
int res;
/* Yeah, let's not change a lock-critical value without locking */
ast_channel_lock(chan);
ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_DEV);
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when a hangup is requested with no set cause.</synopsis>
</managerEventInstance>
***/
manager_event(EVENT_FLAG_CALL, "HangupRequest",
"Channel: %s\r\n"
"Uniqueid: %s\r\n",
ast_channel_name(chan),
ast_channel_uniqueid(chan));
res = ast_queue_frame(chan, &f);
ast_channel_unlock(chan);
return res;
}
| int ast_queue_hangup_with_cause | ( | struct ast_channel * | chan, |
| int | cause | ||
| ) |
Queue a hangup frame with hangupcause set.
| [in] | chan | channel to queue frame onto |
| [in] | cause | the hangup cause |
Definition at line 1387 of file channel.c.
References ast_channel_hangupcause(), ast_channel_lock, ast_channel_name(), ast_channel_softhangup_internal_flag_add(), ast_channel_uniqueid(), ast_channel_unlock, AST_CONTROL_HANGUP, AST_FRAME_CONTROL, ast_queue_frame(), AST_SOFTHANGUP_DEV, ast_frame::data, EVENT_FLAG_CALL, manager_event, and ast_frame::uint32.
Referenced by __analog_handle_event(), __oh323_update_info(), __sip_autodestruct(), close_call(), close_client(), console_hangup(), dahdi_handle_event(), dahdi_r2_on_call_disconnect(), discard_call(), handle_call_outgoing(), handle_request_bye(), handle_response(), handle_response_invite(), hangup_chan(), hangup_connection(), jingle_action_session_terminate(), jingle_queue_hangup_with_cause(), misdn_answer(), retrans_pkt(), sip_queue_hangup_cause(), and transfer_cancel_step2().
{
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_HANGUP };
int res;
if (cause >= 0) {
f.data.uint32 = cause;
}
/* Yeah, let's not change a lock-critical value without locking */
ast_channel_lock(chan);
ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_DEV);
if (cause < 0) {
f.data.uint32 = ast_channel_hangupcause(chan);
}
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when a hangup is requested with a specific cause code.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='Hangup']/managerEventInstance/syntax/parameter[@name='Cause'])" />
</syntax>
</managerEventInstance>
***/
manager_event(EVENT_FLAG_CALL, "HangupRequest",
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
"Cause: %d\r\n",
ast_channel_name(chan),
ast_channel_uniqueid(chan),
cause);
res = ast_queue_frame(chan, &f);
ast_channel_unlock(chan);
return res;
}
| int ast_raw_answer | ( | struct ast_channel * | chan, |
| int | cdr_answer | ||
| ) |
Answer a channel.
| chan | channel to answer |
| cdr_answer | flag to control whether any associated CDR should be marked as 'answered' |
This function answers a channel and handles all necessary call setup functions.
| 0 | on success |
| non-zero | on failure |
Definition at line 2897 of file channel.c.
References ast_channel_tech::answer, ast_cdr_answer(), AST_CEL_ANSWER, ast_cel_report_event(), ast_channel_cdr(), ast_channel_flags(), ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_check_hangup(), AST_FLAG_OUTGOING, AST_FLAG_ZOMBIE, ast_indicate(), ast_setstate(), AST_STATE_RING, AST_STATE_RINGING, AST_STATE_UP, and ast_test_flag.
Referenced by __ast_answer(), and ast_bridge_call().
{
int res = 0;
ast_channel_lock(chan);
/* You can't answer an outbound call */
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING)) {
ast_channel_unlock(chan);
return 0;
}
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
return -1;
}
ast_channel_unlock(chan);
switch (ast_channel_state(chan)) {
case AST_STATE_RINGING:
case AST_STATE_RING:
ast_channel_lock(chan);
if (ast_channel_tech(chan)->answer) {
res = ast_channel_tech(chan)->answer(chan);
}
ast_setstate(chan, AST_STATE_UP);
if (cdr_answer) {
ast_cdr_answer(ast_channel_cdr(chan));
}
ast_cel_report_event(chan, AST_CEL_ANSWER, NULL, NULL, NULL);
ast_channel_unlock(chan);
break;
case AST_STATE_UP:
ast_cel_report_event(chan, AST_CEL_ANSWER, NULL, NULL, NULL);
/* Calling ast_cdr_answer when it it has previously been called
* is essentially a no-op, so it is safe.
*/
if (cdr_answer) {
ast_cdr_answer(ast_channel_cdr(chan));
}
break;
default:
break;
}
ast_indicate(chan, -1);
return res;
}
| struct ast_frame* ast_read | ( | struct ast_channel * | chan | ) | [read] |
Reads a frame.
| chan | channel to read a frame from |
Definition at line 4386 of file channel.c.
References __ast_read().
Referenced by __adsi_transmit_messages(), __analog_ss_thread(), __ast_answer(), __ast_play_and_record(), __ast_request_and_dial(), adsi_careful_send(), agent_ack_sleep(), agent_read(), analog_ss_thread(), ast_bridge_handle_trip(), ast_generic_bridge(), ast_recvtext(), ast_safe_sleep_conditional(), ast_tonepair(), ast_transfer(), ast_udptl_bridge(), ast_waitfordigit_full(), async_agi_read_frame(), async_wait(), autoservice_run(), background_detect_exec(), channel_spy(), conf_flush(), conf_run(), dahdi_accept_r2_call_exec(), dahdi_bridge(), dial_exec_full(), dictate_exec(), disa_exec(), disable_t38(), do_idle_thread(), do_waiting(), echo_exec(), eivr_comm(), feature_request_and_dial(), find_cache(), generic_fax_exec(), handle_recordfile(), handle_speechrecognize(), iax2_bridge(), ices_exec(), isAnsweringMachine(), jack_exec(), local_bridge_loop(), manage_parked_call(), measurenoise(), misdn_bridge(), monitor_dial(), mp3_exec(), NBScat_exec(), receive_dtmf_digits(), receivefax_t38_init(), record_exec(), recordthread(), remote_bridge_loop(), run_agi(), send_tone_burst(), send_waveform_to_channel(), sendfax_t38_init(), sendurl_exec(), speech_background(), transmit_audio(), transmit_t38(), wait_for_answer(), wait_for_hangup(), wait_for_winner(), waitforring_exec(), and waitstream_core().
{
return __ast_read(chan, 0);
}
| struct ast_frame* ast_read_noaudio | ( | struct ast_channel * | chan | ) | [read] |
Reads a frame, returning AST_FRAME_NULL frame if audio.
| chan | channel to read a frame from |
Definition at line 4391 of file channel.c.
References __ast_read().
Referenced by ast_bridge_handle_trip(), and conf_run().
{
return __ast_read(chan, 1);
}
| int ast_readstring | ( | struct ast_channel * | c, |
| char * | s, | ||
| int | len, | ||
| int | timeout, | ||
| int | rtimeout, | ||
| char * | enders | ||
| ) |
Reads multiple digits.
| c | channel to read from |
| s | string to read in to. Must be at least the size of your length |
| len | how many digits to read (maximum) |
| timeout | how long to timeout between digits |
| rtimeout | timeout to wait on the first digit |
| enders | digits to end the string |
Read in a digit string "s", max length "len", maximum timeout between digits "timeout" (-1 for none), terminated by anything in "enders". Give them rtimeout for the first digit.
Definition at line 6080 of file channel.c.
References ast_readstring_full().
Referenced by __adsi_transmit_messages(), adsi_begin_download(), adsi_get_cpeinfo(), adsi_load_session(), app_exec(), ast_app_getdata(), dialout(), do_directory(), forward_message(), privacy_exec(), vm_authenticate(), vm_newuser(), and vm_options().
{
return ast_readstring_full(c, s, len, timeout, ftimeout, enders, -1, -1);
}
| int ast_readstring_full | ( | struct ast_channel * | c, |
| char * | s, | ||
| int | len, | ||
| int | timeout, | ||
| int | rtimeout, | ||
| char * | enders, | ||
| int | audiofd, | ||
| int | ctrlfd | ||
| ) |
Definition at line 6085 of file channel.c.
References ast_channel_flags(), ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), ast_channel_stream(), ast_check_hangup(), AST_DIGIT_ANY, AST_FLAG_ZOMBIE, AST_GETDATA_COMPLETE, AST_GETDATA_EMPTY_END_TERMINATED, AST_GETDATA_FAILED, AST_GETDATA_INTERRUPTED, AST_GETDATA_TIMEOUT, ast_opt_transmit_silence, ast_stopstream(), ast_test_flag, ast_waitfordigit_full(), and ast_waitstream_full().
Referenced by ast_app_getdata_full(), and ast_readstring().
{
int pos = 0; /* index in the buffer where we accumulate digits */
int to = ftimeout;
struct ast_silence_generator *silgen = NULL;
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(c), AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
if (!len)
return -1;
for (;;) {
int d;
if (ast_channel_stream(c)) {
d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd);
ast_stopstream(c);
if (!silgen && ast_opt_transmit_silence)
silgen = ast_channel_start_silence_generator(c);
usleep(1000);
if (!d)
d = ast_waitfordigit_full(c, to, audiofd, ctrlfd);
} else {
if (!silgen && ast_opt_transmit_silence)
silgen = ast_channel_start_silence_generator(c);
d = ast_waitfordigit_full(c, to, audiofd, ctrlfd);
}
if (d < 0) {
ast_channel_stop_silence_generator(c, silgen);
return AST_GETDATA_FAILED;
}
if (d == 0) {
s[pos] = '\0';
ast_channel_stop_silence_generator(c, silgen);
return AST_GETDATA_TIMEOUT;
}
if (d == 1) {
s[pos] = '\0';
ast_channel_stop_silence_generator(c, silgen);
return AST_GETDATA_INTERRUPTED;
}
if (strchr(enders, d) && (pos == 0)) {
s[pos] = '\0';
ast_channel_stop_silence_generator(c, silgen);
return AST_GETDATA_EMPTY_END_TERMINATED;
}
if (!strchr(enders, d)) {
s[pos++] = d;
}
if (strchr(enders, d) || (pos >= len)) {
s[pos] = '\0';
ast_channel_stop_silence_generator(c, silgen);
return AST_GETDATA_COMPLETE;
}
to = timeout;
}
/* Never reached */
return 0;
}
| int ast_recvchar | ( | struct ast_channel * | chan, |
| int | timeout | ||
| ) |
Receives a text character from a channel.
| chan | channel to act upon |
| timeout | timeout in milliseconds (0 for infinite wait) |
Read a char of text from a channel
Definition at line 4666 of file channel.c.
References ast_free, and ast_recvtext().
Referenced by handle_recvchar().
{
int c;
char *buf = ast_recvtext(chan, timeout);
if (buf == NULL)
return -1; /* error or timeout */
c = *(unsigned char *)buf;
ast_free(buf);
return c;
}
| char* ast_recvtext | ( | struct ast_channel * | chan, |
| int | timeout | ||
| ) |
Receives a text string from a channel Read a string of text from a channel.
| chan | channel to act upon |
| timeout | timeout in milliseconds (0 for infinite wait) |
Definition at line 4677 of file channel.c.
References ast_check_hangup(), AST_CONTROL_HANGUP, AST_FRAME_CONTROL, AST_FRAME_TEXT, ast_frfree, ast_read(), ast_remaining_ms(), ast_strndup, ast_tvnow(), ast_waitfor(), ast_frame::data, ast_frame::datalen, f, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::ptr, and ast_frame::subclass.
Referenced by ast_recvchar(), and handle_recvtext().
{
int res;
char *buf = NULL;
struct timeval start = ast_tvnow();
int ms;
while ((ms = ast_remaining_ms(start, timeout))) {
struct ast_frame *f;
if (ast_check_hangup(chan)) {
break;
}
res = ast_waitfor(chan, ms);
if (res <= 0) {/* timeout or error */
break;
}
f = ast_read(chan);
if (f == NULL) {
break; /* no frame */
}
if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
ast_frfree(f);
break;
} else if (f->frametype == AST_FRAME_TEXT) { /* what we want */
buf = ast_strndup((char *) f->data.ptr, f->datalen); /* dup and break */
ast_frfree(f);
break;
}
ast_frfree(f);
}
return buf;
}
| 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.
| data | Buffer to fill with the frame data |
| datalen | Size of the buffer to fill |
| redirecting | Redirecting id information |
| update | What redirecting information to build. NULL if all. |
| -1 | if error |
| Amount | of data buffer used |
Definition at line 9849 of file channel.c.
References ast_log(), AST_REDIRECTING_COUNT, AST_REDIRECTING_FROM_ID_PRESENTATION, AST_REDIRECTING_FROM_NAME, AST_REDIRECTING_FROM_NAME_CHAR_SET, AST_REDIRECTING_FROM_NAME_PRESENTATION, AST_REDIRECTING_FROM_NAME_VALID, AST_REDIRECTING_FROM_NUMBER, AST_REDIRECTING_FROM_NUMBER_PLAN, AST_REDIRECTING_FROM_NUMBER_PRESENTATION, AST_REDIRECTING_FROM_NUMBER_VALID, AST_REDIRECTING_FROM_SUBADDRESS, AST_REDIRECTING_FROM_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_FROM_SUBADDRESS_TYPE, AST_REDIRECTING_FROM_SUBADDRESS_VALID, AST_REDIRECTING_FROM_TAG, AST_REDIRECTING_ORIG_NAME, AST_REDIRECTING_ORIG_NAME_CHAR_SET, AST_REDIRECTING_ORIG_NAME_PRESENTATION, AST_REDIRECTING_ORIG_NAME_VALID, AST_REDIRECTING_ORIG_NUMBER, AST_REDIRECTING_ORIG_NUMBER_PLAN, AST_REDIRECTING_ORIG_NUMBER_PRESENTATION, AST_REDIRECTING_ORIG_NUMBER_VALID, AST_REDIRECTING_ORIG_REASON, AST_REDIRECTING_ORIG_SUBADDRESS, AST_REDIRECTING_ORIG_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_ORIG_SUBADDRESS_TYPE, AST_REDIRECTING_ORIG_SUBADDRESS_VALID, AST_REDIRECTING_ORIG_TAG, AST_REDIRECTING_PRIV_FROM_NAME, AST_REDIRECTING_PRIV_FROM_NAME_CHAR_SET, AST_REDIRECTING_PRIV_FROM_NAME_PRESENTATION, AST_REDIRECTING_PRIV_FROM_NAME_VALID, AST_REDIRECTING_PRIV_FROM_NUMBER, AST_REDIRECTING_PRIV_FROM_NUMBER_PLAN, AST_REDIRECTING_PRIV_FROM_NUMBER_PRESENTATION, AST_REDIRECTING_PRIV_FROM_NUMBER_VALID, AST_REDIRECTING_PRIV_FROM_SUBADDRESS, AST_REDIRECTING_PRIV_FROM_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_PRIV_FROM_SUBADDRESS_TYPE, AST_REDIRECTING_PRIV_FROM_SUBADDRESS_VALID, AST_REDIRECTING_PRIV_FROM_TAG, AST_REDIRECTING_PRIV_ORIG_NAME, AST_REDIRECTING_PRIV_ORIG_NAME_CHAR_SET, AST_REDIRECTING_PRIV_ORIG_NAME_PRESENTATION, AST_REDIRECTING_PRIV_ORIG_NAME_VALID, AST_REDIRECTING_PRIV_ORIG_NUMBER, AST_REDIRECTING_PRIV_ORIG_NUMBER_PLAN, AST_REDIRECTING_PRIV_ORIG_NUMBER_PRESENTATION, AST_REDIRECTING_PRIV_ORIG_NUMBER_VALID, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_TYPE, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_VALID, AST_REDIRECTING_PRIV_ORIG_TAG, AST_REDIRECTING_PRIV_TO_NAME, AST_REDIRECTING_PRIV_TO_NAME_CHAR_SET, AST_REDIRECTING_PRIV_TO_NAME_PRESENTATION, AST_REDIRECTING_PRIV_TO_NAME_VALID, AST_REDIRECTING_PRIV_TO_NUMBER, AST_REDIRECTING_PRIV_TO_NUMBER_PLAN, AST_REDIRECTING_PRIV_TO_NUMBER_PRESENTATION, AST_REDIRECTING_PRIV_TO_NUMBER_VALID, AST_REDIRECTING_PRIV_TO_SUBADDRESS, AST_REDIRECTING_PRIV_TO_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_PRIV_TO_SUBADDRESS_TYPE, AST_REDIRECTING_PRIV_TO_SUBADDRESS_VALID, AST_REDIRECTING_PRIV_TO_TAG, AST_REDIRECTING_TO_ID_PRESENTATION, AST_REDIRECTING_TO_NAME, AST_REDIRECTING_TO_NAME_CHAR_SET, AST_REDIRECTING_TO_NAME_PRESENTATION, AST_REDIRECTING_TO_NAME_VALID, AST_REDIRECTING_TO_NUMBER, AST_REDIRECTING_TO_NUMBER_PLAN, AST_REDIRECTING_TO_NUMBER_PRESENTATION, AST_REDIRECTING_TO_NUMBER_VALID, AST_REDIRECTING_TO_SUBADDRESS, AST_REDIRECTING_TO_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_TO_SUBADDRESS_TYPE, AST_REDIRECTING_TO_SUBADDRESS_VALID, AST_REDIRECTING_TO_TAG, AST_REDIRECTING_VERSION, ast_party_redirecting::count, ast_party_redirecting::from, ast_set_party_redirecting::from, LOG_WARNING, ast_party_id_ies::name, ast_party_redirecting::orig, ast_set_party_redirecting::orig, ast_party_redirecting::orig_reason, party_id_build_data(), ast_party_redirecting::priv_from, ast_set_party_redirecting::priv_from, ast_party_redirecting::priv_orig, ast_set_party_redirecting::priv_orig, ast_party_redirecting::priv_to, ast_set_party_redirecting::priv_to, ast_party_redirecting::reason, ast_party_name_ies::str, ast_party_redirecting::to, ast_set_party_redirecting::to, and value.
Referenced by ast_channel_queue_redirecting_update(), ast_channel_update_redirecting(), and local_indicate().
{
int32_t value;
size_t pos = 0;
int res;
static const struct ast_party_id_ies orig_ies = {
.name.str = AST_REDIRECTING_ORIG_NAME,
.name.char_set = AST_REDIRECTING_ORIG_NAME_CHAR_SET,
.name.presentation = AST_REDIRECTING_ORIG_NAME_PRESENTATION,
.name.valid = AST_REDIRECTING_ORIG_NAME_VALID,
.number.str = AST_REDIRECTING_ORIG_NUMBER,
.number.plan = AST_REDIRECTING_ORIG_NUMBER_PLAN,
.number.presentation = AST_REDIRECTING_ORIG_NUMBER_PRESENTATION,
.number.valid = AST_REDIRECTING_ORIG_NUMBER_VALID,
.subaddress.str = AST_REDIRECTING_ORIG_SUBADDRESS,
.subaddress.type = AST_REDIRECTING_ORIG_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_REDIRECTING_ORIG_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_REDIRECTING_ORIG_SUBADDRESS_VALID,
.tag = AST_REDIRECTING_ORIG_TAG,
.combined_presentation = 0,/* Not sent. */
};
static const struct ast_party_id_ies from_ies = {
.name.str = AST_REDIRECTING_FROM_NAME,
.name.char_set = AST_REDIRECTING_FROM_NAME_CHAR_SET,
.name.presentation = AST_REDIRECTING_FROM_NAME_PRESENTATION,
.name.valid = AST_REDIRECTING_FROM_NAME_VALID,
.number.str = AST_REDIRECTING_FROM_NUMBER,
.number.plan = AST_REDIRECTING_FROM_NUMBER_PLAN,
.number.presentation = AST_REDIRECTING_FROM_NUMBER_PRESENTATION,
.number.valid = AST_REDIRECTING_FROM_NUMBER_VALID,
.subaddress.str = AST_REDIRECTING_FROM_SUBADDRESS,
.subaddress.type = AST_REDIRECTING_FROM_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_REDIRECTING_FROM_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_REDIRECTING_FROM_SUBADDRESS_VALID,
.tag = AST_REDIRECTING_FROM_TAG,
.combined_presentation = AST_REDIRECTING_FROM_ID_PRESENTATION,
};
static const struct ast_party_id_ies to_ies = {
.name.str = AST_REDIRECTING_TO_NAME,
.name.char_set = AST_REDIRECTING_TO_NAME_CHAR_SET,
.name.presentation = AST_REDIRECTING_TO_NAME_PRESENTATION,
.name.valid = AST_REDIRECTING_TO_NAME_VALID,
.number.str = AST_REDIRECTING_TO_NUMBER,
.number.plan = AST_REDIRECTING_TO_NUMBER_PLAN,
.number.presentation = AST_REDIRECTING_TO_NUMBER_PRESENTATION,
.number.valid = AST_REDIRECTING_TO_NUMBER_VALID,
.subaddress.str = AST_REDIRECTING_TO_SUBADDRESS,
.subaddress.type = AST_REDIRECTING_TO_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_REDIRECTING_TO_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_REDIRECTING_TO_SUBADDRESS_VALID,
.tag = AST_REDIRECTING_TO_TAG,
.combined_presentation = AST_REDIRECTING_TO_ID_PRESENTATION,
};
static const struct ast_party_id_ies priv_orig_ies = {
.name.str = AST_REDIRECTING_PRIV_ORIG_NAME,
.name.char_set = AST_REDIRECTING_PRIV_ORIG_NAME_CHAR_SET,
.name.presentation = AST_REDIRECTING_PRIV_ORIG_NAME_PRESENTATION,
.name.valid = AST_REDIRECTING_PRIV_ORIG_NAME_VALID,
.number.str = AST_REDIRECTING_PRIV_ORIG_NUMBER,
.number.plan = AST_REDIRECTING_PRIV_ORIG_NUMBER_PLAN,
.number.presentation = AST_REDIRECTING_PRIV_ORIG_NUMBER_PRESENTATION,
.number.valid = AST_REDIRECTING_PRIV_ORIG_NUMBER_VALID,
.subaddress.str = AST_REDIRECTING_PRIV_ORIG_SUBADDRESS,
.subaddress.type = AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_VALID,
.tag = AST_REDIRECTING_PRIV_ORIG_TAG,
.combined_presentation = 0,/* Not sent. */
};
static const struct ast_party_id_ies priv_from_ies = {
.name.str = AST_REDIRECTING_PRIV_FROM_NAME,
.name.char_set = AST_REDIRECTING_PRIV_FROM_NAME_CHAR_SET,
.name.presentation = AST_REDIRECTING_PRIV_FROM_NAME_PRESENTATION,
.name.valid = AST_REDIRECTING_PRIV_FROM_NAME_VALID,
.number.str = AST_REDIRECTING_PRIV_FROM_NUMBER,
.number.plan = AST_REDIRECTING_PRIV_FROM_NUMBER_PLAN,
.number.presentation = AST_REDIRECTING_PRIV_FROM_NUMBER_PRESENTATION,
.number.valid = AST_REDIRECTING_PRIV_FROM_NUMBER_VALID,
.subaddress.str = AST_REDIRECTING_PRIV_FROM_SUBADDRESS,
.subaddress.type = AST_REDIRECTING_PRIV_FROM_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_REDIRECTING_PRIV_FROM_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_REDIRECTING_PRIV_FROM_SUBADDRESS_VALID,
.tag = AST_REDIRECTING_PRIV_FROM_TAG,
.combined_presentation = 0,/* Not sent. */
};
static const struct ast_party_id_ies priv_to_ies = {
.name.str = AST_REDIRECTING_PRIV_TO_NAME,
.name.char_set = AST_REDIRECTING_PRIV_TO_NAME_CHAR_SET,
.name.presentation = AST_REDIRECTING_PRIV_TO_NAME_PRESENTATION,
.name.valid = AST_REDIRECTING_PRIV_TO_NAME_VALID,
.number.str = AST_REDIRECTING_PRIV_TO_NUMBER,
.number.plan = AST_REDIRECTING_PRIV_TO_NUMBER_PLAN,
.number.presentation = AST_REDIRECTING_PRIV_TO_NUMBER_PRESENTATION,
.number.valid = AST_REDIRECTING_PRIV_TO_NUMBER_VALID,
.subaddress.str = AST_REDIRECTING_PRIV_TO_SUBADDRESS,
.subaddress.type = AST_REDIRECTING_PRIV_TO_SUBADDRESS_TYPE,
.subaddress.odd_even_indicator = AST_REDIRECTING_PRIV_TO_SUBADDRESS_ODD_EVEN,
.subaddress.valid = AST_REDIRECTING_PRIV_TO_SUBADDRESS_VALID,
.tag = AST_REDIRECTING_PRIV_TO_TAG,
.combined_presentation = 0,/* Not sent. */
};
/* Redirecting frame version */
if (datalen < pos + (sizeof(data[0]) * 2) + 1) {
ast_log(LOG_WARNING, "No space left for redirecting frame version\n");
return -1;
}
data[pos++] = AST_REDIRECTING_VERSION;
data[pos++] = 1;
data[pos++] = 2;/* Version 1 did not have a version ie */
res = party_id_build_data(data + pos, datalen - pos, &redirecting->orig,
"redirecting-orig", &orig_ies, update ? &update->orig : NULL);
if (res < 0) {
return -1;
}
pos += res;
res = party_id_build_data(data + pos, datalen - pos, &redirecting->from,
"redirecting-from", &from_ies, update ? &update->from : NULL);
if (res < 0) {
return -1;
}
pos += res;
res = party_id_build_data(data + pos, datalen - pos, &redirecting->to,
"redirecting-to", &to_ies, update ? &update->to : NULL);
if (res < 0) {
return -1;
}
pos += res;
res = party_id_build_data(data + pos, datalen - pos, &redirecting->priv_orig,
"redirecting-priv-orig", &priv_orig_ies, update ? &update->priv_orig : NULL);
if (res < 0) {
return -1;
}
pos += res;
res = party_id_build_data(data + pos, datalen - pos, &redirecting->priv_from,
"redirecting-priv-from", &priv_from_ies, update ? &update->priv_from : NULL);
if (res < 0) {
return -1;
}
pos += res;
res = party_id_build_data(data + pos, datalen - pos, &redirecting->priv_to,
"redirecting-priv-to", &priv_to_ies, update ? &update->priv_to : NULL);
if (res < 0) {
return -1;
}
pos += res;
/* Redirecting reason */
if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) {
ast_log(LOG_WARNING, "No space left for redirecting reason\n");
return -1;
}
data[pos++] = AST_REDIRECTING_REASON;
data[pos++] = sizeof(value);
value = htonl(redirecting->reason);
memcpy(data + pos, &value, sizeof(value));
pos += sizeof(value);
/* Redirecting original reason */
if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) {
ast_log(LOG_WARNING, "No space left for redirecting original reason\n");
return -1;
}
data[pos++] = AST_REDIRECTING_ORIG_REASON;
data[pos++] = sizeof(value);
value = htonl(redirecting->orig_reason);
memcpy(data + pos, &value, sizeof(value));
pos += sizeof(value);
/* Redirecting count */
if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) {
ast_log(LOG_WARNING, "No space left for redirecting count\n");
return -1;
}
data[pos++] = AST_REDIRECTING_COUNT;
data[pos++] = sizeof(value);
value = htonl(redirecting->count);
memcpy(data + pos, &value, sizeof(value));
pos += sizeof(value);
return pos;
}
| int ast_redirecting_parse_data | ( | const unsigned char * | data, |
| size_t | datalen, | ||
| struct ast_party_redirecting * | redirecting | ||
| ) |
Parse redirecting indication frame data.
| data | Buffer with the frame data to parse |
| datalen | Size of the buffer |
| redirecting | Extracted redirecting id information |
| 0 | on success. |
| -1 | on error. |
Definition at line 10057 of file channel.c.
References ast_debug, ast_free, ast_log(), ast_malloc, AST_PARTY_CHAR_SET_ISO8859_1, AST_REDIRECTING_COUNT, AST_REDIRECTING_FROM_ID_PRESENTATION, AST_REDIRECTING_FROM_NAME, AST_REDIRECTING_FROM_NAME_CHAR_SET, AST_REDIRECTING_FROM_NAME_PRESENTATION, AST_REDIRECTING_FROM_NAME_VALID, AST_REDIRECTING_FROM_NUMBER, AST_REDIRECTING_FROM_NUMBER_PLAN, AST_REDIRECTING_FROM_NUMBER_PRESENTATION, AST_REDIRECTING_FROM_NUMBER_VALID, AST_REDIRECTING_FROM_SUBADDRESS, AST_REDIRECTING_FROM_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_FROM_SUBADDRESS_TYPE, AST_REDIRECTING_FROM_SUBADDRESS_VALID, AST_REDIRECTING_FROM_TAG, AST_REDIRECTING_ORIG_NAME, AST_REDIRECTING_ORIG_NAME_CHAR_SET, AST_REDIRECTING_ORIG_NAME_PRESENTATION, AST_REDIRECTING_ORIG_NAME_VALID, AST_REDIRECTING_ORIG_NUMBER, AST_REDIRECTING_ORIG_NUMBER_PLAN, AST_REDIRECTING_ORIG_NUMBER_PRESENTATION, AST_REDIRECTING_ORIG_NUMBER_VALID, AST_REDIRECTING_ORIG_REASON, AST_REDIRECTING_ORIG_SUBADDRESS, AST_REDIRECTING_ORIG_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_ORIG_SUBADDRESS_TYPE, AST_REDIRECTING_ORIG_SUBADDRESS_VALID, AST_REDIRECTING_ORIG_TAG, AST_REDIRECTING_PRIV_FROM_NAME, AST_REDIRECTING_PRIV_FROM_NAME_CHAR_SET, AST_REDIRECTING_PRIV_FROM_NAME_PRESENTATION, AST_REDIRECTING_PRIV_FROM_NAME_VALID, AST_REDIRECTING_PRIV_FROM_NUMBER, AST_REDIRECTING_PRIV_FROM_NUMBER_PLAN, AST_REDIRECTING_PRIV_FROM_NUMBER_PRESENTATION, AST_REDIRECTING_PRIV_FROM_NUMBER_VALID, AST_REDIRECTING_PRIV_FROM_SUBADDRESS, AST_REDIRECTING_PRIV_FROM_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_PRIV_FROM_SUBADDRESS_TYPE, AST_REDIRECTING_PRIV_FROM_SUBADDRESS_VALID, AST_REDIRECTING_PRIV_FROM_TAG, AST_REDIRECTING_PRIV_ORIG_NAME, AST_REDIRECTING_PRIV_ORIG_NAME_CHAR_SET, AST_REDIRECTING_PRIV_ORIG_NAME_PRESENTATION, AST_REDIRECTING_PRIV_ORIG_NAME_VALID, AST_REDIRECTING_PRIV_ORIG_NUMBER, AST_REDIRECTING_PRIV_ORIG_NUMBER_PLAN, AST_REDIRECTING_PRIV_ORIG_NUMBER_PRESENTATION, AST_REDIRECTING_PRIV_ORIG_NUMBER_VALID, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_TYPE, AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_VALID, AST_REDIRECTING_PRIV_ORIG_TAG, AST_REDIRECTING_PRIV_TO_NAME, AST_REDIRECTING_PRIV_TO_NAME_CHAR_SET, AST_REDIRECTING_PRIV_TO_NAME_PRESENTATION, AST_REDIRECTING_PRIV_TO_NAME_VALID, AST_REDIRECTING_PRIV_TO_NUMBER, AST_REDIRECTING_PRIV_TO_NUMBER_PLAN, AST_REDIRECTING_PRIV_TO_NUMBER_PRESENTATION, AST_REDIRECTING_PRIV_TO_NUMBER_VALID, AST_REDIRECTING_PRIV_TO_SUBADDRESS, AST_REDIRECTING_PRIV_TO_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_PRIV_TO_SUBADDRESS_TYPE, AST_REDIRECTING_PRIV_TO_SUBADDRESS_VALID, AST_REDIRECTING_PRIV_TO_TAG, AST_REDIRECTING_TO_ID_PRESENTATION, AST_REDIRECTING_TO_NAME, AST_REDIRECTING_TO_NAME_CHAR_SET, AST_REDIRECTING_TO_NAME_PRESENTATION, AST_REDIRECTING_TO_NAME_VALID, AST_REDIRECTING_TO_NUMBER, AST_REDIRECTING_TO_NUMBER_PLAN, AST_REDIRECTING_TO_NUMBER_PRESENTATION, AST_REDIRECTING_TO_NUMBER_VALID, AST_REDIRECTING_TO_SUBADDRESS, AST_REDIRECTING_TO_SUBADDRESS_ODD_EVEN, AST_REDIRECTING_TO_SUBADDRESS_TYPE, AST_REDIRECTING_TO_SUBADDRESS_VALID, AST_REDIRECTING_TO_TAG, AST_REDIRECTING_VERSION, ast_party_name::char_set, ast_party_redirecting::count, ast_party_redirecting::from, LOG_WARNING, ast_party_id::name, ast_party_id::number, ast_party_subaddress::odd_even_indicator, ast_party_redirecting::orig, ast_party_redirecting::orig_reason, ast_party_number::plan, ast_party_name::presentation, ast_party_number::presentation, ast_party_redirecting::priv_from, ast_party_redirecting::priv_orig, ast_party_redirecting::priv_to, ast_party_redirecting::reason, ast_party_name::str, ast_party_number::str, ast_party_subaddress::str, ast_party_id::subaddress, ast_party_id::tag, ast_party_redirecting::to, ast_party_subaddress::type, ast_party_name::valid, ast_party_number::valid, ast_party_subaddress::valid, and value.
Referenced by ast_channel_redirecting_macro(), ast_channel_redirecting_sub(), and ast_indicate_data().
{
size_t pos;
unsigned char ie_len;
unsigned char ie_id;
int32_t value;
int frame_version = 1;
int from_combined_presentation = 0;
int got_from_combined_presentation = 0;/* TRUE if got a combined name and number presentation value. */
int to_combined_presentation = 0;
int got_to_combined_presentation = 0;/* TRUE if got a combined name and number presentation value. */
for (pos = 0; pos < datalen; pos += ie_len) {
if (datalen < pos + sizeof(ie_id) + sizeof(ie_len)) {
ast_log(LOG_WARNING, "Invalid redirecting update\n");
return -1;
}
ie_id = data[pos++];
ie_len = data[pos++];
if (datalen < pos + ie_len) {
ast_log(LOG_WARNING, "Invalid redirecting update\n");
return -1;
}
switch (ie_id) {
/* Redirecting frame version */
case AST_REDIRECTING_VERSION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting frame version (%u)\n",
(unsigned) ie_len);
break;
}
frame_version = data[pos];
break;
/* Redirecting-orig party id name */
case AST_REDIRECTING_ORIG_NAME:
ast_free(redirecting->orig.name.str);
redirecting->orig.name.str = ast_malloc(ie_len + 1);
if (redirecting->orig.name.str) {
memcpy(redirecting->orig.name.str, data + pos, ie_len);
redirecting->orig.name.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_ORIG_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig name char set (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.name.char_set = data[pos];
break;
case AST_REDIRECTING_ORIG_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig name presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.name.presentation = data[pos];
break;
case AST_REDIRECTING_ORIG_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig name valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.name.valid = data[pos];
break;
/* Redirecting-orig party id number */
case AST_REDIRECTING_ORIG_NUMBER:
ast_free(redirecting->orig.number.str);
redirecting->orig.number.str = ast_malloc(ie_len + 1);
if (redirecting->orig.number.str) {
memcpy(redirecting->orig.number.str, data + pos, ie_len);
redirecting->orig.number.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_ORIG_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.number.plan = data[pos];
break;
case AST_REDIRECTING_ORIG_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig number presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.number.presentation = data[pos];
break;
case AST_REDIRECTING_ORIG_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig number valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.number.valid = data[pos];
break;
/* Redirecting-orig party id subaddress */
case AST_REDIRECTING_ORIG_SUBADDRESS:
ast_free(redirecting->orig.subaddress.str);
redirecting->orig.subaddress.str = ast_malloc(ie_len + 1);
if (redirecting->orig.subaddress.str) {
memcpy(redirecting->orig.subaddress.str, data + pos, ie_len);
redirecting->orig.subaddress.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_ORIG_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.subaddress.type = data[pos];
break;
case AST_REDIRECTING_ORIG_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid redirecting-orig subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.subaddress.odd_even_indicator = data[pos];
break;
case AST_REDIRECTING_ORIG_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-orig subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->orig.subaddress.valid = data[pos];
break;
/* Redirecting-orig party id tag */
case AST_REDIRECTING_ORIG_TAG:
ast_free(redirecting->orig.tag);
redirecting->orig.tag = ast_malloc(ie_len + 1);
if (redirecting->orig.tag) {
memcpy(redirecting->orig.tag, data + pos, ie_len);
redirecting->orig.tag[ie_len] = 0;
}
break;
/* Redirecting-from party id name */
case AST_REDIRECTING_FROM_NAME:
ast_free(redirecting->from.name.str);
redirecting->from.name.str = ast_malloc(ie_len + 1);
if (redirecting->from.name.str) {
memcpy(redirecting->from.name.str, data + pos, ie_len);
redirecting->from.name.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_FROM_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from name char set (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.name.char_set = data[pos];
break;
case AST_REDIRECTING_FROM_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from name presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.name.presentation = data[pos];
break;
case AST_REDIRECTING_FROM_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from name valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.name.valid = data[pos];
break;
/* Redirecting-from party id number */
case AST_REDIRECTING_FROM_NUMBER:
ast_free(redirecting->from.number.str);
redirecting->from.number.str = ast_malloc(ie_len + 1);
if (redirecting->from.number.str) {
memcpy(redirecting->from.number.str, data + pos, ie_len);
redirecting->from.number.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_FROM_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.number.plan = data[pos];
break;
case AST_REDIRECTING_FROM_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from number presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.number.presentation = data[pos];
break;
case AST_REDIRECTING_FROM_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from number valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.number.valid = data[pos];
break;
/* Redirecting-from party id combined presentation */
case AST_REDIRECTING_FROM_ID_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from combined presentation (%u)\n",
(unsigned) ie_len);
break;
}
from_combined_presentation = data[pos];
got_from_combined_presentation = 1;
break;
/* Redirecting-from party id subaddress */
case AST_REDIRECTING_FROM_SUBADDRESS:
ast_free(redirecting->from.subaddress.str);
redirecting->from.subaddress.str = ast_malloc(ie_len + 1);
if (redirecting->from.subaddress.str) {
memcpy(redirecting->from.subaddress.str, data + pos, ie_len);
redirecting->from.subaddress.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_FROM_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.subaddress.type = data[pos];
break;
case AST_REDIRECTING_FROM_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid redirecting-from subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.subaddress.odd_even_indicator = data[pos];
break;
case AST_REDIRECTING_FROM_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-from subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->from.subaddress.valid = data[pos];
break;
/* Redirecting-from party id tag */
case AST_REDIRECTING_FROM_TAG:
ast_free(redirecting->from.tag);
redirecting->from.tag = ast_malloc(ie_len + 1);
if (redirecting->from.tag) {
memcpy(redirecting->from.tag, data + pos, ie_len);
redirecting->from.tag[ie_len] = 0;
}
break;
/* Redirecting-to party id name */
case AST_REDIRECTING_TO_NAME:
ast_free(redirecting->to.name.str);
redirecting->to.name.str = ast_malloc(ie_len + 1);
if (redirecting->to.name.str) {
memcpy(redirecting->to.name.str, data + pos, ie_len);
redirecting->to.name.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_TO_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to name char set (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.name.char_set = data[pos];
break;
case AST_REDIRECTING_TO_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to name presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.name.presentation = data[pos];
break;
case AST_REDIRECTING_TO_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to name valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.name.valid = data[pos];
break;
/* Redirecting-to party id number */
case AST_REDIRECTING_TO_NUMBER:
ast_free(redirecting->to.number.str);
redirecting->to.number.str = ast_malloc(ie_len + 1);
if (redirecting->to.number.str) {
memcpy(redirecting->to.number.str, data + pos, ie_len);
redirecting->to.number.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_TO_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.number.plan = data[pos];
break;
case AST_REDIRECTING_TO_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to number presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.number.presentation = data[pos];
break;
case AST_REDIRECTING_TO_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to number valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.number.valid = data[pos];
break;
/* Redirecting-to party id combined presentation */
case AST_REDIRECTING_TO_ID_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to combined presentation (%u)\n",
(unsigned) ie_len);
break;
}
to_combined_presentation = data[pos];
got_to_combined_presentation = 1;
break;
/* Redirecting-to party id subaddress */
case AST_REDIRECTING_TO_SUBADDRESS:
ast_free(redirecting->to.subaddress.str);
redirecting->to.subaddress.str = ast_malloc(ie_len + 1);
if (redirecting->to.subaddress.str) {
memcpy(redirecting->to.subaddress.str, data + pos, ie_len);
redirecting->to.subaddress.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_TO_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.subaddress.type = data[pos];
break;
case AST_REDIRECTING_TO_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid redirecting-to subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.subaddress.odd_even_indicator = data[pos];
break;
case AST_REDIRECTING_TO_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid redirecting-to subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->to.subaddress.valid = data[pos];
break;
/* Redirecting-to party id tag */
case AST_REDIRECTING_TO_TAG:
ast_free(redirecting->to.tag);
redirecting->to.tag = ast_malloc(ie_len + 1);
if (redirecting->to.tag) {
memcpy(redirecting->to.tag, data + pos, ie_len);
redirecting->to.tag[ie_len] = 0;
}
break;
/* Private redirecting-orig party id name */
case AST_REDIRECTING_PRIV_ORIG_NAME:
ast_free(redirecting->priv_orig.name.str);
redirecting->priv_orig.name.str = ast_malloc(ie_len + 1);
if (redirecting->priv_orig.name.str) {
memcpy(redirecting->priv_orig.name.str, data + pos, ie_len);
redirecting->priv_orig.name.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_ORIG_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig name char set (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.name.char_set = data[pos];
break;
case AST_REDIRECTING_PRIV_ORIG_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig name presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.name.presentation = data[pos];
break;
case AST_REDIRECTING_PRIV_ORIG_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig name valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.name.valid = data[pos];
break;
/* Private redirecting-orig party id number */
case AST_REDIRECTING_PRIV_ORIG_NUMBER:
ast_free(redirecting->priv_orig.number.str);
redirecting->priv_orig.number.str = ast_malloc(ie_len + 1);
if (redirecting->priv_orig.number.str) {
memcpy(redirecting->priv_orig.number.str, data + pos, ie_len);
redirecting->priv_orig.number.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_ORIG_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.number.plan = data[pos];
break;
case AST_REDIRECTING_PRIV_ORIG_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig number presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.number.presentation = data[pos];
break;
case AST_REDIRECTING_PRIV_ORIG_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig number valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.number.valid = data[pos];
break;
/* Private redirecting-orig party id subaddress */
case AST_REDIRECTING_PRIV_ORIG_SUBADDRESS:
ast_free(redirecting->priv_orig.subaddress.str);
redirecting->priv_orig.subaddress.str = ast_malloc(ie_len + 1);
if (redirecting->priv_orig.subaddress.str) {
memcpy(redirecting->priv_orig.subaddress.str, data + pos, ie_len);
redirecting->priv_orig.subaddress.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.subaddress.type = data[pos];
break;
case AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid private redirecting-orig subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.subaddress.odd_even_indicator = data[pos];
break;
case AST_REDIRECTING_PRIV_ORIG_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-orig subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_orig.subaddress.valid = data[pos];
break;
/* Private redirecting-orig party id tag */
case AST_REDIRECTING_PRIV_ORIG_TAG:
ast_free(redirecting->priv_orig.tag);
redirecting->priv_orig.tag = ast_malloc(ie_len + 1);
if (redirecting->priv_orig.tag) {
memcpy(redirecting->priv_orig.tag, data + pos, ie_len);
redirecting->priv_orig.tag[ie_len] = 0;
}
break;
/* Private redirecting-from party id name */
case AST_REDIRECTING_PRIV_FROM_NAME:
ast_free(redirecting->priv_from.name.str);
redirecting->priv_from.name.str = ast_malloc(ie_len + 1);
if (redirecting->priv_from.name.str) {
memcpy(redirecting->priv_from.name.str, data + pos, ie_len);
redirecting->priv_from.name.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_FROM_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from name char set (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.name.char_set = data[pos];
break;
case AST_REDIRECTING_PRIV_FROM_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from name presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.name.presentation = data[pos];
break;
case AST_REDIRECTING_PRIV_FROM_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from name valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.name.valid = data[pos];
break;
/* Private redirecting-from party id number */
case AST_REDIRECTING_PRIV_FROM_NUMBER:
ast_free(redirecting->priv_from.number.str);
redirecting->priv_from.number.str = ast_malloc(ie_len + 1);
if (redirecting->priv_from.number.str) {
memcpy(redirecting->priv_from.number.str, data + pos, ie_len);
redirecting->priv_from.number.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_FROM_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.number.plan = data[pos];
break;
case AST_REDIRECTING_PRIV_FROM_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from number presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.number.presentation = data[pos];
break;
case AST_REDIRECTING_PRIV_FROM_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from number valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.number.valid = data[pos];
break;
/* Private redirecting-from party id subaddress */
case AST_REDIRECTING_PRIV_FROM_SUBADDRESS:
ast_free(redirecting->priv_from.subaddress.str);
redirecting->priv_from.subaddress.str = ast_malloc(ie_len + 1);
if (redirecting->priv_from.subaddress.str) {
memcpy(redirecting->priv_from.subaddress.str, data + pos, ie_len);
redirecting->priv_from.subaddress.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_FROM_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.subaddress.type = data[pos];
break;
case AST_REDIRECTING_PRIV_FROM_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid private redirecting-from subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.subaddress.odd_even_indicator = data[pos];
break;
case AST_REDIRECTING_PRIV_FROM_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-from subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_from.subaddress.valid = data[pos];
break;
/* Private redirecting-from party id tag */
case AST_REDIRECTING_PRIV_FROM_TAG:
ast_free(redirecting->priv_from.tag);
redirecting->priv_from.tag = ast_malloc(ie_len + 1);
if (redirecting->priv_from.tag) {
memcpy(redirecting->priv_from.tag, data + pos, ie_len);
redirecting->priv_from.tag[ie_len] = 0;
}
break;
/* Private redirecting-to party id name */
case AST_REDIRECTING_PRIV_TO_NAME:
ast_free(redirecting->priv_to.name.str);
redirecting->priv_to.name.str = ast_malloc(ie_len + 1);
if (redirecting->priv_to.name.str) {
memcpy(redirecting->priv_to.name.str, data + pos, ie_len);
redirecting->priv_to.name.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_TO_NAME_CHAR_SET:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to name char set (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.name.char_set = data[pos];
break;
case AST_REDIRECTING_PRIV_TO_NAME_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to name presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.name.presentation = data[pos];
break;
case AST_REDIRECTING_PRIV_TO_NAME_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to name valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.name.valid = data[pos];
break;
/* Private redirecting-to party id number */
case AST_REDIRECTING_PRIV_TO_NUMBER:
ast_free(redirecting->priv_to.number.str);
redirecting->priv_to.number.str = ast_malloc(ie_len + 1);
if (redirecting->priv_to.number.str) {
memcpy(redirecting->priv_to.number.str, data + pos, ie_len);
redirecting->priv_to.number.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_TO_NUMBER_PLAN:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to numbering plan (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.number.plan = data[pos];
break;
case AST_REDIRECTING_PRIV_TO_NUMBER_PRESENTATION:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to number presentation (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.number.presentation = data[pos];
break;
case AST_REDIRECTING_PRIV_TO_NUMBER_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to number valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.number.valid = data[pos];
break;
/* Private redirecting-to party id subaddress */
case AST_REDIRECTING_PRIV_TO_SUBADDRESS:
ast_free(redirecting->priv_to.subaddress.str);
redirecting->priv_to.subaddress.str = ast_malloc(ie_len + 1);
if (redirecting->priv_to.subaddress.str) {
memcpy(redirecting->priv_to.subaddress.str, data + pos, ie_len);
redirecting->priv_to.subaddress.str[ie_len] = 0;
}
break;
case AST_REDIRECTING_PRIV_TO_SUBADDRESS_TYPE:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to type of subaddress (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.subaddress.type = data[pos];
break;
case AST_REDIRECTING_PRIV_TO_SUBADDRESS_ODD_EVEN:
if (ie_len != 1) {
ast_log(LOG_WARNING,
"Invalid private redirecting-to subaddress odd-even indicator (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.subaddress.odd_even_indicator = data[pos];
break;
case AST_REDIRECTING_PRIV_TO_SUBADDRESS_VALID:
if (ie_len != 1) {
ast_log(LOG_WARNING, "Invalid private redirecting-to subaddress valid (%u)\n",
(unsigned) ie_len);
break;
}
redirecting->priv_to.subaddress.valid = data[pos];
break;
/* Private redirecting-to party id tag */
case AST_REDIRECTING_PRIV_TO_TAG:
ast_free(redirecting->priv_to.tag);
redirecting->priv_to.tag = ast_malloc(ie_len + 1);
if (redirecting->priv_to.tag) {
memcpy(redirecting->priv_to.tag, data + pos, ie_len);
redirecting->priv_to.tag[ie_len] = 0;
}
break;
/* Redirecting reason */
case AST_REDIRECTING_REASON:
if (ie_len != sizeof(value)) {
ast_log(LOG_WARNING, "Invalid redirecting reason (%u)\n",
(unsigned) ie_len);
break;
}
memcpy(&value, data + pos, sizeof(value));
redirecting->reason = ntohl(value);
break;
/* Redirecting orig-reason */
case AST_REDIRECTING_ORIG_REASON:
if (ie_len != sizeof(value)) {
ast_log(LOG_WARNING, "Invalid redirecting original reason (%u)\n",
(unsigned) ie_len);
break;
}
memcpy(&value, data + pos, sizeof(value));
redirecting->orig_reason = ntohl(value);
break;
/* Redirecting count */
case AST_REDIRECTING_COUNT:
if (ie_len != sizeof(value)) {
ast_log(LOG_WARNING, "Invalid redirecting count (%u)\n",
(unsigned) ie_len);
break;
}
memcpy(&value, data + pos, sizeof(value));
redirecting->count = ntohl(value);
break;
/* Redirecting unknown element */
default:
ast_debug(1, "Unknown redirecting element: %u (%u)\n",
(unsigned) ie_id, (unsigned) ie_len);
break;
}
}
switch (frame_version) {
case 1:
/*
* The other end is an earlier version that we need to adjust
* for compatibility.
*
* The earlier version did not have the orig party id or
* orig_reason value.
*/
redirecting->from.name.valid = 1;
redirecting->from.name.char_set = AST_PARTY_CHAR_SET_ISO8859_1;
redirecting->from.number.valid = 1;
if (got_from_combined_presentation) {
redirecting->from.name.presentation = from_combined_presentation;
redirecting->from.number.presentation = from_combined_presentation;
}
redirecting->to.name.valid = 1;
redirecting->to.name.char_set = AST_PARTY_CHAR_SET_ISO8859_1;
redirecting->to.number.valid = 1;
if (got_to_combined_presentation) {
redirecting->to.name.presentation = to_combined_presentation;
redirecting->to.number.presentation = to_combined_presentation;
}
break;
case 2:
/* The other end is at the same level as we are. */
break;
default:
/*
* The other end is newer than we are.
* We need to assume that they are compatible with us.
*/
ast_debug(1, "Redirecting frame has newer version: %u\n",
(unsigned) frame_version);
break;
}
return 0;
}
| struct ast_namedgroups* ast_ref_namedgroups | ( | struct ast_namedgroups * | groups | ) | [read] |
Definition at line 8423 of file channel.c.
References ao2_ref, and groups.
Referenced by ast_channel_named_callgroups_set(), ast_channel_named_pickupgroups_set(), check_peer_ok(), create_addr_from_peer(), and mkintf().
| struct ast_channel* ast_request | ( | const char * | type, |
| struct ast_format_cap * | request_cap, | ||
| const struct ast_channel * | requestor, | ||
| const char * | addr, | ||
| int * | cause | ||
| ) | [read] |
Requests a channel.
| type | type of channel to request |
| request_cap | Format capabilities for requested channel |
| requestor | channel asking for data |
| addr | destination of the call |
| cause | Cause of failure |
Request a channel of a given type, with addr as optional information used by the low level module
| NULL | failure |
| non-NULL | channel on success |
Definition at line 5896 of file channel.c.
References ast_callid_unref, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, AST_CAUSE_NOSUCHDRIVER, AST_CAUSE_NOTDEFINED, ast_channel_callid(), ast_channel_callid_set(), ast_channel_release(), ast_format_cap_add(), ast_format_cap_destroy(), ast_format_cap_dup(), ast_format_cap_get_type(), ast_format_cap_remove_bytype(), ast_format_clear(), AST_FORMAT_TYPE_AUDIO, ast_getformatname_multiple(), ast_log(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_translator_best_choice(), chanlist::chan, LOG_WARNING, set_security_requirements(), and chanlist::tech.
Referenced by __ast_request_and_dial(), alloc_playback_chan(), ast_call_forward(), begin_dial_channel(), build_conf(), chanavail_exec(), conf_run(), conf_start_record(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), meetme_menu_admin_extended(), ring_entry(), and wait_for_answer().
{
struct chanlist *chan;
struct ast_channel *c;
int res;
int foo;
if (!cause)
cause = &foo;
*cause = AST_CAUSE_NOTDEFINED;
if (AST_RWLIST_RDLOCK(&backends)) {
ast_log(LOG_WARNING, "Unable to lock technology backend list\n");
return NULL;
}
AST_RWLIST_TRAVERSE(&backends, chan, list) {
struct ast_format_cap *tmp_cap;
struct ast_format tmp_fmt;
struct ast_format best_audio_fmt;
struct ast_format_cap *joint_cap;
if (strcasecmp(type, chan->tech->type))
continue;
ast_format_clear(&best_audio_fmt);
/* find the best audio format to use */
if ((tmp_cap = ast_format_cap_get_type(request_cap, AST_FORMAT_TYPE_AUDIO))) {
/* We have audio - is it possible to connect the various calls to each other?
(Avoid this check for calls without audio, like text+video calls)
*/
res = ast_translator_best_choice(tmp_cap, chan->tech->capabilities, &tmp_fmt, &best_audio_fmt);
ast_format_cap_destroy(tmp_cap);
if (res < 0) {
char tmp1[256], tmp2[256];
ast_log(LOG_WARNING, "No translator path exists for channel type %s (native %s) to %s\n", type,
ast_getformatname_multiple(tmp1, sizeof(tmp1), chan->tech->capabilities),
ast_getformatname_multiple(tmp2, sizeof(tmp2), request_cap));
*cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
AST_RWLIST_UNLOCK(&backends);
return NULL;
}
}
AST_RWLIST_UNLOCK(&backends);
if (!chan->tech->requester)
return NULL;
/* XXX Only the audio format calculated as being the best for translation
* purposes is used for the request. This needs to be re-evaluated. It may be
* a better choice to send all the audio formats capable of being translated
* during the request and allow the channel drivers to pick the best one. */
if (!(joint_cap = ast_format_cap_dup(request_cap))) {
return NULL;
}
ast_format_cap_remove_bytype(joint_cap, AST_FORMAT_TYPE_AUDIO);
ast_format_cap_add(joint_cap, &best_audio_fmt);
if (!(c = chan->tech->requester(type, joint_cap, requestor, addr, cause))) {
ast_format_cap_destroy(joint_cap);
return NULL;
}
/* Set newly created channel callid to same as the requestor */
if (requestor) {
struct ast_callid *callid = ast_channel_callid(requestor);
if (callid) {
ast_channel_callid_set(c, callid);
callid = ast_callid_unref(callid);
}
}
joint_cap = ast_format_cap_destroy(joint_cap);
if (set_security_requirements(requestor, c)) {
ast_log(LOG_WARNING, "Setting security requirements failed\n");
c = ast_channel_release(c);
*cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
return NULL;
}
/* no need to generate a Newchannel event here; it is done in the channel_alloc call */
return c;
}
ast_log(LOG_WARNING, "No channel type registered for '%s'\n", type);
*cause = AST_CAUSE_NOSUCHDRIVER;
AST_RWLIST_UNLOCK(&backends);
return NULL;
}
| struct ast_channel* ast_request_and_dial | ( | const char * | type, |
| struct ast_format_cap * | cap, | ||
| const struct ast_channel * | requestor, | ||
| const char * | addr, | ||
| int | timeout, | ||
| int * | reason, | ||
| const char * | cid_num, | ||
| const char * | cid_name | ||
| ) | [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.
| type | type of channel to request |
| format | capabilities for requested channel |
| requestor | channel asking for 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) |
Definition at line 5851 of file channel.c.
References __ast_request_and_dial().
Referenced by ast_pbx_outgoing_exten(), and generic_recall().
{
return __ast_request_and_dial(type, cap, requestor, addr, timeout, outstate, cidnum, cidname, NULL);
}
| int ast_safe_sleep | ( | struct ast_channel * | chan, |
| int | ms | ||
| ) |
Wait for a specified amount of time, looking for hangups.
| chan | channel to wait for |
| ms | length of time in milliseconds to sleep. This should never be less than zero. |
Waits for a specified amount of time, servicing the channel as required.
Definition at line 1744 of file channel.c.
References ast_safe_sleep_conditional().
Referenced by __analog_ss_thread(), adsi_transmit_message_full(), alarmreceiver_exec(), analog_ss_thread(), ast_dtmf_stream(), ast_senddigit(), builtin_atxfer(), builtin_parkcall(), conf_run(), dahdi_send_callrerouting_facility_exec(), dial_trunk(), dialandactivatesub(), dictate_exec(), disa_exec(), flash_exec(), handle_callforward_button(), login_exec(), mgcp_ss(), milliwatt_exec(), misdn_check_l2l1(), old_milliwatt_exec(), park_call_exec(), pbx_builtin_wait(), play_moh_exec(), playtone(), privacy_exec(), receive_ademco_contact_id(), testclient_exec(), testserver_exec(), try_calling(), wait_for_hangup(), wait_moh_exec(), waituntil_exec(), and zapateller_exec().
{
return ast_safe_sleep_conditional(chan, ms, NULL, NULL);
}
| int ast_safe_sleep_conditional | ( | struct ast_channel * | chan, |
| int | timeout_ms, | ||
| int(*)(void *) | cond, | ||
| void * | data | ||
| ) |
Wait for a specified amount of time, looking for hangups and a condition argument.
| chan | channel to wait for |
| ms | length of time in milliseconds to sleep. |
| cond | a function pointer for testing continue condition |
| data | argument to be passed to the condition test function |
Waits for a specified amount of time, servicing the channel as required. If cond returns 0, this function returns.
Definition at line 1673 of file channel.c.
References ast_channel_generatordata(), ast_channel_lock, ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), ast_channel_unlock, ast_frfree, ast_frisolate(), ast_is_deferrable_frame(), AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_HEAD_NOLOCK, AST_LIST_INSERT_HEAD, AST_LIST_REMOVE_HEAD, ast_opt_transmit_silence, ast_queue_frame_head(), ast_read(), ast_remaining_ms(), ast_tvnow(), ast_waitfor(), cond, and f.
Referenced by ast_safe_sleep(), and login_exec().
{
struct ast_frame *f;
struct ast_silence_generator *silgen = NULL;
int res = 0;
struct timeval start;
int ms;
AST_LIST_HEAD_NOLOCK(, ast_frame) deferred_frames;
AST_LIST_HEAD_INIT_NOLOCK(&deferred_frames);
/* If no other generator is present, start silencegen while waiting */
if (ast_opt_transmit_silence && !ast_channel_generatordata(chan)) {
silgen = ast_channel_start_silence_generator(chan);
}
start = ast_tvnow();
while ((ms = ast_remaining_ms(start, timeout_ms))) {
struct ast_frame *dup_f = NULL;
if (cond && ((*cond)(data) == 0)) {
break;
}
ms = ast_waitfor(chan, ms);
if (ms < 0) {
res = -1;
break;
}
if (ms > 0) {
f = ast_read(chan);
if (!f) {
res = -1;
break;
}
if (!ast_is_deferrable_frame(f)) {
ast_frfree(f);
continue;
}
if ((dup_f = ast_frisolate(f))) {
if (dup_f != f) {
ast_frfree(f);
}
AST_LIST_INSERT_HEAD(&deferred_frames, dup_f, frame_list);
}
}
}
/* stop silgen if present */
if (silgen) {
ast_channel_stop_silence_generator(chan, silgen);
}
/* We need to free all the deferred frames, but we only need to
* queue the deferred frames if there was no error and no
* hangup was received
*/
ast_channel_lock(chan);
while ((f = AST_LIST_REMOVE_HEAD(&deferred_frames, frame_list))) {
if (!res) {
ast_queue_frame_head(chan, f);
}
ast_frfree(f);
}
ast_channel_unlock(chan);
return res;
}
| int ast_senddigit | ( | struct ast_channel * | chan, |
| char | digit, | ||
| unsigned int | duration | ||
| ) |
Send a DTMF digit to a channel.
| chan | channel to act upon |
| digit | the DTMF digit to send, encoded in ASCII |
| duration | the duration of the digit ending in ms |
Definition at line 4818 of file channel.c.
References ast_channel_tech(), AST_DEFAULT_EMULATE_DTMF_DURATION, ast_safe_sleep(), ast_senddigit_begin(), and ast_senddigit_end().
Referenced by ast_dtmf_stream(), dial_exec_full(), and manager_play_dtmf().
{
if (ast_channel_tech(chan)->send_digit_begin) {
ast_senddigit_begin(chan, digit);
ast_safe_sleep(chan, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
}
return ast_senddigit_end(chan, digit, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION));
}
| int ast_senddigit_begin | ( | struct ast_channel * | chan, |
| char | digit | ||
| ) |
Send a DTMF digit to a channel.
| chan | channel to act upon |
| digit | the DTMF digit to send, encoded in ASCII |
Definition at line 4749 of file channel.c.
References ast_channel_lock, ast_channel_name(), ast_channel_sending_dtmf_digit_set(), ast_channel_sending_dtmf_tv_set(), ast_channel_tech(), ast_channel_unlock, ast_debug, ast_playtones_start(), and ast_tvnow().
Referenced by agent_digit_begin(), ast_senddigit(), and ast_write().
{
/* Device does not support DTMF tones, lets fake
* it by doing our own generation. */
static const char * const dtmf_tones[] = {
"941+1336", /* 0 */
"697+1209", /* 1 */
"697+1336", /* 2 */
"697+1477", /* 3 */
"770+1209", /* 4 */
"770+1336", /* 5 */
"770+1477", /* 6 */
"852+1209", /* 7 */
"852+1336", /* 8 */
"852+1477", /* 9 */
"697+1633", /* A */
"770+1633", /* B */
"852+1633", /* C */
"941+1633", /* D */
"941+1209", /* * */
"941+1477" /* # */
};
if (!ast_channel_tech(chan)->send_digit_begin)
return 0;
ast_channel_lock(chan);
ast_channel_sending_dtmf_digit_set(chan, digit);
ast_channel_sending_dtmf_tv_set(chan, ast_tvnow());
ast_channel_unlock(chan);
if (!ast_channel_tech(chan)->send_digit_begin(chan, digit))
return 0;
if (digit >= '0' && digit <='9')
ast_playtones_start(chan, 0, dtmf_tones[digit-'0'], 0);
else if (digit >= 'A' && digit <= 'D')
ast_playtones_start(chan, 0, dtmf_tones[digit-'A'+10], 0);
else if (digit == '*')
ast_playtones_start(chan, 0, dtmf_tones[14], 0);
else if (digit == '#')
ast_playtones_start(chan, 0, dtmf_tones[15], 0);
else {
/* not handled */
ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, ast_channel_name(chan));
}
return 0;
}
| int ast_senddigit_end | ( | struct ast_channel * | chan, |
| char | digit, | ||
| unsigned int | duration | ||
| ) |
Send a DTMF digit to a channel.
| chan | channel to act upon |
| digit | the DTMF digit to send, encoded in ASCII |
| duration | the duration of the digit ending in ms |
Definition at line 4799 of file channel.c.
References ast_channel_generator(), ast_channel_lock, ast_channel_sending_dtmf_digit(), ast_channel_sending_dtmf_digit_set(), ast_channel_tech(), ast_channel_unlock, ast_playtones_stop(), and ast_channel_tech::send_digit_end.
Referenced by agent_digit_end(), ast_bridge_end_dtmf(), ast_senddigit(), and ast_write().
{
int res = -1;
if (ast_channel_tech(chan)->send_digit_end)
res = ast_channel_tech(chan)->send_digit_end(chan, digit, duration);
ast_channel_lock(chan);
if (ast_channel_sending_dtmf_digit(chan) == digit) {
ast_channel_sending_dtmf_digit_set(chan, 0);
}
ast_channel_unlock(chan);
if (res && ast_channel_generator(chan))
ast_playtones_stop(chan);
return 0;
}
| int ast_sendtext | ( | struct ast_channel * | chan, |
| const char * | text | ||
| ) |
Sends text to a channel.
| chan | channel to act upon |
| text | string of text to send on the channel |
Write text to a display on a channel
| 0 | on success |
| -1 | on failure |
Definition at line 4711 of file channel.c.
References ast_channel_flags(), ast_channel_lock, ast_channel_nativeformats(), ast_channel_tech(), ast_channel_unlock, ast_check_hangup(), ast_clear_flag, AST_FLAG_BLOCKING, AST_FLAG_ZOMBIE, ast_format_cap_has_type(), ast_format_set(), AST_FORMAT_T140, AST_FORMAT_TYPE_TEXT, AST_FRAME_TEXT, AST_MALLOCD_DATA, ast_strdup, ast_strlen_zero(), ast_test_flag, CHECK_BLOCKING, ast_frame::data, ast_frame::datalen, ast_frame_subclass::format, ast_frame::frametype, ast_frame::mallocd, ast_frame::offset, ast_frame::ptr, ast_channel_tech::send_text, send_text(), ast_frame::seqno, ast_frame::src, ast_frame::subclass, and ast_channel_tech::write_text.
Referenced by action_sendtext(), agent_sendtext(), handle_sendtext(), and sendtext_exec().
{
int res = 0;
ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
return -1;
}
if (ast_strlen_zero(text)) {
ast_channel_unlock(chan);
return 0;
}
CHECK_BLOCKING(chan);
if (ast_channel_tech(chan)->write_text && (ast_format_cap_has_type(ast_channel_nativeformats(chan), AST_FORMAT_TYPE_TEXT))) {
struct ast_frame f;
f.frametype = AST_FRAME_TEXT;
f.src = "DIALPLAN";
f.mallocd = AST_MALLOCD_DATA;
f.datalen = strlen(text);
f.data.ptr = ast_strdup(text);
f.offset = 0;
f.seqno = 0;
ast_format_set(&f.subclass.format, AST_FORMAT_T140, 0);
res = ast_channel_tech(chan)->write_text(chan, &f);
} else if (ast_channel_tech(chan)->send_text) {
res = ast_channel_tech(chan)->send_text(chan, text);
}
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
return res;
}
| void ast_set_callerid | ( | struct ast_channel * | chan, |
| const char * | cid_num, | ||
| const char * | cid_name, | ||
| const char * | cid_ani | ||
| ) |
Set caller ID number, name and ANI and generate AMI event.
Definition at line 7321 of file channel.c.
References ast_party_caller::ani, ast_cdr_setcid(), ast_channel_caller(), ast_channel_cdr(), ast_channel_lock, ast_channel_unlock, ast_free, ast_strdup, ast_party_caller::id, name, ast_party_id::name, ast_party_id::number, report_new_callerid(), ast_party_name::str, ast_party_number::str, ast_party_name::valid, and ast_party_number::valid.
Referenced by __analog_ss_thread(), __ast_request_and_dial(), analog_ss_thread(), cb_events(), disa_exec(), get_pai(), get_rpid(), handle_setcallerid(), mgcp_ss(), privacy_exec(), ring_entry(), skinny_newcall(), and socket_process_helper().
{
ast_channel_lock(chan);
if (cid_num) {
ast_channel_caller(chan)->id.number.valid = 1;
ast_free(ast_channel_caller(chan)->id.number.str);
ast_channel_caller(chan)->id.number.str = ast_strdup(cid_num);
}
if (cid_name) {
ast_channel_caller(chan)->id.name.valid = 1;
ast_free(ast_channel_caller(chan)->id.name.str);
ast_channel_caller(chan)->id.name.str = ast_strdup(cid_name);
}
if (cid_ani) {
ast_channel_caller(chan)->ani.number.valid = 1;
ast_free(ast_channel_caller(chan)->ani.number.str);
ast_channel_caller(chan)->ani.number.str = ast_strdup(cid_ani);
}
if (ast_channel_cdr(chan)) {
ast_cdr_setcid(ast_channel_cdr(chan), chan);
}
report_new_callerid(chan);
ast_channel_unlock(chan);
}
| 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.
| chan | channel to set the field on |
| source | a string describing the source of the hangup for this channel |
| force |
Hangupsource is generally the channel name that caused the bridge to be hung up, but it can also be other things such as "dialplan/agi" This can then be logged in the CDR or CEL
Definition at line 2717 of file channel.c.
References ast_bridged_channel(), ast_channel_hangupsource(), ast_channel_lock, ast_channel_ref, ast_channel_unlock, ast_channel_unref, ast_strlen_zero(), and ast_channel::bridge.
Referenced by __dahdi_exception(), analog_exception(), func_channel_write_real(), handle_hangup(), pbx_builtin_hangup(), set_hangup_source_and_cause(), and sip_queue_hangup_cause().
{
struct ast_channel *bridge;
ast_channel_lock(chan);
if (force || ast_strlen_zero(ast_channel_hangupsource(chan))) {
ast_channel_hangupsource_set(chan, source);
}
bridge = ast_bridged_channel(chan);
if (bridge) {
ast_channel_ref(bridge);
}
ast_channel_unlock(chan);
if (bridge) {
ast_channel_lock(bridge);
if (force || ast_strlen_zero(ast_channel_hangupsource(bridge))) {
ast_channel_hangupsource_set(bridge, source);
}
ast_channel_unlock(bridge);
ast_channel_unref(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.
| update_id | The update marker for a corresponding party id. |
Definition at line 1915 of file channel.c.
References ast_set_party_id::name, ast_set_party_id::number, and ast_set_party_id::subaddress.
Referenced by handle_request_invite(), handle_request_update(), handle_response_invite(), misdn_queue_connected_line_update(), and sip_call().
{
update_id->name = 1;
update_id->number = 1;
update_id->subaddress = 1;
}
| int ast_set_read_format | ( | struct ast_channel * | chan, |
| struct ast_format * | format | ||
| ) |
Sets read format on channel chan.
| chan | channel to change |
| formats,format | to set for reading |
Definition at line 5395 of file channel.c.
References ast_channel_rawreadformat(), ast_channel_readformat(), ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), and set_format().
Referenced by __ast_play_and_record(), __oh323_update_info(), adsi_transmit_message_full(), ast_channel_make_compatible_helper(), ast_do_masquerade(), background_detect_exec(), bridge_channel_join(), bridge_make_compatible(), dictate_exec(), do_waiting(), eagi_exec(), echo_exec(), fax_detect_framehook(), fax_gateway_framehook(), generic_fax_exec(), gtalk_rtp_read(), handle_recordfile(), ices_exec(), isAnsweringMachine(), jingle_interpret_content(), jingle_read(), jingle_rtp_read(), measurenoise(), mgcp_rtp_read(), oh323_rtp_read(), process_sdp(), record_exec(), set_softmix_bridge_data(), setup_rtp_connection(), sip_rtp_read(), skinny_rtp_read(), socket_process_helper(), speech_background(), transmit_audio(), and unistim_rtp_read().
{
struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
int res;
if (!cap) {
return -1;
}
ast_format_cap_add(cap, format);
res = set_format(chan,
cap,
ast_channel_rawreadformat(chan),
ast_channel_readformat(chan),
&set_format_readtrans,
0);
ast_format_cap_destroy(cap);
return res;
}
| int ast_set_read_format_by_id | ( | struct ast_channel * | chan, |
| enum ast_format_id | id | ||
| ) |
Sets read format on channel chan by id.
| chan | channel to change |
| format | id to set for reading, only used for formats without attributes |
Definition at line 5416 of file channel.c.
References ast_channel_rawreadformat(), ast_channel_readformat(), ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_format_set(), and set_format().
Referenced by __ast_play_and_record(), adsi_transmit_message_full(), alarmreceiver_exec(), background_detect_exec(), build_conf(), conf_run(), dictate_exec(), do_waiting(), eagi_exec(), fax_detect_framehook(), fax_gateway_framehook(), generic_fax_exec(), handle_recordfile(), handle_speechrecognize(), ices_exec(), isAnsweringMachine(), jack_exec(), measurenoise(), meetme_menu_admin_extended(), old_milliwatt_exec(), record_exec(), and transmit_audio().
{
struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
struct ast_format tmp_format;
int res;
if (!cap) {
return -1;
}
ast_format_cap_add(cap, ast_format_set(&tmp_format, id, 0));
res = set_format(chan,
cap,
ast_channel_rawreadformat(chan),
ast_channel_readformat(chan),
&set_format_readtrans,
0);
ast_format_cap_destroy(cap);
return res;
}
| 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.
| chan | channel to change |
| formats | new formats to pick from for reading |
Definition at line 5438 of file channel.c.
References ast_channel_rawreadformat(), ast_channel_readformat(), and set_format().
Referenced by agent_call(), and login_exec().
{
return set_format(chan,
cap,
ast_channel_rawreadformat(chan),
ast_channel_readformat(chan),
&set_format_readtrans,
0);
}
| void ast_set_variables | ( | struct ast_channel * | chan, |
| struct ast_variable * | vars | ||
| ) |
adds a list of channel variables to a channel
| chan | the channel |
| vars | a linked list of variables |
Variable names can be for a regular channel variable or a dialplan function that has the ability to be written to.
Definition at line 8732 of file channel.c.
References ast_variable::name, ast_variable::next, pbx_builtin_setvar_helper(), and ast_variable::value.
Referenced by __ast_request_and_dial(), ast_call_forward(), ast_pbx_outgoing_app(), and ast_pbx_outgoing_exten().
{
struct ast_variable *cur;
for (cur = vars; cur; cur = cur->next)
pbx_builtin_setvar_helper(chan, cur->name, cur->value);
}
| int ast_set_write_format | ( | struct ast_channel * | chan, |
| struct ast_format * | format | ||
| ) |
Sets write format on channel chan.
| chan | channel to change |
| formats,format | to set for writing |
Definition at line 5448 of file channel.c.
References ast_channel_rawwriteformat(), ast_channel_writeformat(), ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), and set_format().
Referenced by __oh323_update_info(), adsi_transmit_message_full(), ast_channel_make_compatible_helper(), ast_channel_stop_silence_generator(), ast_do_masquerade(), ast_stopstream(), bridge_channel_join(), bridge_make_compatible(), chanspy_exec(), dahdiscan_exec(), echo_exec(), extenspy_exec(), generic_fax_exec(), gtalk_rtp_read(), jingle_interpret_content(), jingle_read(), jingle_rtp_read(), linear_release(), mgcp_rtp_read(), moh_alloc(), moh_files_release(), moh_files_write_format_change(), moh_release(), mp3_exec(), NBScat_exec(), oh323_rtp_read(), playtones_release(), process_sdp(), send_waveform_to_channel(), set_softmix_bridge_data(), setup_rtp_connection(), sip_rtp_read(), skinny_rtp_read(), socket_process_helper(), tonepair_release(), transmit_audio(), and unistim_rtp_read().
{
struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
int res;
if (!cap) {
return -1;
}
ast_format_cap_add(cap, format);
res = set_format(chan,
cap,
ast_channel_rawwriteformat(chan),
ast_channel_writeformat(chan),
&set_format_writetrans,
1);
ast_format_cap_destroy(cap);
return res;
}
| int ast_set_write_format_by_id | ( | struct ast_channel * | chan, |
| enum ast_format_id | id | ||
| ) |
Sets write format on channel chan.
| chan | channel to change |
| format | id to set for writing, only used for formats without attributes |
Definition at line 5469 of file channel.c.
References ast_channel_rawwriteformat(), ast_channel_writeformat(), ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_format_set(), and set_format().
Referenced by adsi_transmit_message_full(), alarmreceiver_exec(), ast_channel_start_silence_generator(), ast_write(), build_conf(), chanspy_exec(), conf_run(), dahdiscan_exec(), extenspy_exec(), fax_gateway_framehook(), generic_fax_exec(), jack_exec(), linear_alloc(), meetme_menu_admin_extended(), mp3_exec(), NBScat_exec(), old_milliwatt_exec(), playtones_alloc(), send_waveform_to_channel(), tonepair_alloc(), and transmit_audio().
{
struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
struct ast_format tmp_format;
int res;
if (!cap) {
return -1;
}
ast_format_cap_add(cap, ast_format_set(&tmp_format, id, 0));
res = set_format(chan,
cap,
ast_channel_rawwriteformat(chan),
ast_channel_writeformat(chan),
&set_format_writetrans,
1);
ast_format_cap_destroy(cap);
return res;
}
| 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.
| chan | channel to change |
| formats | new formats to pick from for writing |
Definition at line 5491 of file channel.c.
References ast_channel_rawwriteformat(), ast_channel_writeformat(), and set_format().
Referenced by agent_call(), ast_openstream_full(), and login_exec().
{
return set_format(chan,
cap,
ast_channel_rawwriteformat(chan),
ast_channel_writeformat(chan),
&set_format_writetrans,
1);
}
| int ast_settimeout | ( | struct ast_channel * | c, |
| unsigned int | rate, | ||
| int(*)(const void *data) | func, | ||
| void * | data | ||
| ) |
Enable or disable timer ticks for a channel.
| c | channel |
| rate | number of timer ticks per second |
| func | callback function |
| data |
If timers are supported, force a scheduled expiration on the timer fd, at which point we call the callback function / data
Definition at line 3556 of file channel.c.
References ast_settimeout_full().
Referenced by ast_activate_generator(), ast_deactivate_generator(), ast_read_generator_actions(), ast_readaudio_callback(), filestream_close(), and internal_deactivate_generator().
{
return ast_settimeout_full(c, rate, func, data, 0);
}
| int ast_settimeout_full | ( | struct ast_channel * | c, |
| unsigned int | rate, | ||
| int(*)(const void *data) | func, | ||
| void * | data, | ||
| unsigned int | is_ao2_obj | ||
| ) |
Definition at line 3561 of file channel.c.
References ao2_ref, ast_channel_fdno(), ast_channel_fdno_set(), ast_channel_flags(), ast_channel_lock, ast_channel_timer(), ast_channel_timingdata(), ast_channel_timingdata_set(), ast_channel_timingfd(), ast_channel_timingfunc_set(), ast_channel_unlock, ast_clear_flag, ast_debug, AST_FLAG_TIMINGDATA_IS_AO2_OBJ, ast_set_flag, ast_test_flag, ast_timer_get_max_rate(), ast_timer_set_rate(), and AST_TIMING_FD.
Referenced by ast_readaudio_callback(), and ast_settimeout().
{
int res;
unsigned int real_rate = rate, max_rate;
ast_channel_lock(c);
if (ast_channel_timingfd(c) == -1) {
ast_channel_unlock(c);
return -1;
}
if (!func) {
rate = 0;
data = NULL;
}
if (rate && rate > (max_rate = ast_timer_get_max_rate(ast_channel_timer(c)))) {
real_rate = max_rate;
}
ast_debug(1, "Scheduling timer at (%u requested / %u actual) timer ticks per second\n", rate, real_rate);
res = ast_timer_set_rate(ast_channel_timer(c), real_rate);
if (ast_channel_timingdata(c) && ast_test_flag(ast_channel_flags(c), AST_FLAG_TIMINGDATA_IS_AO2_OBJ)) {
ao2_ref(ast_channel_timingdata(c), -1);
}
ast_channel_timingfunc_set(c, func);
ast_channel_timingdata_set(c, data);
if (data && is_ao2_obj) {
ao2_ref(data, 1);
ast_set_flag(ast_channel_flags(c), AST_FLAG_TIMINGDATA_IS_AO2_OBJ);
} else {
ast_clear_flag(ast_channel_flags(c), AST_FLAG_TIMINGDATA_IS_AO2_OBJ);
}
if (func == NULL && rate == 0 && ast_channel_fdno(c) == AST_TIMING_FD) {
/* Clearing the timing func and setting the rate to 0
* means that we don't want to be reading from the timingfd
* any more. Setting c->fdno to -1 means we won't have any
* errant reads from the timingfd, meaning we won't potentially
* miss any important frames.
*/
ast_channel_fdno_set(c, -1);
}
ast_channel_unlock(c);
return res;
}
| int ast_shutting_down | ( | void | ) |
Returns non-zero if Asterisk is being shut down.
Definition at line 674 of file channel.c.
References shutting_down.
Referenced by __ast_channel_alloc_ap(), confbridge_exec(), and handle_request_options().
{
return shutting_down;
}
| int ast_softhangup | ( | struct ast_channel * | chan, |
| int | cause | ||
| ) |
Softly hangup up a channel.
| chan | channel to be soft-hung-up |
| reason | an AST_SOFTHANGUP_* reason code |
Call the protocol layer, but don't destroy the channel structure (use this if you are trying to safely hangup a channel managed by another thread.
Definition at line 2672 of file channel.c.
References ast_channel_lock, ast_channel_name(), ast_channel_uniqueid(), ast_channel_unlock, ast_softhangup_nolock(), EVENT_FLAG_CALL, and manager_event.
Referenced by __analog_handle_event(), __ast_module_user_hangup_all(), __ast_pbx_run(), __unload_module(), agent_hangup(), agent_logoff(), agent_read(), ast_channel_softhangup_cb(), ast_dial_join(), cc_generic_agent_stop_ringing(), conf_free(), dahdi_handle_event(), handle_hangup(), handle_softhangup(), login_exec(), manager_park(), mgcp_pktcgate_remove(), read_agent_config(), sla_handle_hold_event(), softhangup_exec(), start_spying(), startmon(), and unload_module().
{
int res;
ast_channel_lock(chan);
res = ast_softhangup_nolock(chan, cause);
/*** DOCUMENTATION
<managerEventInstance>
<synopsis>Raised when a soft hangup is requested with a specific cause code.</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/managerEvent[@name='Hangup']/managerEventInstance/syntax/parameter[@name='Cause'])" />
</syntax>
</managerEventInstance>
***/
manager_event(EVENT_FLAG_CALL, "SoftHangupRequest",
"Channel: %s\r\n"
"Uniqueid: %s\r\n"
"Cause: %d\r\n",
ast_channel_name(chan),
ast_channel_uniqueid(chan),
cause);
ast_channel_unlock(chan);
return res;
}
| int ast_softhangup_nolock | ( | struct ast_channel * | chan, |
| int | cause | ||
| ) |
Softly hangup up a channel (no channel lock)
| chan | channel to be soft-hung-up |
| reason | an AST_SOFTHANGUP_* reason code |
Definition at line 2659 of file channel.c.
References ast_channel_blocker(), ast_channel_flags(), ast_channel_name(), ast_channel_softhangup_internal_flag_add(), ast_debug, AST_FLAG_BLOCKING, ast_null_frame, ast_queue_frame(), and ast_test_flag.
Referenced by __analog_handle_event(), analog_attempt_transfer(), ast_async_goto(), ast_channel_softhangup_withcause_locked(), ast_pbx_h_exten_run(), ast_pbx_hangup_handler_run(), ast_softhangup(), attempt_transfer(), check_pendings(), check_rtp_timeout(), dahdi_softhangup_all(), gosub_run(), jingle_indicate(), oh323_indicate(), pbx_builtin_hangup(), pri_dchannel(), proc_session_timer(), sig_pri_indicate(), sig_pri_send_aoce_termination_request(), sig_ss7_indicate(), sip_indicate(), ss7_hangup_cics(), and ss7_linkset().
{
ast_debug(1, "Soft-Hanging up channel '%s'\n", ast_channel_name(chan));
/* Inform channel driver that we need to be hung up, if it cares */
ast_channel_softhangup_internal_flag_add(chan, cause);
ast_queue_frame(chan, &ast_null_frame);
/* Interrupt any poll call or such */
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING))
pthread_kill(ast_channel_blocker(chan), SIGURG);
return 0;
}
| const char* ast_state2str | ( | enum ast_channel_state | state | ) |
Gives the string form of a given channel state.
| ast_channel_state | state to get the name of |
Definition at line 821 of file channel.c.
References AST_STATE_BUSY, AST_STATE_DIALING, AST_STATE_DIALING_OFFHOOK, AST_STATE_DOWN, AST_STATE_OFFHOOK, AST_STATE_PRERING, AST_STATE_RESERVED, AST_STATE_RING, AST_STATE_RINGING, AST_STATE_UP, ast_threadstorage_get(), STATE2STR_BUFSIZE, and state2str_threadbuf.
Referenced by __ast_channel_alloc_ap(), action_coreshowchannels(), action_status(), agent_hangup(), ast_channel_data_add_structure(), ast_do_masquerade(), ast_setstate(), attempt_transfer(), func_channel_read(), handle_chanlist(), handle_showchan(), local_attended_transfer(), mgcp_new(), serialize_showchan(), sip_hangup(), and update_connectedline().
{
char *buf;
switch (state) {
case AST_STATE_DOWN:
return "Down";
case AST_STATE_RESERVED:
return "Rsrvd";
case AST_STATE_OFFHOOK:
return "OffHook";
case AST_STATE_DIALING:
return "Dialing";
case AST_STATE_RING:
return "Ring";
case AST_STATE_RINGING:
return "Ringing";
case AST_STATE_UP:
return "Up";
case AST_STATE_BUSY:
return "Busy";
case AST_STATE_DIALING_OFFHOOK:
return "Dialing Offhook";
case AST_STATE_PRERING:
return "Pre-ring";
default:
if (!(buf = ast_threadstorage_get(&state2str_threadbuf, STATE2STR_BUFSIZE)))
return "Unknown";
snprintf(buf, STATE2STR_BUFSIZE, "Unknown (%d)", state);
return buf;
}
}
| int ast_str2cause | ( | const char * | name | ) |
Convert the string form of a cause code to a number.
| name | string form of the cause |
Definition at line 807 of file channel.c.
References ARRAY_LEN, and causes.
Referenced by pbx_builtin_hangup().
| int ast_tonepair | ( | struct ast_channel * | chan, |
| int | freq1, | ||
| int | freq2, | ||
| int | duration, | ||
| int | vol | ||
| ) |
Play a tone pair for a given amount of time
Definition at line 8285 of file channel.c.
References ast_channel_generatordata(), ast_frfree, ast_read(), ast_tonepair_start(), and ast_waitfor().
Referenced by zapateller_exec().
{
int res;
if ((res = ast_tonepair_start(chan, freq1, freq2, duration, vol)))
return res;
/* Give us some wiggle room */
while (ast_channel_generatordata(chan) && ast_waitfor(chan, 100) >= 0) {
struct ast_frame *f = ast_read(chan);
if (f)
ast_frfree(f);
else
return -1;
}
return 0;
}
| int ast_tonepair_start | ( | struct ast_channel * | chan, |
| int | freq1, | ||
| int | freq2, | ||
| int | duration, | ||
| int | vol | ||
| ) |
Start a tone going
Definition at line 8267 of file channel.c.
References ast_activate_generator(), tonepair_def::duration, tonepair_def::freq1, tonepair_def::freq2, and tonepair_def::vol.
Referenced by ast_tonepair(), pbx_builtin_waitexten(), play_dialtone(), and sendnoise().
| void ast_tonepair_stop | ( | struct ast_channel * | chan | ) |
Stop a tone from playing
Definition at line 8280 of file channel.c.
References ast_deactivate_generator().
Referenced by sendnoise().
{
ast_deactivate_generator(chan);
}
| int ast_transfer | ( | struct ast_channel * | chan, |
| char * | dest | ||
| ) |
Transfer a channel (if supported).
| -1 | on error |
| 0 | if not supported |
| 1 | if supported and requested |
| chan | current channel |
| dest | destination extension for transfer |
Transfer a channel (if supported).
Called by:
Definition at line 6031 of file channel.c.
References ast_channel_flags(), ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_check_hangup(), AST_CONTROL_TRANSFER, AST_FLAG_ZOMBIE, AST_FRAME_CONTROL, ast_frfree, ast_read(), ast_test_flag, AST_TRANSFER_SUCCESS, ast_waitfor(), ast_frame::data, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::ptr, ast_frame::subclass, transfer, and ast_channel_tech::transfer.
Referenced by transfer_exec().
{
int res = -1;
/* Stop if we're a zombie or need a soft hangup */
ast_channel_lock(chan);
if (!ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
if (ast_channel_tech(chan)->transfer) {
res = ast_channel_tech(chan)->transfer(chan, dest);
if (!res)
res = 1;
} else
res = 0;
}
ast_channel_unlock(chan);
if (res <= 0) {
return res;
}
for (;;) {
struct ast_frame *fr;
res = ast_waitfor(chan, -1);
if (res < 0 || !(fr = ast_read(chan))) {
res = -1;
break;
}
if (fr->frametype == AST_FRAME_CONTROL && fr->subclass.integer == AST_CONTROL_TRANSFER) {
enum ast_control_transfer *message = fr->data.ptr;
if (*message == AST_TRANSFER_SUCCESS) {
res = 1;
} else {
res = -1;
}
ast_frfree(fr);
break;
}
ast_frfree(fr);
}
return res;
}
| char* ast_transfercapability2str | ( | int | transfercapability | ) | const |
Gives the string form of a given transfer capability.
| transfercapability | transfer capability to get the name of |
Definition at line 855 of file channel.c.
References AST_TRANS_CAP_3_1K_AUDIO, AST_TRANS_CAP_DIGITAL, AST_TRANS_CAP_DIGITAL_W_TONES, AST_TRANS_CAP_RESTRICTED_DIGITAL, AST_TRANS_CAP_SPEECH, and AST_TRANS_CAP_VIDEO.
Referenced by ast_channel_data_add_structure(), cb_events(), misdn_call(), oh323_call(), sig_pri_call(), sig_pri_new_ast_channel(), and sig_ss7_new_ast_channel().
{
switch (transfercapability) {
case AST_TRANS_CAP_SPEECH:
return "SPEECH";
case AST_TRANS_CAP_DIGITAL:
return "DIGITAL";
case AST_TRANS_CAP_RESTRICTED_DIGITAL:
return "RESTRICTED_DIGITAL";
case AST_TRANS_CAP_3_1K_AUDIO:
return "3K1AUDIO";
case AST_TRANS_CAP_DIGITAL_W_TONES:
return "DIGITAL_W_TONES";
case AST_TRANS_CAP_VIDEO:
return "VIDEO";
default:
return "UNKNOWN";
}
}
| int ast_undestroyed_channels | ( | void | ) |
Definition at line 662 of file channel.c.
References ast_atomic_fetchadd_int().
Referenced by can_safely_quit().
{
return ast_atomic_fetchadd_int(&chancount, 0);
}
| struct ast_namedgroups* ast_unref_namedgroups | ( | struct ast_namedgroups * | groups | ) | [read] |
Definition at line 8417 of file channel.c.
References ao2_cleanup.
Referenced by __sip_destroy(), _free_port_cfg(), ast_channel_named_callgroups_set(), ast_channel_named_pickupgroups_set(), build_peer(), check_peer_ok(), create_addr_from_peer(), destroy_dahdi_pvt(), func_channel_write_real(), mkintf(), process_dahdi(), and sip_destroy_peer().
{
ao2_cleanup(groups);
return NULL;
}
| int ast_waitfor | ( | struct ast_channel * | chan, |
| int | ms | ||
| ) |
Wait for input on a channel.
| chan | channel to wait on |
| ms | length of time to wait on the channel |
Wait for input on a channel for a given # of milliseconds (<0 for indefinite).
| < | 0 on failure |
| 0 | if nothing ever arrived |
| the | # of ms remaining otherwise |
Definition at line 3538 of file channel.c.
References ast_waitfor_nandfds().
Referenced by __adsi_transmit_messages(), __analog_ss_thread(), __ast_answer(), __ast_play_and_record(), __ast_request_and_dial(), adsi_careful_send(), agent_ack_sleep(), analog_ss_thread(), ast_dtmf_stream(), ast_recvtext(), ast_safe_sleep_conditional(), ast_tonepair(), ast_transfer(), async_wait(), background_detect_exec(), channel_spy(), conf_flush(), dahdi_accept_r2_call_exec(), dictate_exec(), disa_exec(), disable_t38(), do_idle_thread(), do_waiting(), echo_exec(), handle_recordfile(), handle_speechrecognize(), ices_exec(), isAnsweringMachine(), jack_exec(), launch_asyncagi(), measurenoise(), mp3_exec(), NBScat_exec(), receive_dtmf_digits(), receivefax_t38_init(), record_exec(), recordthread(), send_tone_burst(), send_waveform_to_channel(), sendfax_t38_init(), sendurl_exec(), speech_background(), transmit_audio(), transmit_t38(), wait_for_hangup(), waitforring_exec(), and waitstream_core().
{
if (ms < 0) {
do {
ms = 100000;
ast_waitfor_nandfds(&c, 1, NULL, 0, NULL, NULL, &ms);
} while (!ms);
} else {
ast_waitfor_nandfds(&c, 1, NULL, 0, NULL, NULL, &ms);
}
return ms;
}
| struct ast_channel* ast_waitfor_n | ( | struct ast_channel ** | chan, |
| int | n, | ||
| int * | ms | ||
| ) | [read] |
Waits for input on a group of channels Wait for input on an array of channels for a given # of milliseconds.
| chan | an array of pointers to channels |
| n | number of channels that are to be waited upon |
| ms | time "ms" is modified in-place, if applicable |
Definition at line 3533 of file channel.c.
References ast_waitfor_nandfds().
Referenced by ast_generic_bridge(), ast_udptl_bridge(), autoservice_run(), dahdi_bridge(), dial_exec_full(), feature_request_and_dial(), generic_thread_loop(), iax2_bridge(), local_bridge_loop(), misdn_bridge(), monitor_dial(), remote_bridge_loop(), wait_for_answer(), and wait_for_winner().
{
return ast_waitfor_nandfds(c, n, NULL, 0, NULL, NULL, ms);
}
| int ast_waitfor_n_fd | ( | int * | fds, |
| int | n, | ||
| int * | ms, | ||
| int * | exception | ||
| ) |
Waits for input on an fd.
Definition at line 3144 of file channel.c.
References ast_waitfor_nandfds().
Referenced by dundi_lookup_internal(), dundi_precache_internal(), and softmix_bridge_thread().
{
int winner = -1;
ast_waitfor_nandfds(NULL, 0, fds, n, exception, &winner, ms);
return winner;
}
| struct ast_channel* ast_waitfor_nandfds | ( | struct ast_channel ** | c, |
| int | n, | ||
| int * | fds, | ||
| int | nfds, | ||
| int * | exception, | ||
| int * | outfd, | ||
| int * | ms | ||
| ) | [read] |
Waits for activity on a group of channels.
| chan | an array of pointers to channels |
| n | number of channels that are to be waited upon |
| fds | an array of fds to wait upon |
| nfds | the number of fds to wait upon |
| exception | exception flag |
| outfd | fd that had activity on it |
| ms | how long the wait was |
Big momma function here. Wait for activity on any of the n channels, or any of the nfds file descriptors.
Definition at line 3156 of file channel.c.
References ast_add_fd(), ast_alloca, ast_channel_fd(), ast_channel_fdno_set(), ast_channel_flags(), ast_channel_lock, ast_channel_masq(), ast_channel_name(), ast_channel_softhangup_internal_flag_add(), ast_channel_unlock, ast_channel_whentohangup(), ast_clear_flag, ast_do_masquerade(), AST_FLAG_BLOCKING, AST_FLAG_EXCEPTION, AST_MAX_FDS, ast_poll, ast_set_flag, AST_SOFTHANGUP_TIMEOUT, ast_test_suite_event_notify, ast_tvcmp(), ast_tvdiff_ms(), ast_tvnow(), ast_tvsub(), ast_tvzero(), chanlist::chan, CHECK_BLOCKING, and errno.
Referenced by ast_waitfor(), ast_waitfor_n(), ast_waitfor_n_fd(), ast_waitfordigit_full(), bridge_channel_join_multithreaded(), conf_run(), eivr_comm(), find_cache(), generic_fax_exec(), multiplexed_thread_function(), run_agi(), and waitstream_core().
{
struct timeval start = { 0 , 0 };
struct pollfd *pfds = NULL;
int res;
long rms;
int x, y, max;
int sz;
struct timeval now = { 0, 0 };
struct timeval whentohangup = { 0, 0 }, diff;
struct ast_channel *winner = NULL;
struct fdmap {
int chan;
int fdno;
} *fdmap = NULL;
if (outfd) {
*outfd = -99999;
}
if (exception) {
*exception = 0;
}
if ((sz = n * AST_MAX_FDS + nfds)) {
pfds = ast_alloca(sizeof(*pfds) * sz);
fdmap = ast_alloca(sizeof(*fdmap) * sz);
} else {
/* nothing to allocate and no FDs to check */
return NULL;
}
/* Perform any pending masquerades */
for (x = 0; x < n; x++) {
while (ast_channel_masq(c[x])) {
ast_do_masquerade(c[x]);
}
ast_channel_lock(c[x]);
if (!ast_tvzero(*ast_channel_whentohangup(c[x]))) {
if (ast_tvzero(whentohangup))
now = ast_tvnow();
diff = ast_tvsub(*ast_channel_whentohangup(c[x]), now);
if (diff.tv_sec < 0 || ast_tvzero(diff)) {
ast_test_suite_event_notify("HANGUP_TIME", "Channel: %s", ast_channel_name(c[x]));
/* Should already be hungup */
ast_channel_softhangup_internal_flag_add(c[x], AST_SOFTHANGUP_TIMEOUT);
ast_channel_unlock(c[x]);
return c[x];
}
if (ast_tvzero(whentohangup) || ast_tvcmp(diff, whentohangup) < 0)
whentohangup = diff;
}
ast_channel_unlock(c[x]);
}
/* Wait full interval */
rms = *ms;
/* INT_MAX, not LONG_MAX, because it matters on 64-bit */
if (!ast_tvzero(whentohangup) && whentohangup.tv_sec < INT_MAX / 1000) {
rms = whentohangup.tv_sec * 1000 + whentohangup.tv_usec / 1000; /* timeout in milliseconds */
if (*ms >= 0 && *ms < rms) { /* original *ms still smaller */
rms = *ms;
}
} else if (!ast_tvzero(whentohangup) && rms < 0) {
/* Tiny corner case... call would need to last >24 days */
rms = INT_MAX;
}
/*
* Build the pollfd array, putting the channels' fds first,
* followed by individual fds. Order is important because
* individual fd's must have priority over channel fds.
*/
max = 0;
for (x = 0; x < n; x++) {
for (y = 0; y < AST_MAX_FDS; y++) {
fdmap[max].fdno = y; /* fd y is linked to this pfds */
fdmap[max].chan = x; /* channel x is linked to this pfds */
max += ast_add_fd(&pfds[max], ast_channel_fd(c[x], y));
}
CHECK_BLOCKING(c[x]);
}
/* Add the individual fds */
for (x = 0; x < nfds; x++) {
fdmap[max].chan = -1;
max += ast_add_fd(&pfds[max], fds[x]);
}
if (*ms > 0) {
start = ast_tvnow();
}
if (sizeof(int) == 4) { /* XXX fix timeout > 600000 on linux x86-32 */
do {
int kbrms = rms;
if (kbrms > 600000) {
kbrms = 600000;
}
res = ast_poll(pfds, max, kbrms);
if (!res) {
rms -= kbrms;
}
} while (!res && (rms > 0));
} else {
res = ast_poll(pfds, max, rms);
}
for (x = 0; x < n; x++) {
ast_clear_flag(ast_channel_flags(c[x]), AST_FLAG_BLOCKING);
}
if (res < 0) { /* Simulate a timeout if we were interrupted */
if (errno != EINTR) {
*ms = -1;
}
return NULL;
}
if (!ast_tvzero(whentohangup)) { /* if we have a timeout, check who expired */
now = ast_tvnow();
for (x = 0; x < n; x++) {
if (!ast_tvzero(*ast_channel_whentohangup(c[x])) && ast_tvcmp(*ast_channel_whentohangup(c[x]), now) <= 0) {
ast_test_suite_event_notify("HANGUP_TIME", "Channel: %s", ast_channel_name(c[x]));
ast_channel_softhangup_internal_flag_add(c[x], AST_SOFTHANGUP_TIMEOUT);
if (winner == NULL) {
winner = c[x];
}
}
}
}
if (res == 0) { /* no fd ready, reset timeout and done */
*ms = 0; /* XXX use 0 since we may not have an exact timeout. */
return winner;
}
/*
* Then check if any channel or fd has a pending event.
* Remember to check channels first and fds last, as they
* must have priority on setting 'winner'
*/
for (x = 0; x < max; x++) {
res = pfds[x].revents;
if (res == 0) {
continue;
}
if (fdmap[x].chan >= 0) { /* this is a channel */
winner = c[fdmap[x].chan]; /* override previous winners */
if (res & POLLPRI) {
ast_set_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
} else {
ast_clear_flag(ast_channel_flags(winner), AST_FLAG_EXCEPTION);
}
ast_channel_fdno_set(winner, fdmap[x].fdno);
} else { /* this is an fd */
if (outfd) {
*outfd = pfds[x].fd;
}
if (exception) {
*exception = (res & POLLPRI) ? -1 : 0;
}
winner = NULL;
}
}
if (*ms > 0) {
*ms -= ast_tvdiff_ms(ast_tvnow(), start);
if (*ms < 0) {
*ms = 0;
}
}
return winner;
}
| int ast_waitfordigit | ( | struct ast_channel * | c, |
| int | ms | ||
| ) |
Waits for a digit.
| c | channel to wait for a digit on |
| ms | how many milliseconds to wait (<0 for indefinite). |
Definition at line 3551 of file channel.c.
References ast_waitfordigit_full().
Referenced by __analog_ss_thread(), _while_exec(), adsi_get_cpeid(), adsi_get_cpeinfo(), adsi_print(), adsi_read_encoded_dtmf(), adsi_transmit_message_full(), advanced_options(), analog_my_getsigstr(), analog_ss_thread(), ast_app_dtget(), ast_record_review(), bridge_channel_feature(), builtin_atxfer(), collect_digits(), common_exec(), control_streamfile(), cpeid_exec(), dialout(), directory_exec(), forward_message(), get_folder(), ivr_dispatch(), mgcp_ss(), my_getsigstr(), pbx_builtin_waitexten(), play_record_review(), pri_ss_thread(), read_exec(), read_newoption(), readexten_exec(), retrydial_exec(), select_item_menu(), select_item_pause(), select_item_seq(), sendnoise(), testclient_exec(), testserver_exec(), vm_execmain(), vm_forwardoptions(), vm_instructions_en(), vm_options(), vm_tempgreeting(), wait_a_bit(), and wait_our_turn().
{
return ast_waitfordigit_full(c, ms, -1, -1);
}
| 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.
| c | channel to wait for a digit on |
| ms | how many milliseconds to wait (<0 for indefinite). |
| audiofd | audio file descriptor to write to if audio frames are received |
| ctrlfd | control file descriptor to monitor for reading |
Definition at line 3615 of file channel.c.
References ast_channel_flags(), ast_check_hangup(), ast_clear_flag, AST_CONTROL_ANSWER, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, AST_CONTROL_UPDATE_RTP_PEER, AST_FLAG_END_DTMF_ONLY, AST_FLAG_ZOMBIE, AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, AST_FRAME_VOICE, ast_frfree, ast_log(), ast_read(), ast_remaining_ms(), ast_set_flag, ast_test_flag, ast_tvnow(), ast_waitfor_nandfds(), ast_frame::data, ast_frame::datalen, errno, ast_frame::frametype, ast_frame_subclass::integer, LOG_WARNING, ast_frame::ptr, and ast_frame::subclass.
Referenced by ast_readstring_full(), ast_waitfordigit(), handle_getoption(), and handle_waitfordigit().
{
struct timeval start = ast_tvnow();
int ms;
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(c), AST_FLAG_ZOMBIE) || ast_check_hangup(c))
return -1;
/* Only look for the end of DTMF, don't bother with the beginning and don't emulate things */
ast_set_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
/* Wait for a digit, no more than timeout_ms milliseconds total.
* Or, wait indefinitely if timeout_ms is <0.
*/
while ((ms = ast_remaining_ms(start, timeout_ms))) {
struct ast_channel *rchan;
int outfd = -1;
errno = 0;
/* While ast_waitfor_nandfds tries to help by reducing the timeout by how much was waited,
* it is unhelpful if it waited less than a millisecond.
*/
rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms);
if (!rchan && outfd < 0 && ms) {
if (errno == 0 || errno == EINTR)
continue;
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
} else if (outfd > -1) {
/* The FD we were watching has something waiting */
ast_log(LOG_WARNING, "The FD we were waiting for has something waiting. Waitfordigit returning numeric 1\n");
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 1;
} else if (rchan) {
int res;
struct ast_frame *f = ast_read(c);
if (!f)
return -1;
switch (f->frametype) {
case AST_FRAME_DTMF_BEGIN:
break;
case AST_FRAME_DTMF_END:
res = f->subclass.integer;
ast_frfree(f);
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return res;
case AST_FRAME_CONTROL:
switch (f->subclass.integer) {
case AST_CONTROL_HANGUP:
ast_frfree(f);
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
case AST_CONTROL_PVT_CAUSE_CODE:
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
case AST_CONTROL_SRCUPDATE:
case AST_CONTROL_SRCCHANGE:
case AST_CONTROL_CONNECTED_LINE:
case AST_CONTROL_REDIRECTING:
case AST_CONTROL_UPDATE_RTP_PEER:
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
case -1:
/* Unimportant */
break;
default:
ast_log(LOG_WARNING, "Unexpected control subclass '%d'\n", f->subclass.integer);
break;
}
break;
case AST_FRAME_VOICE:
/* Write audio if appropriate */
if (audiofd > -1) {
if (write(audiofd, f->data.ptr, f->datalen) < 0) {
ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
}
}
default:
/* Ignore */
break;
}
ast_frfree(f);
}
}
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return 0; /* Time is up */
}
| 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.
| chan | destination channel of the frame |
| frame | frame that will be written |
Definition at line 4960 of file channel.c.
References apply_plc(), ast_audiohook_detach_list(), AST_AUDIOHOOK_DIRECTION_WRITE, ast_audiohook_write_list(), ast_audiohook_write_list_empty(), ast_channel_audiohooks(), ast_channel_audiohooks_set(), ast_channel_flags(), ast_channel_fout(), ast_channel_fout_set(), ast_channel_framehooks(), ast_channel_generatordata(), ast_channel_insmpl(), ast_channel_lock, ast_channel_masq(), ast_channel_masqr(), ast_channel_monitor(), ast_channel_name(), ast_channel_nativeformats(), ast_channel_outsmpl(), ast_channel_outsmpl_set(), ast_channel_rawwriteformat(), ast_channel_softhangup_internal_flag_add(), ast_channel_tech(), ast_channel_trylock, ast_channel_unlock, ast_channel_writeformat(), ast_channel_writetrans(), ast_check_hangup(), ast_clear_flag, AST_CONTROL_UNHOLD, ast_deactivate_generator(), ast_debug, ast_do_masquerade(), AST_FLAG_BLOCKING, AST_FLAG_WRITE_INT, AST_FLAG_ZOMBIE, ast_format_cap_iscompatible(), ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, ast_format_rate(), AST_FORMAT_SLINEAR, AST_FORMAT_T140, AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, ast_frame_dump(), AST_FRAME_HTML, AST_FRAME_IAX, AST_FRAME_MODEM, AST_FRAME_NULL, AST_FRAME_TEXT, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_framehook_list_write_event(), ast_frfree, ast_frisolate(), ast_getformatname(), ast_getformatname_multiple(), AST_LIST_NEXT, ast_log(), AST_MONITOR_RUNNING, ast_opt_generic_plc, ast_seekstream(), ast_senddigit_begin(), ast_senddigit_end(), ast_set_write_format_by_id(), AST_SOFTHANGUP_DEV, ast_test_flag, ast_translate(), ast_writestream(), calc_monitor_jump(), CHECK_BLOCKING, ast_frame::data, ast_frame::datalen, DEBUGCHAN_FLAG, f, ast_channel_monitor::format, ast_frame_subclass::format, FRAMECOUNT_INC, ast_frame::frametype, ast_format::id, ast_channel_tech::indicate, ast_frame_subclass::integer, ast_frame::len, LOG_WARNING, chanlist::next, ast_frame::ptr, ast_frame::samples, SEEK_FORCECUR, send_dtmf_event(), ast_channel_tech::send_html, ast_channel_tech::send_text, ast_frame::src, ast_frame::subclass, ast_channel_tech::write, write_stream(), ast_channel_tech::write_text, and ast_channel_tech::write_video.
Referenced by adsi_careful_send(), agent_write(), ast_bridge_call(), ast_generic_bridge(), ast_prod(), ast_readaudio_callback(), ast_readvideo_callback(), ast_udptl_bridge(), ast_write_video(), conf_queue_dtmf(), conf_run(), dahdi_bridge(), dictate_exec(), echo_exec(), fax_generator_generate(), feature_request_and_dial(), gen_generate(), generic_fax_exec(), handle_jack_audio(), iax2_bridge(), jb_get_and_deliver(), linear_generator(), local_bridge_loop(), milliwatt_generate(), misdn_bridge(), moh_files_generator(), moh_generate(), mp3_exec(), multiplexed_bridge_write(), NBScat_exec(), playtones_generator(), remote_bridge_loop(), send_tone_burst(), send_waveform_to_channel(), silence_generator_generate(), simple_bridge_write(), sms_generate(), softmix_bridge_poke(), softmix_bridge_write(), softmix_pass_dtmf(), softmix_pass_video_all(), softmix_pass_video_top_priority(), spandsp_fax_gw_t30_gen(), spy_generate(), t38_tx_packet_handler(), tonepair_generator(), and wait_for_answer().
{
int res = -1;
struct ast_frame *f = NULL;
int count = 0;
/*Deadlock avoidance*/
while(ast_channel_trylock(chan)) {
/*cannot goto done since the channel is not locked*/
if(count++ > 10) {
ast_debug(1, "Deadlock avoided for write to channel '%s'\n", ast_channel_name(chan));
return 0;
}
usleep(1);
}
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
goto done;
/* Handle any pending masquerades */
while (ast_channel_masq(chan)) {
ast_channel_unlock(chan);
ast_do_masquerade(chan);
ast_channel_lock(chan);
}
if (ast_channel_masqr(chan)) {
res = 0; /* XXX explain, why 0 ? */
goto done;
}
/* Perform the framehook write event here. After the frame enters the framehook list
* there is no telling what will happen, how awesome is that!!! */
if (!(fr = ast_framehook_list_write_event(ast_channel_framehooks(chan), fr))) {
res = 0;
goto done;
}
if (ast_channel_generatordata(chan) && (!fr->src || strcasecmp(fr->src, "ast_prod"))) {
if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT)) {
ast_deactivate_generator(chan);
} else {
if (fr->frametype == AST_FRAME_DTMF_END) {
/* There is a generator running while we're in the middle of a digit.
* It's probably inband DTMF, so go ahead and pass it so it can
* stop the generator */
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan);
CHECK_BLOCKING(chan);
} else if (fr->frametype == AST_FRAME_CONTROL && fr->subclass.integer == AST_CONTROL_UNHOLD) {
/* This is a side case where Echo is basically being called and the person put themselves on hold and took themselves off hold */
res = (ast_channel_tech(chan)->indicate == NULL) ? 0 :
ast_channel_tech(chan)->indicate(chan, fr->subclass.integer, fr->data.ptr, fr->datalen);
}
res = 0; /* XXX explain, why 0 ? */
goto done;
}
}
/* High bit prints debugging */
if (ast_channel_fout(chan) & DEBUGCHAN_FLAG)
ast_frame_dump(ast_channel_name(chan), fr, ">>");
CHECK_BLOCKING(chan);
switch (fr->frametype) {
case AST_FRAME_CONTROL:
res = (ast_channel_tech(chan)->indicate == NULL) ? 0 :
ast_channel_tech(chan)->indicate(chan, fr->subclass.integer, fr->data.ptr, fr->datalen);
break;
case AST_FRAME_DTMF_BEGIN:
if (ast_channel_audiohooks(chan)) {
struct ast_frame *old_frame = fr;
fr = ast_audiohook_write_list(chan, ast_channel_audiohooks(chan), AST_AUDIOHOOK_DIRECTION_WRITE, fr);
if (old_frame != fr)
f = fr;
}
send_dtmf_event(chan, "Sent", fr->subclass.integer, "Yes", "No");
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_begin(chan, fr->subclass.integer);
ast_channel_lock(chan);
CHECK_BLOCKING(chan);
break;
case AST_FRAME_DTMF_END:
if (ast_channel_audiohooks(chan)) {
struct ast_frame *new_frame = fr;
new_frame = ast_audiohook_write_list(chan, ast_channel_audiohooks(chan), AST_AUDIOHOOK_DIRECTION_WRITE, fr);
if (new_frame != fr) {
ast_frfree(new_frame);
}
}
send_dtmf_event(chan, "Sent", fr->subclass.integer, "No", "Yes");
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
res = ast_senddigit_end(chan, fr->subclass.integer, fr->len);
ast_channel_lock(chan);
CHECK_BLOCKING(chan);
break;
case AST_FRAME_TEXT:
if (fr->subclass.integer == AST_FORMAT_T140) {
res = (ast_channel_tech(chan)->write_text == NULL) ? 0 :
ast_channel_tech(chan)->write_text(chan, fr);
} else {
res = (ast_channel_tech(chan)->send_text == NULL) ? 0 :
ast_channel_tech(chan)->send_text(chan, (char *) fr->data.ptr);
}
break;
case AST_FRAME_HTML:
res = (ast_channel_tech(chan)->send_html == NULL) ? 0 :
ast_channel_tech(chan)->send_html(chan, fr->subclass.integer, (char *) fr->data.ptr, fr->datalen);
break;
case AST_FRAME_VIDEO:
/* XXX Handle translation of video codecs one day XXX */
res = (ast_channel_tech(chan)->write_video == NULL) ? 0 :
ast_channel_tech(chan)->write_video(chan, fr);
break;
case AST_FRAME_MODEM:
res = (ast_channel_tech(chan)->write == NULL) ? 0 :
ast_channel_tech(chan)->write(chan, fr);
break;
case AST_FRAME_VOICE:
if (ast_channel_tech(chan)->write == NULL)
break; /*! \todo XXX should return 0 maybe ? */
if (ast_opt_generic_plc && fr->subclass.format.id == AST_FORMAT_SLINEAR) {
apply_plc(chan, fr);
}
/* If the frame is in the raw write format, then it's easy... just use the frame - otherwise we will have to translate */
if (ast_format_cmp(&fr->subclass.format, ast_channel_rawwriteformat(chan)) != AST_FORMAT_CMP_NOT_EQUAL) {
f = fr;
} else {
if ((!ast_format_cap_iscompatible(ast_channel_nativeformats(chan), &fr->subclass.format)) &&
(ast_format_cmp(ast_channel_writeformat(chan), &fr->subclass.format) != AST_FORMAT_CMP_EQUAL)) {
char nf[512];
/*
* XXX Something is not right. We are not compatible with this
* frame. Bad things can happen. Problems range from no audio,
* one-way audio, to unexplained line hangups. As a last resort
* try to adjust the format. Ideally, we do not want to do this
* because it indicates a deeper problem. For now, we log these
* events to reduce user impact and help identify the problem
* areas.
*/
ast_log(LOG_WARNING, "Codec mismatch on channel %s setting write format to %s from %s native formats %s\n",
ast_channel_name(chan), ast_getformatname(&fr->subclass.format), ast_getformatname(ast_channel_writeformat(chan)),
ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(chan)));
ast_set_write_format_by_id(chan, fr->subclass.format.id);
}
f = (ast_channel_writetrans(chan)) ? ast_translate(ast_channel_writetrans(chan), fr, 0) : fr;
}
if (!f) {
res = 0;
break;
}
if (ast_channel_audiohooks(chan)) {
struct ast_frame *prev = NULL, *new_frame, *cur, *dup;
int freeoldlist = 0;
if (f != fr) {
freeoldlist = 1;
}
/* Since ast_audiohook_write may return a new frame, and the cur frame is
* an item in a list of frames, create a new list adding each cur frame back to it
* regardless if the cur frame changes or not. */
for (cur = f; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
new_frame = ast_audiohook_write_list(chan, ast_channel_audiohooks(chan), AST_AUDIOHOOK_DIRECTION_WRITE, cur);
/* if this frame is different than cur, preserve the end of the list,
* free the old frames, and set cur to be the new frame */
if (new_frame != cur) {
/* doing an ast_frisolate here seems silly, but we are not guaranteed the new_frame
* isn't part of local storage, meaning if ast_audiohook_write is called multiple
* times it may override the previous frame we got from it unless we dup it */
if ((dup = ast_frisolate(new_frame))) {
AST_LIST_NEXT(dup, frame_list) = AST_LIST_NEXT(cur, frame_list);
if (freeoldlist) {
AST_LIST_NEXT(cur, frame_list) = NULL;
ast_frfree(cur);
}
if (new_frame != dup) {
ast_frfree(new_frame);
}
cur = dup;
}
}
/* now, regardless if cur is new or not, add it to the new list,
* if the new list has not started, cur will become the first item. */
if (prev) {
AST_LIST_NEXT(prev, frame_list) = cur;
} else {
f = cur; /* set f to be the beginning of our new list */
}
prev = cur;
}
}
/* If Monitor is running on this channel, then we have to write frames out there too */
/* the translator on chan->writetrans may have returned multiple frames
from the single frame we passed in; if so, feed each one of them to the
monitor */
if (ast_channel_monitor(chan) && ast_channel_monitor(chan)->write_stream) {
struct ast_frame *cur;
for (cur = f; cur; cur = AST_LIST_NEXT(cur, frame_list)) {
/* XXX must explain this code */
#ifndef MONITOR_CONSTANT_DELAY
int jump = ast_channel_insmpl(chan) - ast_channel_outsmpl(chan) - 4 * cur->samples;
if (jump >= 0) {
jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)), ast_format_rate(&f->subclass.format), ast_format_rate(&ast_channel_monitor(chan)->read_stream->fmt->format));
if (ast_seekstream(ast_channel_monitor(chan)->write_stream, jump, SEEK_FORCECUR) == -1) {
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
}
ast_channel_outsmpl_set(chan, ast_channel_outsmpl(chan) + (ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)) + cur->samples);
} else {
ast_channel_outsmpl_set(chan, ast_channel_outsmpl(chan) + cur->samples);
}
#else
int jump = calc_monitor_jump((ast_channel_insmpl(chan) - ast_channel_outsmpl(chan)), ast_format_rate(f->subclass.codec), ast_format_rate(ast_channel_monitor(chan)->read_stream->fmt->format));
if (jump - MONITOR_DELAY >= 0) {
if (ast_seekstream(ast_channel_monitor(chan)->write_stream, jump - cur->samples, SEEK_FORCECUR) == -1) {
ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n");
}
ast_channel_outsmpl_set(chan, ast_channel_outsmpl(chan) + ast_channel_insmpl(chan) - ast_channel_outsmpl(chan));
} else {
ast_channel_outsmpl_set(chan, ast_channel_outsmpl(chan) + cur->samples);
}
#endif
if (ast_channel_monitor(chan)->state == AST_MONITOR_RUNNING) {
if (ast_writestream(ast_channel_monitor(chan)->write_stream, cur) < 0)
ast_log(LOG_WARNING, "Failed to write data to channel monitor write stream\n");
}
}
}
/* the translator on chan->writetrans may have returned multiple frames
from the single frame we passed in; if so, feed each one of them to the
channel, freeing each one after it has been written */
if ((f != fr) && AST_LIST_NEXT(f, frame_list)) {
struct ast_frame *cur, *next = NULL;
unsigned int skip = 0;
cur = f;
while (cur) {
next = AST_LIST_NEXT(cur, frame_list);
AST_LIST_NEXT(cur, frame_list) = NULL;
if (!skip) {
if ((res = ast_channel_tech(chan)->write(chan, cur)) < 0) {
ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_DEV);
skip = 1;
} else if (next) {
/* don't do this for the last frame in the list,
as the code outside the loop will do it once
*/
ast_channel_fout_set(chan, FRAMECOUNT_INC(ast_channel_fout(chan)));
}
}
ast_frfree(cur);
cur = next;
}
/* reset f so the code below doesn't attempt to free it */
f = NULL;
} else {
res = ast_channel_tech(chan)->write(chan, f);
}
break;
case AST_FRAME_NULL:
case AST_FRAME_IAX:
/* Ignore these */
res = 0;
break;
default:
/* At this point, fr is the incoming frame and f is NULL. Channels do
* not expect to get NULL as a frame pointer and will segfault. Hence,
* we output the original frame passed in. */
res = ast_channel_tech(chan)->write(chan, fr);
break;
}
if (f && f != fr)
ast_frfree(f);
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);
/* Consider a write failure to force a soft hangup */
if (res < 0) {
ast_channel_softhangup_internal_flag_add(chan, AST_SOFTHANGUP_DEV);
} else {
ast_channel_fout_set(chan, FRAMECOUNT_INC(ast_channel_fout(chan)));
}
done:
if (ast_channel_audiohooks(chan) && ast_audiohook_write_list_empty(ast_channel_audiohooks(chan))) {
/* The list gets recreated if audiohooks are added again later */
ast_audiohook_detach_list(ast_channel_audiohooks(chan));
ast_channel_audiohooks_set(chan, NULL);
}
ast_channel_unlock(chan);
return res;
}
| 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.
| chan | destination channel of the frame |
| frame | frame that will be written |
| 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.
| chan | destination channel of the frame |
| frame | frame that will be written |
Definition at line 4845 of file channel.c.
References ast_channel_tech(), and ast_write().
{
int res;
if (!ast_channel_tech(chan)->write_video)
return 0;
res = ast_write(chan, fr);
if (!res)
res = 1;
return res;
}
| const char* channelreloadreason2txt | ( | enum channelreloadreason | reason | ) |
Convert enum channelreloadreason to text string for manager event.
| reason | The reason for reload (manager, cli, start etc) |
\ brief Convert channel reloadreason (ENUM) to text string for manager event
Definition at line 8847 of file channel.c.
References CHANNEL_CLI_RELOAD, CHANNEL_MODULE_LOAD, and CHANNEL_MODULE_RELOAD.
Referenced by reload_config().
{
switch (reason) {
case CHANNEL_MODULE_LOAD:
return "LOAD (Channel module load)";
case CHANNEL_MODULE_RELOAD:
return "RELOAD (Channel module reload)";
case CHANNEL_CLI_RELOAD:
return "CLIRELOAD (Channel module reload by CLI command)";
default:
return "MANAGERRELOAD (Channel module reload by manager)";
}
};
| DECLARE_STRINGFIELD_SETTERS_FOR | ( | peeraccount | ) |
| DECLARE_STRINGFIELD_SETTERS_FOR | ( | userfield | ) |
| DECLARE_STRINGFIELD_SETTERS_FOR | ( | call_forward | ) |
| DECLARE_STRINGFIELD_SETTERS_FOR | ( | uniqueid | ) |
| DECLARE_STRINGFIELD_SETTERS_FOR | ( | linkedid | ) |
| DECLARE_STRINGFIELD_SETTERS_FOR | ( | hangupsource | ) |
| struct ast_channel_tech ast_kill_tech |
| unsigned long global_fin |
The current value of the debug flags is stored in the two variables global_fin and global_fout (declared in main/channel.c)
Definition at line 108 of file channel.c.
Referenced by handle_core_set_debug_channel().
| unsigned long global_fout |
Definition at line 108 of file channel.c.
Referenced by handle_core_set_debug_channel().