#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_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 |
| Main Channel structure associated with a channel. More... | |
| struct | ast_channel::autochans |
| struct | ast_channel::datastores |
| struct | ast_channel_tech |
| Structure to describe a channel "technology", ie a channel driver See for examples:. More... | |
| struct | ast_generator |
| struct | ast_group_info |
| channel group info More... | |
| 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_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 |
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_ANSWERED_ELSEWHERE = (1 << 15), 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_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_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 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. | |
| 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. | |
| const char * | ast_channel_accountcode (const struct ast_channel *chan) |
| 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. | |
| 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. | |
| 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. | |
| int | ast_channel_connected_line_macro (struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame) |
| Run a connected line interception macro and update a channel's connected line information. | |
| 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. | |
| 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. | |
| 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) |
| int | ast_channel_early_bridge (struct ast_channel *c0, struct ast_channel *c1) |
| Bridge two channels together (early). | |
| 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. | |
| 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. | |
| const char * | ast_channel_language (const struct ast_channel *chan) |
| const char * | ast_channel_linkedid (const struct ast_channel *chan) |
| int | ast_channel_make_compatible (struct ast_channel *c0, struct ast_channel *c1) |
| Makes two channel formats compatible. | |
| int | ast_channel_masquerade (struct ast_channel *original, struct ast_channel *clone) |
| Weird function made for call transfers. | |
| 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. | |
| const char * | ast_channel_parkinglot (const struct ast_channel *chan) |
| const char * | ast_channel_peeraccount (const struct ast_channel *chan) |
| int | ast_channel_queryoption (struct ast_channel *channel, int option, void *data, int *datalen, int block) |
| Checks the value of an option. | |
| 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. | |
| const char * | ast_channel_reason2str (int reason) |
| return an english explanation of the code returned thru __ast_request_and_dial's 'outstate' argument | |
| 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. | |
| 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_sendhtml (struct ast_channel *channel, int subclass, const char *data, int datalen) |
| Sends HTML on given channel Send HTML or URL on link. | |
| 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. | |
| struct ast_silence_generator * | ast_channel_start_silence_generator (struct ast_channel *chan) |
| Starts a silence generator on the given channel. | |
| 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. | |
| int | ast_channel_supports_html (struct ast_channel *channel) |
| Checks for HTML support on a channel. | |
| 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. | |
| 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 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) |
| 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? | |
| 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. | |
| int | ast_party_id_presentation (const struct ast_party_id *id) |
| Determine the overall presentation value for the given party. | |
| 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) |
| char * | ast_print_group (char *buf, int buflen, ast_group_t group) |
| print call- and pickup groups into buffer | |
| 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_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. | |
| 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_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_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. | |
| struct ast_channel * | ast_channel_get_by_exten (const char *exten, const char *context) |
| Find a channel by extension and context. | |
| 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_iterator * | ast_channel_iterator_all_new (void) |
| Create a new 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_destroy (struct ast_channel_iterator *i) |
| Destroy a channel iterator. | |
| struct ast_channel * | ast_channel_iterator_next (struct ast_channel_iterator *i) |
| Get the next channel for a channel iterator. | |
Variables | |
| struct ast_channel_tech | ast_kill_tech |
| Kill the channel channel driver technology descriptor. | |
| unsigned long | global_fin |
| unsigned long | global_fout |
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 1975 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 1977 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 1983 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 497 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, | |||||
| ... | ) |
Value:
__ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag, \ __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
| NULL | failure | |
| non-NULL | successfully allocated channel |
By default, new channels are set to the "s" extension and "default" context.
Definition at line 1170 of file channel.h.
Referenced by __oh323_new(), action_bridge(), agent_new(), alsa_new(), ast_async_goto(), ast_iax2_new(), ast_pbx_outgoing_exten(), bridge_exec(), bridge_request(), builtin_atxfer(), check_goto_on_transfer(), console_new(), create_msg_q_chan(), dahdi_new(), do_notify(), gtalk_new(), iax_park(), jingle_new(), local_new(), masq_park_call(), mgcp_new(), misdn_new(), multicast_rtp_request(), nbs_new(), oss_new(), phone_new(), rec_request(), sip_new(), sip_park(), skinny_new(), unistim_new(), and usbradio_new().
| #define ast_channel_lock | ( | chan | ) | ao2_lock(chan) |
Definition at line 2510 of file channel.h.
Referenced by __ast_answer(), __ast_pbx_run(), __ast_queue_frame(), __ast_read(), __ast_request_and_dial(), __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_hangup(), action_redirect(), action_status(), action_timeout(), activatesub(), add_features_datastores(), add_to_agi(), agent_hangup(), agent_indicate(), agent_lock_owner(), 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_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_destructor(), ast_channel_queryoption(), ast_channel_redirecting_macro(), ast_channel_set_caller(), ast_channel_set_caller_event(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_channel_setoption(), 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_outgoing_app(), ast_pbx_outgoing_exten(), 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_sendtext(), ast_set_callerid(), ast_set_cc_interfaces_chanvar(), ast_set_hangupsource(), ast_settimeout(), 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_play_sounds(), bridge_write(), builtin_atxfer(), builtin_automixmonitor(), builtin_blindtransfer(), 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_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_bridge(), dahdi_handle_dtmf(), data_channels_provider_handler(), dial_exec_full(), disable_jack_hook(), do_forward(), dundi_query_read(), dundi_result_read(), enable_jack_hook(), end_bridge_callback(), enum_query_read(), enum_result_read(), exec_odbcfinish(), fax_detect_attach(), fax_detect_framehook(), fax_gateway_attach(), feature_check(), feature_interpret(), feature_request_and_dial(), find_by_mark(), find_by_part(), find_calling_channel(), find_channel_by_group(), find_conf_realtime(), find_details(), find_or_create_details(), 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(), handle_chanlist(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_invite_replaces(), handle_request_bye(), handle_request_refer(), handle_showchan(), handle_softhangup(), import_ch(), import_helper(), init_jack_data(), jack_hook_callback(), jb_helper(), leave_voicemail(), linkedid_match(), listfilter(), local_ast_moh_stop(), local_call(), local_hangup(), local_queryoption(), local_queue_frame(), local_read(), local_setoption(), login_exec(), lua_get_state(), manage_parked_call(), manager_mixmonitor(), manager_mutestream(), mark_transaction_active(), 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(), park_call_full(), parkandannounce_exec(), parked_call_exec(), pbx_builtin_background(), pbx_builtin_getvar_helper(), pbx_builtin_gotoiftime(), 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(), process_sdp(), queue_exec(), receivefax_exec(), redirecting_read(), redirecting_write(), release_transaction(), report_fax_status(), retrydial_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(), smdi_msg_read(), smdi_msg_retrieve_read(), softhangup_exec(), speech_background(), speex_read(), speex_write(), srv_datastore_setup(), srv_query_read(), srv_result_read(), start_monitor_action(), start_monitor_exec(), state_notify_build_xml(), stop_mixmonitor_exec(), 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 2517 of file channel.h.
Referenced by __ast_channel_masquerade(), __ast_request_and_dial(), ast_bridge_call(), ast_call_forward(), call_forward_inherit(), dial_transfer(), do_bridge_masquerade(), findmeexec(), 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 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(), dial_exec_full(), fast_originate(), page_exec(), park_call_full(), sip_call(), sip_handle_cc(), softhangup_exec(), 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 2535 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(), awesome_locking(), bridge_write(), check_bridge(), conf_stop_record(), handle_getvariablefull(), handle_incoming(), handle_invite_replaces(), handle_request_refer(), local_attended_transfer(), local_queryoption(), local_queue_frame(), local_setoption(), record_thread(), sip_pickup(), sip_pvt_lock_full(), and socket_process().
| #define ast_channel_trylock | ( | chan | ) | ao2_trylock(chan) |
Definition at line 2512 of file channel.h.
Referenced by __ast_channel_masquerade(), __oh323_rtp_create(), agent_indicate(), agent_logoff(), agent_read(), analog_lock_sub_owner(), ast_do_masquerade(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_rtp_instance_bridge(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_udptl_bridge(), ast_write(), auto_congest(), awesome_locking(), check_bridge(), check_rtp_timeout(), cleanup_connection(), dahdi_bridge(), dahdi_handle_event(), dahdi_lock_sub_owner(), dahdi_queue_frame(), dahdi_softhangup_all(), dial_exec_full(), do_forward(), get_sip_pvt_byid_locked(), grab_owner(), handle_request_bye(), hangup_connection(), iax2_destroy(), iax2_lock_owner(), mgcp_queue_frame(), mgcp_queue_hangup(), misdn_attempt_transfer(), oh323_rtp_read(), oh323_simulate_dtmf_end(), proc_session_timer(), receive_digit(), release_chan(), release_chan_early(), remote_hold(), retrans_pkt(), setup_rtp_connection(), sip_hangup(), sip_reinvite_retry(), and update_state().
| #define ast_channel_unlock | ( | chan | ) | ao2_unlock(chan) |
Definition at line 2511 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(), __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_hangup(), action_redirect(), action_status(), action_timeout(), activatesub(), add_features_datastores(), add_to_agi(), agent_hangup(), agent_indicate(), agent_lock_owner(), agent_logoff(), agent_read(), agents_data_provider_get(), agents_show(), agents_show_online(), alsa_call(), analog_attempt_transfer(), 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_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_destructor(), ast_channel_queryoption(), ast_channel_redirecting_macro(), ast_channel_set_caller(), ast_channel_set_caller_event(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_channel_setoption(), 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_outgoing_app(), ast_pbx_outgoing_exten(), ast_pickup_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_sendtext(), ast_set_callerid(), ast_set_cc_interfaces_chanvar(), ast_set_hangupsource(), ast_settimeout(), 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_play_sounds(), bridge_write(), builtin_atxfer(), builtin_automixmonitor(), builtin_blindtransfer(), 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(), dundi_query_read(), dundi_result_read(), enable_jack_hook(), end_bridge_callback(), enum_query_read(), enum_result_read(), exec_odbcfinish(), fast_originate(), fax_detect_attach(), fax_detect_framehook(), fax_gateway_attach(), feature_check(), feature_interpret(), feature_request_and_dial(), find_by_mark(), find_by_part(), find_calling_channel(), find_channel_by_group(), find_conf_realtime(), find_details(), find_or_create_details(), 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(), handle_chanlist(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_incoming(), handle_invite_replaces(), handle_request_bye(), handle_request_do(), handle_request_invite(), handle_request_refer(), handle_showchan(), handle_softhangup(), hangup_connection(), iax2_destroy(), iax2_queue_control_data(), iax2_queue_frame(), iax2_queue_hangup(), import_ch(), import_helper(), init_jack_data(), jack_hook_callback(), jb_helper(), leave_voicemail(), linkedid_match(), listfilter(), local_ast_moh_stop(), local_attended_transfer(), local_bridge_loop(), local_call(), local_hangup(), local_queryoption(), local_queue_frame(), local_read(), local_setoption(), login_exec(), lua_get_state(), manage_parked_call(), manager_mixmonitor(), manager_mutestream(), mark_transaction_active(), 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_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(), proc_session_timer(), process_sdp(), queue_exec(), receive_digit(), receivefax_exec(), redirecting_read(), redirecting_write(), release_chan(), release_chan_early(), release_transaction(), remote_bridge_loop(), remote_hold(), report_fax_status(), retrans_pkt(), retrydial_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(), sip_addheader(), sip_dtmfmode(), sip_hangup(), sip_new(), sip_pvt_lock_full(), sip_read(), sip_reinvite_retry(), sip_removeheader(), sip_request_call(), sip_set_rtp_peer(), sip_set_udptl_peer(), smdi_msg_read(), smdi_msg_retrieve_read(), socket_process(), softhangup_exec(), spandsp_fax_gateway_start(), speech_background(), speex_read(), speex_write(), srv_datastore_setup(), srv_query_read(), srv_result_read(), start_monitor_action(), start_monitor_exec(), state_notify_build_xml(), stop_mixmonitor_exec(), 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 2546 of file channel.h.
Referenced by __ast_channel_alloc_ap(), __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_check_retire_linkedid(), ast_cel_fabricate_channel_from_event(), ast_cel_report_event(), ast_channel_release(), ast_complete_channels(), ast_dummy_channel_alloc(), ast_hangup(), ast_parse_device_state(), ast_pbx_outgoing_cdr_failed(), ast_pickup_call(), 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(), custom_log(), data_channels_provider_handler(), dialog_unlink_all(), do_pause_or_unpause(), func_channels_read(), func_mchan_read(), func_mchan_write(), handle_chanlist(), handle_channelstatus(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_core_set_debug_channel(), handle_getvariablefull(), handle_hangup(), handle_incoming(), handle_invite_replaces(), handle_redirect(), handle_request_do(), handle_request_refer(), handle_set_chanvar(), handle_show_chanvar(), handle_showchan(), handle_softhangup(), import_helper(), 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(), rotate_file(), send_provisional_keepalive_full(), senddtmf_exec(), sendmail(), sendpage(), shared_read(), shared_write(), sip_pickup(), sip_pickup_thread(), sip_pvt_lock_full(), socket_process(), 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(), and ast_do_masquerade().
| #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(), dial_transfer(), do_magic_pickup(), handle_gosub(), handle_request_invite(), handle_statechange(), park_call_full(), parkinglot_activate(), reload_config(), and try_calling().
| #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(), begin_dial_channel(), build_device(), cc_extension_monitor_init(), conf_run(), destroy_space(), destroy_station(), 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_gosub(), 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(), process_dahdi(), realtime_common(), realtime_switch_common(), search_directory_sub(), show_dialplan_helper(), sla_build_station(), speech_background(), state_notify_build_xml(), try_calling(), vm_authenticate(), and vmauthenticate().
| #define AST_MAX_FDS 11 |
Definition at line 157 of file channel.h.
Referenced by ast_channel_destructor(), ast_do_masquerade(), ast_poll_channel_add(), ast_poll_channel_del(), and ast_waitfor_nandfds().
| #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(), and ast_do_masquerade().
| #define CHECK_BLOCKING | ( | c | ) |
Definition at line 2472 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_datastores(), 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(), 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 683 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 | ) |
Value:
void ast_channel_##field##_set(struct ast_channel *chan, const char *field); \ void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) __attribute__((format(printf, 2, 0))); \ void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
| #define FRAMECOUNT_INC | ( | x | ) | ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) ) |
| #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 |
| anonymous enum |
ast_channel_tech Properties
Definition at line 911 of file channel.h.
00911 { 00912 /*! 00913 * \brief Channels have this property if they can accept input with jitter; 00914 * i.e. most VoIP channels 00915 */ 00916 AST_CHAN_TP_WANTSJITTER = (1 << 0), 00917 /*! 00918 * \brief Channels have this property if they can create jitter; 00919 * i.e. most VoIP channels 00920 */ 00921 AST_CHAN_TP_CREATESJITTER = (1 << 1), 00922 };
| 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_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_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. |
Definition at line 925 of file channel.h.
00925 { 00926 /*! Queue incoming DTMF, to be released when this flag is turned off */ 00927 AST_FLAG_DEFER_DTMF = (1 << 1), 00928 /*! write should be interrupt generator */ 00929 AST_FLAG_WRITE_INT = (1 << 2), 00930 /*! a thread is blocking on this channel */ 00931 AST_FLAG_BLOCKING = (1 << 3), 00932 /*! This is a zombie channel */ 00933 AST_FLAG_ZOMBIE = (1 << 4), 00934 /*! There is an exception pending */ 00935 AST_FLAG_EXCEPTION = (1 << 5), 00936 /*! Listening to moh XXX anthm promises me this will disappear XXX */ 00937 AST_FLAG_MOH = (1 << 6), 00938 /*! This channel is spying on another channel */ 00939 AST_FLAG_SPYING = (1 << 7), 00940 /*! This channel is in a native bridge */ 00941 AST_FLAG_NBRIDGE = (1 << 8), 00942 /*! the channel is in an auto-incrementing dialplan processor, 00943 * so when ->priority is set, it will get incremented before 00944 * finding the next priority to run */ 00945 AST_FLAG_IN_AUTOLOOP = (1 << 9), 00946 /*! This is an outgoing call */ 00947 AST_FLAG_OUTGOING = (1 << 10), 00948 /*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */ 00949 AST_FLAG_IN_DTMF = (1 << 12), 00950 /*! A DTMF_END was received when not IN_DTMF, so the length of the digit is 00951 * currently being emulated */ 00952 AST_FLAG_EMULATE_DTMF = (1 << 13), 00953 /*! This is set to tell the channel not to generate DTMF begin frames, and 00954 * to instead only generate END frames. */ 00955 AST_FLAG_END_DTMF_ONLY = (1 << 14), 00956 /*! Flag to show channels that this call is hangup due to the fact that the call 00957 was indeed answered, but in another channel */ 00958 AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), 00959 /*! This flag indicates that on a masquerade, an active stream should not 00960 * be carried over */ 00961 AST_FLAG_MASQ_NOSTREAM = (1 << 16), 00962 /*! This flag indicates that the hangup exten was run when the bridge terminated, 00963 * a message aimed at preventing a subsequent hangup exten being run at the pbx_run 00964 * level */ 00965 AST_FLAG_BRIDGE_HANGUP_RUN = (1 << 17), 00966 /*! This flag indicates that the hangup exten should NOT be run when the 00967 * bridge terminates, this will allow the hangup in the pbx loop to be run instead. 00968 * */ 00969 AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18), 00970 /*! Disable certain workarounds. This reintroduces certain bugs, but allows 00971 * some non-traditional dialplans (like AGI) to continue to function. 00972 */ 00973 AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20), 00974 };
| anonymous enum |
ast_bridge_config flags
Definition at line 977 of file channel.h.
00977 { 00978 AST_FEATURE_PLAY_WARNING = (1 << 0), 00979 AST_FEATURE_REDIRECT = (1 << 1), 00980 AST_FEATURE_DISCONNECT = (1 << 2), 00981 AST_FEATURE_ATXFER = (1 << 3), 00982 AST_FEATURE_AUTOMON = (1 << 4), 00983 AST_FEATURE_PARKCALL = (1 << 5), 00984 AST_FEATURE_AUTOMIXMON = (1 << 6), 00985 AST_FEATURE_NO_H_EXTEN = (1 << 7), 00986 AST_FEATURE_WARNING_ACTIVE = (1 << 8), 00987 };
| 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 1025 of file channel.h.
01025 { 01026 /*! 01027 * Soft hangup requested by device or other internal reason. 01028 * Actual hangup needed. 01029 */ 01030 AST_SOFTHANGUP_DEV = (1 << 0), 01031 /*! 01032 * Used to break the normal frame flow so an async goto can be 01033 * done instead of actually hanging up. 01034 */ 01035 AST_SOFTHANGUP_ASYNCGOTO = (1 << 1), 01036 /*! 01037 * Soft hangup requested by system shutdown. Actual hangup 01038 * needed. 01039 */ 01040 AST_SOFTHANGUP_SHUTDOWN = (1 << 2), 01041 /*! 01042 * Used to break the normal frame flow after a timeout so an 01043 * implicit async goto can be done to the 'T' exten if it exists 01044 * instead of actually hanging up. If the exten does not exist 01045 * then actually hangup. 01046 */ 01047 AST_SOFTHANGUP_TIMEOUT = (1 << 3), 01048 /*! 01049 * Soft hangup requested by application/channel-driver being 01050 * unloaded. Actual hangup needed. 01051 */ 01052 AST_SOFTHANGUP_APPUNLOAD = (1 << 4), 01053 /*! 01054 * Soft hangup requested by non-associated party. Actual hangup 01055 * needed. 01056 */ 01057 AST_SOFTHANGUP_EXPLICIT = (1 << 5), 01058 /*! 01059 * Used to break a bridge so the channel can be spied upon 01060 * instead of actually hanging up. 01061 */ 01062 AST_SOFTHANGUP_UNBRIDGE = (1 << 6), 01063 01064 01065 /*! 01066 * \brief All softhangup flags. 01067 * 01068 * This can be used as an argument to ast_channel_clear_softhangup() 01069 * to clear all softhangup flags from a channel. 01070 */ 01071 AST_SOFTHANGUP_ALL = (0xFFFFFFFF) 01072 };
| enum ast_bridge_result |
Definition at line 168 of file channel.h.
00168 { 00169 AST_BRIDGE_COMPLETE = 0, 00170 AST_BRIDGE_FAILED = -1, 00171 AST_BRIDGE_FAILED_NOWARN = -2, 00172 AST_BRIDGE_RETRY = -3, 00173 };
| enum ast_channel_adsicpe |
Definition at line 694 of file channel.h.
00694 { 00695 AST_ADSI_UNKNOWN, 00696 AST_ADSI_AVAILABLE, 00697 AST_ADSI_UNAVAILABLE, 00698 AST_ADSI_OFFHOOKONLY, 00699 };
| enum AST_PARTY_CHAR_SET |
Party name character set enumeration values (values from Q.SIG)
Definition at line 196 of file channel.h.
00196 { 00197 AST_PARTY_CHAR_SET_UNKNOWN = 0, 00198 AST_PARTY_CHAR_SET_ISO8859_1 = 1, 00199 AST_PARTY_CHAR_SET_WITHDRAWN = 2,/* ITU withdrew this enum value. */ 00200 AST_PARTY_CHAR_SET_ISO8859_2 = 3, 00201 AST_PARTY_CHAR_SET_ISO8859_3 = 4, 00202 AST_PARTY_CHAR_SET_ISO8859_4 = 5, 00203 AST_PARTY_CHAR_SET_ISO8859_5 = 6, 00204 AST_PARTY_CHAR_SET_ISO8859_7 = 7, 00205 AST_PARTY_CHAR_SET_ISO10646_BMPSTRING = 8, 00206 AST_PARTY_CHAR_SET_ISO10646_UTF_8STRING = 9, 00207 };
| enum ast_t38_state |
Possible T38 states on channels.
Definition at line 704 of file channel.h.
00704 { 00705 T38_STATE_UNAVAILABLE, /*!< T38 is unavailable on this channel or disabled by configuration */ 00706 T38_STATE_UNKNOWN, /*!< The channel supports T38 but the current status is unknown */ 00707 T38_STATE_NEGOTIATING, /*!< T38 is being negotiated */ 00708 T38_STATE_REJECTED, /*!< Remote side has rejected our offer */ 00709 T38_STATE_NEGOTIATED, /*!< T38 established */ 00710 };
| enum channelreloadreason |
Channel reload reasons for manager events at load or reload of configuration.
Definition at line 1076 of file channel.h.
01076 { 01077 CHANNEL_MODULE_LOAD, 01078 CHANNEL_MODULE_RELOAD, 01079 CHANNEL_CLI_RELOAD, 01080 CHANNEL_MANAGER_RELOAD, 01081 };
| 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 will wait up to 'delay' milliseconds for media to arrive on the channel before returning to the caller, so that the caller can properly assume the channel is 'ready' for media flow. If 'delay' is less than 500, the function will wait up to 500 milliseconds.
| 0 | on success | |
| non-zero | on failure |
Definition at line 2767 of file channel.c.
References ast_channel::_state, 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_STATE_RING, AST_STATE_RINGING, 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().
02768 { 02769 int res = 0; 02770 enum ast_channel_state old_state; 02771 02772 old_state = chan->_state; 02773 if ((res = ast_raw_answer(chan, cdr_answer))) { 02774 return res; 02775 } 02776 02777 switch (old_state) { 02778 case AST_STATE_RINGING: 02779 case AST_STATE_RING: 02780 /* wait for media to start flowing, but don't wait any longer 02781 * than 'delay' or 500 milliseconds, whichever is longer 02782 */ 02783 do { 02784 AST_LIST_HEAD_NOLOCK(, ast_frame) frames; 02785 struct ast_frame *cur, *new; 02786 int ms = MAX(delay, 500); 02787 unsigned int done = 0; 02788 02789 AST_LIST_HEAD_INIT_NOLOCK(&frames); 02790 02791 for (;;) { 02792 ms = ast_waitfor(chan, ms); 02793 if (ms < 0) { 02794 ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", ast_channel_name(chan), strerror(errno)); 02795 res = -1; 02796 break; 02797 } 02798 if (ms == 0) { 02799 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)); 02800 break; 02801 } 02802 cur = ast_read(chan); 02803 if (!cur || ((cur->frametype == AST_FRAME_CONTROL) && 02804 (cur->subclass.integer == AST_CONTROL_HANGUP))) { 02805 if (cur) { 02806 ast_frfree(cur); 02807 } 02808 res = -1; 02809 ast_debug(2, "Hangup of channel %s detected in answer routine\n", ast_channel_name(chan)); 02810 break; 02811 } 02812 02813 if ((new = ast_frisolate(cur)) != cur) { 02814 ast_frfree(cur); 02815 } 02816 02817 AST_LIST_INSERT_HEAD(&frames, new, frame_list); 02818 02819 /* if a specific delay period was requested, continue 02820 * until that delay has passed. don't stop just because 02821 * incoming media has arrived. 02822 */ 02823 if (delay) { 02824 continue; 02825 } 02826 02827 switch (new->frametype) { 02828 /* all of these frametypes qualify as 'media' */ 02829 case AST_FRAME_VOICE: 02830 case AST_FRAME_VIDEO: 02831 case AST_FRAME_TEXT: 02832 case AST_FRAME_DTMF_BEGIN: 02833 case AST_FRAME_DTMF_END: 02834 case AST_FRAME_IMAGE: 02835 case AST_FRAME_HTML: 02836 case AST_FRAME_MODEM: 02837 done = 1; 02838 break; 02839 case AST_FRAME_CONTROL: 02840 case AST_FRAME_IAX: 02841 case AST_FRAME_NULL: 02842 case AST_FRAME_CNG: 02843 break; 02844 } 02845 02846 if (done) { 02847 break; 02848 } 02849 } 02850 02851 if (res == 0) { 02852 ast_channel_lock(chan); 02853 while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { 02854 ast_queue_frame_head(chan, cur); 02855 ast_frfree(cur); 02856 } 02857 ast_channel_unlock(chan); 02858 } 02859 } while (0); 02860 break; 02861 default: 02862 break; 02863 } 02864 02865 return res; 02866 }
| 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 |
By default, new channels are set to the "s" extension and "default" context.
Definition at line 1153 of file channel.c.
References __ast_channel_alloc_ap().
01159 { 01160 va_list ap; 01161 struct ast_channel *result; 01162 01163 va_start(ap, name_fmt); 01164 result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context, 01165 linkedid, amaflag, file, line, function, name_fmt, ap); 01166 va_end(ap); 01167 01168 return result; 01169 }
| 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 5301 of file channel.c.
References ast_channel::_state, 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_datastore_inherit(), ast_channel_inherit_variables(), ast_channel_lock, ast_channel_lock_both, 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_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, AST_CONTROL_VIDUPDATE, ast_copy_string(), 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_request(), ast_set_flag, ast_set_variables(), AST_STATE_UP, ast_strlen_zero(), ast_waitfor(), cause, ast_channel::cdr, outgoing_helper::cid_name, outgoing_helper::cid_num, ast_channel::connected, ast_channel::context, outgoing_helper::context, ast_channel::exten, outgoing_helper::exten, ast_frame::frametype, handle_cause(), ast_channel::hangupcause, 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, ast_channel::priority, outgoing_helper::priority, 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().
05302 { 05303 int dummy_outstate; 05304 int cause = 0; 05305 struct ast_channel *chan; 05306 int res = 0; 05307 int last_subclass = 0; 05308 struct ast_party_connected_line connected; 05309 05310 if (outstate) 05311 *outstate = 0; 05312 else 05313 outstate = &dummy_outstate; /* make outstate always a valid pointer */ 05314 05315 chan = ast_request(type, cap, requestor, addr, &cause); 05316 if (!chan) { 05317 ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, addr); 05318 handle_cause(cause, outstate); 05319 return NULL; 05320 } 05321 05322 if (oh) { 05323 if (oh->vars) { 05324 ast_set_variables(chan, oh->vars); 05325 } 05326 if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name)) { 05327 /* 05328 * Use the oh values instead of the function parameters for the 05329 * outgoing CallerID. 05330 */ 05331 cid_num = oh->cid_num; 05332 cid_name = oh->cid_name; 05333 } 05334 if (oh->parent_channel) { 05335 /* Safely inherit variables and datastores from the parent channel. */ 05336 ast_channel_lock_both(oh->parent_channel, chan); 05337 ast_channel_inherit_variables(oh->parent_channel, chan); 05338 ast_channel_datastore_inherit(oh->parent_channel, chan); 05339 ast_channel_unlock(oh->parent_channel); 05340 ast_channel_unlock(chan); 05341 } 05342 if (oh->account) { 05343 ast_channel_lock(chan); 05344 ast_cdr_setaccount(chan, oh->account); 05345 ast_channel_unlock(chan); 05346 } 05347 } 05348 05349 ast_set_flag(chan->cdr, AST_CDR_FLAG_ORIGINATED); 05350 ast_party_connected_line_set_init(&connected, &chan->connected); 05351 if (cid_num) { 05352 connected.id.number.valid = 1; 05353 connected.id.number.str = (char *) cid_num; 05354 connected.id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; 05355 } 05356 if (cid_name) { 05357 connected.id.name.valid = 1; 05358 connected.id.name.str = (char *) cid_name; 05359 connected.id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; 05360 } 05361 ast_channel_set_connected_line(chan, &connected, NULL); 05362 05363 if (ast_call(chan, addr, 0)) { /* ast_call failed... */ 05364 ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, addr); 05365 } else { 05366 res = 1; /* mark success in case chan->_state is already AST_STATE_UP */ 05367 while (timeout && chan->_state != AST_STATE_UP) { 05368 struct ast_frame *f; 05369 res = ast_waitfor(chan, timeout); 05370 if (res == 0) { /* timeout, treat it like ringing */ 05371 *outstate = AST_CONTROL_RINGING; 05372 break; 05373 } 05374 if (res < 0) /* error or done */ 05375 break; 05376 if (timeout > -1) 05377 timeout = res; 05378 if (!ast_strlen_zero(ast_channel_call_forward(chan))) { 05379 if (!(chan = ast_call_forward(NULL, chan, NULL, cap, oh, outstate))) { 05380 return NULL; 05381 } 05382 continue; 05383 } 05384 05385 f = ast_read(chan); 05386 if (!f) { 05387 *outstate = AST_CONTROL_HANGUP; 05388 res = 0; 05389 break; 05390 } 05391 if (f->frametype == AST_FRAME_CONTROL) { 05392 switch (f->subclass.integer) { 05393 case AST_CONTROL_RINGING: /* record but keep going */ 05394 *outstate = f->subclass.integer; 05395 break; 05396 05397 case AST_CONTROL_BUSY: 05398 ast_cdr_busy(chan->cdr); 05399 *outstate = f->subclass.integer; 05400 timeout = 0; 05401 break; 05402 05403 case AST_CONTROL_INCOMPLETE: 05404 ast_cdr_failed(chan->cdr); 05405 *outstate = AST_CONTROL_CONGESTION; 05406 timeout = 0; 05407 break; 05408 05409 case AST_CONTROL_CONGESTION: 05410 ast_cdr_failed(chan->cdr); 05411 *outstate = f->subclass.integer; 05412 timeout = 0; 05413 break; 05414 05415 case AST_CONTROL_ANSWER: 05416 ast_cdr_answer(chan->cdr); 05417 *outstate = f->subclass.integer; 05418 timeout = 0; /* trick to force exit from the while() */ 05419 break; 05420 05421 /* Ignore these */ 05422 case AST_CONTROL_PROGRESS: 05423 case AST_CONTROL_PROCEEDING: 05424 case AST_CONTROL_HOLD: 05425 case AST_CONTROL_UNHOLD: 05426 case AST_CONTROL_VIDUPDATE: 05427 case AST_CONTROL_SRCUPDATE: 05428 case AST_CONTROL_SRCCHANGE: 05429 case AST_CONTROL_CONNECTED_LINE: 05430 case AST_CONTROL_REDIRECTING: 05431 case AST_CONTROL_CC: 05432 case -1: /* Ignore -- just stopping indications */ 05433 break; 05434 05435 default: 05436 ast_log(LOG_NOTICE, "Don't know what to do with control frame %d\n", f->subclass.integer); 05437 } 05438 last_subclass = f->subclass.integer; 05439 } 05440 ast_frfree(f); 05441 } 05442 } 05443 05444 /* Final fixups */ 05445 if (oh) { 05446 if (!ast_strlen_zero(oh->context)) 05447 ast_copy_string(chan->context, oh->context, sizeof(chan->context)); 05448 if (!ast_strlen_zero(oh->exten)) 05449 ast_copy_string(chan->exten, oh->exten, sizeof(chan->exten)); 05450 if (oh->priority) 05451 chan->priority = oh->priority; 05452 } 05453 if (chan->_state == AST_STATE_UP) 05454 *outstate = AST_CONTROL_ANSWER; 05455 05456 if (res <= 0) { 05457 ast_channel_lock(chan); 05458 if (AST_CONTROL_RINGING == last_subclass) { 05459 chan->hangupcause = AST_CAUSE_NO_ANSWER; 05460 } 05461 if (!chan->cdr && (chan->cdr = ast_cdr_alloc())) { 05462 ast_cdr_init(chan->cdr, chan); 05463 } 05464 if (chan->cdr) { 05465 char tmp[256]; 05466 05467 snprintf(tmp, sizeof(tmp), "%s/%s", type, addr); 05468 ast_cdr_setapp(chan->cdr, "Dial", tmp); 05469 ast_cdr_update(chan); 05470 ast_cdr_start(chan->cdr); 05471 ast_cdr_end(chan->cdr); 05472 /* If the cause wasn't handled properly */ 05473 if (ast_cdr_disposition(chan->cdr, chan->hangupcause)) { 05474 ast_cdr_failed(chan->cdr); 05475 } 05476 } 05477 ast_channel_unlock(chan); 05478 ast_hangup(chan); 05479 chan = NULL; 05480 } 05481 return chan; 05482 }
| int ast_activate_generator | ( | struct ast_channel * | chan, | |
| struct ast_generator * | gen, | |||
| void * | params | |||
| ) |
Activate a given generator
Definition at line 2927 of file channel.c.
References ast_generator::alloc, ast_channel_lock, ast_channel_unlock, ast_prod(), ast_settimeout(), ast_channel::generator, 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().
02928 { 02929 int res = 0; 02930 02931 ast_channel_lock(chan); 02932 if (chan->generatordata) { 02933 if (chan->generator && chan->generator->release) 02934 chan->generator->release(chan, chan->generatordata); 02935 chan->generatordata = NULL; 02936 } 02937 if (gen->alloc && !(chan->generatordata = gen->alloc(chan, params))) { 02938 res = -1; 02939 } 02940 if (!res) { 02941 ast_settimeout(chan, 50, generator_force, chan); 02942 chan->generator = gen; 02943 } 02944 ast_channel_unlock(chan); 02945 02946 ast_prod(chan); 02947 02948 return res; 02949 }
| int ast_active_channels | ( | void | ) |
returns number of active/allocated channels
Definition at line 625 of file channel.c.
References ao2_container_count(), and channels.
Referenced by action_corestatus(), ast_var_channels(), ast_var_channels_table(), can_safely_quit(), dahdi_restart(), handle_chanlist(), handle_show_settings(), and really_quit().
00626 { 00627 return channels ? ao2_container_count(channels) : 0; 00628 }
| 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 2435 of file channel.h.
Referenced by ast_waitfor_nandfds().
| int ast_answer | ( | struct ast_channel * | chan | ) |
Answer a channel.
| chan | channel to answer |
This function will wait up to 500 milliseconds for media to arrive on the channel before returning to the caller, so that the caller can properly assume the channel is 'ready' for media flow.
| 0 | on success | |
| non-zero | on failure |
Definition at line 2868 of file channel.c.
References __ast_answer().
Referenced by action_bridge(), agi_exec_full(), alarmreceiver_exec(), answer_trunk_chan(), app_exec(), ast_control_streamfile(), ast_do_pickup(), ast_pickup_call(), auth_exec(), background_detect_exec(), bridge_exec(), bridge_request(), builtin_parkcall(), common_exec(), conf_exec(), confbridge_exec(), 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(), rpt_exec(), sayunixtime_exec(), send_waveform_to_channel(), sendfax_exec(), setup_privacy_args(), skel_exec(), sla_station_exec(), speech_background(), testclient_exec(), testserver_exec(), transmit(), vm_exec(), vm_execmain(), waitfor_exec(), and zapateller_exec().
02869 { 02870 return __ast_answer(chan, 0, 1); 02871 }
| 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 302 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().
00303 { 00304 struct asent *as; 00305 int res = -1; 00306 00307 AST_LIST_LOCK(&aslist); 00308 AST_LIST_TRAVERSE(&aslist, as, list) { 00309 if (as->chan == chan) { 00310 res = 0; 00311 as->ignore_frame_types |= (1 << ftype); 00312 break; 00313 } 00314 } 00315 AST_LIST_UNLOCK(&aslist); 00316 return res; 00317 }
| 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 174 of file autoservice.c.
References as_cond, ast_calloc, 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_run_macro(), 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(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), leave_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(), post_join_marked(), realtimefield_read(), senddtmf_exec(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().
00175 { 00176 int res = 0; 00177 struct asent *as; 00178 00179 AST_LIST_LOCK(&aslist); 00180 AST_LIST_TRAVERSE(&aslist, as, list) { 00181 if (as->chan == chan) { 00182 as->use_count++; 00183 break; 00184 } 00185 } 00186 AST_LIST_UNLOCK(&aslist); 00187 00188 if (as) { 00189 /* Entry exists, autoservice is already handling this channel */ 00190 return 0; 00191 } 00192 00193 if (!(as = ast_calloc(1, sizeof(*as)))) 00194 return -1; 00195 00196 /* New entry created */ 00197 as->chan = chan; 00198 as->use_count = 1; 00199 00200 ast_channel_lock(chan); 00201 as->orig_end_dtmf_flag = ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY) ? 1 : 0; 00202 if (!as->orig_end_dtmf_flag) 00203 ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY); 00204 ast_channel_unlock(chan); 00205 00206 AST_LIST_LOCK(&aslist); 00207 00208 if (AST_LIST_EMPTY(&aslist) && asthread != AST_PTHREADT_NULL) { 00209 ast_cond_signal(&as_cond); 00210 } 00211 00212 AST_LIST_INSERT_HEAD(&aslist, as, list); 00213 00214 if (asthread == AST_PTHREADT_NULL) { /* need start the thread */ 00215 if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) { 00216 ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n"); 00217 /* There will only be a single member in the list at this point, 00218 the one we just added. */ 00219 AST_LIST_REMOVE(&aslist, as, list); 00220 free(as); 00221 asthread = AST_PTHREADT_NULL; 00222 res = -1; 00223 } else { 00224 pthread_kill(asthread, SIGURG); 00225 } 00226 } 00227 00228 AST_LIST_UNLOCK(&aslist); 00229 00230 return res; 00231 }
| 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 233 of file autoservice.c.
References ast_channel::_softhangup, as_chan_list_state, ast_channel_lock, 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_run_macro(), 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(), finishup(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), leave_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(), post_join_marked(), realtimefield_read(), senddtmf_exec(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), srv_datastore_setup(), system_exec_helper(), try_calling(), and trylock_read().
00234 { 00235 int res = -1; 00236 struct asent *as, *removed = NULL; 00237 struct ast_frame *f; 00238 int chan_list_state; 00239 00240 AST_LIST_LOCK(&aslist); 00241 00242 /* Save the autoservice channel list state. We _must_ verify that the channel 00243 * list has been rebuilt before we return. Because, after we return, the channel 00244 * could get destroyed and we don't want our poor autoservice thread to step on 00245 * it after its gone! */ 00246 chan_list_state = as_chan_list_state; 00247 00248 /* Find the entry, but do not free it because it still can be in the 00249 autoservice thread array */ 00250 AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) { 00251 if (as->chan == chan) { 00252 as->use_count--; 00253 if (as->use_count < 1) { 00254 AST_LIST_REMOVE_CURRENT(list); 00255 removed = as; 00256 } 00257 break; 00258 } 00259 } 00260 AST_LIST_TRAVERSE_SAFE_END; 00261 00262 if (removed && asthread != AST_PTHREADT_NULL) { 00263 pthread_kill(asthread, SIGURG); 00264 } 00265 00266 AST_LIST_UNLOCK(&aslist); 00267 00268 if (!removed) { 00269 return 0; 00270 } 00271 00272 /* Wait while autoservice thread rebuilds its list. */ 00273 while (chan_list_state == as_chan_list_state) { 00274 usleep(1000); 00275 } 00276 00277 /* Now autoservice thread should have no references to our entry 00278 and we can safely destroy it */ 00279 00280 if (!chan->_softhangup) { 00281 res = 0; 00282 } 00283 00284 if (!as->orig_end_dtmf_flag) { 00285 ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY); 00286 } 00287 00288 ast_channel_lock(chan); 00289 while ((f = AST_LIST_REMOVE_HEAD(&as->deferred_frames, frame_list))) { 00290 if (!((1 << f->frametype) & as->ignore_frame_types)) { 00291 ast_queue_frame_head(chan, f); 00292 } 00293 ast_frfree(f); 00294 } 00295 ast_channel_unlock(chan); 00296 00297 free(as); 00298 00299 return res; 00300 }
| 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 615 of file channel.c.
References ao2_callback, ast_channel_softhangup_cb(), channels, OBJ_MULTIPLE, and OBJ_NODATA.
Referenced by can_safely_quit().
00616 { 00617 shutting_down = 1; 00618 00619 if (hangup) { 00620 ao2_callback(channels, OBJ_NODATA | OBJ_MULTIPLE, ast_channel_softhangup_cb, NULL); 00621 } 00622 }
| 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 834 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().
00835 { 00836 /* This just our opinion, expressed in code. We are asked to choose 00837 the best codec to use, given no information */ 00838 static const enum ast_format_id prefs[] = 00839 { 00840 /*! Okay, ulaw is used by all telephony equipment, so start with it */ 00841 AST_FORMAT_ULAW, 00842 /*! Unless of course, you're a silly European, so then prefer ALAW */ 00843 AST_FORMAT_ALAW, 00844 AST_FORMAT_G719, 00845 AST_FORMAT_SIREN14, 00846 AST_FORMAT_SIREN7, 00847 AST_FORMAT_TESTLAW, 00848 /*! G.722 is better then all below, but not as common as the above... so give ulaw and alaw priority */ 00849 AST_FORMAT_G722, 00850 /*! Okay, well, signed linear is easy to translate into other stuff */ 00851 AST_FORMAT_SLINEAR192, 00852 AST_FORMAT_SLINEAR96, 00853 AST_FORMAT_SLINEAR48, 00854 AST_FORMAT_SLINEAR44, 00855 AST_FORMAT_SLINEAR32, 00856 AST_FORMAT_SLINEAR24, 00857 AST_FORMAT_SLINEAR16, 00858 AST_FORMAT_SLINEAR12, 00859 AST_FORMAT_SLINEAR, 00860 /*! G.726 is standard ADPCM, in RFC3551 packing order */ 00861 AST_FORMAT_G726, 00862 /*! G.726 is standard ADPCM, in AAL2 packing order */ 00863 AST_FORMAT_G726_AAL2, 00864 /*! ADPCM has great sound quality and is still pretty easy to translate */ 00865 AST_FORMAT_ADPCM, 00866 /*! Okay, we're down to vocoders now, so pick GSM because it's small and easier to 00867 translate and sounds pretty good */ 00868 AST_FORMAT_GSM, 00869 /*! iLBC is not too bad */ 00870 AST_FORMAT_ILBC, 00871 /*! Speex is free, but computationally more expensive than GSM */ 00872 AST_FORMAT_SPEEX32, 00873 AST_FORMAT_SPEEX16, 00874 AST_FORMAT_SPEEX, 00875 /*! SILK is pretty awesome. */ 00876 AST_FORMAT_SILK, 00877 /*! CELT supports crazy high sample rates */ 00878 AST_FORMAT_CELT, 00879 /*! Ick, LPC10 sounds terrible, but at least we have code for it, if you're tacky enough 00880 to use it */ 00881 AST_FORMAT_LPC10, 00882 /*! G.729a is faster than 723 and slightly less expensive */ 00883 AST_FORMAT_G729A, 00884 /*! Down to G.723.1 which is proprietary but at least designed for voice */ 00885 AST_FORMAT_G723_1, 00886 }; 00887 char buf[512]; 00888 int x; 00889 00890 /* Find the first preferred codec in the format given */ 00891 for (x = 0; x < ARRAY_LEN(prefs); x++) { 00892 if (ast_format_cap_best_byid(cap, prefs[x], result)) { 00893 return result; 00894 } 00895 } 00896 00897 ast_format_clear(result); 00898 ast_log(LOG_WARNING, "Don't know any of %s formats\n", ast_getformatname_multiple(buf, sizeof(buf), cap)); 00899 00900 return NULL; 00901 }
| struct ast_channel* ast_bridged_channel | ( | struct ast_channel * | chan | ) | [read] |
Find bridged channel.
| chan | Current channel |
Definition at line 6932 of file channel.c.
References ast_channel::_bridge, ast_channel_tech::bridged_channel, and ast_channel::tech.
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_call(), 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(), schedule_delivery(), serialize_showchan(), sip_hangup(), sip_set_rtp_peer(), skinny_transfer(), socket_process(), spandsp_fax_gateway_start(), start_spying(), startmon(), TransferCallStep1(), and unistim_hangup().
06933 { 06934 struct ast_channel *bridged; 06935 bridged = chan->_bridge; 06936 if (bridged && bridged->tech->bridged_channel) 06937 bridged = bridged->tech->bridged_channel(chan, bridged); 06938 return bridged; 06939 }
| 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.) |
| 0 | on success | |
| -1 | on failure |
Definition at line 5610 of file channel.c.
References AST_CDR_FLAG_DIALED, ast_channel_lock, ast_channel_unlock, ast_check_hangup(), AST_FLAG_OUTGOING, AST_FLAG_ZOMBIE, ast_set_flag, ast_test_flag, ast_channel_tech::call, ast_channel::cdr, and ast_channel::tech.
Referenced by __ast_request_and_dial(), alloc_playback_chan(), ast_call_forward(), attempt_reconnect(), begin_dial_channel(), connect_link(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), ring_entry(), rpt(), rpt_exec(), and wait_for_answer().
05611 { 05612 /* Place an outgoing call, but don't wait any longer than timeout ms before returning. 05613 If the remote end does not answer within the timeout, then do NOT hang up, but 05614 return anyway. */ 05615 int res = -1; 05616 /* Stop if we're a zombie or need a soft hangup */ 05617 ast_channel_lock(chan); 05618 if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) { 05619 if (chan->cdr) { 05620 ast_set_flag(chan->cdr, AST_CDR_FLAG_DIALED); 05621 } 05622 if (chan->tech->call) 05623 res = chan->tech->call(chan, addr, timeout); 05624 ast_set_flag(chan, AST_FLAG_OUTGOING); 05625 } 05626 ast_channel_unlock(chan); 05627 return res; 05628 }
| 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 5231 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_lock, ast_channel_lock_both, 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(), cause, ast_channel::cdr, ast_channel::connected, ast_channel::context, handle_cause(), LOG_NOTICE, outgoing_helper::parent_channel, pbx_builtin_getvar_helper(), ast_channel::redirecting, S_OR, type, and outgoing_helper::vars.
Referenced by __ast_request_and_dial(), and feature_request_and_dial().
05232 { 05233 char tmpchan[256]; 05234 struct ast_channel *new_chan = NULL; 05235 char *data, *type; 05236 int cause = 0; 05237 int res; 05238 05239 /* gather data and request the new forward channel */ 05240 ast_copy_string(tmpchan, ast_channel_call_forward(orig), sizeof(tmpchan)); 05241 if ((data = strchr(tmpchan, '/'))) { 05242 *data++ = '\0'; 05243 type = tmpchan; 05244 } else { 05245 const char *forward_context; 05246 ast_channel_lock(orig); 05247 forward_context = pbx_builtin_getvar_helper(orig, "FORWARD_CONTEXT"); 05248 snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(orig), S_OR(forward_context, orig->context)); 05249 ast_channel_unlock(orig); 05250 data = tmpchan; 05251 type = "Local"; 05252 } 05253 if (!(new_chan = ast_request(type, cap, orig, data, &cause))) { 05254 ast_log(LOG_NOTICE, "Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause); 05255 handle_cause(cause, outstate); 05256 ast_hangup(orig); 05257 return NULL; 05258 } 05259 05260 /* Copy/inherit important information into new channel */ 05261 if (oh) { 05262 if (oh->vars) { 05263 ast_set_variables(new_chan, oh->vars); 05264 } 05265 if (oh->parent_channel) { 05266 call_forward_inherit(new_chan, oh->parent_channel, orig); 05267 } 05268 if (oh->account) { 05269 ast_channel_lock(new_chan); 05270 ast_cdr_setaccount(new_chan, oh->account); 05271 ast_channel_unlock(new_chan); 05272 } 05273 } else if (caller) { /* no outgoing helper so use caller if avaliable */ 05274 call_forward_inherit(new_chan, caller, orig); 05275 } 05276 05277 ast_channel_lock_both(orig, new_chan); 05278 ast_copy_flags(new_chan->cdr, orig->cdr, AST_CDR_FLAG_ORIGINATED); 05279 ast_channel_accountcode_set(new_chan, ast_channel_accountcode(orig)); 05280 ast_party_connected_line_copy(&new_chan->connected, &orig->connected); 05281 ast_party_redirecting_copy(&new_chan->redirecting, &orig->redirecting); 05282 ast_channel_unlock(new_chan); 05283 ast_channel_unlock(orig); 05284 05285 /* call new channel */ 05286 res = ast_call(new_chan, data, 0); 05287 if (timeout) { 05288 *timeout = res; 05289 } 05290 if (res) { 05291 ast_log(LOG_NOTICE, "Unable to call forward to channel %s/%s\n", type, (char *)data); 05292 ast_hangup(orig); 05293 ast_hangup(new_chan); 05294 return NULL; 05295 } 05296 ast_hangup(orig); 05297 05298 return new_chan; 05299 }
| void ast_cancel_shutdown | ( | void | ) |
Cancel a shutdown in progress.
Cancels an existing shutdown and returns to normal operation
Definition at line 631 of file channel.c.
Referenced by handle_abort_shutdown().
00632 { 00633 shutting_down = 0; 00634 }
| 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 752 of file channel.c.
References ARRAY_LEN, and causes.
Referenced by __transmit_response(), ast_channel_data_add_structure(), ast_do_masquerade(), ast_hangup(), dial_exec_full(), findmeexec(), sip_hangup(), and transmit_request_with_auth().
00753 { 00754 int x; 00755 00756 for (x = 0; x < ARRAY_LEN(causes); x++) { 00757 if (causes[x].cause == cause) 00758 return causes[x].desc; 00759 } 00760 00761 return "Unknown"; 00762 }
| 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 6086 of file channel.c.
References __ast_change_name_nolink(), ao2_link, ao2_unlink, ast_channel_lock, ast_channel_unlock, and channels.
Referenced by update_name().
06087 { 06088 /* We must re-link, as the hash value will change here. */ 06089 ao2_unlink(channels, chan); 06090 ast_channel_lock(chan); 06091 __ast_change_name_nolink(chan, newname); 06092 ast_channel_unlock(chan); 06093 ao2_link(channels, chan); 06094 }
| 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_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().
| 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(?) |
Definition at line 7286 of file channel.c.
References ast_channel::_bridge, ast_channel::_softhangup, AST_BRIDGE_COMPLETE, AST_BRIDGE_FAILED, AST_BRIDGE_FAILED_NOWARN, AST_BRIDGE_RETRY, ast_channel_clear_softhangup(), ast_channel_make_compatible(), ast_channel_name(), 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_tvadd(), ast_tvdiff_ms(), ast_tvnow(), ast_tvsub(), ast_tvzero(), ast_verb, ast_channel::audiohooks, ast_channel_tech::bridge, 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, ast_channel::framehooks, ast_channel::generator, LOG_WARNING, manager_bridge_event(), ast_channel::masq, ast_channel::masqr, ast_channel::monitor, ast_channel::nativeformats, ast_bridge_config::nexteventts, ast_bridge_config::play_warning, ast_channel::readformat, ast_channel_tech::send_digit_begin, ast_bridge_config::start_sound, ast_bridge_config::start_time, ast_channel::tech, ast_bridge_config::timelimit, update_bridge_vars(), ast_bridge_config::warning_freq, ast_bridge_config::warning_sound, and ast_channel::writeformat.
Referenced by ast_bridge_call().
07288 { 07289 enum ast_bridge_result res = AST_BRIDGE_COMPLETE; 07290 struct ast_format_cap *o0nativeformats; 07291 struct ast_format_cap *o1nativeformats; 07292 long time_left_ms=0; 07293 char caller_warning = 0; 07294 char callee_warning = 0; 07295 07296 *fo = NULL; 07297 07298 if (c0->_bridge) { 07299 ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", 07300 ast_channel_name(c0), ast_channel_name(c0->_bridge)); 07301 return -1; 07302 } 07303 if (c1->_bridge) { 07304 ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", 07305 ast_channel_name(c1), ast_channel_name(c1->_bridge)); 07306 return -1; 07307 } 07308 07309 /* Stop if we're a zombie or need a soft hangup */ 07310 if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) || 07311 ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) 07312 return -1; 07313 07314 o0nativeformats = ast_format_cap_dup(c0->nativeformats); 07315 o1nativeformats = ast_format_cap_dup(c1->nativeformats); 07316 if (!o0nativeformats || !o1nativeformats) { 07317 ast_format_cap_destroy(o0nativeformats); 07318 ast_format_cap_destroy(o1nativeformats); 07319 ast_log(LOG_WARNING, "failed to copy native formats\n"); 07320 return -1; 07321 } 07322 07323 caller_warning = ast_test_flag(&config->features_caller, AST_FEATURE_PLAY_WARNING); 07324 callee_warning = ast_test_flag(&config->features_callee, AST_FEATURE_PLAY_WARNING); 07325 07326 if (ast_tvzero(config->start_time)) { 07327 config->start_time = ast_tvnow(); 07328 if (config->start_sound) { 07329 if (caller_warning) { 07330 bridge_playfile(c0, c1, config->start_sound, config->timelimit / 1000); 07331 } 07332 if (callee_warning) { 07333 bridge_playfile(c1, c0, config->start_sound, config->timelimit / 1000); 07334 } 07335 } 07336 } 07337 07338 /* Keep track of bridge */ 07339 c0->_bridge = c1; 07340 c1->_bridge = c0; 07341 07342 ast_set_owners_and_peers(c0, c1); 07343 07344 if (config->feature_timer && !ast_tvzero(config->nexteventts)) { 07345 config->nexteventts = ast_tvadd(config->feature_start_time, ast_samp2tv(config->feature_timer, 1000)); 07346 } else if (config->timelimit) { 07347 time_left_ms = config->timelimit - ast_tvdiff_ms(ast_tvnow(), config->start_time); 07348 config->nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000)); 07349 if ((caller_warning || callee_warning) && config->play_warning) { 07350 long next_warn = config->play_warning; 07351 if (time_left_ms < config->play_warning && config->warning_freq > 0) { 07352 /* At least one warning was played, which means we are returning after feature */ 07353 long warns_passed = (config->play_warning - time_left_ms) / config->warning_freq; 07354 /* It is 'warns_passed * warning_freq' NOT '(warns_passed + 1) * warning_freq', 07355 because nexteventts will be updated once again in the 'if (!to)' block */ 07356 next_warn = config->play_warning - warns_passed * config->warning_freq; 07357 } 07358 config->nexteventts = ast_tvsub(config->nexteventts, ast_samp2tv(next_warn, 1000)); 07359 } 07360 } else { 07361 config->nexteventts.tv_sec = 0; 07362 config->nexteventts.tv_usec = 0; 07363 } 07364 07365 if (!c0->tech->send_digit_begin) 07366 ast_set_flag(c1, AST_FLAG_END_DTMF_ONLY); 07367 if (!c1->tech->send_digit_begin) 07368 ast_set_flag(c0, AST_FLAG_END_DTMF_ONLY); 07369 manager_bridge_event(1, 1, c0, c1); 07370 07371 /* Before we enter in and bridge these two together tell them both the source of audio has changed */ 07372 ast_indicate(c0, AST_CONTROL_SRCUPDATE); 07373 ast_indicate(c1, AST_CONTROL_SRCUPDATE); 07374 07375 for (/* ever */;;) { 07376 struct timeval now = { 0, }; 07377 int to; 07378 07379 to = -1; 07380 07381 if (!ast_tvzero(config->nexteventts)) { 07382 now = ast_tvnow(); 07383 to = ast_tvdiff_ms(config->nexteventts, now); 07384 if (to <= 0) { 07385 if (!config->timelimit) { 07386 res = AST_BRIDGE_COMPLETE; 07387 break; 07388 } 07389 to = 0; 07390 } 07391 } 07392 07393 if (config->timelimit) { 07394 time_left_ms = config->timelimit - ast_tvdiff_ms(now, config->start_time); 07395 if (time_left_ms < to) 07396 to = time_left_ms; 07397 07398 if (time_left_ms <= 0) { 07399 if (caller_warning && config->end_sound) 07400 bridge_playfile(c0, c1, config->end_sound, 0); 07401 if (callee_warning && config->end_sound) 07402 bridge_playfile(c1, c0, config->end_sound, 0); 07403 *fo = NULL; 07404 res = 0; 07405 break; 07406 } 07407 07408 if (!to) { 07409 if (time_left_ms >= 5000 && config->warning_sound && config->play_warning && ast_test_flag(config, AST_FEATURE_WARNING_ACTIVE)) { 07410 int t = (time_left_ms + 500) / 1000; /* round to nearest second */ 07411 if (caller_warning) 07412 bridge_playfile(c0, c1, config->warning_sound, t); 07413 if (callee_warning) 07414 bridge_playfile(c1, c0, config->warning_sound, t); 07415 } 07416 07417 if (config->warning_freq && (time_left_ms > (config->warning_freq + 5000))) { 07418 config->nexteventts = ast_tvadd(config->nexteventts, ast_samp2tv(config->warning_freq, 1000)); 07419 } else { 07420 config->nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000)); 07421 } 07422 } 07423 ast_clear_flag(config, AST_FEATURE_WARNING_ACTIVE); 07424 } 07425 07426 if ((c0->_softhangup | c1->_softhangup) & AST_SOFTHANGUP_UNBRIDGE) {/* Bit operators are intentional. */ 07427 if (c0->_softhangup & AST_SOFTHANGUP_UNBRIDGE) { 07428 ast_channel_clear_softhangup(c0, AST_SOFTHANGUP_UNBRIDGE); 07429 } 07430 if (c1->_softhangup & AST_SOFTHANGUP_UNBRIDGE) { 07431 ast_channel_clear_softhangup(c1, AST_SOFTHANGUP_UNBRIDGE); 07432 } 07433 c0->_bridge = c1; 07434 c1->_bridge = c0; 07435 ast_debug(1, "Unbridge signal received. Ending native bridge.\n"); 07436 continue; 07437 } 07438 07439 /* Stop if we're a zombie or need a soft hangup */ 07440 if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) || 07441 ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) { 07442 *fo = NULL; 07443 res = 0; 07444 ast_debug(1, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n", 07445 ast_channel_name(c0), ast_channel_name(c1), 07446 ast_test_flag(c0, AST_FLAG_ZOMBIE) ? "Yes" : "No", 07447 ast_check_hangup(c0) ? "Yes" : "No", 07448 ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No", 07449 ast_check_hangup(c1) ? "Yes" : "No"); 07450 break; 07451 } 07452 07453 update_bridge_vars(c0, c1); 07454 07455 bridge_play_sounds(c0, c1); 07456 07457 if (c0->tech->bridge && 07458 /* if < 1 ms remains use generic bridging for accurate timing */ 07459 (!config->timelimit || to > 1000 || to == 0) && 07460 (c0->tech->bridge == c1->tech->bridge) && 07461 !c0->monitor && !c1->monitor && 07462 !c0->audiohooks && !c1->audiohooks && 07463 ast_framehook_list_is_empty(c0->framehooks) && ast_framehook_list_is_empty(c1->framehooks) && 07464 !c0->masq && !c0->masqr && !c1->masq && !c1->masqr) { 07465 int timeoutms = to - 1000 > 0 ? to - 1000 : to; 07466 /* Looks like they share a bridge method and nothing else is in the way */ 07467 ast_set_flag(c0, AST_FLAG_NBRIDGE); 07468 ast_set_flag(c1, AST_FLAG_NBRIDGE); 07469 if ((res = c0->tech->bridge(c0, c1, config->flags, fo, rc, timeoutms)) == AST_BRIDGE_COMPLETE) { 07470 manager_bridge_event(0, 1, c0, c1); 07471 ast_debug(1, "Returning from native bridge, channels: %s, %s\n", ast_channel_name(c0), ast_channel_name(c1)); 07472 07473 ast_clear_flag(c0, AST_FLAG_NBRIDGE); 07474 ast_clear_flag(c1, AST_FLAG_NBRIDGE); 07475 07476 if ((c0->_softhangup | c1->_softhangup) & AST_SOFTHANGUP_UNBRIDGE) {/* Bit operators are intentional. */ 07477 continue; 07478 } 07479 07480 c0->_bridge = NULL; 07481 c1->_bridge = NULL; 07482 ast_format_cap_destroy(o0nativeformats); 07483 ast_format_cap_destroy(o1nativeformats); 07484 return res; 07485 } else { 07486 ast_clear_flag(c0, AST_FLAG_NBRIDGE); 07487 ast_clear_flag(c1, AST_FLAG_NBRIDGE); 07488 } 07489 switch (res) { 07490 case AST_BRIDGE_RETRY: 07491 if (config->play_warning) { 07492 ast_set_flag(config, AST_FEATURE_WARNING_ACTIVE); 07493 } 07494 continue; 07495 default: 07496 ast_verb(3, "Native bridging %s and %s ended\n", ast_channel_name(c0), ast_channel_name(c1)); 07497 /* fallthrough */ 07498 case AST_BRIDGE_FAILED_NOWARN: 07499 break; 07500 } 07501 } 07502 07503 if (((ast_format_cmp(&c1->readformat, &c0->writeformat) == AST_FORMAT_CMP_NOT_EQUAL) || 07504 (ast_format_cmp(&c0->readformat, &c1->writeformat) == AST_FORMAT_CMP_NOT_EQUAL) || 07505 !ast_format_cap_identical(c0->nativeformats, o0nativeformats) || 07506 !ast_format_cap_identical(c1->nativeformats, o1nativeformats)) && 07507 !(c0->generator || c1->generator)) { 07508 if (ast_channel_make_compatible(c0, c1)) { 07509 ast_log(LOG_WARNING, "Can't make %s and %s compatible\n", ast_channel_name(c0), ast_channel_name(c1)); 07510 manager_bridge_event(0, 1, c0, c1); 07511 ast_format_cap_destroy(o0nativeformats); 07512 ast_format_cap_destroy(o1nativeformats); 07513 return AST_BRIDGE_FAILED; 07514 } 07515 07516 ast_format_cap_copy(o0nativeformats, c0->nativeformats); 07517 ast_format_cap_copy(o1nativeformats, c1->nativeformats); 07518 } 07519 07520 update_bridge_vars(c0, c1); 07521 07522 res = ast_generic_bridge(c0, c1, config, fo, rc); 07523 if (res != AST_BRIDGE_RETRY) { 07524 break; 07525 } else if (config->feature_timer) { 07526 /* feature timer expired but has not been updated, sending to ast_bridge_call to do so */ 07527 break; 07528 } 07529 } 07530 07531 ast_clear_flag(c0, AST_FLAG_END_DTMF_ONLY); 07532 ast_clear_flag(c1, AST_FLAG_END_DTMF_ONLY); 07533 07534 /* Now that we have broken the bridge the source will change yet again */ 07535 ast_indicate(c0, AST_CONTROL_SRCUPDATE); 07536 ast_indicate(c1, AST_CONTROL_SRCUPDATE); 07537 07538 c0->_bridge = NULL; 07539 c1->_bridge = NULL; 07540 07541 manager_bridge_event(0, 1, c0, c1); 07542 ast_debug(1, "Bridge stops bridging channels %s and %s\n", ast_channel_name(c0), ast_channel_name(c1)); 07543 07544 ast_format_cap_destroy(o0nativeformats); 07545 ast_format_cap_destroy(o1nativeformats); 07546 return res; 07547 }
| 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 1414 of file channel.c.
References ao2_callback_data, and channels.
Referenced by ast_cel_check_retire_linkedid(), 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_call(), handle_core_set_debug_channel(), my_ast_get_channel_by_name_locked(), pickup_by_group(), pickup_by_mark(), pickup_by_part(), and state_notify_build_xml().
01416 { 01417 return ao2_callback_data(channels, ao2_flags, cb_fn, arg, data); 01418 }
| 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.
| 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 9440 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().
09442 { 09443 struct ast_cc_config_params *cc_params; 09444 struct ast_datastore *cc_datastore; 09445 09446 if (!(cc_params = ast_cc_config_params_init())) { 09447 return -1; 09448 } 09449 09450 if (!(cc_datastore = ast_datastore_alloc(&cc_channel_datastore_info, NULL))) { 09451 ast_cc_config_params_destroy(cc_params); 09452 return -1; 09453 } 09454 09455 if (base_params) { 09456 ast_cc_copy_config_params(cc_params, base_params); 09457 } 09458 cc_datastore->data = cc_params; 09459 ast_channel_datastore_add(chan, cc_datastore); 09460 return 0; 09461 }
| 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 2479 of file channel.c.
References ast_channel::_softhangup, ast_channel_lock, 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, ast_channel::readq, and ast_frame::subclass.
Referenced by __ast_pbx_run(), ast_channel_bridge(), ast_generic_bridge(), check_goto_on_transfer(), and collect_digits().
02480 { 02481 ast_channel_lock(chan); 02482 02483 chan->_softhangup &= ~flag; 02484 02485 if (!chan->_softhangup) { 02486 struct ast_frame *fr; 02487 02488 /* If we have completely cleared the softhangup flag, 02489 * then we need to fully abort the hangup process. This requires 02490 * pulling the END_OF_Q frame out of the channel frame queue if it 02491 * still happens to be there. */ 02492 02493 fr = AST_LIST_LAST(&chan->readq); 02494 if (fr && fr->frametype == AST_FRAME_CONTROL && 02495 fr->subclass.integer == AST_CONTROL_END_OF_Q) { 02496 AST_LIST_REMOVE(&chan->readq, fr, frame_list); 02497 ast_frfree(fr); 02498 } 02499 } 02500 02501 ast_channel_unlock(chan); 02502 }
| 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 |
Definition at line 672 of file channel.c.
References ast_channel_cmpwhentohangup_tv().
00673 { 00674 struct timeval when = { offset, }; 00675 return ast_channel_cmpwhentohangup_tv(chan, when); 00676 }
| 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 657 of file channel.c.
References ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), and ast_channel::whentohangup.
Referenced by ast_channel_cmpwhentohangup().
00658 { 00659 struct timeval whentohangup; 00660 00661 if (ast_tvzero(chan->whentohangup)) 00662 return ast_tvzero(offset) ? 0 : -1; 00663 00664 if (ast_tvzero(offset)) 00665 return 1; 00666 00667 whentohangup = ast_tvadd(offset, ast_tvnow()); 00668 00669 return ast_tvdiff_ms(whentohangup, chan->whentohangup); 00670 }
| int ast_channel_connected_line_macro | ( | struct ast_channel * | autoservice_chan, | |
| struct ast_channel * | macro_chan, | |||
| const void * | connected_info, | |||
| int | caller, | |||
| int | frame | |||
| ) |
Run a connected line interception macro and update a channel's connected line information.
| 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 | |
| caller | If true, then run CONNECTED_LINE_CALLER_SEND_MACRO, otherwise run CONNECTED_LINE_CALLEE_SEND_MACRO | |
| 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 |
Definition at line 9338 of file channel.c.
References ast_app_run_macro(), ast_channel_lock, ast_channel_unlock, ast_channel_update_connected_line(), ast_connected_line_parse_data(), ast_party_connected_line_copy(), ast_strdupa, ast_strlen_zero(), chanlist::connected, ast_channel::connected, ast_frame::data, ast_frame::datalen, 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().
09339 { 09340 const char *macro; 09341 const char *macro_args; 09342 int retval; 09343 09344 ast_channel_lock(macro_chan); 09345 macro = pbx_builtin_getvar_helper(macro_chan, is_caller 09346 ? "CONNECTED_LINE_CALLER_SEND_MACRO" : "CONNECTED_LINE_CALLEE_SEND_MACRO"); 09347 macro = ast_strdupa(S_OR(macro, "")); 09348 macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller 09349 ? "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS" : "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS"); 09350 macro_args = ast_strdupa(S_OR(macro_args, "")); 09351 09352 if (ast_strlen_zero(macro)) { 09353 ast_channel_unlock(macro_chan); 09354 return -1; 09355 } 09356 09357 if (is_frame) { 09358 const struct ast_frame *frame = connected_info; 09359 09360 ast_connected_line_parse_data(frame->data.ptr, frame->datalen, ¯o_chan->connected); 09361 } else { 09362 const struct ast_party_connected_line *connected = connected_info; 09363 09364 ast_party_connected_line_copy(¯o_chan->connected, connected); 09365 } 09366 ast_channel_unlock(macro_chan); 09367 09368 if (!(retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args))) { 09369 ast_channel_lock(macro_chan); 09370 ast_channel_update_connected_line(macro_chan, ¯o_chan->connected, NULL); 09371 ast_channel_unlock(macro_chan); 09372 } 09373 09374 return retval; 09375 }
| 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 108 of file channel_internal_api.c.
References ast_channel::_softhangup, ast_channel::_state, ast_channel::amaflags, ast_bridged_channel(), ast_cause2str(), ast_cdr_data_add_structure(), ast_cdr_flags2str(), ast_channel_data_add_structure(), 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(), ast_channel::cdr, channel_data_add_flags(), ast_channel::hangupcause, ast_channel::nativeformats, ast_channel::oldwriteformat, ast_channel::rawreadformat, ast_channel::rawwriteformat, ast_channel::readformat, ast_channel::transfercapability, ast_channel::whentohangup, ast_channel::writeformat, and ast_channel::zone.
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().
00110 { 00111 struct ast_channel *bc; 00112 struct ast_data *data_bridged; 00113 struct ast_data *data_cdr; 00114 struct ast_data *data_flags; 00115 struct ast_data *data_zones; 00116 struct ast_data *enum_node; 00117 struct ast_data *data_softhangup; 00118 #if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ 00119 struct ast_data *data_callerid; 00120 char value_str[100]; 00121 #endif 00122 00123 if (!tree) { 00124 return -1; 00125 } 00126 00127 ast_data_add_structure(ast_channel, tree, chan); 00128 00129 if (add_bridged) { 00130 bc = ast_bridged_channel(chan); 00131 if (bc) { 00132 data_bridged = ast_data_add_node(tree, "bridged"); 00133 if (!data_bridged) { 00134 return -1; 00135 } 00136 ast_channel_data_add_structure(data_bridged, bc, 0); 00137 } 00138 } 00139 00140 ast_data_add_codec(tree, "oldwriteformat", &chan->oldwriteformat); 00141 ast_data_add_codec(tree, "readformat", &chan->readformat); 00142 ast_data_add_codec(tree, "writeformat", &chan->writeformat); 00143 ast_data_add_codec(tree, "rawreadformat", &chan->rawreadformat); 00144 ast_data_add_codec(tree, "rawwriteformat", &chan->rawwriteformat); 00145 ast_data_add_codecs(tree, "nativeformats", chan->nativeformats); 00146 00147 /* state */ 00148 enum_node = ast_data_add_node(tree, "state"); 00149 if (!enum_node) { 00150 return -1; 00151 } 00152 ast_data_add_str(enum_node, "text", ast_state2str(chan->_state)); 00153 ast_data_add_int(enum_node, "value", chan->_state); 00154 00155 /* hangupcause */ 00156 enum_node = ast_data_add_node(tree, "hangupcause"); 00157 if (!enum_node) { 00158 return -1; 00159 } 00160 ast_data_add_str(enum_node, "text", ast_cause2str(chan->hangupcause)); 00161 ast_data_add_int(enum_node, "value", chan->hangupcause); 00162 00163 /* amaflags */ 00164 enum_node = ast_data_add_node(tree, "amaflags"); 00165 if (!enum_node) { 00166 return -1; 00167 } 00168 ast_data_add_str(enum_node, "text", ast_cdr_flags2str(chan->amaflags)); 00169 ast_data_add_int(enum_node, "value", chan->amaflags); 00170 00171 /* transfercapability */ 00172 enum_node = ast_data_add_node(tree, "transfercapability"); 00173 if (!enum_node) { 00174 return -1; 00175 } 00176 ast_data_add_str(enum_node, "text", ast_transfercapability2str(chan->transfercapability)); 00177 ast_data_add_int(enum_node, "value", chan->transfercapability); 00178 00179 /* _softphangup */ 00180 data_softhangup = ast_data_add_node(tree, "softhangup"); 00181 if (!data_softhangup) { 00182 return -1; 00183 } 00184 ast_data_add_bool(data_softhangup, "dev", chan->_softhangup & AST_SOFTHANGUP_DEV); 00185 ast_data_add_bool(data_softhangup, "asyncgoto", chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO); 00186 ast_data_add_bool(data_softhangup, "shutdown", chan->_softhangup & AST_SOFTHANGUP_SHUTDOWN); 00187 ast_data_add_bool(data_softhangup, "timeout", chan->_softhangup & AST_SOFTHANGUP_TIMEOUT); 00188 ast_data_add_bool(data_softhangup, "appunload", chan->_softhangup & AST_SOFTHANGUP_APPUNLOAD); 00189 ast_data_add_bool(data_softhangup, "explicit", chan->_softhangup & AST_SOFTHANGUP_EXPLICIT); 00190 ast_data_add_bool(data_softhangup, "unbridge", chan->_softhangup & AST_SOFTHANGUP_UNBRIDGE); 00191 00192 /* channel flags */ 00193 data_flags = ast_data_add_node(tree, "flags"); 00194 if (!data_flags) { 00195 return -1; 00196 } 00197 channel_data_add_flags(data_flags, chan); 00198 00199 ast_data_add_uint(tree, "timetohangup", chan->whentohangup.tv_sec); 00200 00201 #if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */ 00202 /* callerid */ 00203 data_callerid = ast_data_add_node(tree, "callerid"); 00204 if (!data_callerid) { 00205 return -1; 00206 } 00207 ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid)); 00208 /* insert the callerid ton */ 00209 enum_node = ast_data_add_node(data_callerid, "cid_ton"); 00210 if (!enum_node) { 00211 return -1; 00212 } 00213 ast_data_add_int(enum_node, "value", chan->cid.cid_ton); 00214 snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s", 00215 party_number_ton2str(chan->cid.cid_ton), 00216 party_number_plan2str(chan->cid.cid_ton)); 00217 ast_data_add_str(enum_node, "text", value_str); 00218 #endif 00219 00220 /* tone zone */ 00221 if (chan->zone) { 00222 data_zones = ast_data_add_node(tree, "zone"); 00223 if (!data_zones) { 00224 return -1; 00225 } 00226 ast_tone_zone_data_add_structure(data_zones, chan->zone); 00227 } 00228 00229 /* insert cdr */ 00230 data_cdr = ast_data_add_node(tree, "cdr"); 00231 if (!data_cdr) { 00232 return -1; 00233 } 00234 00235 ast_cdr_data_add_structure(data_cdr, chan->cdr, 1); 00236 00237 return 0; 00238 }
| 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 240 of file channel_internal_api.c.
References ast_data_search_cmp_structure.
00242 { 00243 return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name); 00244 }
| 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 2362 of file channel.c.
References AST_LIST_INSERT_HEAD, and ast_channel::datastores.
Referenced by __ast_channel_masquerade(), _macro_exec(), acf_curlopt_write(), acf_iaxvar_write(), acf_odbc_read(), add_features_datastores(), add_to_agi(), apply_plc(), 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_lock(), gosub_exec(), jb_helper(), lua_get_state(), msg_datastore_find_or_create(), mute_add_audiohook(), pitchshift_helper(), raise_exception(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_transfer_datastore(), shared_write(), smdi_msg_retrieve_read(), socket_process(), speech_create(), speex_write(), srv_datastore_setup(), try_calling(), and volume_write().
02363 { 02364 int res = 0; 02365 02366 AST_LIST_INSERT_HEAD(&chan->datastores, datastore, entry); 02367 02368 return res; 02369 }
| 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 2335 of file channel.c.
References ast_datastore_alloc.
02336 { 02337 return ast_datastore_alloc(info, uid); 02338 }
| 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.
The datastore returned from this function must not be used if the reference to the channel is released.
| pointer | to the datastore if found | |
| NULL | if not found |
Definition at line 2376 of file channel.c.
References AST_LIST_TRAVERSE, ast_channel::datastores, 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_datastores(), 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(), 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_lock(), gosub_exec(), 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(), stop_mixmonitor_exec(), try_calling(), unlock_read(), volume_callback(), and volume_write().
02377 { 02378 struct ast_datastore *datastore = NULL; 02379 02380 if (info == NULL) 02381 return NULL; 02382 02383 AST_LIST_TRAVERSE(&chan->datastores, datastore, entry) { 02384 if (datastore->info != info) { 02385 continue; 02386 } 02387 02388 if (uid == NULL) { 02389 /* matched by type only */ 02390 break; 02391 } 02392 02393 if ((datastore->uid != NULL) && !strcasecmp(uid, datastore->uid)) { 02394 /* Matched by type AND uid */ 02395 break; 02396 } 02397 } 02398 02399 return datastore; 02400 }
| int ast_channel_datastore_free | ( | struct ast_datastore * | datastore | ) |
Free a channel data store object.
Definition at line 2340 of file channel.c.
References ast_datastore_free().
02341 { 02342 return ast_datastore_free(datastore); 02343 }
| int ast_channel_datastore_inherit | ( | struct ast_channel * | from, | |
| struct ast_channel * | to | |||
| ) |
Inherit datastores from a parent to a child.
Definition at line 2345 of file channel.c.
References ast_datastore_alloc, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_datastore::data, DATASTORE_INHERIT_FOREVER, ast_channel::datastores, 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().
02346 { 02347 struct ast_datastore *datastore = NULL, *datastore2; 02348 02349 AST_LIST_TRAVERSE(&from->datastores, datastore, entry) { 02350 if (datastore->inheritance > 0) { 02351 datastore2 = ast_datastore_alloc(datastore->info, datastore->uid); 02352 if (datastore2) { 02353 datastore2->data = datastore->info->duplicate ? datastore->info->duplicate(datastore->data) : NULL; 02354 datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1; 02355 AST_LIST_INSERT_TAIL(&to->datastores, datastore2, entry); 02356 } 02357 } 02358 } 02359 return 0; 02360 }
| 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 2371 of file channel.c.
References AST_LIST_REMOVE, and ast_channel::datastores.
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_exec(), and try_calling().
02372 { 02373 return AST_LIST_REMOVE(&chan->datastores, datastore, entry) ? 0 : -1; 02374 }
| int ast_channel_defer_dtmf | ( | struct ast_channel * | chan | ) |
Defers DTMF so that you only read things like hangups and audio.
Definition at line 1396 of file channel.c.
References AST_FLAG_DEFER_DTMF, ast_set_flag, and ast_test_flag.
Referenced by __adsi_transmit_messages(), and find_cache().
01397 { 01398 int pre = 0; 01399 01400 if (chan) { 01401 pre = ast_test_flag(chan, AST_FLAG_DEFER_DTMF); 01402 ast_set_flag(chan, AST_FLAG_DEFER_DTMF); 01403 } 01404 return pre; 01405 }
| const char* ast_channel_dialcontext | ( | const struct ast_channel * | chan | ) |
Referenced by ast_channel_log().
| 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 |
Definition at line 7186 of file channel.c.
References ast_channel_tech::early_bridge, and ast_channel::tech.
Referenced by dial_exec_full(), and wait_for_answer().
07187 { 07188 /* Make sure we can early bridge, if not error out */ 07189 if (!c0->tech->early_bridge || (c1 && (!c1->tech->early_bridge || c0->tech->early_bridge != c1->tech->early_bridge))) 07190 return -1; 07191 07192 return c0->tech->early_bridge(c0, c1); 07193 }
| 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 |
| a | channel that is at the specified extension and context | |
| NULL | if no channel was found |
Definition at line 1595 of file channel.c.
References ast_channel_by_exten_cb(), and ast_channel_callback().
01596 { 01597 char *l_exten = (char *) exten; 01598 char *l_context = (char *) context; 01599 01600 return ast_channel_callback(ast_channel_by_exten_cb, l_context, l_exten, 0); 01601 }
| 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 |
| a | channel with the name specified by the argument | |
| NULL | if no channel was found |
Definition at line 1590 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_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().
01591 { 01592 return ast_channel_get_by_name_prefix(name, 0); 01593 }
| 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 |
| a | channel with the name prefix specified by the arguments | |
| NULL | if no channel was found |
Definition at line 1570 of file channel.c.
References ast_channel_by_name_cb(), ast_channel_by_uniqueid_cb(), ast_channel_callback(), ast_strlen_zero(), 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().
01571 { 01572 struct ast_channel *chan; 01573 char *l_name = (char *) name; 01574 01575 chan = ast_channel_callback(ast_channel_by_name_cb, l_name, &name_len, 01576 (name_len == 0) /* optimize if it is a complete name match */ ? OBJ_KEY : 0); 01577 if (chan) { 01578 return chan; 01579 } 01580 01581 if (ast_strlen_zero(l_name)) { 01582 /* We didn't have a name to search for so quit. */ 01583 return NULL; 01584 } 01585 01586 /* Now try a search for uniqueid. */ 01587 return ast_channel_callback(ast_channel_by_uniqueid_cb, l_name, &name_len, 0); 01588 }
| 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.
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 9502 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().
09503 { 09504 int len = size; 09505 char *slash; 09506 09507 if (!ast_channel_queryoption(chan, AST_OPTION_CC_AGENT_TYPE, agent_type, &len, 0)) { 09508 return 0; 09509 } 09510 09511 ast_copy_string(agent_type, ast_channel_name(chan), size); 09512 if ((slash = strchr(agent_type, '/'))) { 09513 *slash = '\0'; 09514 } 09515 return 0; 09516 }
| struct ast_cc_config_params* ast_channel_get_cc_config_params | ( | struct ast_channel * | chan | ) | [read] |
Get the CCSS parameters from a channel.
| chan | Channel to retrieve parameters from |
| NULL | Failure | |
| non-NULL | The parameters desired |
Definition at line 9463 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(), and local_request().
09464 { 09465 struct ast_datastore *cc_datastore; 09466 09467 if (!(cc_datastore = ast_channel_datastore_find(chan, &cc_channel_datastore_info, NULL))) { 09468 /* If we can't find the datastore, it almost definitely means that the channel type being 09469 * used has not had its driver modified to parse CC config parameters. The best action 09470 * to take here is to create the parameters on the spot with the defaults set. 09471 */ 09472 if (ast_channel_cc_params_init(chan, NULL)) { 09473 return NULL; 09474 } 09475 if (!(cc_datastore = ast_channel_datastore_find(chan, &cc_channel_datastore_info, NULL))) { 09476 /* Should be impossible */ 09477 return NULL; 09478 } 09479 } 09480 09481 ast_assert(cc_datastore->data != NULL); 09482 return cc_datastore->data; 09483 }
| 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.
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 9485 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(), sip_call(), and sip_handle_cc().
09486 { 09487 int len = name_buffer_length; 09488 char *dash; 09489 if (!ast_channel_queryoption(chan, AST_OPTION_DEVICE_NAME, device_name, &len, 0)) { 09490 return 0; 09491 } 09492 09493 /* Dang. Do it the old-fashioned way */ 09494 ast_copy_string(device_name, ast_channel_name(chan), name_buffer_length); 09495 if ((dash = strrchr(device_name, '-'))) { 09496 *dash = '\0'; 09497 } 09498 09499 return 0; 09500 }
| 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 2462 of file channel.h.
References ast_channel_queryoption(), AST_OPTION_T38_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().
02463 { 02464 enum ast_t38_state state = T38_STATE_UNAVAILABLE; 02465 int datalen = sizeof(state); 02466 02467 ast_channel_queryoption(chan, AST_OPTION_T38_STATE, &state, &datalen, 0); 02468 02469 return state; 02470 }
| 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 |
Definition at line 6096 of file channel.c.
References ast_debug, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_var_assign(), ast_var_full_name(), ast_var_name(), ast_var_value(), ast_var_t::entries, and ast_channel::varshead.
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().
06097 { 06098 struct ast_var_t *current, *newvar; 06099 const char *varname; 06100 06101 AST_LIST_TRAVERSE(&parent->varshead, current, entries) { 06102 int vartype = 0; 06103 06104 varname = ast_var_full_name(current); 06105 if (!varname) 06106 continue; 06107 06108 if (varname[0] == '_') { 06109 vartype = 1; 06110 if (varname[1] == '_') 06111 vartype = 2; 06112 } 06113 06114 switch (vartype) { 06115 case 1: 06116 newvar = ast_var_assign(&varname[1], ast_var_value(current)); 06117 if (newvar) { 06118 AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries); 06119 ast_debug(1, "Copying soft-transferable variable %s.\n", ast_var_name(newvar)); 06120 } 06121 break; 06122 case 2: 06123 newvar = ast_var_assign(varname, ast_var_value(current)); 06124 if (newvar) { 06125 AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries); 06126 ast_debug(1, "Copying hard-transferable variable %s.\n", ast_var_name(newvar)); 06127 } 06128 break; 06129 default: 06130 ast_debug(1, "Not copying variable %s.\n", ast_var_name(current)); 06131 break; 06132 } 06133 } 06134 }
| 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 1544 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_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(), and handle_softhangup().
01545 { 01546 struct ast_channel_iterator *i; 01547 01548 if (!(i = ast_calloc(1, sizeof(*i)))) { 01549 return NULL; 01550 } 01551 01552 i->simple_iterator = ao2_iterator_init(channels, 0); 01553 i->active_iterator = &i->simple_iterator; 01554 01555 return i; 01556 }
| 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 |
| NULL | on failure | |
| a | new channel iterator based on the specified parameters |
Definition at line 1504 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().
01505 { 01506 struct ast_channel_iterator *i; 01507 char *l_exten = (char *) exten; 01508 char *l_context = (char *) context; 01509 01510 if (!(i = ast_calloc(1, sizeof(*i)))) { 01511 return NULL; 01512 } 01513 01514 i->active_iterator = (void *) ast_channel_callback(ast_channel_by_exten_cb, 01515 l_context, l_exten, OBJ_MULTIPLE); 01516 if (!i->active_iterator) { 01517 ast_free(i); 01518 return NULL; 01519 } 01520 01521 return i; 01522 }
| 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. |
| NULL | on failure | |
| a | new channel iterator based on the specified parameters |
Definition at line 1524 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(), and softhangup_exec().
01525 { 01526 struct ast_channel_iterator *i; 01527 char *l_name = (char *) name; 01528 01529 if (!(i = ast_calloc(1, sizeof(*i)))) { 01530 return NULL; 01531 } 01532 01533 i->active_iterator = (void *) ast_channel_callback(ast_channel_by_name_cb, 01534 l_name, &name_len, 01535 OBJ_MULTIPLE | (name_len == 0 /* match the whole word, so optimize */ ? OBJ_KEY : 0)); 01536 if (!i->active_iterator) { 01537 ast_free(i); 01538 return NULL; 01539 } 01540 01541 return i; 01542 }
| struct ast_channel_iterator* ast_channel_iterator_destroy | ( | struct ast_channel_iterator * | i | ) | [read] |
Destroy a channel iterator.
| i | the itereator to destroy |
Definition at line 1496 of file channel.c.
References ast_channel_iterator::active_iterator, ao2_iterator_destroy(), and ast_free.
Referenced by action_coreshowchannels(), 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_softhangup(), pickup_by_exten(), and softhangup_exec().
01497 { 01498 ao2_iterator_destroy(i->active_iterator); 01499 ast_free(i); 01500 01501 return NULL; 01502 }
| 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. |
| 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 1558 of file channel.c.
References ast_channel_iterator::active_iterator, and ao2_iterator_next.
Referenced by action_coreshowchannels(), 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(), handle_chanlist(), handle_softhangup(), next_channel(), pickup_by_exten(), and softhangup_exec().
01559 { 01560 return ao2_iterator_next(i->active_iterator); 01561 }
| 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_control_streamfile(), 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(), copy_message(), count_exec(), dial_exec_full(), dictate_exec(), do_directory(), eivr_comm(), find_conf_realtime(), findmeexec(), forward_message(), func_channel_read(), function_playback(), 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(), 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(), rpt_tele_thread(), say_position(), saycharstr(), sayfile(), saynode(), saynum(), 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(), linkedid_match(), local_attended_transfer(), local_request(), masq_park_call(), mgcp_request(), misdn_request(), multicast_rtp_request(), my_new_analog_ast_channel(), nbs_request(), oh323_request(), oss_request(), phone_request(), serialize_showchan(), sip_park(), sip_request_call(), skinny_request(), unistim_request(), and usbradio_request().
| 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 |
Definition at line 5827 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().
05828 { 05829 /* Some callers do not check return code, and we must try to set all call legs correctly */ 05830 int rc = 0; 05831 05832 /* Set up translation from the chan to the peer */ 05833 rc = ast_channel_make_compatible_helper(chan, peer); 05834 05835 if (rc < 0) 05836 return rc; 05837 05838 /* Set up translation from the peer to the chan */ 05839 rc = ast_channel_make_compatible_helper(peer, chan); 05840 05841 return rc; 05842 }
| 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 |
Definition at line 5967 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().
05968 { 05969 return __ast_channel_masquerade(original, clone, NULL); 05970 }
| 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_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_confbridgekick(), action_confbridgelist(), 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_set_base_channel(), 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_getdata(), ast_async_goto(), ast_autochan_new_channel(), ast_autochan_setup(), ast_bridge_call(), 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_cmp_cb(), ast_channel_destructor(), ast_channel_get_cc_agent_type(), ast_channel_get_device_name(), ast_channel_hash_cb(), ast_channel_log(), ast_channel_make_compatible_helper(), ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), 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_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_write(), async_agi_read_frame(), async_wait(), attempt_reconnect(), 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_compat(), check_goto_on_transfer(), check_rtp_timeout(), clear_dialed_interfaces(), common_exec(), conf_handle_talker_cb(), conf_queue_dtmf(), conf_run(), connect_link(), console_indicate(), console_transfer(), cpeid_exec(), create_channel_name(), create_jb(), dahdi_ami_channel_event(), dahdi_bridge(), dahdi_call(), dahdi_fake_event(), dahdi_fixup(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_indicate(), dahdi_new(), dahdi_queryoption(), dahdi_read(), dahdi_setoption(), dahdi_show_channel(), dahdi_softhangup_all(), dahdi_write(), dahdiras_exec(), data_channels_provider_handler(), dial_exec_full(), dialog_unlink_all(), disa_exec(), disable_t38(), do_dtmf_local(), do_forward(), 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(), group_count_function_read(), group_show_channels(), gtalk_answer(), gtalk_call(), gtalk_new(), gtalk_show_channels(), handle_chanlist(), handle_cli_agi_add_cmd(), handle_cli_confbridge_kick(), handle_cli_confbridge_list(), handle_cli_iax2_show_channels(), handle_cli_misdn_show_channel(), handle_frame(), handle_frame_ownerless(), handle_incoming(), handle_invite_replaces(), handle_offhook_message(), handle_parkedcalls(), handle_recordfile(), handle_request_bye(), handle_request_cancel(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), handle_response_notify(), handle_showchan(), handle_softhangup(), handle_stimulus_message(), HandleCallOutgoing(), 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(), is_our_turn(), isAnsweringMachine(), jack_hook_callback(), jingle_call(), jingle_new(), jingle_show_channels(), join_queue(), 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_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(), 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(), print_bc_info(), proc_session_timer(), process_ast_dsp(), process_sdp(), queue_exec(), rbi_out(), 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(), rpt_exec(), rpt_tele_thread(), rqm_exec(), run_agi(), run_ras(), say_number_full(), say_position(), saycharstr(), sayfile(), saynum(), 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(), sip_answer(), sip_call(), sip_fixup(), sip_hangup(), sip_indicate(), sip_new(), sip_park(), sip_park_thread(), sip_pickup(), sip_queryoption(), sip_read(), sip_request_call(), sip_rtp_read(), sip_sendtext(), sip_set_rtp_peer(), sip_set_udptl_peer(), sip_setoption(), sip_show_channel(), skinny_answer(), skinny_call(), skinny_fixup(), skinny_get_rtp_peer(), skinny_indicate(), skinny_new(), skinny_ss(), skinny_transfer(), sms_generate(), socket_process(), softhangup_exec(), 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(), usbradio_indicate(), usbradio_new(), usbradio_read(), 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().
| const char* ast_channel_parkinglot | ( | const struct ast_channel * | chan | ) |
Referenced by findparkinglotname(), func_channel_read(), iax_park(), serialize_showchan(), and sip_park().
| const char* ast_channel_peeraccount | ( | const struct ast_channel * | chan | ) |
| int ast_channel_queryoption | ( | struct ast_channel * | channel, | |
| int | option, | |||
| void * | data, | |||
| int * | datalen, | |||
| int | block | |||
| ) |
Checks the value of an option.
Query the value of an option Works similarly to setoption except only reads the options.
Definition at line 7570 of file channel.c.
References ast_channel_lock, ast_channel_unlock, ast_log(), errno, LOG_ERROR, ast_channel_tech::queryoption, and ast_channel::tech.
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().
07571 { 07572 int res; 07573 07574 ast_channel_lock(chan); 07575 if (!chan->tech->queryoption) { 07576 errno = ENOSYS; 07577 ast_channel_unlock(chan); 07578 return -1; 07579 } 07580 07581 if (block) 07582 ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n"); 07583 07584 res = chan->tech->queryoption(chan, option, data, datalen); 07585 ast_channel_unlock(chan); 07586 07587 return res; 07588 }
| 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 8818 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(), and sip_call().
08819 { 08820 unsigned char data[1024]; /* This should be large enough */ 08821 size_t datalen; 08822 08823 datalen = ast_connected_line_build_data(data, sizeof(data), connected, update); 08824 if (datalen == (size_t) -1) { 08825 return; 08826 } 08827 08828 ast_queue_control_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen); 08829 }
| 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 9325 of file channel.c.
References AST_CONTROL_REDIRECTING, ast_queue_control_data(), and ast_redirecting_build_data().
Referenced by cb_events(), handle_response_invite(), and misdn_facility_ie_handler().
09326 { 09327 unsigned char data[1024]; /* This should be large enough */ 09328 size_t datalen; 09329 09330 datalen = ast_redirecting_build_data(data, sizeof(data), redirecting, update); 09331 if (datalen == (size_t) -1) { 09332 return; 09333 } 09334 09335 ast_queue_control_data(chan, AST_CONTROL_REDIRECTING, data, datalen); 09336 }
| 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 5158 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().
05159 { 05160 switch (reason) /* the following appear to be the only ones actually returned by request_and_dial */ 05161 { 05162 case 0: 05163 return "Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)"; 05164 case AST_CONTROL_HANGUP: 05165 return "Hangup"; 05166 case AST_CONTROL_RING: 05167 return "Local Ring"; 05168 case AST_CONTROL_RINGING: 05169 return "Remote end Ringing"; 05170 case AST_CONTROL_ANSWER: 05171 return "Remote end has Answered"; 05172 case AST_CONTROL_BUSY: 05173 return "Remote end is Busy"; 05174 case AST_CONTROL_CONGESTION: 05175 return "Congestion (circuits busy)"; 05176 default: 05177 return "Unknown Reason!!"; 05178 } 05179 }
| 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.
| 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, otherwise run REDIRECTING_CALLEE_SEND_MACRO | |
| 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 |
Definition at line 9377 of file channel.c.
References ast_app_run_macro(), ast_channel_lock, ast_channel_unlock, ast_channel_update_redirecting(), ast_party_redirecting_copy(), ast_redirecting_parse_data(), ast_strdupa, ast_strlen_zero(), ast_frame::data, ast_frame::datalen, pbx_builtin_getvar_helper(), ast_frame::ptr, ast_channel::redirecting, 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().
09378 { 09379 const char *macro; 09380 const char *macro_args; 09381 int retval; 09382 09383 ast_channel_lock(macro_chan); 09384 macro = pbx_builtin_getvar_helper(macro_chan, is_caller 09385 ? "REDIRECTING_CALLER_SEND_MACRO" : "REDIRECTING_CALLEE_SEND_MACRO"); 09386 macro = ast_strdupa(S_OR(macro, "")); 09387 macro_args = pbx_builtin_getvar_helper(macro_chan, is_caller 09388 ? "REDIRECTING_CALLER_SEND_MACRO_ARGS" : "REDIRECTING_CALLEE_SEND_MACRO_ARGS"); 09389 macro_args = ast_strdupa(S_OR(macro_args, "")); 09390 09391 if (ast_strlen_zero(macro)) { 09392 ast_channel_unlock(macro_chan); 09393 return -1; 09394 } 09395 09396 if (is_frame) { 09397 const struct ast_frame *frame = redirecting_info; 09398 09399 ast_redirecting_parse_data(frame->data.ptr, frame->datalen, ¯o_chan->redirecting); 09400 } else { 09401 const struct ast_party_redirecting *redirecting = redirecting_info; 09402 09403 ast_party_redirecting_copy(¯o_chan->redirecting, redirecting); 09404 } 09405 ast_channel_unlock(macro_chan); 09406 09407 retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args); 09408 if (!retval) { 09409 ast_channel_lock(macro_chan); 09410 ast_channel_update_redirecting(macro_chan, ¯o_chan->redirecting, NULL); 09411 ast_channel_unlock(macro_chan); 09412 } 09413 09414 return retval; 09415 }
| 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 679 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, ast_channel_tech::description, LOG_WARNING, chanlist::tech, and ast_channel_tech::type.
Referenced by load_module(), and unload_module().
00680 { 00681 struct chanlist *chan; 00682 00683 AST_RWLIST_WRLOCK(&backends); 00684 00685 AST_RWLIST_TRAVERSE(&backends, chan, list) { 00686 if (!strcasecmp(tech->type, chan->tech->type)) { 00687 ast_log(LOG_WARNING, "Already have a handler for type '%s'\n", tech->type); 00688 AST_RWLIST_UNLOCK(&backends); 00689 return -1; 00690 } 00691 } 00692 00693 if (!(chan = ast_calloc(1, sizeof(*chan)))) { 00694 AST_RWLIST_UNLOCK(&backends); 00695 return -1; 00696 } 00697 chan->tech = tech; 00698 AST_RWLIST_INSERT_HEAD(&backends, chan, list); 00699 00700 ast_debug(1, "Registered handler for '%s' (%s)\n", chan->tech->type, chan->tech->description); 00701 00702 ast_verb(2, "Registered channel type '%s' (%s)\n", chan->tech->type, chan->tech->description); 00703 00704 AST_RWLIST_UNLOCK(&backends); 00705 00706 return 0; 00707 }
| 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 1702 of file channel.c.
References ao2_unlink, ast_channel_unref, and channels.
Referenced by agent_cleanup(), ast_do_masquerade(), ast_iax2_new(), ast_request(), bridge_request(), do_notify(), gtalk_newcall(), local_new(), and local_request().
01703 { 01704 /* Safe, even if already unlinked. */ 01705 ao2_unlink(channels, chan); 01706 return ast_channel_unref(chan); 01707 }
| 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 5756 of file channel.c.
References ast_channel_tech::send_html, and ast_channel::tech.
Referenced by agent_sendhtml(), ast_channel_sendurl(), and wait_for_answer().
05757 { 05758 if (chan->tech->send_html) 05759 return chan->tech->send_html(chan, subclass, data, datalen); 05760 return -1; 05761 }
| 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 5763 of file channel.c.
References ast_channel_sendhtml(), and AST_HTML_URL.
Referenced by dial_exec_full(), sendurl_exec(), and try_calling().
05764 { 05765 return ast_channel_sendhtml(chan, AST_HTML_URL, url, strlen(url) + 1); 05766 }
| 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 6851 of file channel.c.
References ast_channel_lock, ast_channel_unlock, ast_party_caller_set(), and ast_channel::caller.
06852 { 06853 if (&chan->caller == caller) { 06854 /* Don't set to self */ 06855 return; 06856 } 06857 06858 ast_channel_lock(chan); 06859 ast_party_caller_set(&chan->caller, caller, update); 06860 ast_channel_unlock(chan); 06861 }
| 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 6863 of file channel.c.
References ast_cdr_setcid(), ast_channel_lock, ast_channel_unlock, ast_party_caller_set(), ast_channel::caller, ast_channel::cdr, ast_party_caller::id, ast_party_id::name, ast_party_id::number, report_new_callerid(), S_COR, ast_party_name::str, ast_party_number::str, ast_party_name::valid, and ast_party_number::valid.
Referenced by callerid_write(), dial_exec_full(), do_forward(), misdn_update_caller_id(), and ring_entry().
06864 { 06865 const char *pre_set_number; 06866 const char *pre_set_name; 06867 06868 if (&chan->caller == caller) { 06869 /* Don't set to self */ 06870 return; 06871 } 06872 06873 ast_channel_lock(chan); 06874 pre_set_number = 06875 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL); 06876 pre_set_name = S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL); 06877 ast_party_caller_set(&chan->caller, caller, update); 06878 if (S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL) 06879 != pre_set_number 06880 || S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL) 06881 != pre_set_name) { 06882 /* The caller id name or number changed. */ 06883 report_new_callerid(chan); 06884 } 06885 if (chan->cdr) { 06886 ast_cdr_setcid(chan->cdr, chan); 06887 } 06888 ast_channel_unlock(chan); 06889 }
| 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 8178 of file channel.c.
References ast_channel_lock, ast_channel_unlock, ast_party_connected_line_set(), and ast_channel::connected.
Referenced by __ast_request_and_dial(), ast_indicate_data(), connectedline_write(), dial_exec_full(), and feature_request_and_dial().
08179 { 08180 if (&chan->connected == connected) { 08181 /* Don't set to self */ 08182 return; 08183 } 08184 08185 ast_channel_lock(chan); 08186 ast_party_connected_line_set(&chan->connected, connected, update); 08187 ast_channel_unlock(chan); 08188 }
| void ast_channel_set_fd | ( | struct ast_channel * | chan, | |
| int | which, | |||
| int | fd | |||
| ) |
Set the file descriptor on the channel
Definition at line 2403 of file channel.c.
References ast_calloc, ast_epoll_data::chan, ast_channel::fds, free, 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(), jb_helper(), jingle_new(), mgcp_new(), misdn_new(), my_swap_subchannels(), nbs_new(), oss_new(), phone_new(), process_sdp(), setformat(), sip_new(), skinny_new(), start_rtp(), and swap_subs().
02404 { 02405 #ifdef HAVE_EPOLL 02406 struct epoll_event ev; 02407 struct ast_epoll_data *aed = NULL; 02408 02409 if (chan->fds[which] > -1) { 02410 epoll_ctl(chan->epfd, EPOLL_CTL_DEL, chan->fds[which], &ev); 02411 aed = chan->epfd_data[which]; 02412 } 02413 02414 /* If this new fd is valid, add it to the epoll */ 02415 if (fd > -1) { 02416 if (!aed && (!(aed = ast_calloc(1, sizeof(*aed))))) 02417 return; 02418 02419 chan->epfd_data[which] = aed; 02420 aed->chan = chan; 02421 aed->which = which; 02422 02423 ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP; 02424 ev.data.ptr = aed; 02425 epoll_ctl(chan->epfd, EPOLL_CTL_ADD, fd, &ev); 02426 } else if (aed) { 02427 /* We don't have to keep around this epoll data structure now */ 02428 free(aed); 02429 chan->epfd_data[which] = NULL; 02430 } 02431 #endif 02432 chan->fds[which] = fd; 02433 return; 02434 }
| void ast_channel_set_linkgroup | ( | struct ast_channel * | chan, | |
| struct ast_channel * | peer | |||
| ) |
propagate the linked id between chan and peer
Definition at line 6240 of file channel.c.
References ast_channel::_bridge, ast_bridged_channel(), ast_channel_change_linkedid(), ast_channel_linkedid(), ast_channel_uniqueid(), ast_strdupa, and oldest_linkedid().
Referenced by ast_bridge_call(), and ast_do_masquerade().
06241 { 06242 const char* linkedid=NULL; 06243 struct ast_channel *bridged; 06244 06245 linkedid = oldest_linkedid(ast_channel_linkedid(chan), ast_channel_linkedid(peer)); 06246 linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(chan)); 06247 linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(peer)); 06248 if (chan->_bridge) { 06249 bridged = ast_bridged_channel(chan); 06250 if (bridged != peer) { 06251 linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged)); 06252 linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged)); 06253 } 06254 } 06255 if (peer->_bridge) { 06256 bridged = ast_bridged_channel(peer); 06257 if (bridged != chan) { 06258 linkedid = oldest_linkedid(linkedid, ast_channel_linkedid(bridged)); 06259 linkedid = oldest_linkedid(linkedid, ast_channel_uniqueid(bridged)); 06260 } 06261 } 06262 06263 /* just in case setting a stringfield to itself causes problems */ 06264 linkedid = ast_strdupa(linkedid); 06265 06266 ast_channel_change_linkedid(chan, linkedid); 06267 ast_channel_change_linkedid(peer, linkedid); 06268 if (chan->_bridge) { 06269 bridged = ast_bridged_channel(chan); 06270 if (bridged != peer) { 06271 ast_channel_change_linkedid(bridged, linkedid); 06272 } 06273 } 06274 if (peer->_bridge) { 06275 bridged = ast_bridged_channel(peer); 06276 if (bridged != chan) { 06277 ast_channel_change_linkedid(bridged, linkedid); 06278 } 06279 } 06280 }
| 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 8831 of file channel.c.
References ast_channel_lock, ast_channel_unlock, ast_party_redirecting_set(), and ast_channel::redirecting.
Referenced by ast_indicate_data(), do_forward(), handle_request_invite(), handle_response(), misdn_copy_redirecting_to_ast(), redirecting_write(), and wait_for_answer().
08832 { 08833 if (&chan->redirecting == redirecting) { 08834 /* Don't set to self */ 08835 return; 08836 } 08837 08838 ast_channel_lock(chan); 08839 ast_party_redirecting_set(&chan->redirecting, redirecting, update); 08840 ast_channel_unlock(chan); 08841 }
| 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 |
Definition at line 7550 of file channel.c.
References ast_channel_lock, ast_channel_unlock, ast_log(), errno, LOG_ERROR, ast_channel_tech::setoption, and ast_channel::tech.
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(), rpt(), rpt_exec(), set_format(), set_listen_volume(), set_security_requirements(), set_talk_volume(), sndfax_exec(), try_calling(), and vm_forwardoptions().
07551 { 07552 int res; 07553 07554 ast_channel_lock(chan); 07555 if (!chan->tech->setoption) { 07556 errno = ENOSYS; 07557 ast_channel_unlock(chan); 07558 return -1; 07559 } 07560 07561 if (block) 07562 ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n"); 07563 07564 res = chan->tech->setoption(chan, option, data, datalen); 07565 ast_channel_unlock(chan); 07566 07567 return res; 07568 }
| 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 |
Definition at line 650 of file channel.c.
References ast_channel_setwhentohangup_tv().
00651 { 00652 struct timeval when = { offset, }; 00653 ast_channel_setwhentohangup_tv(chan, when); 00654 }
| 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 |
Definition at line 643 of file channel.c.
References ast_null_frame, ast_queue_frame(), ast_tvadd(), ast_tvnow(), ast_tvzero(), and ast_channel::whentohangup.
Referenced by action_timeout(), ast_channel_setwhentohangup(), handle_autohangup(), and timeout_write().
00644 { 00645 chan->whentohangup = ast_tvzero(offset) ? offset : ast_tvadd(offset, ast_tvnow()); 00646 ast_queue_frame(chan, &ast_null_frame); 00647 return; 00648 }
| 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 |
Definition at line 8052 of file channel.c.
References ast_activate_generator(), ast_calloc, ast_channel_name(), 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 ast_channel::writeformat.
Referenced by __ast_play_and_record(), ast_bridge_call(), ast_dtmf_stream(), ast_readstring_full(), ast_safe_sleep_conditional(), channel_spy(), record_exec(), TransferCallStep1(), waitfor_exec(), and waitforring_exec().
08053 { 08054 struct ast_silence_generator *state; 08055 08056 if (!(state = ast_calloc(1, sizeof(*state)))) { 08057 return NULL; 08058 } 08059 08060 ast_format_copy(&state->old_write_format, &chan->writeformat); 08061 08062 if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR) < 0) { 08063 ast_log(LOG_ERROR, "Could not set write format to SLINEAR\n"); 08064 ast_free(state); 08065 return NULL; 08066 } 08067 08068 ast_activate_generator(chan, &silence_generator, state); 08069 08070 ast_debug(1, "Started silence generator on '%s'\n", ast_channel_name(chan)); 08071 08072 return state; 08073 }
| 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. |
Definition at line 8075 of file channel.c.
References ast_channel_name(), ast_deactivate_generator(), ast_debug, ast_free, ast_log(), ast_set_write_format(), 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(), HandleCallOutgoing(), key_dial_page(), record_exec(), unistim_hangup(), waitfor_exec(), and waitforring_exec().
08076 { 08077 if (!state) 08078 return; 08079 08080 ast_deactivate_generator(chan); 08081 08082 ast_debug(1, "Stopped silence generator on '%s'\n", ast_channel_name(chan)); 08083 08084 if (ast_set_write_format(chan, &state->old_write_format) < 0) 08085 ast_log(LOG_ERROR, "Could not return write format to its original state\n"); 08086 08087 ast_free(state); 08088 }
| int ast_channel_supports_html | ( | struct ast_channel * | channel | ) |
Checks for HTML support on a channel.
Definition at line 5751 of file channel.c.
References ast_channel_tech::send_html, and ast_channel::tech.
Referenced by dial_exec_full(), sendurl_exec(), and try_calling().
| 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 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 6041 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(), and misdn_attempt_transfer().
06048 { 06049 struct ast_datastore *xfer_ds; 06050 struct xfer_masquerade_ds *xfer_colp; 06051 int res; 06052 06053 xfer_ds = ast_datastore_alloc(&xfer_ds_info, NULL); 06054 if (!xfer_ds) { 06055 return -1; 06056 } 06057 06058 xfer_colp = ast_calloc(1, sizeof(*xfer_colp)); 06059 if (!xfer_colp) { 06060 ast_datastore_free(xfer_ds); 06061 return -1; 06062 } 06063 party_connected_line_copy_transfer(&xfer_colp->target_id, target_id); 06064 xfer_colp->target_held = target_held; 06065 party_connected_line_copy_transfer(&xfer_colp->transferee_id, transferee_id); 06066 xfer_colp->transferee_held = transferee_held; 06067 xfer_ds->data = xfer_colp; 06068 06069 res = __ast_channel_masquerade(target_chan, transferee_chan, xfer_ds); 06070 if (res) { 06071 ast_datastore_free(xfer_ds); 06072 } 06073 return res; 06074 }
| 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 1408 of file channel.c.
References ast_clear_flag, and AST_FLAG_DEFER_DTMF.
Referenced by __adsi_transmit_messages(), find_cache(), and rpt_call().
01409 { 01410 if (chan) 01411 ast_clear_flag(chan, AST_FLAG_DEFER_DTMF); 01412 }
| 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_do_masquerade(), ast_hangup(), ast_monitor_start(), ast_monitor_stop(), 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(), 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(), sip_new(), socket_process(), 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 |
Definition at line 9552 of file channel.c.
References ao2_unlink, and channels.
Referenced by create_msg_q_chan().
09553 { 09554 ao2_unlink(channels, chan); 09555 }
| 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 710 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::tech, and ast_channel_tech::type.
Referenced by __unload_module(), load_module(), and unload_module().
00711 { 00712 struct chanlist *chan; 00713 00714 ast_debug(1, "Unregistering channel type '%s'\n", tech->type); 00715 00716 AST_RWLIST_WRLOCK(&backends); 00717 00718 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&backends, chan, list) { 00719 if (chan->tech == tech) { 00720 AST_LIST_REMOVE_CURRENT(list); 00721 ast_free(chan); 00722 ast_verb(2, "Unregistered channel type '%s'\n", tech->type); 00723 break; 00724 } 00725 } 00726 AST_LIST_TRAVERSE_SAFE_END; 00727 00728 AST_RWLIST_UNLOCK(&backends); 00729 }
| 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 8805 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_do_pickup(), atxfer_fail_cleanup(), builtin_atxfer(), connectedline_write(), parked_call_exec(), and wait_for_answer().
08806 { 08807 unsigned char data[1024]; /* This should be large enough */ 08808 size_t datalen; 08809 08810 datalen = ast_connected_line_build_data(data, sizeof(data), connected, update); 08811 if (datalen == (size_t) -1) { 08812 return; 08813 } 08814 08815 ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen); 08816 }
| 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 9312 of file channel.c.
References AST_CONTROL_REDIRECTING, ast_indicate_data(), and ast_redirecting_build_data().
Referenced by ast_channel_redirecting_macro(), call_forward_inherit(), do_forward(), redirecting_write(), and wait_for_answer().
09313 { 09314 unsigned char data[1024]; /* This should be large enough */ 09315 size_t datalen; 09316 09317 datalen = ast_redirecting_build_data(data, sizeof(data), redirecting, update); 09318 if (datalen == (size_t) -1) { 09319 return; 09320 } 09321 09322 ast_indicate_data(chan, AST_CONTROL_REDIRECTING, data, datalen); 09323 }
| const char* ast_channel_userfield | ( | const struct ast_channel * | chan | ) |
Referenced by ast_cel_report_event(), and func_channel_read().
| struct ast_variable* ast_channeltype_list | ( | void | ) | [read] |
return an ast_variable list of channeltypes
Definition at line 202 of file channel.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_variable_new(), ast_channel_tech::description, chanlist::tech, ast_channel_tech::type, and var.
Referenced by ast_var_channel_types(), and ast_var_channel_types_table().
00203 { 00204 struct chanlist *cl; 00205 struct ast_variable *var = NULL, *prev = NULL; 00206 00207 AST_RWLIST_RDLOCK(&backends); 00208 AST_RWLIST_TRAVERSE(&backends, cl, list) { 00209 if (prev) { 00210 if ((prev->next = ast_variable_new(cl->tech->type, cl->tech->description, ""))) 00211 prev = prev->next; 00212 } else { 00213 var = ast_variable_new(cl->tech->type, cl->tech->description, ""); 00214 prev = var; 00215 } 00216 } 00217 AST_RWLIST_UNLOCK(&backends); 00218 00219 return var; 00220 }
| 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 584 of file channel.c.
References ast_channel::_softhangup, ast_debug, AST_SOFTHANGUP_TIMEOUT, ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), and ast_channel::whentohangup.
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_sendtext(), dahdi_setoption(), dial_exec_full(), dundi_lookup_internal(), eagi_exec(), eivr_comm(), feature_request_and_dial(), findmeexec(), func_channel_read(), handle_sendimage(), iax2_bridge(), launch_asyncagi(), local_bridge_loop(), local_fixup(), lua_check_hangup(), ospfinished_exec(), pbx_builtin_incomplete(), pbx_builtin_waitexten(), pbx_exec(), read_exec(), readexten_exec(), remote_bridge_loop(), rpt(), rpt_exec(), run_agi(), run_ras(), try_calling(), and wait_for_answer().
00585 { 00586 if (chan->_softhangup) /* yes if soft hangup flag set */ 00587 return 1; 00588 if (ast_tvzero(chan->whentohangup)) /* no if no hangup scheduled */ 00589 return 0; 00590 if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0) /* no if hangup time has not come yet. */ 00591 return 0; 00592 ast_debug(4, "Hangup time has come: %" PRIi64 "\n", ast_tvdiff_ms(chan->whentohangup, ast_tvnow())); 00593 chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; /* record event */ 00594 return 1; 00595 }
| int ast_check_hangup_locked | ( | struct ast_channel * | chan | ) |
Definition at line 597 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().
00598 { 00599 int res; 00600 ast_channel_lock(chan); 00601 res = ast_check_hangup(chan); 00602 ast_channel_unlock(chan); 00603 return res; 00604 }
| 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 8545 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_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_set_party_connected_line::id, ast_party_connected_line::id, LOG_WARNING, ast_party_id_ies::name, party_id_build_data(), 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().
08546 { 08547 int32_t value; 08548 size_t pos = 0; 08549 int res; 08550 08551 static const struct ast_party_id_ies ies = { 08552 .name.str = AST_CONNECTED_LINE_NAME, 08553 .name.char_set = AST_CONNECTED_LINE_NAME_CHAR_SET, 08554 .name.presentation = AST_CONNECTED_LINE_NAME_PRESENTATION, 08555 .name.valid = AST_CONNECTED_LINE_NAME_VALID, 08556 08557 .number.str = AST_CONNECTED_LINE_NUMBER, 08558 .number.plan = AST_CONNECTED_LINE_NUMBER_PLAN, 08559 .number.presentation = AST_CONNECTED_LINE_NUMBER_PRESENTATION, 08560 .number.valid = AST_CONNECTED_LINE_NUMBER_VALID, 08561 08562 .subaddress.str = AST_CONNECTED_LINE_SUBADDRESS, 08563 .subaddress.type = AST_CONNECTED_LINE_SUBADDRESS_TYPE, 08564 .subaddress.odd_even_indicator = AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN, 08565 .subaddress.valid = AST_CONNECTED_LINE_SUBADDRESS_VALID, 08566 08567 .tag = AST_CONNECTED_LINE_TAG, 08568 .combined_presentation = AST_CONNECTED_LINE_ID_PRESENTATION, 08569 }; 08570 08571 /* 08572 * The size of integer values must be fixed in case the frame is 08573 * shipped to another machine. 08574 */ 08575 08576 /* Connected line frame version */ 08577 if (datalen < pos + (sizeof(data[0]) * 2) + 1) { 08578 ast_log(LOG_WARNING, "No space left for connected line frame version\n"); 08579 return -1; 08580 } 08581 data[pos++] = AST_CONNECTED_LINE_VERSION; 08582 data[pos++] = 1; 08583 data[pos++] = 2;/* Version 1 did not have a version ie */ 08584 08585 res = party_id_build_data(data + pos, datalen - pos, &connected->id, 08586 "connected line", &ies, update ? &update->id : NULL); 08587 if (res < 0) { 08588 return -1; 08589 } 08590 pos += res; 08591 08592 /* Connected line source */ 08593 if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) { 08594 ast_log(LOG_WARNING, "No space left for connected line source\n"); 08595 return -1; 08596 } 08597 data[pos++] = AST_CONNECTED_LINE_SOURCE; 08598 data[pos++] = sizeof(value); 08599 value = htonl(connected->source); 08600 memcpy(data + pos, &value, sizeof(value)); 08601 pos += sizeof(value); 08602 08603 return pos; 08604 }
| 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 8163 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().
08164 { 08165 ast_party_id_copy(&dest->id, &src->id); 08166 ast_party_id_copy(&dest->ani, &src->ani); 08167 dest->ani2 = src->ani2; 08168 }
| 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 8170 of file channel.c.
References ast_party_connected_line::ani, ast_party_caller::ani, ast_party_connected_line::ani2, ast_party_caller::ani2, ast_party_id_copy(), ast_party_connected_line::id, and ast_party_caller::id.
Referenced by local_call(), and local_indicate().
08171 { 08172 ast_party_id_copy(&dest->id, &src->id); 08173 ast_party_id_copy(&dest->ani, &src->ani); 08174 08175 dest->ani2 = src->ani2; 08176 }
| 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. |
The filled in connected line structure needs to be destroyed by ast_party_connected_line_free() when it is no longer needed.
Definition at line 8606 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_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_number::presentation, ast_party_name::presentation, ast_party_connected_line::source, ast_party_subaddress::str, ast_party_number::str, ast_party_name::str, ast_party_id::subaddress, ast_party_id::tag, ast_party_subaddress::type, ast_party_subaddress::valid, ast_party_number::valid, ast_party_name::valid, and value.
Referenced by __ast_read(), ast_channel_connected_line_macro(), ast_indicate_data(), feature_request_and_dial(), socket_process(), wait_for_answer(), and wait_for_winner().
08607 { 08608 size_t pos; 08609 unsigned char ie_len; 08610 unsigned char ie_id; 08611 int32_t value; 08612 int frame_version = 1; 08613 int combined_presentation = 0; 08614 int got_combined_presentation = 0;/* TRUE if got a combined name and number presentation value. */ 08615 08616 for (pos = 0; pos < datalen; pos += ie_len) { 08617 if (datalen < pos + sizeof(ie_id) + sizeof(ie_len)) { 08618 ast_log(LOG_WARNING, "Invalid connected line update\n"); 08619 return -1; 08620 } 08621 ie_id = data[pos++]; 08622 ie_len = data[pos++]; 08623 if (datalen < pos + ie_len) { 08624 ast_log(LOG_WARNING, "Invalid connected line update\n"); 08625 return -1; 08626 } 08627 08628 switch (ie_id) { 08629 /* Connected line party frame version */ 08630 case AST_CONNECTED_LINE_VERSION: 08631 if (ie_len != 1) { 08632 ast_log(LOG_WARNING, "Invalid connected line frame version (%u)\n", 08633 (unsigned) ie_len); 08634 break; 08635 } 08636 frame_version = data[pos]; 08637 break; 08638 /* Connected line party id name */ 08639 case AST_CONNECTED_LINE_NAME: 08640 ast_free(connected->id.name.str); 08641 connected->id.name.str = ast_malloc(ie_len + 1); 08642 if (connected->id.name.str) { 08643 memcpy(connected->id.name.str, data + pos, ie_len); 08644 connected->id.name.str[ie_len] = 0; 08645 } 08646 break; 08647 case AST_CONNECTED_LINE_NAME_CHAR_SET: 08648 if (ie_len != 1) { 08649 ast_log(LOG_WARNING, "Invalid connected line name char set (%u)\n", 08650 (unsigned) ie_len); 08651 break; 08652 } 08653 connected->id.name.char_set = data[pos]; 08654 break; 08655 case AST_CONNECTED_LINE_NAME_PRESENTATION: 08656 if (ie_len != 1) { 08657 ast_log(LOG_WARNING, "Invalid connected line name presentation (%u)\n", 08658 (unsigned) ie_len); 08659 break; 08660 } 08661 connected->id.name.presentation = data[pos]; 08662 break; 08663 case AST_CONNECTED_LINE_NAME_VALID: 08664 if (ie_len != 1) { 08665 ast_log(LOG_WARNING, "Invalid connected line name valid (%u)\n", 08666 (unsigned) ie_len); 08667 break; 08668 } 08669 connected->id.name.valid = data[pos]; 08670 break; 08671 /* Connected line party id number */ 08672 case AST_CONNECTED_LINE_NUMBER: 08673 ast_free(connected->id.number.str); 08674 connected->id.number.str = ast_malloc(ie_len + 1); 08675 if (connected->id.number.str) { 08676 memcpy(connected->id.number.str, data + pos, ie_len); 08677 connected->id.number.str[ie_len] = 0; 08678 } 08679 break; 08680 case AST_CONNECTED_LINE_NUMBER_PLAN: 08681 if (ie_len != 1) { 08682 ast_log(LOG_WARNING, "Invalid connected line numbering plan (%u)\n", 08683 (unsigned) ie_len); 08684 break; 08685 } 08686 connected->id.number.plan = data[pos]; 08687 break; 08688 case AST_CONNECTED_LINE_NUMBER_PRESENTATION: 08689 if (ie_len != 1) { 08690 ast_log(LOG_WARNING, "Invalid connected line number presentation (%u)\n", 08691 (unsigned) ie_len); 08692 break; 08693 } 08694 connected->id.number.presentation = data[pos]; 08695 break; 08696 case AST_CONNECTED_LINE_NUMBER_VALID: 08697 if (ie_len != 1) { 08698 ast_log(LOG_WARNING, "Invalid connected line number valid (%u)\n", 08699 (unsigned) ie_len); 08700 break; 08701 } 08702 connected->id.number.valid = data[pos]; 08703 break; 08704 /* Connected line party id combined presentation */ 08705 case AST_CONNECTED_LINE_ID_PRESENTATION: 08706 if (ie_len != 1) { 08707 ast_log(LOG_WARNING, "Invalid connected line combined presentation (%u)\n", 08708 (unsigned) ie_len); 08709 break; 08710 } 08711 combined_presentation = data[pos]; 08712 got_combined_presentation = 1; 08713 break; 08714 /* Connected line party id subaddress */ 08715 case AST_CONNECTED_LINE_SUBADDRESS: 08716 ast_free(connected->id.subaddress.str); 08717 connected->id.subaddress.str = ast_malloc(ie_len + 1); 08718 if (connected->id.subaddress.str) { 08719 memcpy(connected->id.subaddress.str, data + pos, ie_len); 08720 connected->id.subaddress.str[ie_len] = 0; 08721 } 08722 break; 08723 case AST_CONNECTED_LINE_SUBADDRESS_TYPE: 08724 if (ie_len != 1) { 08725 ast_log(LOG_WARNING, "Invalid connected line type of subaddress (%u)\n", 08726 (unsigned) ie_len); 08727 break; 08728 } 08729 connected->id.subaddress.type = data[pos]; 08730 break; 08731 case AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN: 08732 if (ie_len != 1) { 08733 ast_log(LOG_WARNING, 08734 "Invalid connected line subaddress odd-even indicator (%u)\n", 08735 (unsigned) ie_len); 08736 break; 08737 } 08738 connected->id.subaddress.odd_even_indicator = data[pos]; 08739 break; 08740 case AST_CONNECTED_LINE_SUBADDRESS_VALID: 08741 if (ie_len != 1) { 08742 ast_log(LOG_WARNING, "Invalid connected line subaddress valid (%u)\n", 08743 (unsigned) ie_len); 08744 break; 08745 } 08746 connected->id.subaddress.valid = data[pos]; 08747 break; 08748 /* Connected line party tag */ 08749 case AST_CONNECTED_LINE_TAG: 08750 ast_free(connected->id.tag); 08751 connected->id.tag = ast_malloc(ie_len + 1); 08752 if (connected->id.tag) { 08753 memcpy(connected->id.tag, data + pos, ie_len); 08754 connected->id.tag[ie_len] = 0; 08755 } 08756 break; 08757 /* Connected line party source */ 08758 case AST_CONNECTED_LINE_SOURCE: 08759 if (ie_len != sizeof(value)) { 08760 ast_log(LOG_WARNING, "Invalid connected line source (%u)\n", 08761 (unsigned) ie_len); 08762 break; 08763 } 08764 memcpy(&value, data + pos, sizeof(value)); 08765 connected->source = ntohl(value); 08766 break; 08767 /* Connected line party unknown element */ 08768 default: 08769 ast_debug(1, "Unknown connected line element: %u (%u)\n", 08770 (unsigned) ie_id, (unsigned) ie_len); 08771 break; 08772 } 08773 } 08774 08775 switch (frame_version) { 08776 case 1: 08777 /* 08778 * The other end is an earlier version that we need to adjust 08779 * for compatibility. 08780 */ 08781 connected->id.name.valid = 1; 08782 connected->id.name.char_set = AST_PARTY_CHAR_SET_ISO8859_1; 08783 connected->id.number.valid = 1; 08784 if (got_combined_presentation) { 08785 connected->id.name.presentation = combined_presentation; 08786 connected->id.number.presentation = combined_presentation; 08787 } 08788 break; 08789 case 2: 08790 /* The other end is at the same level as we are. */ 08791 break; 08792 default: 08793 /* 08794 * The other end is newer than we are. 08795 * We need to assume that they are compatible with us. 08796 */ 08797 ast_debug(1, "Connected line frame has newer version: %u\n", 08798 (unsigned) frame_version); 08799 break; 08800 } 08801 08802 return 0; 08803 }
| void ast_deactivate_generator | ( | struct ast_channel * | chan | ) |
Deactivate an active generator
Definition at line 2873 of file channel.c.
References ast_channel_lock, ast_channel_set_fd(), ast_channel_unlock, ast_clear_flag, AST_FLAG_WRITE_INT, AST_GENERATOR_FD, ast_settimeout(), ast_channel::generator, ast_channel::generatordata, and ast_generator::release.
Referenced by __ast_read(), app_exec(), ast_channel_stop_silence_generator(), 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(), and wait_for_answer().
02874 { 02875 ast_channel_lock(chan); 02876 if (chan->generatordata) { 02877 if (chan->generator && chan->generator->release) 02878 chan->generator->release(chan, chan->generatordata); 02879 chan->generatordata = NULL; 02880 chan->generator = NULL; 02881 ast_channel_set_fd(chan, AST_GENERATOR_FD, -1); 02882 ast_clear_flag(chan, AST_FLAG_WRITE_INT); 02883 ast_settimeout(chan, 0, NULL, NULL); 02884 } 02885 ast_channel_unlock(chan); 02886 }
| int ast_do_masquerade | ( | struct ast_channel * | original | ) |
Start masquerading a channel.
| chan | Channel to masquerade |
Definition at line 6399 of file channel.c.
References __ast_change_name_nolink(), ast_channel::_bridge, ast_channel::_softhangup, ast_channel::_state, ast_channel::adsicpe, ast_channel::alertpipe, ao2_link, ao2_lock, ao2_unlink, ao2_unlock, ast_app_group_update(), ast_autochan_new_channel(), ast_bridged_channel(), ast_cause2str(), AST_CEL_BRIDGE_UPDATE, ast_cel_report_event(), ast_channel_accountcode(), ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_language(), ast_channel_lock, ast_channel_musicclass(), ast_channel_name(), AST_CHANNEL_NAME, ast_channel_release(), ast_channel_set_fd(), ast_channel_set_linkgroup(), ast_channel_trylock, ast_channel_uniqueid(), ast_channel_unlock, AST_CONTROL_SRCCHANGE, AST_CONTROL_UNHOLD, ast_copy_string(), ast_datastore_free(), ast_debug, AST_FLAG_BLOCKING, AST_FLAG_EXCEPTION, AST_FLAG_OUTGOING, AST_FLAG_ZOMBIE, ast_format_cap_copy(), ast_format_copy(), AST_GENERATOR_FD, ast_getformatname(), ast_indicate(), ast_kill_tech, AST_LIST_APPEND_LIST, AST_LIST_FIRST, AST_LIST_HEAD_NOLOCK, AST_LIST_HEAD_SET_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log(), ast_manager_event, ast_manager_event_multichan, AST_MAX_FDS, ast_null_frame, 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::blocker, ast_channel::caller, ast_channel::cdr, ast_datastore_info::chan_fixup, CHANNEL_DEADLOCK_AVOIDANCE, channels, clone_variables(), ast_channel::connected, ast_datastore::data, ast_channel::datastores, ast_channel::dialed, errno, EVENT_FLAG_CALL, ast_channel::fdno, ast_channel::fds, ast_channel_tech::fixup, free_translation(), ast_channel_tech::hangup, ast_channel::hangupcause, ast_datastore::info, LOG_WARNING, ast_channel::masq, ast_channel::masqr, masquerade_colp_transfer(), ast_channel::monitor, ast_channel::nativeformats, ast_channel::rawreadformat, ast_channel::rawwriteformat, ast_channel::readformat, ast_channel::readq, ast_channel::redirecting, report_new_callerid(), S_OR, ast_channel::tech, ast_channel::tech_pvt, ast_channel::timingfd, xfer_masquerade_ds::transferee_held, ast_channel_tech::type, ast_channel::visible_indication, and ast_channel::writeformat.
Referenced by __ast_read(), ast_async_goto(), ast_do_pickup(), ast_hangup(), ast_waitfor_nandfds(), ast_write(), builtin_atxfer(), check_goto_on_transfer(), do_bridge_masquerade(), handle_invite_replaces(), iax_park(), local_attended_transfer(), masq_park_call(), and sip_park().
06400 { 06401 int x, i; 06402 int res=0; 06403 int origstate; 06404 int visible_indication; 06405 struct ast_frame *current; 06406 const struct ast_channel_tech *t; 06407 void *t_pvt; 06408 union { 06409 struct ast_party_dialed dialed; 06410 struct ast_party_caller caller; 06411 struct ast_party_connected_line connected; 06412 struct ast_party_redirecting redirecting; 06413 } exchange; 06414 struct ast_channel *clonechan, *chans[2]; 06415 struct ast_channel *bridged; 06416 struct ast_cdr *cdr; 06417 struct ast_datastore *xfer_ds; 06418 struct xfer_masquerade_ds *xfer_colp; 06419 struct ast_format rformat; 06420 struct ast_format wformat; 06421 struct ast_format tmp_format; 06422 char newn[AST_CHANNEL_NAME]; 06423 char orig[AST_CHANNEL_NAME]; 06424 char masqn[AST_CHANNEL_NAME]; 06425 char zombn[AST_CHANNEL_NAME]; 06426 06427 ast_format_copy(&rformat, &original->readformat); 06428 ast_format_copy(&wformat, &original->writeformat); 06429 06430 /* XXX This operation is a bit odd. We're essentially putting the guts of 06431 * the clone channel into the original channel. Start by killing off the 06432 * original channel's backend. While the features are nice, which is the 06433 * reason we're keeping it, it's still awesomely weird. XXX */ 06434 06435 /* The reasoning for the channels ao2_container lock here is complex. 06436 * 06437 * In order to check for a race condition, the original channel must 06438 * be locked. If it is determined that the masquerade should proceed 06439 * the original channel can absolutely not be unlocked until the end 06440 * of the function. Since after determining the masquerade should 06441 * continue requires the channels to be unlinked from the ao2_container, 06442 * the container lock must be held first to achieve proper locking order. 06443 */ 06444 ao2_lock(channels); 06445 06446 /* lock the original channel to determine if the masquerade is required or not */ 06447 ast_channel_lock(original); 06448 06449 /* 06450 * This checks to see if the masquerade has already happened or 06451 * not. There is a race condition that exists for this 06452 * function. Since all pvt and channel locks must be let go 06453 * before calling do_masquerade, it is possible that it could be 06454 * called multiple times for the same channel. This check 06455 * verifies whether or not the masquerade has already been 06456 * completed by another thread. 06457 */ 06458 while ((clonechan = original->masq) && ast_channel_trylock(clonechan)) { 06459 /* 06460 * A masq is needed but we could not get the clonechan lock 06461 * immediately. Since this function already holds the global 06462 * container lock, unlocking original for deadlock avoidance 06463 * will not result in any sort of masquerade race condition. If 06464 * masq is called by a different thread while this happens, it 06465 * will be stuck waiting until we unlock the container. 06466 */ 06467 CHANNEL_DEADLOCK_AVOIDANCE(original); 06468 } 06469 06470 /* 06471 * A final masq check must be done after deadlock avoidance for 06472 * clonechan above or we could get a double masq. This is 06473 * posible with ast_hangup at least. 06474 */ 06475 if (!clonechan) { 06476 /* masq already completed by another thread, or never needed to be done to begin with */ 06477 ast_channel_unlock(original); 06478 ao2_unlock(channels); 06479 return 0; 06480 } 06481 06482 /* Get any transfer masquerade connected line exchange data. */ 06483 xfer_ds = ast_channel_datastore_find(original, &xfer_ds_info, NULL); 06484 if (xfer_ds) { 06485 ast_channel_datastore_remove(original, xfer_ds); 06486 xfer_colp = xfer_ds->data; 06487 } else { 06488 xfer_colp = NULL; 06489 } 06490 06491 /* 06492 * Release any hold on the transferee channel before proceeding 06493 * with the masquerade. 06494 */ 06495 if (xfer_colp && xfer_colp->transferee_held) { 06496 ast_indicate(clonechan, AST_CONTROL_UNHOLD); 06497 } 06498 06499 /* clear the masquerade channels */ 06500 original->masq = NULL; 06501 clonechan->masqr = NULL; 06502 06503 /* unlink from channels container as name (which is the hash value) will change */ 06504 ao2_unlink(channels, original); 06505 ao2_unlink(channels, clonechan); 06506 06507 ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n", 06508 ast_channel_name(clonechan), clonechan->_state, ast_channel_name(original), original->_state); 06509 06510 /* 06511 * Stop any visible indiction on the original channel so we can 06512 * transfer it to the clonechan taking the original's place. 06513 */ 06514 visible_indication = original->visible_indication; 06515 ast_indicate(original, -1); 06516 06517 chans[0] = clonechan; 06518 chans[1] = original; 06519 ast_manager_event_multichan(EVENT_FLAG_CALL, "Masquerade", 2, chans, 06520 "Clone: %s\r\n" 06521 "CloneState: %s\r\n" 06522 "Original: %s\r\n" 06523 "OriginalState: %s\r\n", 06524 ast_channel_name(clonechan), ast_state2str(clonechan->_state), ast_channel_name(original), ast_state2str(original->_state)); 06525 06526 /* Having remembered the original read/write formats, we turn off any translation on either 06527 one */ 06528 free_translation(clonechan); 06529 free_translation(original); 06530 06531 /* Save the original name */ 06532 ast_copy_string(orig, ast_channel_name(original), sizeof(orig)); 06533 /* Save the new name */ 06534 ast_copy_string(newn, ast_channel_name(clonechan), sizeof(newn)); 06535 /* Create the masq name */ 06536 snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn); 06537 06538 /* Mangle the name of the clone channel */ 06539 __ast_change_name_nolink(clonechan, masqn); 06540 06541 /* Copy the name from the clone channel */ 06542 __ast_change_name_nolink(original, newn); 06543 06544 /* share linked id's */ 06545 ast_channel_set_linkgroup(original, clonechan); 06546 06547 /* Swap the technologies */ 06548 t = original->tech; 06549 original->tech = clonechan->tech; 06550 clonechan->tech = t; 06551 06552 /* Swap the cdrs */ 06553 cdr = original->cdr; 06554 original->cdr = clonechan->cdr; 06555 clonechan->cdr = cdr; 06556 06557 t_pvt = original->tech_pvt; 06558 original->tech_pvt = clonechan->tech_pvt; 06559 clonechan->tech_pvt = t_pvt; 06560 06561 /* Swap the alertpipes */ 06562 for (i = 0; i < 2; i++) { 06563 x = original->alertpipe[i]; 06564 original->alertpipe[i] = clonechan->alertpipe[i]; 06565 clonechan->alertpipe[i] = x; 06566 } 06567 06568 /* 06569 * Swap the readq's. The end result should be this: 06570 * 06571 * 1) All frames should be on the new (original) channel. 06572 * 2) Any frames that were already on the new channel before this 06573 * masquerade need to be at the end of the readq, after all of the 06574 * frames on the old (clone) channel. 06575 * 3) The alertpipe needs to get poked for every frame that was already 06576 * on the new channel, since we are now using the alert pipe from the 06577 * old (clone) channel. 06578 */ 06579 { 06580 AST_LIST_HEAD_NOLOCK(, ast_frame) tmp_readq; 06581 AST_LIST_HEAD_SET_NOLOCK(&tmp_readq, NULL); 06582 06583 AST_LIST_APPEND_LIST(&tmp_readq, &original->readq, frame_list); 06584 AST_LIST_APPEND_LIST(&original->readq, &clonechan->readq, frame_list); 06585 06586 while ((current = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) { 06587 AST_LIST_INSERT_TAIL(&original->readq, current, frame_list); 06588 if (original->alertpipe[1] > -1) { 06589 int poke = 0; 06590 06591 if (write(original->alertpipe[1], &poke, sizeof(poke)) < 0) { 06592 ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); 06593 } 06594 } 06595 } 06596 } 06597 06598 /* Swap the raw formats */ 06599 ast_format_copy(&tmp_format, &original->rawreadformat); 06600 ast_format_copy(&original->rawreadformat, &clonechan->rawreadformat); 06601 ast_format_copy(&clonechan->rawreadformat, &tmp_format); 06602 06603 ast_format_copy(&tmp_format, &original->rawwriteformat); 06604 ast_format_copy(&original->rawwriteformat, &clonechan->rawwriteformat); 06605 ast_format_copy(&clonechan->rawwriteformat, &tmp_format); 06606 06607 clonechan->_softhangup = AST_SOFTHANGUP_DEV; 06608 06609 /* And of course, so does our current state. Note we need not 06610 call ast_setstate since the event manager doesn't really consider 06611 these separate. We do this early so that the clone has the proper 06612 state of the original channel. */ 06613 origstate = original->_state; 06614 original->_state = clonechan->_state; 06615 clonechan->_state = origstate; 06616 06617 if (clonechan->tech->fixup && clonechan->tech->fixup(original, clonechan)) { 06618 ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", ast_channel_name(clonechan)); 06619 } 06620 06621 /* Start by disconnecting the original's physical side */ 06622 if (clonechan->tech->hangup && clonechan->tech->hangup(clonechan)) { 06623 ast_log(LOG_WARNING, "Hangup failed! Strange things may happen!\n"); 06624 res = -1; 06625 goto done; 06626 } 06627 06628 /* 06629 * We just hung up the physical side of the channel. Set the 06630 * new zombie to use the kill channel driver for safety. 06631 */ 06632 clonechan->tech = &ast_kill_tech; 06633 06634 /* Mangle the name of the clone channel */ 06635 snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig); /* quick, hide the brains! */ 06636 __ast_change_name_nolink(clonechan, zombn); 06637 06638 /* Update the type. */ 06639 t_pvt = original->monitor; 06640 original->monitor = clonechan->monitor; 06641 clonechan->monitor = t_pvt; 06642 06643 /* Keep the same language. */ 06644 ast_channel_language_set(original, ast_channel_language(clonechan)); 06645 /* Copy the FD's other than the generator fd */ 06646 for (x = 0; x < AST_MAX_FDS; x++) { 06647 if (x != AST_GENERATOR_FD) 06648 ast_channel_set_fd(original, x, clonechan->fds[x]); 06649 } 06650 06651 ast_app_group_update(clonechan, original); 06652 06653 /* Move data stores over */ 06654 if (AST_LIST_FIRST(&clonechan->datastores)) { 06655 struct ast_datastore *ds; 06656 /* We use a safe traversal here because some fixup routines actually 06657 * remove the datastore from the list and free them. 06658 */ 06659 AST_LIST_TRAVERSE_SAFE_BEGIN(&clonechan->datastores, ds, entry) { 06660 if (ds->info->chan_fixup) 06661 ds->info->chan_fixup(ds->data, clonechan, original); 06662 } 06663 AST_LIST_TRAVERSE_SAFE_END; 06664 AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry); 06665 } 06666 06667 ast_autochan_new_channel(clonechan, original); 06668 06669 clone_variables(original, clonechan); 06670 /* Presense of ADSI capable CPE follows clone */ 06671 original->adsicpe = clonechan->adsicpe; 06672 /* Bridge remains the same */ 06673 /* CDR fields remain the same */ 06674 /* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */ 06675 /* Application and data remain the same */ 06676 /* Clone exception becomes real one, as with fdno */ 06677 ast_set_flag(original, ast_test_flag(clonechan, AST_FLAG_EXCEPTION | AST_FLAG_OUTGOING)); 06678 original->fdno = clonechan->fdno; 06679 /* Schedule context remains the same */ 06680 /* Stream stuff stays the same */ 06681 /* Keep the original state. The fixup code will need to work with it most likely */ 06682 06683 /* 06684 * Just swap the whole structures, nevermind the allocations, 06685 * they'll work themselves out. 06686 */ 06687 exchange.dialed = original->dialed; 06688 original->dialed = clonechan->dialed; 06689 clonechan->dialed = exchange.dialed; 06690 06691 exchange.caller = original->caller; 06692 original->caller = clonechan->caller; 06693 clonechan->caller = exchange.caller; 06694 06695 exchange.connected = original->connected; 06696 original->connected = clonechan->connected; 06697 clonechan->connected = exchange.connected; 06698 06699 exchange.redirecting = original->redirecting; 06700 original->redirecting = clonechan->redirecting; 06701 clonechan->redirecting = exchange.redirecting; 06702 06703 report_new_callerid(original); 06704 06705 /* Restore original timing file descriptor */ 06706 ast_channel_set_fd(original, AST_TIMING_FD, original->timingfd); 06707 06708 /* Our native formats are different now */ 06709 ast_format_cap_copy(original->nativeformats, clonechan->nativeformats); 06710 06711 /* Context, extension, priority, app data, jump table, remain the same */ 06712 /* pvt switches. pbx stays the same, as does next */ 06713 06714 /* Set the write format */ 06715 ast_set_write_format(original, &wformat); 06716 06717 /* Set the read format */ 06718 ast_set_read_format(original, &rformat); 06719 06720 /* Copy the music class */ 06721 ast_channel_musicclass_set(original, ast_channel_musicclass(clonechan)); 06722 06723 /* copy over accuntcode and set peeraccount across the bridge */ 06724 ast_channel_accountcode_set(original, S_OR(ast_channel_accountcode(clonechan), "")); 06725 if (original->_bridge) { 06726 /* XXX - should we try to lock original->_bridge here? */ 06727 ast_channel_peeraccount_set(original->_bridge, S_OR(ast_channel_accountcode(clonechan), "")); 06728 ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL); 06729 } 06730 06731 ast_debug(1, "Putting channel %s in %s/%s formats\n", ast_channel_name(original), 06732 ast_getformatname(&wformat), ast_getformatname(&rformat)); 06733 06734 /* Okay. Last thing is to let the channel driver know about all this mess, so he 06735 can fix up everything as best as possible */ 06736 if (original->tech->fixup) { 06737 if (original->tech->fixup(clonechan, original)) { 06738 ast_log(LOG_WARNING, "Channel for type '%s' could not fixup channel %s\n", 06739 original->tech->type, ast_channel_name(original)); 06740 res = -1; 06741 goto done; 06742 } 06743 } else 06744 ast_log(LOG_WARNING, "Channel type '%s' does not have a fixup routine (for %s)! Bad things may happen.\n", 06745 original->tech->type, ast_channel_name(original)); 06746 06747 /* 06748 * If an indication is currently playing, maintain it on the channel 06749 * that is taking the place of original 06750 * 06751 * This is needed because the masquerade is swapping out in the internals 06752 * of this channel, and the new channel private data needs to be made 06753 * aware of the current visible indication (RINGING, CONGESTION, etc.) 06754 */ 06755 if (visible_indication) { 06756 ast_indicate(original, visible_indication); 06757 } 06758 06759 /* Now, at this point, the "clone" channel is totally F'd up. We mark it as 06760 a zombie so nothing tries to touch it. If it's already been marked as a 06761 zombie, then free it now (since it already is considered invalid). */ 06762 if (ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) { 06763 ast_debug(1, "Destroying channel clone '%s'\n", ast_channel_name(clonechan)); 06764 ast_channel_unlock(clonechan); 06765 ast_manager_event(clonechan, EVENT_FLAG_CALL, "Hangup", 06766 "Channel: %s\r\n" 06767 "Uniqueid: %s\r\n" 06768 "Cause: %d\r\n" 06769 "Cause-txt: %s\r\n", 06770 ast_channel_name(clonechan), 06771 ast_channel_uniqueid(clonechan), 06772 clonechan->hangupcause, 06773 ast_cause2str(clonechan->hangupcause) 06774 ); 06775 clonechan = ast_channel_release(clonechan); 06776 } else { 06777 ast_debug(1, "Released clone lock on '%s'\n", ast_channel_name(clonechan)); 06778 ast_set_flag(clonechan, AST_FLAG_ZOMBIE); 06779 ast_queue_frame(clonechan, &ast_null_frame); 06780 } 06781 06782 /* Signal any blocker */ 06783 if (ast_test_flag(original, AST_FLAG_BLOCKING)) 06784 pthread_kill(original->blocker, SIGURG); 06785 ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), original->_state); 06786 06787 if ((bridged = ast_bridged_channel(original))) { 06788 ast_channel_lock(bridged); 06789 ast_indicate(bridged, AST_CONTROL_SRCCHANGE); 06790 ast_channel_unlock(bridged); 06791 } 06792 ast_indicate(original, AST_CONTROL_SRCCHANGE); 06793 06794 if (xfer_colp) { 06795 /* 06796 * After the masquerade, the original channel pointer actually 06797 * points to the new transferee channel and the bridged channel 06798 * is still the intended transfer target party. 06799 */ 06800 masquerade_colp_transfer(original, xfer_colp); 06801 } 06802 06803 done: 06804 if (xfer_ds) { 06805 ast_datastore_free(xfer_ds); 06806 } 06807 /* it is possible for the clone channel to disappear during this */ 06808 if (clonechan) { 06809 ast_channel_unlock(original); 06810 ast_channel_unlock(clonechan); 06811 ao2_link(channels, clonechan); 06812 ao2_link(channels, original); 06813 } else { 06814 ast_channel_unlock(original); 06815 ao2_link(channels, original); 06816 } 06817 06818 ao2_unlock(channels); 06819 06820 return res; 06821 }
| struct ast_channel* ast_dummy_channel_alloc | ( | void | ) | [read] |
Create a fake channel structure.
| NULL | failure | |
| non-NULL | successfully allocated channel |
The created dummy channel should be destroyed by ast_channel_unref(). Using ast_channel_release() needlessly grabs the channel container lock and can cause a deadlock as a result. Also grabbing the channel container lock reduces system performance.
Definition at line 1176 of file channel.c.
References __ao2_alloc_debug(), ao2_alloc, ast_channel_unref, ast_dummy_channel_destructor(), AST_LIST_HEAD_INIT_NOLOCK, ast_string_field_init, and ast_channel::varshead.
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().
01178 { 01179 struct ast_channel *tmp; 01180 struct varshead *headp; 01181 01182 #if defined(REF_DEBUG) 01183 tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor, "dummy channel", 01184 file, line, function, 1); 01185 #elif defined(__AST_DEBUG_MALLOC) 01186 tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor, "dummy channel", 01187 file, line, function, 0); 01188 #else 01189 tmp = ao2_alloc(sizeof(*tmp), ast_dummy_channel_destructor); 01190 #endif 01191 if (!tmp) { 01192 /* Dummy channel structure allocation failure. */ 01193 return NULL; 01194 } 01195 01196 if ((ast_string_field_init(tmp, 128))) { 01197 return ast_channel_unref(tmp); 01198 } 01199 01200 headp = &tmp->varshead; 01201 AST_LIST_HEAD_INIT_NOLOCK(headp); 01202 01203 return tmp; 01204 }
| 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 2443 of file channel.h.
References dummy().
Referenced by do_monitor().
02444 { 02445 int x; 02446 int dummy = 0; 02447 02448 if (fd < 0) 02449 return 0; 02450 if (!start) 02451 start = &dummy; 02452 for (x = *start; x < maximum; x++) 02453 if (pfds[x].fd == fd) { 02454 if (x == *start) 02455 (*start)++; 02456 return pfds[x].revents; 02457 } 02458 return 0; 02459 }
| 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 732 of file channel.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, chanlist::tech, and ast_channel_tech::type.
Referenced by __ast_channel_alloc_ap(), _ast_device_state(), ast_cc_callback(), and ast_var_channel_types_table().
00733 { 00734 struct chanlist *chanls; 00735 const struct ast_channel_tech *ret = NULL; 00736 00737 AST_RWLIST_RDLOCK(&backends); 00738 00739 AST_RWLIST_TRAVERSE(&backends, chanls, list) { 00740 if (!strcasecmp(name, chanls->tech->type)) { 00741 ret = chanls->tech; 00742 break; 00743 } 00744 } 00745 00746 AST_RWLIST_UNLOCK(&backends); 00747 00748 return ret; 00749 }
| ast_group_t ast_get_group | ( | const char * | s | ) |
Definition at line 7742 of file channel.c.
References ast_log(), ast_strdupa, ast_strlen_zero(), LOG_ERROR, LOG_WARNING, and strsep().
Referenced by _parse(), build_device(), build_gateway(), build_peer(), config_parse_variables(), func_channel_write_real(), process_dahdi(), and read_agent_config().
07743 { 07744 char *piece; 07745 char *c; 07746 int start=0, finish=0, x; 07747 ast_group_t group = 0; 07748 07749 if (ast_strlen_zero(s)) 07750 return 0; 07751 07752 c = ast_strdupa(s); 07753 07754 while ((piece = strsep(&c, ","))) { 07755 if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) { 07756 /* Range */ 07757 } else if (sscanf(piece, "%30d", &start)) { 07758 /* Just one */ 07759 finish = start; 07760 } else { 07761 ast_log(LOG_ERROR, "Syntax error parsing group configuration '%s' at '%s'. Ignoring.\n", s, piece); 07762 continue; 07763 } 07764 for (x = start; x <= finish; x++) { 07765 if ((x > 63) || (x < 0)) { 07766 ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 63)\n", x); 07767 } else 07768 group |= ((ast_group_t) 1 << x); 07769 } 07770 } 07771 return group; 07772 }
| int ast_hangup | ( | struct ast_channel * | chan | ) |
Hang up a channel.
This function performs a hard hangup on a channel. Unlike the soft-hangup, this function performs all stream stopping, etc, on the channel that needs to end. chan is no longer valid after this call.
| chan | channel to hang up |
Definition at line 2584 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_hangupsource(), ast_channel_lock, ast_channel_name(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_unref, ast_closestream(), ast_debug, ast_do_masquerade(), AST_FLAG_BLOCKING, AST_FLAG_ZOMBIE, ast_log(), ast_manager_event, ast_sched_context_destroy(), ast_set_flag, ast_test_flag, ast_channel::blocker, ast_channel::blockproc, ast_channel::caller, ast_channel::cdr, channels, ast_channel::connected, destroy_hooks(), ast_cdr::disposition, EVENT_FLAG_CALL, free_translation(), ast_channel::generator, ast_channel::generatordata, ast_channel_tech::hangup, ast_channel::hangupcause, ast_party_connected_line::id, ast_party_caller::id, LOG_WARNING, ast_channel::masq, ast_channel::masqr, ast_party_id::name, ast_party_id::number, pbx_builtin_getvar_helper(), ast_generator::release, S_COR, S_OR, ast_channel::sched, ast_party_name::str, ast_party_number::str, ast_channel::stream, ast_channel::tech, ast_party_name::valid, ast_party_number::valid, and ast_channel::vstream.
Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_pbx_run(), __ast_request_and_dial(), __oh323_new(), action_bridge(), alloc_playback_chan(), alsa_new(), analog_handle_init_event(), analog_ss_thread(), answer_exec_run(), app_exec(), ast_async_goto(), ast_call_forward(), ast_dial_destroy(), ast_dial_hangup(), ast_iax2_new(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run_app(), async_wait(), begin_dial_channel(), bridge_call_thread(), bridge_channel_thread(), bridge_exec(), build_conf(), builtin_atxfer(), chanavail_exec(), check_availability(), check_compat(), check_goto_on_transfer(), clear_caller(), conf_free(), conf_run(), connect_link(), console_new(), create_msg_q_chan(), dahdi_handle_event(), dahdi_new(), destroy_conference_bridge(), dial_exec_full(), dial_transfer(), do_forward(), do_hang(), feature_attended_transfer(), feature_request_and_dial(), findmeexec(), generic_recall(), gtalk_new(), handle_call_forward(), handle_callforward_button(), handle_frame(), handle_frame_ownerless(), handle_hd_hf(), handle_init_event(), handle_invite_replaces(), handle_request_invite(), handle_timeout_trip(), HandleCallOutgoing(), hangup_chan(), hangupcalls(), hanguptree(), iax2_request(), iax_park(), iax_park_thread(), jingle_new(), local_hangup(), manage_parked_call(), masq_park_call(), mgcp_new(), mgcp_ss(), monitor_dial(), mwi_thread(), my_distinctive_ring(), my_handle_notify_message(), nbs_new(), oss_new(), parkandannounce_exec(), parked_call_exec(), phone_new(), record_thread(), rpt(), rpt_call(), rpt_exec(), rpt_tele_thread(), setsubstate(), sip_park(), sip_park_thread(), sip_pickup_thread(), skinny_new(), skinny_ss(), try_calling(), unistim_new(), usbradio_new(), wait_for_answer(), and wait_for_winner().
02585 { 02586 char extra_str[64]; /* used for cel logging below */ 02587 int was_zombie; 02588 02589 ast_autoservice_stop(chan); 02590 02591 ast_channel_lock(chan); 02592 02593 /* 02594 * Do the masquerade if someone is setup to masquerade into us. 02595 * 02596 * NOTE: We must hold the channel lock after testing for a 02597 * pending masquerade and setting the channel as a zombie to 02598 * prevent __ast_channel_masquerade() from setting up a 02599 * masquerade with a dead channel. 02600 */ 02601 while (chan->masq) { 02602 ast_channel_unlock(chan); 02603 if (ast_do_masquerade(chan)) { 02604 ast_log(LOG_WARNING, "Failed to perform masquerade\n"); 02605 02606 /* Abort the loop or we might never leave. */ 02607 ast_channel_lock(chan); 02608 break; 02609 } 02610 ast_channel_lock(chan); 02611 } 02612 02613 if (chan->masqr) { 02614 /* 02615 * This channel is one which will be masqueraded into something. 02616 * Mark it as a zombie already so ast_do_masquerade() will know 02617 * to free it later. 02618 */ 02619 ast_set_flag(chan, AST_FLAG_ZOMBIE); 02620 destroy_hooks(chan); 02621 ast_channel_unlock(chan); 02622 return 0; 02623 } 02624 02625 if (!(was_zombie = ast_test_flag(chan, AST_FLAG_ZOMBIE))) { 02626 ast_set_flag(chan, AST_FLAG_ZOMBIE); 02627 } 02628 02629 ast_channel_unlock(chan); 02630 ao2_unlink(channels, chan); 02631 ast_channel_lock(chan); 02632 02633 destroy_hooks(chan); 02634 02635 free_translation(chan); 02636 /* Close audio stream */ 02637 if (chan->stream) { 02638 ast_closestream(chan->stream); 02639 chan->stream = NULL; 02640 } 02641 /* Close video stream */ 02642 if (chan->vstream) { 02643 ast_closestream(chan->vstream); 02644 chan->vstream = NULL; 02645 } 02646 if (chan->sched) { 02647 ast_sched_context_destroy(chan->sched); 02648 chan->sched = NULL; 02649 } 02650 02651 if (chan->generatordata) { /* Clear any tone stuff remaining */ 02652 if (chan->generator && chan->generator->release) { 02653 chan->generator->release(chan, chan->generatordata); 02654 } 02655 } 02656 chan->generatordata = NULL; 02657 chan->generator = NULL; 02658 02659 snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", chan->hangupcause, ast_channel_hangupsource(chan), S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), "")); 02660 ast_cel_report_event(chan, AST_CEL_HANGUP, NULL, extra_str, NULL); 02661 02662 if (ast_test_flag(chan, AST_FLAG_BLOCKING)) { 02663 ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd " 02664 "is blocked by thread %ld in procedure %s! Expect a failure\n", 02665 (long) pthread_self(), ast_channel_name(chan), (long)chan->blocker, chan->blockproc); 02666 ast_assert(ast_test_flag(chan, AST_FLAG_BLOCKING) == 0); 02667 } 02668 if (!was_zombie) { 02669 ast_debug(1, "Hanging up channel '%s'\n", ast_channel_name(chan)); 02670 02671 if (chan->tech->hangup) { 02672 chan->tech->hangup(chan); 02673 } 02674 } else { 02675 ast_debug(1, "Hanging up zombie '%s'\n", ast_channel_name(chan)); 02676 } 02677 02678 ast_channel_unlock(chan); 02679 02680 ast_cc_offer(chan); 02681 ast_manager_event(chan, EVENT_FLAG_CALL, "Hangup", 02682 "Channel: %s\r\n" 02683 "Uniqueid: %s\r\n" 02684 "CallerIDNum: %s\r\n" 02685 "CallerIDName: %s\r\n" 02686 "ConnectedLineNum: %s\r\n" 02687 "ConnectedLineName: %s\r\n" 02688 "Cause: %d\r\n" 02689 "Cause-txt: %s\r\n", 02690 ast_channel_name(chan), 02691 ast_channel_uniqueid(chan), 02692 S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "<unknown>"), 02693 S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, "<unknown>"), 02694 S_COR(chan->connected.id.number.valid, chan->connected.id.number.str, "<unknown>"), 02695 S_COR(chan->connected.id.name.valid, chan->connected.id.name.str, "<unknown>"), 02696 chan->hangupcause, 02697 ast_cause2str(chan->hangupcause) 02698 ); 02699 02700 if (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_BRIDGED) && 02701 !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED) && 02702 (chan->cdr->disposition != AST_CDR_NULL || ast_test_flag(chan->cdr, AST_CDR_FLAG_DIALED))) { 02703 ast_channel_lock(chan); 02704 ast_cdr_end(chan->cdr); 02705 ast_cdr_detach(chan->cdr); 02706 chan->cdr = NULL; 02707 ast_channel_unlock(chan); 02708 } 02709 02710 ast_channel_unref(chan); 02711 02712 return 0; 02713 }
| 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 4117 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(), disa_exec(), do_forward(), feature_request_and_dial(), finishup(), function_remote(), 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(), rpt(), rpt_exec(), say_periodic_announcement(), say_position(), send_waveform_to_channel(), skinny_ss(), sla_handle_hold_event(), sla_station_exec(), sla_trunk_exec(), try_calling(), and wait_for_answer().
04118 { 04119 return ast_indicate_data(chan, condition, NULL, 0); 04120 }
| 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 4172 of file channel.c.
References ast_channel::_state, _XXX_AST_CONTROL_T38, ast_channel_lock, ast_channel_name(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_channel_unlock, 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_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_channel::connected, ast_tone_zone_sound::data, ast_frame::data, ast_frame::datalen, ast_channel::framehooks, ast_frame::frametype, ast_channel_tech::indicate, ast_frame_subclass::integer, is_visible_indication(), LOG_WARNING, ast_frame::ptr, ast_channel::redirecting, ast_frame::subclass, ast_channel::tech, ast_channel::visible_indication, and ast_channel::zone.
Referenced by __ast_read(), action_aocmessage(), agent_hangup(), 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(), and wait_for_answer().
04174 { 04175 /* By using an enum, we'll get compiler warnings for values not handled 04176 * in switch statements. */ 04177 enum ast_control_frame_type condition = _condition; 04178 struct ast_tone_zone_sound *ts = NULL; 04179 int res; 04180 /* this frame is used by framehooks. if it is set, we must free it at the end of this function */ 04181 struct ast_frame *awesome_frame = NULL; 04182 04183 ast_channel_lock(chan); 04184 04185 /* Don't bother if the channel is about to go away, anyway. */ 04186 if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) { 04187 res = -1; 04188 goto indicate_cleanup; 04189 } 04190 04191 if (!ast_framehook_list_is_empty(chan->framehooks)) { 04192 /* Do framehooks now, do it, go, go now */ 04193 struct ast_frame frame = { 04194 .frametype = AST_FRAME_CONTROL, 04195 .subclass.integer = condition, 04196 .data.ptr = (void *) data, /* this cast from const is only okay because we do the ast_frdup below */ 04197 .datalen = datalen 04198 }; 04199 04200 /* we have now committed to freeing this frame */ 04201 awesome_frame = ast_frdup(&frame); 04202 04203 /* who knows what we will get back! the anticipation is killing me. */ 04204 if (!(awesome_frame = ast_framehook_list_write_event(chan->framehooks, awesome_frame)) 04205 || awesome_frame->frametype != AST_FRAME_CONTROL) { 04206 04207 res = 0; 04208 goto indicate_cleanup; 04209 } 04210 04211 condition = awesome_frame->subclass.integer; 04212 data = awesome_frame->data.ptr; 04213 datalen = awesome_frame->datalen; 04214 } 04215 04216 switch (condition) { 04217 case AST_CONTROL_CONNECTED_LINE: 04218 { 04219 struct ast_party_connected_line connected; 04220 04221 ast_party_connected_line_set_init(&connected, &chan->connected); 04222 res = ast_connected_line_parse_data(data, datalen, &connected); 04223 if (!res) { 04224 ast_channel_set_connected_line(chan, &connected, NULL); 04225 } 04226 ast_party_connected_line_free(&connected); 04227 } 04228 break; 04229 04230 case AST_CONTROL_REDIRECTING: 04231 { 04232 struct ast_party_redirecting redirecting; 04233 04234 ast_party_redirecting_set_init(&redirecting, &chan->redirecting); 04235 res = ast_redirecting_parse_data(data, datalen, &redirecting); 04236 if (!res) { 04237 ast_channel_set_redirecting(chan, &redirecting, NULL); 04238 } 04239 ast_party_redirecting_free(&redirecting); 04240 } 04241 break; 04242 04243 default: 04244 break; 04245 } 04246 04247 if (is_visible_indication(condition)) { 04248 /* A new visible indication is requested. */ 04249 chan->visible_indication = condition; 04250 } else if (condition == AST_CONTROL_UNHOLD || _condition < 0) { 04251 /* Visible indication is cleared/stopped. */ 04252 chan->visible_indication = 0; 04253 } 04254 04255 if (chan->tech->indicate) { 04256 /* See if the channel driver can handle this condition. */ 04257 res = chan->tech->indicate(chan, condition, data, datalen); 04258 } else { 04259 res = -1; 04260 } 04261 04262 if (!res) { 04263 /* The channel driver successfully handled this indication */ 04264 res = 0; 04265 goto indicate_cleanup; 04266 } 04267 04268 /* The channel driver does not support this indication, let's fake 04269 * it by doing our own tone generation if applicable. */ 04270 04271 /*!\note If we compare the enumeration type, which does not have any 04272 * negative constants, the compiler may optimize this code away. 04273 * Therefore, we must perform an integer comparison here. */ 04274 if (_condition < 0) { 04275 /* Stop any tones that are playing */ 04276 ast_playtones_stop(chan); 04277 res = 0; 04278 goto indicate_cleanup; 04279 } 04280 04281 /* Handle conditions that we have tones for. */ 04282 switch (condition) { 04283 case _XXX_AST_CONTROL_T38: 04284 /* deprecated T.38 control frame */ 04285 res = -1; 04286 goto indicate_cleanup; 04287 case AST_CONTROL_T38_PARAMETERS: 04288 /* there is no way to provide 'default' behavior for these 04289 * control frames, so we need to return failure, but there 04290 * is also no value in the log message below being emitted 04291 * since failure to handle these frames is not an 'error' 04292 * so just return right now. in addition, we want to return 04293 * whatever value the channel driver returned, in case it 04294 * has some meaning.*/ 04295 goto indicate_cleanup; 04296 case AST_CONTROL_RINGING: 04297 ts = ast_get_indication_tone(chan->zone, "ring"); 04298 /* It is common practice for channel drivers to return -1 if trying 04299 * to indicate ringing on a channel which is up. The idea is to let the 04300 * core generate the ringing inband. However, we don't want the 04301 * warning message about not being able to handle the specific indication 04302 * to print nor do we want ast_indicate_data to return an "error" for this 04303 * condition 04304 */ 04305 if (chan->_state == AST_STATE_UP) { 04306 res = 0; 04307 } 04308 break; 04309 case AST_CONTROL_BUSY: 04310 ts = ast_get_indication_tone(chan->zone, "busy"); 04311 break; 04312 case AST_CONTROL_INCOMPLETE: 04313 case AST_CONTROL_CONGESTION: 04314 ts = ast_get_indication_tone(chan->zone, "congestion"); 04315 break; 04316 case AST_CONTROL_PROGRESS: 04317 case AST_CONTROL_PROCEEDING: 04318 case AST_CONTROL_VIDUPDATE: 04319 case AST_CONTROL_SRCUPDATE: 04320 case AST_CONTROL_SRCCHANGE: 04321 case AST_CONTROL_RADIO_KEY: 04322 case AST_CONTROL_RADIO_UNKEY: 04323 case AST_CONTROL_OPTION: 04324 case AST_CONTROL_WINK: 04325 case AST_CONTROL_FLASH: 04326 case AST_CONTROL_OFFHOOK: 04327 case AST_CONTROL_TAKEOFFHOOK: 04328 case AST_CONTROL_ANSWER: 04329 case AST_CONTROL_HANGUP: 04330 case AST_CONTROL_RING: 04331 case AST_CONTROL_HOLD: 04332 case AST_CONTROL_UNHOLD: 04333 case AST_CONTROL_TRANSFER: 04334 case AST_CONTROL_CONNECTED_LINE: 04335 case AST_CONTROL_REDIRECTING: 04336 case AST_CONTROL_CC: 04337 case AST_CONTROL_READ_ACTION: 04338 case AST_CONTROL_AOC: 04339 case AST_CONTROL_END_OF_Q: 04340 case AST_CONTROL_MCID: 04341 case AST_CONTROL_UPDATE_RTP_PEER: 04342 /* Nothing left to do for these. */ 04343 res = 0; 04344 break; 04345 } 04346 04347 if (ts) { 04348 /* We have a tone to play, yay. */ 04349 ast_debug(1, "Driver for channel '%s' does not support indication %d, emulating it\n", ast_channel_name(chan), condition); 04350 res = ast_playtones_start(chan, 0, ts->data, 1); 04351 ts = ast_tone_zone_sound_unref(ts); 04352 } 04353 04354 if (res) { 04355 /* not handled */ 04356 ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, ast_channel_name(chan)); 04357 } 04358 04359 indicate_cleanup: 04360 ast_channel_unlock(chan); 04361 if (awesome_frame) { 04362 ast_frfree(awesome_frame); 04363 } 04364 04365 return res; 04366 }
| int ast_internal_timing_enabled | ( | struct ast_channel * | chan | ) |
Check if the channel can run in internal timing mode.
| chan | The channel to check |
Definition at line 4102 of file channel.c.
References ast_opt_internal_timing, and ast_channel::timingfd.
Referenced by add_sdp(), and ast_read_generator_actions().
04103 { 04104 return (ast_opt_internal_timing && chan->timingfd > -1); 04105 }
| 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 1603 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().
01604 { 01605 /* Do not add a default entry in this switch statement. Each new 01606 * frame type should be addressed directly as to whether it should 01607 * be queued up or not. 01608 */ 01609 switch (frame->frametype) { 01610 case AST_FRAME_CONTROL: 01611 case AST_FRAME_TEXT: 01612 case AST_FRAME_IMAGE: 01613 case AST_FRAME_HTML: 01614 return 1; 01615 01616 case AST_FRAME_DTMF_END: 01617 case AST_FRAME_DTMF_BEGIN: 01618 case AST_FRAME_VOICE: 01619 case AST_FRAME_VIDEO: 01620 case AST_FRAME_NULL: 01621 case AST_FRAME_IAX: 01622 case AST_FRAME_CNG: 01623 case AST_FRAME_MODEM: 01624 return 0; 01625 } 01626 return 0; 01627 }
| 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 2054 of file channel.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_copy(), and ast_party_caller::id.
Referenced by wait_for_answer().
02055 { 02056 if (dest == src) { 02057 /* Don't copy to self */ 02058 return; 02059 } 02060 02061 ast_party_id_copy(&dest->id, &src->id); 02062 ast_party_id_copy(&dest->ani, &src->ani); 02063 dest->ani2 = src->ani2; 02064 }
| void ast_party_caller_free | ( | struct ast_party_caller * | doomed | ) |
Destroy the caller party contents.
| doomed | The caller party to destroy. |
Definition at line 2080 of file channel.c.
References ast_party_caller::ani, ast_party_id_free(), and ast_party_caller::id.
Referenced by ast_channel_destructor(), ast_dummy_channel_destructor(), callerid_write(), dial_trunk(), and sla_ring_station().
02081 { 02082 ast_party_id_free(&doomed->id); 02083 ast_party_id_free(&doomed->ani); 02084 }
| void ast_party_caller_init | ( | struct ast_party_caller * | init | ) |
Initialize the given caller structure.
| init | Caller structure to initialize. |
Definition at line 2047 of file channel.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_init(), and ast_party_caller::id.
Referenced by __ast_channel_alloc_ap(), dial_trunk(), and sla_ring_station().
02048 { 02049 ast_party_id_init(&init->id); 02050 ast_party_id_init(&init->ani); 02051 init->ani2 = 0; 02052 }
| 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.
| 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 2073 of file channel.c.
References ast_set_party_caller::ani, ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_set(), ast_set_party_caller::id, and ast_party_caller::id.
Referenced by ast_channel_set_caller(), ast_channel_set_caller_event(), and callerid_write().
02074 { 02075 ast_party_id_set(&dest->id, &src->id, update ? &update->id : NULL); 02076 ast_party_id_set(&dest->ani, &src->ani, update ? &update->ani : NULL); 02077 dest->ani2 = src->ani2; 02078 }
| 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.
| init | Caller structure to initialize. | |
| guide | Source caller to use as a guide in initializing. |
Definition at line 2066 of file channel.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_set_init(), and ast_party_caller::id.
Referenced by callerid_write(), dial_exec_full(), do_forward(), misdn_update_caller_id(), and ring_entry().
02067 { 02068 ast_party_id_set_init(&init->id, &guide->id); 02069 ast_party_id_set_init(&init->ani, &guide->ani); 02070 init->ani2 = guide->ani2; 02071 }
| 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. |
DO NOT call ast_party_connected_line_free() on the filled in connected line structure!
Definition at line 2123 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, and ast_party_connected_line::source.
02124 { 02125 connected->id = caller->id; 02126 connected->ani = caller->ani; 02127 connected->ani2 = caller->ani2; 02128 connected->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN; 02129 }
| 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 2094 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_party_id_copy(), ast_party_connected_line::id, and ast_party_connected_line::source.
Referenced by __ast_read(), ast_call_forward(), ast_channel_connected_line_macro(), 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().
02095 { 02096 if (dest == src) { 02097 /* Don't copy to self */ 02098 return; 02099 } 02100 02101 ast_party_id_copy(&dest->id, &src->id); 02102 ast_party_id_copy(&dest->ani, &src->ani); 02103 dest->ani2 = src->ani2; 02104 dest->source = src->source; 02105 }
| 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 2131 of file channel.c.
References ast_party_connected_line::ani, ast_party_id_free(), and ast_party_connected_line::id.
Referenced by __ast_read(), app_exec(), 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_tree(), feature_request_and_dial(), findmeexec(), local_attended_transfer(), misdn_attempt_transfer(), parked_call_exec(), socket_process(), wait_for_answer(), wait_for_winner(), and xfer_ds_destroy().
02132 { 02133 ast_party_id_free(&doomed->id); 02134 ast_party_id_free(&doomed->ani); 02135 }
| 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 2086 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, and ast_party_connected_line::source.
Referenced by __ast_channel_alloc_ap(), __ast_read(), 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(), sip_call(), socket_process(), and wait_for_answer().
02087 { 02088 ast_party_id_init(&init->id); 02089 ast_party_id_init(&init->ani); 02090 init->ani2 = 0; 02091 init->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN; 02092 }
| 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 2115 of file channel.c.
References ast_set_party_connected_line::ani, ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_party_id_set(), ast_set_party_connected_line::id, ast_party_connected_line::id, and ast_party_connected_line::source.
Referenced by ast_channel_set_connected_line(), wait_for_answer(), and wait_for_winner().
02116 { 02117 ast_party_id_set(&dest->id, &src->id, update ? &update->id : NULL); 02118 ast_party_id_set(&dest->ani, &src->ani, update ? &update->ani : NULL); 02119 dest->ani2 = src->ani2; 02120 dest->source = src->source; 02121 }
| 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.
| init | Connected line structure to initialize. | |
| guide | Source connected line to use as a guide in initializing. |
Definition at line 2107 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, 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().
02108 { 02109 ast_party_id_set_init(&init->id, &guide->id); 02110 ast_party_id_set_init(&init->ani, &guide->ani); 02111 init->ani2 = guide->ani2; 02112 init->source = guide->source; 02113 }
| 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 2005 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().
02006 { 02007 if (dest == src) { 02008 /* Don't copy to self */ 02009 return; 02010 } 02011 02012 ast_free(dest->number.str); 02013 dest->number.str = ast_strdup(src->number.str); 02014 dest->number.plan = src->number.plan; 02015 ast_party_subaddress_copy(&dest->subaddress, &src->subaddress); 02016 dest->transit_network_select = src->transit_network_select; 02017 }
| void ast_party_dialed_free | ( | struct ast_party_dialed * | doomed | ) |
Destroy the dialed party contents.
| doomed | The dialed party to destroy. |
Definition at line 2040 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().
02041 { 02042 ast_free(doomed->number.str); 02043 doomed->number.str = NULL; 02044 ast_party_subaddress_free(&doomed->subaddress); 02045 }
| void ast_party_dialed_init | ( | struct ast_party_dialed * | init | ) |
Initialize the given dialed structure.
| init | Dialed structure to initialize. |
Definition at line 1997 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().
01998 { 01999 init->number.str = NULL; 02000 init->number.plan = 0;/* Unknown */ 02001 ast_party_subaddress_init(&init->subaddress); 02002 init->transit_network_select = 0; 02003 }
| 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.
| dest | The dialed one wishes to update | |
| src | The new dialed values to update the dest |
Definition at line 2027 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().
02028 { 02029 if (src->number.str && src->number.str != dest->number.str) { 02030 ast_free(dest->number.str); 02031 dest->number.str = ast_strdup(src->number.str); 02032 } 02033 dest->number.plan = src->number.plan; 02034 02035 ast_party_subaddress_set(&dest->subaddress, &src->subaddress); 02036 02037 dest->transit_network_select = src->transit_network_select; 02038 }
| 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.
| init | Caller structure to initialize. | |
| guide | Source dialed to use as a guide in initializing. |
Definition at line 2019 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().
02020 { 02021 init->number.str = NULL; 02022 init->number.plan = guide->number.plan; 02023 ast_party_subaddress_set_init(&init->subaddress, &guide->subaddress); 02024 init->transit_network_select = guide->transit_network_select; 02025 }
| 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 1876 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_redirecting_copy(), and parkandannounce_exec().
01877 { 01878 if (dest == src) { 01879 /* Don't copy to self */ 01880 return; 01881 } 01882 01883 ast_party_name_copy(&dest->name, &src->name); 01884 ast_party_number_copy(&dest->number, &src->number); 01885 ast_party_subaddress_copy(&dest->subaddress, &src->subaddress); 01886 01887 ast_free(dest->tag); 01888 dest->tag = ast_strdup(src->tag); 01889 }
| void ast_party_id_free | ( | struct ast_party_id * | doomed | ) |
Destroy the party id contents.
| doomed | The party id to destroy. |
Definition at line 1922 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_redirecting_free(), and parkandannounce_exec().
01923 { 01924 ast_party_name_free(&doomed->name); 01925 ast_party_number_free(&doomed->number); 01926 ast_party_subaddress_free(&doomed->subaddress); 01927 01928 ast_free(doomed->tag); 01929 doomed->tag = NULL; 01930 }
| 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 1868 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_redirecting_init(), dial_exec_full(), and parkandannounce_exec().
01869 { 01870 ast_party_name_init(&init->name); 01871 ast_party_number_init(&init->number); 01872 ast_party_subaddress_init(&init->subaddress); 01873 init->tag = NULL; 01874 }
| 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 1932 of file channel.c.
References AST_PRES_ALLOWED, 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_number::valid, and ast_party_name::valid.
Referenced by add_rpid(), ast_str_retrieve_variable(), ast_var_channels_table(), callerpres_read(), iax2_call(), initreqprep(), oh323_call(), party_id_build_data(), party_id_read(), redirecting_read(), report_new_callerid(), setup_env(), sip_call(), and socket_process().
01933 { 01934 int number_priority; 01935 int number_value; 01936 int number_screening; 01937 int name_priority; 01938 int name_value; 01939 01940 /* Determine name presentation priority. */ 01941 if (!id->name.valid) { 01942 name_value = AST_PRES_UNAVAILABLE; 01943 name_priority = 3; 01944 } else { 01945 name_value = id->name.presentation & AST_PRES_RESTRICTION; 01946 switch (name_value) { 01947 case AST_PRES_RESTRICTED: 01948 name_priority = 0; 01949 break; 01950 case AST_PRES_ALLOWED: 01951 name_priority = 1; 01952 break; 01953 case AST_PRES_UNAVAILABLE: 01954 name_priority = 2; 01955 break; 01956 default: 01957 name_value = AST_PRES_UNAVAILABLE; 01958 name_priority = 3; 01959 break; 01960 } 01961 } 01962 01963 /* Determine number presentation priority. */ 01964 if (!id->number.valid) { 01965 number_screening = AST_PRES_USER_NUMBER_UNSCREENED; 01966 number_value = AST_PRES_UNAVAILABLE; 01967 number_priority = 3; 01968 } else { 01969 number_screening = id->number.presentation & AST_PRES_NUMBER_TYPE; 01970 number_value = id->number.presentation & AST_PRES_RESTRICTION; 01971 switch (number_value) { 01972 case AST_PRES_RESTRICTED: 01973 number_priority = 0; 01974 break; 01975 case AST_PRES_ALLOWED: 01976 number_priority = 1; 01977 break; 01978 case AST_PRES_UNAVAILABLE: 01979 number_priority = 2; 01980 break; 01981 default: 01982 number_screening = AST_PRES_USER_NUMBER_UNSCREENED; 01983 number_value = AST_PRES_UNAVAILABLE; 01984 number_priority = 3; 01985 break; 01986 } 01987 } 01988 01989 /* Select the wining presentation value. */ 01990 if (name_priority < number_priority) { 01991 number_value = name_value; 01992 } 01993 01994 return number_value | number_screening; 01995 }
| 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 1899 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().
01900 { 01901 if (dest == src) { 01902 /* Don't set to self */ 01903 return; 01904 } 01905 01906 if (!update || update->name) { 01907 ast_party_name_set(&dest->name, &src->name); 01908 } 01909 if (!update || update->number) { 01910 ast_party_number_set(&dest->number, &src->number); 01911 } 01912 if (!update || update->subaddress) { 01913 ast_party_subaddress_set(&dest->subaddress, &src->subaddress); 01914 } 01915 01916 if (src->tag && src->tag != dest->tag) { 01917 ast_free(dest->tag); 01918 dest->tag = ast_strdup(src->tag); 01919 } 01920 }
| 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.
| init | Party id structure to initialize. | |
| guide | Source party id to use as a guide in initializing. |
Definition at line 1891 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().
01892 { 01893 ast_party_name_set_init(&init->name, &guide->name); 01894 ast_party_number_set_init(&init->number, &guide->number); 01895 ast_party_subaddress_set_init(&init->subaddress, &guide->subaddress); 01896 init->tag = NULL; 01897 }
| 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 1717 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().
01718 { 01719 if (dest == src) { 01720 /* Don't copy to self */ 01721 return; 01722 } 01723 01724 ast_free(dest->str); 01725 dest->str = ast_strdup(src->str); 01726 dest->char_set = src->char_set; 01727 dest->presentation = src->presentation; 01728 dest->valid = src->valid; 01729 }
| void ast_party_name_free | ( | struct ast_party_name * | doomed | ) |
Destroy the party name contents.
| doomed | The party name to destroy. |
Definition at line 1756 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 1709 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().
01710 { 01711 init->str = NULL; 01712 init->char_set = AST_PARTY_CHAR_SET_ISO8859_1; 01713 init->presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; 01714 init->valid = 0; 01715 }
| 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 1739 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().
01740 { 01741 if (dest == src) { 01742 /* Don't set to self */ 01743 return; 01744 } 01745 01746 if (src->str && src->str != dest->str) { 01747 ast_free(dest->str); 01748 dest->str = ast_strdup(src->str); 01749 } 01750 01751 dest->char_set = src->char_set; 01752 dest->presentation = src->presentation; 01753 dest->valid = src->valid; 01754 }
| 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.
| init | Party name structure to initialize. | |
| guide | Source party name to use as a guide in initializing. |
Definition at line 1731 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().
01732 { 01733 init->str = NULL; 01734 init->char_set = guide->char_set; 01735 init->presentation = guide->presentation; 01736 init->valid = guide->valid; 01737 }
| 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.
Definition at line 1770 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().
01771 { 01772 if (dest == src) { 01773 /* Don't copy to self */ 01774 return; 01775 } 01776 01777 ast_free(dest->str); 01778 dest->str = ast_strdup(src->str); 01779 dest->plan = src->plan; 01780 dest->presentation = src->presentation; 01781 dest->valid = src->valid; 01782 }
| void ast_party_number_free | ( | struct ast_party_number * | doomed | ) |
Destroy the party number contents.
| doomed | The party number to destroy. |
Definition at line 1809 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 1762 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().
01763 { 01764 init->str = NULL; 01765 init->plan = 0;/* Unknown */ 01766 init->presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; 01767 init->valid = 0; 01768 }
| 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.
Definition at line 1792 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().
01793 { 01794 if (dest == src) { 01795 /* Don't set to self */ 01796 return; 01797 } 01798 01799 if (src->str && src->str != dest->str) { 01800 ast_free(dest->str); 01801 dest->str = ast_strdup(src->str); 01802 } 01803 01804 dest->plan = src->plan; 01805 dest->presentation = src->presentation; 01806 dest->valid = src->valid; 01807 }
| 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.
| init | Party number structure to initialize. | |
| guide | Source party number to use as a guide in initializing. |
Definition at line 1784 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().
01785 { 01786 init->str = NULL; 01787 init->plan = guide->plan; 01788 init->presentation = guide->presentation; 01789 init->valid = guide->valid; 01790 }
| 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 2145 of file channel.c.
References ast_party_id_copy(), ast_party_redirecting::count, ast_party_redirecting::from, ast_party_redirecting::reason, and ast_party_redirecting::to.
Referenced by ast_call_forward(), ast_channel_redirecting_macro(), begin_dial_channel(), call_forward_inherit(), dial_exec_full(), do_forward(), local_call(), ring_entry(), and wait_for_answer().
02146 { 02147 if (dest == src) { 02148 /* Don't copy to self */ 02149 return; 02150 } 02151 02152 ast_party_id_copy(&dest->from, &src->from); 02153 ast_party_id_copy(&dest->to, &src->to); 02154 dest->count = src->count; 02155 dest->reason = src->reason; 02156 }
| void ast_party_redirecting_free | ( | struct ast_party_redirecting * | doomed | ) |
Destroy the redirecting information contents.
| doomed | The redirecting information to destroy. |
Definition at line 2174 of file channel.c.
References ast_party_id_free(), ast_party_redirecting::from, and ast_party_redirecting::to.
Referenced by ast_channel_destructor(), ast_dummy_channel_destructor(), ast_indicate_data(), call_forward_inherit(), do_forward(), handle_request_invite(), handle_response(), handle_response_invite(), redirecting_write(), and wait_for_answer().
02175 { 02176 ast_party_id_free(&doomed->from); 02177 ast_party_id_free(&doomed->to); 02178 }
| void ast_party_redirecting_init | ( | struct ast_party_redirecting * | init | ) |
Initialize the given redirecting structure.
| init | Redirecting structure to initialize. |
Definition at line 2137 of file channel.c.
References ast_party_id_init(), AST_REDIRECTING_REASON_UNKNOWN, ast_party_redirecting::count, ast_party_redirecting::from, ast_party_redirecting::reason, and ast_party_redirecting::to.
Referenced by __ast_channel_alloc_ap(), call_forward_inherit(), do_forward(), handle_request_invite(), handle_response(), handle_response_invite(), and wait_for_answer().
02138 { 02139 ast_party_id_init(&init->from); 02140 ast_party_id_init(&init->to); 02141 init->count = 0; 02142 init->reason = AST_REDIRECTING_REASON_UNKNOWN; 02143 }
| 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.
| 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 2166 of file channel.c.
References ast_party_id_set(), ast_party_redirecting::count, ast_set_party_redirecting::from, ast_party_redirecting::from, ast_party_redirecting::reason, ast_set_party_redirecting::to, and ast_party_redirecting::to.
Referenced by ast_channel_set_redirecting().
02167 { 02168 ast_party_id_set(&dest->from, &src->from, update ? &update->from : NULL); 02169 ast_party_id_set(&dest->to, &src->to, update ? &update->to : NULL); 02170 dest->reason = src->reason; 02171 dest->count = src->count; 02172 }
| 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.
| init | Redirecting id structure to initialize. | |
| guide | Source redirecting id to use as a guide in initializing. |
Definition at line 2158 of file channel.c.
References ast_party_id_set_init(), ast_party_redirecting::count, ast_party_redirecting::from, ast_party_redirecting::reason, and ast_party_redirecting::to.
Referenced by ast_indicate_data(), misdn_copy_redirecting_to_ast(), and redirecting_write().
02159 { 02160 ast_party_id_set_init(&init->from, &guide->from); 02161 ast_party_id_set_init(&init->to, &guide->to); 02162 init->count = guide->count; 02163 init->reason = guide->reason; 02164 }
| 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 1823 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().
01824 { 01825 if (dest == src) { 01826 /* Don't copy to self */ 01827 return; 01828 } 01829 01830 ast_free(dest->str); 01831 dest->str = ast_strdup(src->str); 01832 dest->type = src->type; 01833 dest->odd_even_indicator = src->odd_even_indicator; 01834 dest->valid = src->valid; 01835 }
| void ast_party_subaddress_free | ( | struct ast_party_subaddress * | doomed | ) |
Destroy the party subaddress contents.
| doomed | The party subaddress to destroy. |
Definition at line 1862 of file channel.c.
References ast_free, and ast_party_subaddress::str.
Referenced by ast_party_dialed_free(), and ast_party_id_free().
| void ast_party_subaddress_init | ( | struct ast_party_subaddress * | init | ) |
Initialize the given subaddress structure.
| init | Subaddress structure to initialize. |
Definition at line 1815 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(), and ast_party_id_init().
01816 { 01817 init->str = NULL; 01818 init->type = 0; 01819 init->odd_even_indicator = 0; 01820 init->valid = 0; 01821 }
| 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 1845 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().
01846 { 01847 if (dest == src) { 01848 /* Don't set to self */ 01849 return; 01850 } 01851 01852 if (src->str && src->str != dest->str) { 01853 ast_free(dest->str); 01854 dest->str = ast_strdup(src->str); 01855 } 01856 01857 dest->type = src->type; 01858 dest->odd_even_indicator = src->odd_even_indicator; 01859 dest->valid = src->valid; 01860 }
| 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.
| init | Party subaddress structure to initialize. | |
| guide | Source party subaddress to use as a guide in initializing. |
Definition at line 1837 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().
01838 { 01839 init->str = NULL; 01840 init->type = guide->type; 01841 init->odd_even_indicator = guide->odd_even_indicator; 01842 init->valid = guide->valid; 01843 }
| void ast_poll_channel_add | ( | struct ast_channel * | chan0, | |
| struct ast_channel * | chan1 | |||
| ) |
Add a channel to an optimized waitfor
Definition at line 2437 of file channel.c.
References AST_MAX_FDS, and ast_channel::fds.
Referenced by ast_generic_bridge(), begin_dial_channel(), feature_request_and_dial(), local_bridge_loop(), remote_bridge_loop(), and wait_for_answer().
02438 { 02439 #ifdef HAVE_EPOLL 02440 struct epoll_event ev; 02441 int i = 0; 02442 02443 if (chan0->epfd == -1) 02444 return; 02445 02446 /* Iterate through the file descriptors on chan1, adding them to chan0 */ 02447 for (i = 0; i < AST_MAX_FDS; i++) { 02448 if (chan1->fds[i] == -1) 02449 continue; 02450 ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP; 02451 ev.data.ptr = chan1->epfd_data[i]; 02452 epoll_ctl(chan0->epfd, EPOLL_CTL_ADD, chan1->fds[i], &ev); 02453 } 02454 02455 #endif 02456 return; 02457 }
| void ast_poll_channel_del | ( | struct ast_channel * | chan0, | |
| struct ast_channel * | chan1 | |||
| ) |
Delete a channel from an optimized waitfor
Definition at line 2460 of file channel.c.
References AST_MAX_FDS, and ast_channel::fds.
Referenced by ast_generic_bridge(), feature_request_and_dial(), local_bridge_loop(), monitor_dial(), remote_bridge_loop(), and wait_for_answer().
02461 { 02462 #ifdef HAVE_EPOLL 02463 struct epoll_event ev; 02464 int i = 0; 02465 02466 if (chan0->epfd == -1) 02467 return; 02468 02469 for (i = 0; i < AST_MAX_FDS; i++) { 02470 if (chan1->fds[i] == -1) 02471 continue; 02472 epoll_ctl(chan0->epfd, EPOLL_CTL_DEL, chan1->fds[i], &ev); 02473 } 02474 02475 #endif 02476 return; 02477 }
| char* ast_print_group | ( | char * | buf, | |
| int | buflen, | |||
| ast_group_t | group | |||
| ) |
print call- and pickup groups into buffer
Definition at line 7979 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().
07980 { 07981 unsigned int i; 07982 int first = 1; 07983 char num[3]; 07984 07985 buf[0] = '\0'; 07986 07987 if (!group) /* Return empty string if no group */ 07988 return buf; 07989 07990 for (i = 0; i <= 63; i++) { /* Max group is 63 */ 07991 if (group & ((ast_group_t) 1 << i)) { 07992 if (!first) { 07993 strncat(buf, ", ", buflen - strlen(buf) - 1); 07994 } else { 07995 first = 0; 07996 } 07997 snprintf(num, sizeof(num), "%u", i); 07998 strncat(buf, num, buflen - strlen(buf) - 1); 07999 } 08000 } 08001 return buf; 08002 }
| int ast_prod | ( | struct ast_channel * | chan | ) |
Send empty audio to prime a channel driver.
Definition at line 4512 of file channel.c.
References ast_channel::_state, ast_channel_name(), 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_channel::rawwriteformat, ast_frame::src, and ast_frame::subclass.
Referenced by ast_activate_generator().
04513 { 04514 struct ast_frame a = { AST_FRAME_VOICE }; 04515 char nothing[128]; 04516 04517 /* Send an empty audio frame to get things moving */ 04518 if (chan->_state != AST_STATE_UP) { 04519 ast_debug(1, "Prodding channel '%s'\n", ast_channel_name(chan)); 04520 ast_format_copy(&a.subclass.format, &chan->rawwriteformat); 04521 a.data.ptr = nothing + AST_FRIENDLY_OFFSET; 04522 a.src = "ast_prod"; /* this better match check in ast_write */ 04523 if (ast_write(chan, &a)) 04524 ast_log(LOG_WARNING, "Prodding channel '%s' failed\n", ast_channel_name(chan)); 04525 } 04526 return 0; 04527 }
| 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 1381 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_hd_hf(), handle_request(), handle_request_bye(), handle_request_info(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), handle_response_refer(), HandleCallIncoming(), jingle_is_answered(), 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(), skinny_call(), skinny_transfer(), unistim_call(), and update_state().
01382 { 01383 struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = control }; 01384 return ast_queue_frame(chan, &f); 01385 }
| 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 channel does not need to be locked before calling this function.
Definition at line 1388 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(), fax_gateway_indicate_t38(), handle_request_notify(), handle_response_refer(), iax2_queue_control_data(), iax2_transfer(), interpret_t38_parameters(), local_attended_transfer(), masquerade_colp_transfer(), process_sdp(), setsubstate(), and sip_sipredirect().
01390 { 01391 struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = control, .data.ptr = (void *) data, .datalen = datalen }; 01392 return ast_queue_frame(chan, &f); 01393 }
| 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 1326 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(), local_queue_frame(), mgcp_queue_frame(), oh323_simulate_dtmf_end(), oss_call(), process_sdp(), queue_dtmf_readq(), receive_digit(), receive_message(), rpt_call(), stream_monitor(), t38_tx_packet_handler(), unistim_do_senddigit(), unistim_senddigit_end(), usbradio_read(), and wakeup_sub().
01327 { 01328 return __ast_queue_frame(chan, fin, 0, NULL); 01329 }
| 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 1331 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().
01332 { 01333 return __ast_queue_frame(chan, fin, 1, NULL); 01334 }
| int ast_queue_hangup | ( | struct ast_channel * | chan | ) |
Queue a hangup frame.
Definition at line 1337 of file channel.c.
References ast_channel::_softhangup, ast_channel_name(), ast_channel_trylock, 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(), handle_request_cancel(), iax2_destroy(), iax2_queue_hangup(), jingle_hangup_farend(), local_fixup(), local_hangup(), mgcp_queue_hangup(), and setsubstate().
01338 { 01339 struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_HANGUP }; 01340 /* Yeah, let's not change a lock-critical value without locking */ 01341 if (!ast_channel_trylock(chan)) { 01342 chan->_softhangup |= AST_SOFTHANGUP_DEV; 01343 manager_event(EVENT_FLAG_CALL, "HangupRequest", 01344 "Channel: %s\r\n" 01345 "Uniqueid: %s\r\n", 01346 ast_channel_name(chan), 01347 ast_channel_uniqueid(chan)); 01348 ast_channel_unlock(chan); 01349 } 01350 return ast_queue_frame(chan, &f); 01351 }
| 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 1354 of file channel.c.
References ast_channel::_softhangup, ast_channel_name(), ast_channel_trylock, ast_channel_uniqueid(), ast_channel_unlock, AST_CONTROL_HANGUP, AST_FRAME_CONTROL, ast_queue_frame(), AST_SOFTHANGUP_DEV, ast_frame::data, EVENT_FLAG_CALL, ast_channel::hangupcause, 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(), handle_request_bye(), handle_response(), handle_response_invite(), HandleCallOutgoing(), hangup_chan(), hangup_connection(), misdn_answer(), retrans_pkt(), and TransferCallStep1().
01355 { 01356 struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_HANGUP }; 01357 01358 if (cause >= 0) 01359 f.data.uint32 = cause; 01360 01361 /* Yeah, let's not change a lock-critical value without locking */ 01362 if (!ast_channel_trylock(chan)) { 01363 chan->_softhangup |= AST_SOFTHANGUP_DEV; 01364 if (cause < 0) 01365 f.data.uint32 = chan->hangupcause; 01366 01367 manager_event(EVENT_FLAG_CALL, "HangupRequest", 01368 "Channel: %s\r\n" 01369 "Uniqueid: %s\r\n" 01370 "Cause: %d\r\n", 01371 ast_channel_name(chan), 01372 ast_channel_uniqueid(chan), 01373 cause); 01374 ast_channel_unlock(chan); 01375 } 01376 01377 return ast_queue_frame(chan, &f); 01378 }
| 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' |
Unlike ast_answer(), this function will not wait for media flow to begin. The caller should be careful before sending media to the channel before incoming media arrives, as the outgoing media may be lost.
| 0 | on success | |
| non-zero | on failure |
Definition at line 2715 of file channel.c.
References ast_channel::_state, ast_channel_tech::answer, ast_cdr_answer(), AST_CEL_ANSWER, ast_cel_report_event(), ast_channel_lock, 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, ast_test_flag, ast_channel::cdr, and ast_channel::tech.
Referenced by __ast_answer(), and ast_bridge_call().
02716 { 02717 int res = 0; 02718 02719 ast_channel_lock(chan); 02720 02721 /* You can't answer an outbound call */ 02722 if (ast_test_flag(chan, AST_FLAG_OUTGOING)) { 02723 ast_channel_unlock(chan); 02724 return 0; 02725 } 02726 02727 /* Stop if we're a zombie or need a soft hangup */ 02728 if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) { 02729 ast_channel_unlock(chan); 02730 return -1; 02731 } 02732 02733 ast_channel_unlock(chan); 02734 02735 switch (chan->_state) { 02736 case AST_STATE_RINGING: 02737 case AST_STATE_RING: 02738 ast_channel_lock(chan); 02739 if (chan->tech->answer) { 02740 res = chan->tech->answer(chan); 02741 } 02742 ast_setstate(chan, AST_STATE_UP); 02743 if (cdr_answer) { 02744 ast_cdr_answer(chan->cdr); 02745 } 02746 ast_cel_report_event(chan, AST_CEL_ANSWER, NULL, NULL, NULL); 02747 ast_channel_unlock(chan); 02748 break; 02749 case AST_STATE_UP: 02750 ast_cel_report_event(chan, AST_CEL_ANSWER, NULL, NULL, NULL); 02751 /* Calling ast_cdr_answer when it it has previously been called 02752 * is essentially a no-op, so it is safe. 02753 */ 02754 if (cdr_answer) { 02755 ast_cdr_answer(chan->cdr); 02756 } 02757 break; 02758 default: 02759 break; 02760 } 02761 02762 ast_indicate(chan, -1); 02763 02764 return res; 02765 }
| struct ast_frame* ast_read | ( | struct ast_channel * | chan | ) | [read] |
Reads a frame.
| chan | channel to read a frame from |
Definition at line 4107 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_bridge(), dial_exec_full(), dictate_exec(), disa_exec(), disable_t38(), 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(), rpt(), rpt_exec(), 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().
04108 { 04109 return __ast_read(chan, 0); 04110 }
| 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 4112 of file channel.c.
References __ast_read().
Referenced by ast_bridge_handle_trip(), and conf_run().
04113 { 04114 return __ast_read(chan, 1); 04115 }
| 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 |
Definition at line 5686 of file channel.c.
References ast_readstring_full().
Referenced by __adsi_transmit_messages(), ast_adsi_begin_download(), ast_adsi_get_cpeinfo(), ast_adsi_load_session(), ast_app_getdata(), dialout(), do_directory(), forward_message(), privacy_exec(), vm_authenticate(), vm_newuser(), and vm_options().
05687 { 05688 return ast_readstring_full(c, s, len, timeout, ftimeout, enders, -1, -1); 05689 }
| 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 5691 of file channel.c.
References ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), 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(), ast_waitstream_full(), and ast_channel::stream.
Referenced by ast_app_getdata_full(), and ast_readstring().
05692 { 05693 int pos = 0; /* index in the buffer where we accumulate digits */ 05694 int to = ftimeout; 05695 05696 struct ast_silence_generator *silgen = NULL; 05697 05698 /* Stop if we're a zombie or need a soft hangup */ 05699 if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) 05700 return -1; 05701 if (!len) 05702 return -1; 05703 for (;;) { 05704 int d; 05705 if (c->stream) { 05706 d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd); 05707 ast_stopstream(c); 05708 if (!silgen && ast_opt_transmit_silence) 05709 silgen = ast_channel_start_silence_generator(c); 05710 usleep(1000); 05711 if (!d) 05712 d = ast_waitfordigit_full(c, to, audiofd, ctrlfd); 05713 } else { 05714 if (!silgen && ast_opt_transmit_silence) 05715 silgen = ast_channel_start_silence_generator(c); 05716 d = ast_waitfordigit_full(c, to, audiofd, ctrlfd); 05717 } 05718 if (d < 0) { 05719 ast_channel_stop_silence_generator(c, silgen); 05720 return AST_GETDATA_FAILED; 05721 } 05722 if (d == 0) { 05723 s[pos] = '\0'; 05724 ast_channel_stop_silence_generator(c, silgen); 05725 return AST_GETDATA_TIMEOUT; 05726 } 05727 if (d == 1) { 05728 s[pos] = '\0'; 05729 ast_channel_stop_silence_generator(c, silgen); 05730 return AST_GETDATA_INTERRUPTED; 05731 } 05732 if (strchr(enders, d) && (pos == 0)) { 05733 s[pos] = '\0'; 05734 ast_channel_stop_silence_generator(c, silgen); 05735 return AST_GETDATA_EMPTY_END_TERMINATED; 05736 } 05737 if (!strchr(enders, d)) { 05738 s[pos++] = d; 05739 } 05740 if (strchr(enders, d) || (pos >= len)) { 05741 s[pos] = '\0'; 05742 ast_channel_stop_silence_generator(c, silgen); 05743 return AST_GETDATA_COMPLETE; 05744 } 05745 to = timeout; 05746 } 05747 /* Never reached */ 05748 return 0; 05749 }
| 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) |
Definition at line 4368 of file channel.c.
References ast_free, and ast_recvtext().
Referenced by handle_recvchar().
04369 { 04370 int c; 04371 char *buf = ast_recvtext(chan, timeout); 04372 if (buf == NULL) 04373 return -1; /* error or timeout */ 04374 c = *(unsigned char *)buf; 04375 ast_free(buf); 04376 return c; 04377 }
| 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 4379 of file channel.c.
References ast_check_hangup(), AST_CONTROL_HANGUP, AST_FRAME_CONTROL, AST_FRAME_TEXT, ast_frfree, ast_read(), ast_strndup, ast_waitfor(), ast_frame::data, ast_frame::datalen, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::ptr, and ast_frame::subclass.
Referenced by ast_recvchar(), and handle_recvtext().
04380 { 04381 int res, done = 0; 04382 char *buf = NULL; 04383 04384 while (!done) { 04385 struct ast_frame *f; 04386 if (ast_check_hangup(chan)) 04387 break; 04388 res = ast_waitfor(chan, timeout); 04389 if (res <= 0) /* timeout or error */ 04390 break; 04391 timeout = res; /* update timeout */ 04392 f = ast_read(chan); 04393 if (f == NULL) 04394 break; /* no frame */ 04395 if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) 04396 done = 1; /* force a break */ 04397 else if (f->frametype == AST_FRAME_TEXT) { /* what we want */ 04398 buf = ast_strndup((char *) f->data.ptr, f->datalen); /* dup and break */ 04399 done = 1; 04400 } 04401 ast_frfree(f); 04402 } 04403 return buf; 04404 }
| 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 8881 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_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_set_party_redirecting::from, ast_party_redirecting::from, LOG_WARNING, ast_party_id_ies::name, party_id_build_data(), ast_party_redirecting::reason, ast_party_name_ies::str, ast_set_party_redirecting::to, ast_party_redirecting::to, and value.
Referenced by ast_channel_queue_redirecting_update(), ast_channel_update_redirecting(), and local_indicate().
08882 { 08883 int32_t value; 08884 size_t pos = 0; 08885 int res; 08886 08887 static const struct ast_party_id_ies from_ies = { 08888 .name.str = AST_REDIRECTING_FROM_NAME, 08889 .name.char_set = AST_REDIRECTING_FROM_NAME_CHAR_SET, 08890 .name.presentation = AST_REDIRECTING_FROM_NAME_PRESENTATION, 08891 .name.valid = AST_REDIRECTING_FROM_NAME_VALID, 08892 08893 .number.str = AST_REDIRECTING_FROM_NUMBER, 08894 .number.plan = AST_REDIRECTING_FROM_NUMBER_PLAN, 08895 .number.presentation = AST_REDIRECTING_FROM_NUMBER_PRESENTATION, 08896 .number.valid = AST_REDIRECTING_FROM_NUMBER_VALID, 08897 08898 .subaddress.str = AST_REDIRECTING_FROM_SUBADDRESS, 08899 .subaddress.type = AST_REDIRECTING_FROM_SUBADDRESS_TYPE, 08900 .subaddress.odd_even_indicator = AST_REDIRECTING_FROM_SUBADDRESS_ODD_EVEN, 08901 .subaddress.valid = AST_REDIRECTING_FROM_SUBADDRESS_VALID, 08902 08903 .tag = AST_REDIRECTING_FROM_TAG, 08904 .combined_presentation = AST_REDIRECTING_FROM_ID_PRESENTATION, 08905 }; 08906 static const struct ast_party_id_ies to_ies = { 08907 .name.str = AST_REDIRECTING_TO_NAME, 08908 .name.char_set = AST_REDIRECTING_TO_NAME_CHAR_SET, 08909 .name.presentation = AST_REDIRECTING_TO_NAME_PRESENTATION, 08910 .name.valid = AST_REDIRECTING_TO_NAME_VALID, 08911 08912 .number.str = AST_REDIRECTING_TO_NUMBER, 08913 .number.plan = AST_REDIRECTING_TO_NUMBER_PLAN, 08914 .number.presentation = AST_REDIRECTING_TO_NUMBER_PRESENTATION, 08915 .number.valid = AST_REDIRECTING_TO_NUMBER_VALID, 08916 08917 .subaddress.str = AST_REDIRECTING_TO_SUBADDRESS, 08918 .subaddress.type = AST_REDIRECTING_TO_SUBADDRESS_TYPE, 08919 .subaddress.odd_even_indicator = AST_REDIRECTING_TO_SUBADDRESS_ODD_EVEN, 08920 .subaddress.valid = AST_REDIRECTING_TO_SUBADDRESS_VALID, 08921 08922 .tag = AST_REDIRECTING_TO_TAG, 08923 .combined_presentation = AST_REDIRECTING_TO_ID_PRESENTATION, 08924 }; 08925 08926 /* Redirecting frame version */ 08927 if (datalen < pos + (sizeof(data[0]) * 2) + 1) { 08928 ast_log(LOG_WARNING, "No space left for redirecting frame version\n"); 08929 return -1; 08930 } 08931 data[pos++] = AST_REDIRECTING_VERSION; 08932 data[pos++] = 1; 08933 data[pos++] = 2;/* Version 1 did not have a version ie */ 08934 08935 res = party_id_build_data(data + pos, datalen - pos, &redirecting->from, 08936 "redirecting-from", &from_ies, update ? &update->from : NULL); 08937 if (res < 0) { 08938 return -1; 08939 } 08940 pos += res; 08941 08942 res = party_id_build_data(data + pos, datalen - pos, &redirecting->to, 08943 "redirecting-to", &to_ies, update ? &update->to : NULL); 08944 if (res < 0) { 08945 return -1; 08946 } 08947 pos += res; 08948 08949 /* Redirecting reason */ 08950 if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) { 08951 ast_log(LOG_WARNING, "No space left for redirecting reason\n"); 08952 return -1; 08953 } 08954 data[pos++] = AST_REDIRECTING_REASON; 08955 data[pos++] = sizeof(value); 08956 value = htonl(redirecting->reason); 08957 memcpy(data + pos, &value, sizeof(value)); 08958 pos += sizeof(value); 08959 08960 /* Redirecting count */ 08961 if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) { 08962 ast_log(LOG_WARNING, "No space left for redirecting count\n"); 08963 return -1; 08964 } 08965 data[pos++] = AST_REDIRECTING_COUNT; 08966 data[pos++] = sizeof(value); 08967 value = htonl(redirecting->count); 08968 memcpy(data + pos, &value, sizeof(value)); 08969 pos += sizeof(value); 08970 08971 return pos; 08972 }
| 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. |
The filled in id structure needs to be destroyed by ast_party_redirecting_free() when it is no longer needed.
Definition at line 8974 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_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_number::plan, ast_party_number::presentation, ast_party_name::presentation, ast_party_redirecting::reason, ast_party_subaddress::str, ast_party_number::str, ast_party_name::str, ast_party_id::subaddress, ast_party_id::tag, ast_party_redirecting::to, ast_party_subaddress::type, ast_party_subaddress::valid, ast_party_number::valid, ast_party_name::valid, and value.
Referenced by ast_channel_redirecting_macro(), and ast_indicate_data().
08975 { 08976 size_t pos; 08977 unsigned char ie_len; 08978 unsigned char ie_id; 08979 int32_t value; 08980 int frame_version = 1; 08981 int from_combined_presentation = 0; 08982 int got_from_combined_presentation = 0;/* TRUE if got a combined name and number presentation value. */ 08983 int to_combined_presentation = 0; 08984 int got_to_combined_presentation = 0;/* TRUE if got a combined name and number presentation value. */ 08985 08986 for (pos = 0; pos < datalen; pos += ie_len) { 08987 if (datalen < pos + sizeof(ie_id) + sizeof(ie_len)) { 08988 ast_log(LOG_WARNING, "Invalid redirecting update\n"); 08989 return -1; 08990 } 08991 ie_id = data[pos++]; 08992 ie_len = data[pos++]; 08993 if (datalen < pos + ie_len) { 08994 ast_log(LOG_WARNING, "Invalid redirecting update\n"); 08995 return -1; 08996 } 08997 08998 switch (ie_id) { 08999 /* Redirecting frame version */ 09000 case AST_REDIRECTING_VERSION: 09001 if (ie_len != 1) { 09002 ast_log(LOG_WARNING, "Invalid redirecting frame version (%u)\n", 09003 (unsigned) ie_len); 09004 break; 09005 } 09006 frame_version = data[pos]; 09007 break; 09008 /* Redirecting-from party id name */ 09009 case AST_REDIRECTING_FROM_NAME: 09010 ast_free(redirecting->from.name.str); 09011 redirecting->from.name.str = ast_malloc(ie_len + 1); 09012 if (redirecting->from.name.str) { 09013 memcpy(redirecting->from.name.str, data + pos, ie_len); 09014 redirecting->from.name.str[ie_len] = 0; 09015 } 09016 break; 09017 case AST_REDIRECTING_FROM_NAME_CHAR_SET: 09018 if (ie_len != 1) { 09019 ast_log(LOG_WARNING, "Invalid redirecting-from name char set (%u)\n", 09020 (unsigned) ie_len); 09021 break; 09022 } 09023 redirecting->from.name.char_set = data[pos]; 09024 break; 09025 case AST_REDIRECTING_FROM_NAME_PRESENTATION: 09026 if (ie_len != 1) { 09027 ast_log(LOG_WARNING, "Invalid redirecting-from name presentation (%u)\n", 09028 (unsigned) ie_len); 09029 break; 09030 } 09031 redirecting->from.name.presentation = data[pos]; 09032 break; 09033 case AST_REDIRECTING_FROM_NAME_VALID: 09034 if (ie_len != 1) { 09035 ast_log(LOG_WARNING, "Invalid redirecting-from name valid (%u)\n", 09036 (unsigned) ie_len); 09037 break; 09038 } 09039 redirecting->from.name.valid = data[pos]; 09040 break; 09041 /* Redirecting-from party id number */ 09042 case AST_REDIRECTING_FROM_NUMBER: 09043 ast_free(redirecting->from.number.str); 09044 redirecting->from.number.str = ast_malloc(ie_len + 1); 09045 if (redirecting->from.number.str) { 09046 memcpy(redirecting->from.number.str, data + pos, ie_len); 09047 redirecting->from.number.str[ie_len] = 0; 09048 } 09049 break; 09050 case AST_REDIRECTING_FROM_NUMBER_PLAN: 09051 if (ie_len != 1) { 09052 ast_log(LOG_WARNING, "Invalid redirecting-from numbering plan (%u)\n", 09053 (unsigned) ie_len); 09054 break; 09055 } 09056 redirecting->from.number.plan = data[pos]; 09057 break; 09058 case AST_REDIRECTING_FROM_NUMBER_PRESENTATION: 09059 if (ie_len != 1) { 09060 ast_log(LOG_WARNING, "Invalid redirecting-from number presentation (%u)\n", 09061 (unsigned) ie_len); 09062 break; 09063 } 09064 redirecting->from.number.presentation = data[pos]; 09065 break; 09066 case AST_REDIRECTING_FROM_NUMBER_VALID: 09067 if (ie_len != 1) { 09068 ast_log(LOG_WARNING, "Invalid redirecting-from number valid (%u)\n", 09069 (unsigned) ie_len); 09070 break; 09071 } 09072 redirecting->from.number.valid = data[pos]; 09073 break; 09074 /* Redirecting-from party id combined presentation */ 09075 case AST_REDIRECTING_FROM_ID_PRESENTATION: 09076 if (ie_len != 1) { 09077 ast_log(LOG_WARNING, "Invalid redirecting-from combined presentation (%u)\n", 09078 (unsigned) ie_len); 09079 break; 09080 } 09081 from_combined_presentation = data[pos]; 09082 got_from_combined_presentation = 1; 09083 break; 09084 /* Redirecting-from party id subaddress */ 09085 case AST_REDIRECTING_FROM_SUBADDRESS: 09086 ast_free(redirecting->from.subaddress.str); 09087 redirecting->from.subaddress.str = ast_malloc(ie_len + 1); 09088 if (redirecting->from.subaddress.str) { 09089 memcpy(redirecting->from.subaddress.str, data + pos, ie_len); 09090 redirecting->from.subaddress.str[ie_len] = 0; 09091 } 09092 break; 09093 case AST_REDIRECTING_FROM_SUBADDRESS_TYPE: 09094 if (ie_len != 1) { 09095 ast_log(LOG_WARNING, "Invalid redirecting-from type of subaddress (%u)\n", 09096 (unsigned) ie_len); 09097 break; 09098 } 09099 redirecting->from.subaddress.type = data[pos]; 09100 break; 09101 case AST_REDIRECTING_FROM_SUBADDRESS_ODD_EVEN: 09102 if (ie_len != 1) { 09103 ast_log(LOG_WARNING, 09104 "Invalid redirecting-from subaddress odd-even indicator (%u)\n", 09105 (unsigned) ie_len); 09106 break; 09107 } 09108 redirecting->from.subaddress.odd_even_indicator = data[pos]; 09109 break; 09110 case AST_REDIRECTING_FROM_SUBADDRESS_VALID: 09111 if (ie_len != 1) { 09112 ast_log(LOG_WARNING, "Invalid redirecting-from subaddress valid (%u)\n", 09113 (unsigned) ie_len); 09114 break; 09115 } 09116 redirecting->from.subaddress.valid = data[pos]; 09117 break; 09118 /* Redirecting-from party id tag */ 09119 case AST_REDIRECTING_FROM_TAG: 09120 ast_free(redirecting->from.tag); 09121 redirecting->from.tag = ast_malloc(ie_len + 1); 09122 if (redirecting->from.tag) { 09123 memcpy(redirecting->from.tag, data + pos, ie_len); 09124 redirecting->from.tag[ie_len] = 0; 09125 } 09126 break; 09127 /* Redirecting-to party id name */ 09128 case AST_REDIRECTING_TO_NAME: 09129 ast_free(redirecting->to.name.str); 09130 redirecting->to.name.str = ast_malloc(ie_len + 1); 09131 if (redirecting->to.name.str) { 09132 memcpy(redirecting->to.name.str, data + pos, ie_len); 09133 redirecting->to.name.str[ie_len] = 0; 09134 } 09135 break; 09136 case AST_REDIRECTING_TO_NAME_CHAR_SET: 09137 if (ie_len != 1) { 09138 ast_log(LOG_WARNING, "Invalid redirecting-to name char set (%u)\n", 09139 (unsigned) ie_len); 09140 break; 09141 } 09142 redirecting->to.name.char_set = data[pos]; 09143 break; 09144 case AST_REDIRECTING_TO_NAME_PRESENTATION: 09145 if (ie_len != 1) { 09146 ast_log(LOG_WARNING, "Invalid redirecting-to name presentation (%u)\n", 09147 (unsigned) ie_len); 09148 break; 09149 } 09150 redirecting->to.name.presentation = data[pos]; 09151 break; 09152 case AST_REDIRECTING_TO_NAME_VALID: 09153 if (ie_len != 1) { 09154 ast_log(LOG_WARNING, "Invalid redirecting-to name valid (%u)\n", 09155 (unsigned) ie_len); 09156 break; 09157 } 09158 redirecting->to.name.valid = data[pos]; 09159 break; 09160 /* Redirecting-to party id number */ 09161 case AST_REDIRECTING_TO_NUMBER: 09162 ast_free(redirecting->to.number.str); 09163 redirecting->to.number.str = ast_malloc(ie_len + 1); 09164 if (redirecting->to.number.str) { 09165 memcpy(redirecting->to.number.str, data + pos, ie_len); 09166 redirecting->to.number.str[ie_len] = 0; 09167 } 09168 break; 09169 case AST_REDIRECTING_TO_NUMBER_PLAN: 09170 if (ie_len != 1) { 09171 ast_log(LOG_WARNING, "Invalid redirecting-to numbering plan (%u)\n", 09172 (unsigned) ie_len); 09173 break; 09174 } 09175 redirecting->to.number.plan = data[pos]; 09176 break; 09177 case AST_REDIRECTING_TO_NUMBER_PRESENTATION: 09178 if (ie_len != 1) { 09179 ast_log(LOG_WARNING, "Invalid redirecting-to number presentation (%u)\n", 09180 (unsigned) ie_len); 09181 break; 09182 } 09183 redirecting->to.number.presentation = data[pos]; 09184 break; 09185 case AST_REDIRECTING_TO_NUMBER_VALID: 09186 if (ie_len != 1) { 09187 ast_log(LOG_WARNING, "Invalid redirecting-to number valid (%u)\n", 09188 (unsigned) ie_len); 09189 break; 09190 } 09191 redirecting->to.number.valid = data[pos]; 09192 break; 09193 /* Redirecting-to party id combined presentation */ 09194 case AST_REDIRECTING_TO_ID_PRESENTATION: 09195 if (ie_len != 1) { 09196 ast_log(LOG_WARNING, "Invalid redirecting-to combined presentation (%u)\n", 09197 (unsigned) ie_len); 09198 break; 09199 } 09200 to_combined_presentation = data[pos]; 09201 got_to_combined_presentation = 1; 09202 break; 09203 /* Redirecting-to party id subaddress */ 09204 case AST_REDIRECTING_TO_SUBADDRESS: 09205 ast_free(redirecting->to.subaddress.str); 09206 redirecting->to.subaddress.str = ast_malloc(ie_len + 1); 09207 if (redirecting->to.subaddress.str) { 09208 memcpy(redirecting->to.subaddress.str, data + pos, ie_len); 09209 redirecting->to.subaddress.str[ie_len] = 0; 09210 } 09211 break; 09212 case AST_REDIRECTING_TO_SUBADDRESS_TYPE: 09213 if (ie_len != 1) { 09214 ast_log(LOG_WARNING, "Invalid redirecting-to type of subaddress (%u)\n", 09215 (unsigned) ie_len); 09216 break; 09217 } 09218 redirecting->to.subaddress.type = data[pos]; 09219 break; 09220 case AST_REDIRECTING_TO_SUBADDRESS_ODD_EVEN: 09221 if (ie_len != 1) { 09222 ast_log(LOG_WARNING, 09223 "Invalid redirecting-to subaddress odd-even indicator (%u)\n", 09224 (unsigned) ie_len); 09225 break; 09226 } 09227 redirecting->to.subaddress.odd_even_indicator = data[pos]; 09228 break; 09229 case AST_REDIRECTING_TO_SUBADDRESS_VALID: 09230 if (ie_len != 1) { 09231 ast_log(LOG_WARNING, "Invalid redirecting-to subaddress valid (%u)\n", 09232 (unsigned) ie_len); 09233 break; 09234 } 09235 redirecting->to.subaddress.valid = data[pos]; 09236 break; 09237 /* Redirecting-to party id tag */ 09238 case AST_REDIRECTING_TO_TAG: 09239 ast_free(redirecting->to.tag); 09240 redirecting->to.tag = ast_malloc(ie_len + 1); 09241 if (redirecting->to.tag) { 09242 memcpy(redirecting->to.tag, data + pos, ie_len); 09243 redirecting->to.tag[ie_len] = 0; 09244 } 09245 break; 09246 /* Redirecting reason */ 09247 case AST_REDIRECTING_REASON: 09248 if (ie_len != sizeof(value)) { 09249 ast_log(LOG_WARNING, "Invalid redirecting reason (%u)\n", 09250 (unsigned) ie_len); 09251 break; 09252 } 09253 memcpy(&value, data + pos, sizeof(value)); 09254 redirecting->reason = ntohl(value); 09255 break; 09256 /* Redirecting count */ 09257 case AST_REDIRECTING_COUNT: 09258 if (ie_len != sizeof(value)) { 09259 ast_log(LOG_WARNING, "Invalid redirecting count (%u)\n", 09260 (unsigned) ie_len); 09261 break; 09262 } 09263 memcpy(&value, data + pos, sizeof(value)); 09264 redirecting->count = ntohl(value); 09265 break; 09266 /* Redirecting unknown element */ 09267 default: 09268 ast_debug(1, "Unknown redirecting element: %u (%u)\n", 09269 (unsigned) ie_id, (unsigned) ie_len); 09270 break; 09271 } 09272 } 09273 09274 switch (frame_version) { 09275 case 1: 09276 /* 09277 * The other end is an earlier version that we need to adjust 09278 * for compatibility. 09279 */ 09280 redirecting->from.name.valid = 1; 09281 redirecting->from.name.char_set = AST_PARTY_CHAR_SET_ISO8859_1; 09282 redirecting->from.number.valid = 1; 09283 if (got_from_combined_presentation) { 09284 redirecting->from.name.presentation = from_combined_presentation; 09285 redirecting->from.number.presentation = from_combined_presentation; 09286 } 09287 09288 redirecting->to.name.valid = 1; 09289 redirecting->to.name.char_set = AST_PARTY_CHAR_SET_ISO8859_1; 09290 redirecting->to.number.valid = 1; 09291 if (got_to_combined_presentation) { 09292 redirecting->to.name.presentation = to_combined_presentation; 09293 redirecting->to.number.presentation = to_combined_presentation; 09294 } 09295 break; 09296 case 2: 09297 /* The other end is at the same level as we are. */ 09298 break; 09299 default: 09300 /* 09301 * The other end is newer than we are. 09302 * We need to assume that they are compatible with us. 09303 */ 09304 ast_debug(1, "Redirecting frame has newer version: %u\n", 09305 (unsigned) frame_version); 09306 break; 09307 } 09308 09309 return 0; 09310 }
| 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 |
| NULL | failure | |
| non-NULL | channel on success |
Definition at line 5529 of file channel.c.
References AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, AST_CAUSE_NOSUCHDRIVER, AST_CAUSE_NOTDEFINED, 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(), ast_channel_tech::capabilities, LOG_WARNING, ast_channel_tech::requester, set_security_requirements(), chanlist::tech, and ast_channel_tech::type.
Referenced by __ast_request_and_dial(), alloc_playback_chan(), ast_call_forward(), attempt_reconnect(), begin_dial_channel(), build_conf(), chanavail_exec(), conf_run(), conf_start_record(), connect_link(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), ring_entry(), rpt(), rpt_call(), rpt_exec(), rpt_tele_thread(), and wait_for_answer().
05530 { 05531 struct chanlist *chan; 05532 struct ast_channel *c; 05533 int res; 05534 int foo; 05535 05536 if (!cause) 05537 cause = &foo; 05538 *cause = AST_CAUSE_NOTDEFINED; 05539 05540 if (AST_RWLIST_RDLOCK(&backends)) { 05541 ast_log(LOG_WARNING, "Unable to lock technology backend list\n"); 05542 return NULL; 05543 } 05544 05545 AST_RWLIST_TRAVERSE(&backends, chan, list) { 05546 struct ast_format_cap *tmp_cap; 05547 struct ast_format tmp_fmt; 05548 struct ast_format best_audio_fmt; 05549 struct ast_format_cap *joint_cap; 05550 05551 if (strcasecmp(type, chan->tech->type)) 05552 continue; 05553 05554 ast_format_clear(&best_audio_fmt); 05555 /* find the best audio format to use */ 05556 if ((tmp_cap = ast_format_cap_get_type(request_cap, AST_FORMAT_TYPE_AUDIO))) { 05557 /* We have audio - is it possible to connect the various calls to each other? 05558 (Avoid this check for calls without audio, like text+video calls) 05559 */ 05560 res = ast_translator_best_choice(tmp_cap, chan->tech->capabilities, &tmp_fmt, &best_audio_fmt); 05561 ast_format_cap_destroy(tmp_cap); 05562 if (res < 0) { 05563 char tmp1[256], tmp2[256]; 05564 ast_log(LOG_WARNING, "No translator path exists for channel type %s (native %s) to %s\n", type, 05565 ast_getformatname_multiple(tmp1, sizeof(tmp1), chan->tech->capabilities), 05566 ast_getformatname_multiple(tmp2, sizeof(tmp2), request_cap)); 05567 *cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL; 05568 AST_RWLIST_UNLOCK(&backends); 05569 return NULL; 05570 } 05571 } 05572 AST_RWLIST_UNLOCK(&backends); 05573 if (!chan->tech->requester) 05574 return NULL; 05575 05576 /* XXX Only the audio format calculated as being the best for translation 05577 * purposes is used for the request. This needs to be re-evaluated. It may be 05578 * a better choice to send all the audio formats capable of being translated 05579 * during the request and allow the channel drivers to pick the best one. */ 05580 if (!(joint_cap = ast_format_cap_dup(request_cap))) { 05581 return NULL; 05582 } 05583 ast_format_cap_remove_bytype(joint_cap, AST_FORMAT_TYPE_AUDIO); 05584 ast_format_cap_add(joint_cap, &best_audio_fmt); 05585 05586 if (!(c = chan->tech->requester(type, joint_cap, requestor, addr, cause))) { 05587 ast_format_cap_destroy(joint_cap); 05588 return NULL; 05589 } 05590 joint_cap = ast_format_cap_destroy(joint_cap); 05591 05592 if (set_security_requirements(requestor, c)) { 05593 ast_log(LOG_WARNING, "Setting security requirements failed\n"); 05594 c = ast_channel_release(c); 05595 *cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL; 05596 return NULL; 05597 } 05598 05599 /* no need to generate a Newchannel event here; it is done in the channel_alloc call */ 05600 return c; 05601 } 05602 05603 ast_log(LOG_WARNING, "No channel type registered for '%s'\n", type); 05604 *cause = AST_CAUSE_NOSUCHDRIVER; 05605 AST_RWLIST_UNLOCK(&backends); 05606 05607 return NULL; 05608 }
| 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 5484 of file channel.c.
References __ast_request_and_dial().
Referenced by ast_pbx_outgoing_exten(), and generic_recall().
05485 { 05486 return __ast_request_and_dial(type, cap, requestor, addr, timeout, outstate, cidnum, cidname, NULL); 05487 }
| 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 |
Definition at line 1697 of file channel.c.
References ast_safe_sleep_conditional().
Referenced by __analog_ss_thread(), alarmreceiver_exec(), analog_ss_thread(), ast_adsi_transmit_message_full(), ast_dtmf_stream(), ast_senddigit(), builtin_atxfer(), builtin_parkcall(), conf_run(), dictate_exec(), disa_exec(), flash_exec(), function_ilink(), handle_callforward_button(), login_exec(), mgcp_ss(), milliwatt_exec(), misdn_check_l2l1(), old_milliwatt_exec(), park_call_exec(), pbx_builtin_wait(), play_moh_exec(), play_tone_pair(), playtone(), privacy_exec(), receive_ademco_contact_id(), rpt_call(), rpt_exec(), rpt_tele_thread(), send_morse(), send_tone_telemetry(), skinny_ss(), testclient_exec(), testserver_exec(), try_calling(), wait_for_hangup(), wait_interval(), wait_moh_exec(), waituntil_exec(), and zapateller_exec().
01698 { 01699 return ast_safe_sleep_conditional(chan, ms, NULL, NULL); 01700 }
| int ast_safe_sleep_conditional | ( | struct ast_channel * | chan, | |
| int | 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 |
Definition at line 1630 of file channel.c.
References 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_waitfor(), cond, and ast_channel::generatordata.
Referenced by ast_safe_sleep(), and login_exec().
01631 { 01632 struct ast_frame *f; 01633 struct ast_silence_generator *silgen = NULL; 01634 int res = 0; 01635 AST_LIST_HEAD_NOLOCK(, ast_frame) deferred_frames; 01636 01637 AST_LIST_HEAD_INIT_NOLOCK(&deferred_frames); 01638 01639 /* If no other generator is present, start silencegen while waiting */ 01640 if (ast_opt_transmit_silence && !chan->generatordata) { 01641 silgen = ast_channel_start_silence_generator(chan); 01642 } 01643 01644 while (ms > 0) { 01645 struct ast_frame *dup_f = NULL; 01646 if (cond && ((*cond)(data) == 0)) { 01647 break; 01648 } 01649 ms = ast_waitfor(chan, ms); 01650 if (ms < 0) { 01651 res = -1; 01652 break; 01653 } 01654 if (ms > 0) { 01655 f = ast_read(chan); 01656 if (!f) { 01657 res = -1; 01658 break; 01659 } 01660 01661 if (!ast_is_deferrable_frame(f)) { 01662 ast_frfree(f); 01663 continue; 01664 } 01665 01666 if ((dup_f = ast_frisolate(f))) { 01667 if (dup_f != f) { 01668 ast_frfree(f); 01669 } 01670 AST_LIST_INSERT_HEAD(&deferred_frames, dup_f, frame_list); 01671 } 01672 } 01673 } 01674 01675 /* stop silgen if present */ 01676 if (silgen) { 01677 ast_channel_stop_silence_generator(chan, silgen); 01678 } 01679 01680 /* We need to free all the deferred frames, but we only need to 01681 * queue the deferred frames if there was no error and no 01682 * hangup was received 01683 */ 01684 ast_channel_lock(chan); 01685 while ((f = AST_LIST_REMOVE_HEAD(&deferred_frames, frame_list))) { 01686 if (!res) { 01687 ast_queue_frame_head(chan, f); 01688 } 01689 ast_frfree(f); 01690 } 01691 ast_channel_unlock(chan); 01692 01693 return res; 01694 }
| 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 4502 of file channel.c.
References AST_DEFAULT_EMULATE_DTMF_DURATION, ast_safe_sleep(), ast_senddigit_begin(), ast_senddigit_end(), ast_channel_tech::send_digit_begin, and ast_channel::tech.
Referenced by ast_dtmf_stream(), dial_exec_full(), do_dtmf_phone(), manager_play_dtmf(), and rpt_call().
04503 { 04504 if (chan->tech->send_digit_begin) { 04505 ast_senddigit_begin(chan, digit); 04506 ast_safe_sleep(chan, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION)); 04507 } 04508 04509 return ast_senddigit_end(chan, digit, (duration >= AST_DEFAULT_EMULATE_DTMF_DURATION ? duration : AST_DEFAULT_EMULATE_DTMF_DURATION)); 04510 }
| 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 4444 of file channel.c.
References ast_channel_name(), ast_debug, ast_playtones_start(), ast_channel_tech::send_digit_begin, and ast_channel::tech.
Referenced by agent_digit_begin(), ast_senddigit(), and ast_write().
04445 { 04446 /* Device does not support DTMF tones, lets fake 04447 * it by doing our own generation. */ 04448 static const char * const dtmf_tones[] = { 04449 "941+1336", /* 0 */ 04450 "697+1209", /* 1 */ 04451 "697+1336", /* 2 */ 04452 "697+1477", /* 3 */ 04453 "770+1209", /* 4 */ 04454 "770+1336", /* 5 */ 04455 "770+1477", /* 6 */ 04456 "852+1209", /* 7 */ 04457 "852+1336", /* 8 */ 04458 "852+1477", /* 9 */ 04459 "697+1633", /* A */ 04460 "770+1633", /* B */ 04461 "852+1633", /* C */ 04462 "941+1633", /* D */ 04463 "941+1209", /* * */ 04464 "941+1477" /* # */ 04465 }; 04466 04467 if (!chan->tech->send_digit_begin) 04468 return 0; 04469 04470 if (!chan->tech->send_digit_begin(chan, digit)) 04471 return 0; 04472 04473 if (digit >= '0' && digit <='9') 04474 ast_playtones_start(chan, 0, dtmf_tones[digit-'0'], 0); 04475 else if (digit >= 'A' && digit <= 'D') 04476 ast_playtones_start(chan, 0, dtmf_tones[digit-'A'+10], 0); 04477 else if (digit == '*') 04478 ast_playtones_start(chan, 0, dtmf_tones[14], 0); 04479 else if (digit == '#') 04480 ast_playtones_start(chan, 0, dtmf_tones[15], 0); 04481 else { 04482 /* not handled */ 04483 ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, ast_channel_name(chan)); 04484 } 04485 04486 return 0; 04487 }
| 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 4489 of file channel.c.
References ast_playtones_stop(), ast_channel::generator, ast_channel_tech::send_digit_end, and ast_channel::tech.
Referenced by agent_digit_end(), ast_senddigit(), and ast_write().
04490 { 04491 int res = -1; 04492 04493 if (chan->tech->send_digit_end) 04494 res = chan->tech->send_digit_end(chan, digit, duration); 04495 04496 if (res && chan->generator) 04497 ast_playtones_stop(chan); 04498 04499 return 0; 04500 }
| 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 |
| 0 | on success | |
| -1 | on failure |
Definition at line 4406 of file channel.c.
References ast_channel_lock, 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_channel::nativeformats, ast_frame::offset, ast_frame::ptr, ast_channel_tech::send_text, ast_frame::seqno, ast_frame::src, ast_frame::subclass, ast_channel::tech, and ast_channel_tech::write_text.
Referenced by action_sendtext(), agent_sendtext(), handle_sendtext(), send_newkey(), and sendtext_exec().
04407 { 04408 int res = 0; 04409 04410 ast_channel_lock(chan); 04411 /* Stop if we're a zombie or need a soft hangup */ 04412 if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) { 04413 ast_channel_unlock(chan); 04414 return -1; 04415 } 04416 04417 if (ast_strlen_zero(text)) { 04418 ast_channel_unlock(chan); 04419 return 0; 04420 } 04421 04422 CHECK_BLOCKING(chan); 04423 if (chan->tech->write_text && (ast_format_cap_has_type(chan->nativeformats, AST_FORMAT_TYPE_TEXT))) { 04424 struct ast_frame f; 04425 04426 f.frametype = AST_FRAME_TEXT; 04427 f.src = "DIALPLAN"; 04428 f.mallocd = AST_MALLOCD_DATA; 04429 f.datalen = strlen(text); 04430 f.data.ptr = ast_strdup(text); 04431 f.offset = 0; 04432 f.seqno = 0; 04433 04434 ast_format_set(&f.subclass.format, AST_FORMAT_T140, 0); 04435 res = chan->tech->write_text(chan, &f); 04436 } else if (chan->tech->send_text) { 04437 res = chan->tech->send_text(chan, text); 04438 } 04439 ast_clear_flag(chan, AST_FLAG_BLOCKING); 04440 ast_channel_unlock(chan); 04441 return res; 04442 }
| 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.
The channel does not need to be locked before calling this function.
Definition at line 6823 of file channel.c.
References ast_party_caller::ani, ast_cdr_setcid(), ast_channel_lock, ast_channel_unlock, ast_free, ast_strdup, ast_channel::caller, ast_channel::cdr, ast_party_caller::id, 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(), analog_ss_thread(), cb_events(), disa_exec(), get_pai(), get_rpid(), handle_setcallerid(), mgcp_ss(), privacy_exec(), ring_entry(), rpt_exec(), skinny_newcall(), and socket_process().
06824 { 06825 ast_channel_lock(chan); 06826 06827 if (cid_num) { 06828 chan->caller.id.number.valid = 1; 06829 ast_free(chan->caller.id.number.str); 06830 chan->caller.id.number.str = ast_strdup(cid_num); 06831 } 06832 if (cid_name) { 06833 chan->caller.id.name.valid = 1; 06834 ast_free(chan->caller.id.name.str); 06835 chan->caller.id.name.str = ast_strdup(cid_name); 06836 } 06837 if (cid_ani) { 06838 chan->caller.ani.number.valid = 1; 06839 ast_free(chan->caller.ani.number.str); 06840 chan->caller.ani.number.str = ast_strdup(cid_ani); 06841 } 06842 if (chan->cdr) { 06843 ast_cdr_setcid(chan->cdr, chan); 06844 } 06845 06846 report_new_callerid(chan); 06847 06848 ast_channel_unlock(chan); 06849 }
| 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 |
Definition at line 2555 of file channel.c.
References ast_bridged_channel(), ast_channel_hangupsource(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero(), and ast_channel::bridge.
Referenced by __dahdi_exception(), func_channel_write_real(), handle_hangup(), handle_request_bye(), handle_request_cancel(), handle_response_invite(), pbx_builtin_hangup(), and set_hangup_source_and_cause().
02556 { 02557 struct ast_channel *bridge; 02558 02559 ast_channel_lock(chan); 02560 if (force || ast_strlen_zero(ast_channel_hangupsource(chan))) { 02561 ast_channel_hangupsource_set(chan, source); 02562 } 02563 bridge = ast_bridged_channel(chan); 02564 ast_channel_unlock(chan); 02565 02566 if (bridge && (force || ast_strlen_zero(ast_channel_hangupsource(bridge)))) { 02567 ast_channel_lock(bridge); 02568 ast_channel_hangupsource_set(chan, source); 02569 ast_channel_unlock(bridge); 02570 } 02571 }
| 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 5056 of file channel.c.
References ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_channel::rawreadformat, ast_channel::readformat, ast_channel::readtrans, and set_format().
Referenced by __ast_play_and_record(), __oh323_update_info(), ast_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_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(), speech_background(), transmit_audio(), and unistim_rtp_read().
05057 { 05058 struct ast_format_cap *cap = ast_format_cap_alloc_nolock(); 05059 int res; 05060 if (!cap) { 05061 return -1; 05062 } 05063 ast_format_cap_add(cap, format); 05064 05065 res = set_format(chan, 05066 cap, 05067 &chan->rawreadformat, 05068 &chan->readformat, 05069 &chan->readtrans, 05070 0); 05071 05072 ast_format_cap_destroy(cap); 05073 return res; 05074 }
| 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 5076 of file channel.c.
References ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_format_set(), ast_channel::rawreadformat, ast_channel::readformat, ast_channel::readtrans, and set_format().
Referenced by __ast_play_and_record(), alarmreceiver_exec(), ast_adsi_transmit_message_full(), attempt_reconnect(), background_detect_exec(), build_conf(), conf_run(), connect_link(), 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(), old_milliwatt_exec(), record_exec(), rpt(), rpt_exec(), and transmit_audio().
05077 { 05078 struct ast_format_cap *cap = ast_format_cap_alloc_nolock(); 05079 struct ast_format tmp_format; 05080 int res; 05081 if (!cap) { 05082 return -1; 05083 } 05084 ast_format_cap_add(cap, ast_format_set(&tmp_format, id, 0)); 05085 05086 res = set_format(chan, 05087 cap, 05088 &chan->rawreadformat, 05089 &chan->readformat, 05090 &chan->readtrans, 05091 0); 05092 05093 ast_format_cap_destroy(cap); 05094 return res; 05095 }
| 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.
Definition at line 5097 of file channel.c.
References ast_channel::rawreadformat, ast_channel::readformat, ast_channel::readtrans, and set_format().
Referenced by agent_call(), and login_exec().
05098 { 05099 return set_format(chan, 05100 cap, 05101 &chan->rawreadformat, 05102 &chan->readformat, 05103 &chan->readtrans, 05104 0); 05105 }
| 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 |
Definition at line 8004 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().
08005 { 08006 struct ast_variable *cur; 08007 08008 for (cur = vars; cur; cur = cur->next) 08009 pbx_builtin_setvar_helper(chan, cur->name, cur->value); 08010 }
| 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 5107 of file channel.c.
References ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_channel::rawwriteformat, set_format(), ast_channel::writeformat, and ast_channel::writetrans.
Referenced by __oh323_update_info(), ast_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_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(), tonepair_release(), transmit_audio(), and unistim_rtp_read().
05108 { 05109 struct ast_format_cap *cap = ast_format_cap_alloc_nolock(); 05110 int res; 05111 if (!cap) { 05112 return -1; 05113 } 05114 ast_format_cap_add(cap, format); 05115 05116 res = set_format(chan, 05117 cap, 05118 &chan->rawwriteformat, 05119 &chan->writeformat, 05120 &chan->writetrans, 05121 1); 05122 05123 ast_format_cap_destroy(cap); 05124 return res; 05125 }
| 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 5127 of file channel.c.
References ast_format_cap_add(), ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_format_set(), ast_channel::rawwriteformat, set_format(), ast_channel::writeformat, and ast_channel::writetrans.
Referenced by alarmreceiver_exec(), ast_adsi_transmit_message_full(), ast_channel_start_silence_generator(), ast_write(), attempt_reconnect(), build_conf(), chanspy_exec(), conf_run(), connect_link(), dahdiscan_exec(), extenspy_exec(), fax_gateway_framehook(), generic_fax_exec(), jack_exec(), linear_alloc(), mp3_exec(), NBScat_exec(), old_milliwatt_exec(), playtones_alloc(), rpt(), rpt_exec(), send_waveform_to_channel(), tonepair_alloc(), and transmit_audio().
05128 { 05129 struct ast_format_cap *cap = ast_format_cap_alloc_nolock(); 05130 struct ast_format tmp_format; 05131 int res; 05132 if (!cap) { 05133 return -1; 05134 } 05135 ast_format_cap_add(cap, ast_format_set(&tmp_format, id, 0)); 05136 05137 res = set_format(chan, 05138 cap, 05139 &chan->rawwriteformat, 05140 &chan->writeformat, 05141 &chan->writetrans, 05142 1); 05143 05144 ast_format_cap_destroy(cap); 05145 return res; 05146 }
| 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.
Definition at line 5148 of file channel.c.
References ast_channel::rawwriteformat, set_format(), ast_channel::writeformat, and ast_channel::writetrans.
Referenced by agent_call(), ast_openstream_full(), and login_exec().
05149 { 05150 return set_format(chan, 05151 cap, 05152 &chan->rawwriteformat, 05153 &chan->writeformat, 05154 &chan->writetrans, 05155 1); 05156 }
| 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 |
Definition at line 3332 of file channel.c.
References ast_channel_lock, ast_channel_unlock, ast_debug, ast_timer_get_max_rate(), ast_timer_set_rate(), ast_channel::timer, ast_channel::timingdata, ast_channel::timingfd, and ast_channel::timingfunc.
Referenced by ast_activate_generator(), ast_deactivate_generator(), ast_read_generator_actions(), ast_readaudio_callback(), and filestream_close().
03333 { 03334 int res; 03335 unsigned int real_rate = rate, max_rate; 03336 03337 ast_channel_lock(c); 03338 03339 if (c->timingfd == -1) { 03340 ast_channel_unlock(c); 03341 return -1; 03342 } 03343 03344 if (!func) { 03345 rate = 0; 03346 data = NULL; 03347 } 03348 03349 if (rate && rate > (max_rate = ast_timer_get_max_rate(c->timer))) { 03350 real_rate = max_rate; 03351 } 03352 03353 ast_debug(1, "Scheduling timer at (%u requested / %u actual) timer ticks per second\n", rate, real_rate); 03354 03355 res = ast_timer_set_rate(c->timer, real_rate); 03356 03357 c->timingfunc = func; 03358 c->timingdata = data; 03359 03360 ast_channel_unlock(c); 03361 03362 return res; 03363 }
| int ast_shutting_down | ( | void | ) |
Returns non-zero if Asterisk is being shut down.
Definition at line 637 of file channel.c.
Referenced by confbridge_exec(), and handle_request_options().
00638 { 00639 return shutting_down; 00640 }
| 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 |
Definition at line 2518 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_bridge_call(), ast_channel_softhangup_cb(), ast_dial_join(), birdbath(), cc_generic_agent_stop_ringing(), conf_free(), connect_link(), dahdi_handle_event(), flush_telem(), function_ilink(), handle_hangup(), handle_link_data(), handle_softhangup(), login_exec(), manager_park(), mgcp_pktcgate_remove(), read_agent_config(), rpt(), rpt_call(), rpt_do_restart(), rpt_exec(), sla_handle_hold_event(), softhangup_exec(), start_spying(), startmon(), and unload_module().
02519 { 02520 int res; 02521 02522 ast_channel_lock(chan); 02523 res = ast_softhangup_nolock(chan, cause); 02524 manager_event(EVENT_FLAG_CALL, "SoftHangupRequest", 02525 "Channel: %s\r\n" 02526 "Uniqueid: %s\r\n" 02527 "Cause: %d\r\n", 02528 ast_channel_name(chan), 02529 ast_channel_uniqueid(chan), 02530 cause); 02531 ast_channel_unlock(chan); 02532 02533 return res; 02534 }
| 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 2505 of file channel.c.
References ast_channel::_softhangup, ast_channel_name(), ast_debug, AST_FLAG_BLOCKING, ast_null_frame, ast_queue_frame(), ast_test_flag, and ast_channel::blocker.
Referenced by __analog_handle_event(), action_hangup(), ast_async_goto(), ast_softhangup(), attempt_transfer(), check_pendings(), check_rtp_timeout(), dahdi_softhangup_all(), oh323_indicate(), proc_session_timer(), and sip_indicate().
02506 { 02507 ast_debug(1, "Soft-Hanging up channel '%s'\n", ast_channel_name(chan)); 02508 /* Inform channel driver that we need to be hung up, if it cares */ 02509 chan->_softhangup |= cause; 02510 ast_queue_frame(chan, &ast_null_frame); 02511 /* Interrupt any poll call or such */ 02512 if (ast_test_flag(chan, AST_FLAG_BLOCKING)) 02513 pthread_kill(chan->blocker, SIGURG); 02514 return 0; 02515 }
| 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 779 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().
00780 { 00781 char *buf; 00782 00783 switch (state) { 00784 case AST_STATE_DOWN: 00785 return "Down"; 00786 case AST_STATE_RESERVED: 00787 return "Rsrvd"; 00788 case AST_STATE_OFFHOOK: 00789 return "OffHook"; 00790 case AST_STATE_DIALING: 00791 return "Dialing"; 00792 case AST_STATE_RING: 00793 return "Ring"; 00794 case AST_STATE_RINGING: 00795 return "Ringing"; 00796 case AST_STATE_UP: 00797 return "Up"; 00798 case AST_STATE_BUSY: 00799 return "Busy"; 00800 case AST_STATE_DIALING_OFFHOOK: 00801 return "Dialing Offhook"; 00802 case AST_STATE_PRERING: 00803 return "Pre-ring"; 00804 default: 00805 if (!(buf = ast_threadstorage_get(&state2str_threadbuf, STATE2STR_BUFSIZE))) 00806 return "Unknown"; 00807 snprintf(buf, STATE2STR_BUFSIZE, "Unknown (%d)", state); 00808 return buf; 00809 } 00810 }
| 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 765 of file channel.c.
References ARRAY_LEN, cause, and causes.
Referenced by pbx_builtin_hangup().
00766 { 00767 int x; 00768 00769 for (x = 0; x < ARRAY_LEN(causes); x++) 00770 if (!strncasecmp(causes[x].name, name, strlen(causes[x].name))) 00771 return causes[x].cause; 00772 00773 return -1; 00774 }
| 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 7724 of file channel.c.
References ast_frfree, ast_read(), ast_tonepair_start(), ast_waitfor(), and ast_channel::generatordata.
Referenced by zapateller_exec().
07725 { 07726 int res; 07727 07728 if ((res = ast_tonepair_start(chan, freq1, freq2, duration, vol))) 07729 return res; 07730 07731 /* Give us some wiggle room */ 07732 while (chan->generatordata && ast_waitfor(chan, 100) >= 0) { 07733 struct ast_frame *f = ast_read(chan); 07734 if (f) 07735 ast_frfree(f); 07736 else 07737 return -1; 07738 } 07739 return 0; 07740 }
| int ast_tonepair_start | ( | struct ast_channel * | chan, | |
| int | freq1, | |||
| int | freq2, | |||
| int | duration, | |||
| int | vol | |||
| ) |
Start a tone going
Definition at line 7706 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(), play_tone_pair(), rpt_tele_thread(), and sendnoise().
07707 { 07708 struct tonepair_def d = { 0, }; 07709 07710 d.freq1 = freq1; 07711 d.freq2 = freq2; 07712 d.duration = duration; 07713 d.vol = (vol < 1) ? 8192 : vol; /* force invalid to 8192 */ 07714 if (ast_activate_generator(chan, &tonepair, &d)) 07715 return -1; 07716 return 0; 07717 }
| void ast_tonepair_stop | ( | struct ast_channel * | chan | ) |
Stop a tone from playing
Definition at line 7719 of file channel.c.
References ast_deactivate_generator().
Referenced by sendnoise().
07720 { 07721 ast_deactivate_generator(chan); 07722 }
| 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 |
Called by:
Definition at line 5637 of file channel.c.
References ast_channel_lock, 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, ast_channel::tech, and ast_channel_tech::transfer.
Referenced by transfer_exec().
05638 { 05639 int res = -1; 05640 05641 /* Stop if we're a zombie or need a soft hangup */ 05642 ast_channel_lock(chan); 05643 if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) { 05644 if (chan->tech->transfer) { 05645 res = chan->tech->transfer(chan, dest); 05646 if (!res) 05647 res = 1; 05648 } else 05649 res = 0; 05650 } 05651 ast_channel_unlock(chan); 05652 05653 if (res <= 0) { 05654 return res; 05655 } 05656 05657 for (;;) { 05658 struct ast_frame *fr; 05659 05660 res = ast_waitfor(chan, -1); 05661 05662 if (res < 0 || !(fr = ast_read(chan))) { 05663 res = -1; 05664 break; 05665 } 05666 05667 if (fr->frametype == AST_FRAME_CONTROL && fr->subclass.integer == AST_CONTROL_TRANSFER) { 05668 enum ast_control_transfer *message = fr->data.ptr; 05669 05670 if (*message == AST_TRANSFER_SUCCESS) { 05671 res = 1; 05672 } else { 05673 res = -1; 05674 } 05675 05676 ast_frfree(fr); 05677 break; 05678 } 05679 05680 ast_frfree(fr); 05681 } 05682 05683 return res; 05684 }
| 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 813 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(), and oh323_call().
00814 { 00815 switch (transfercapability) { 00816 case AST_TRANS_CAP_SPEECH: 00817 return "SPEECH"; 00818 case AST_TRANS_CAP_DIGITAL: 00819 return "DIGITAL"; 00820 case AST_TRANS_CAP_RESTRICTED_DIGITAL: 00821 return "RESTRICTED_DIGITAL"; 00822 case AST_TRANS_CAP_3_1K_AUDIO: 00823 return "3K1AUDIO"; 00824 case AST_TRANS_CAP_DIGITAL_W_TONES: 00825 return "DIGITAL_W_TONES"; 00826 case AST_TRANS_CAP_VIDEO: 00827 return "VIDEO"; 00828 default: 00829 return "UNKNOWN"; 00830 } 00831 }
| 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 |
| < | 0 on failure | |
| 0 | if nothing ever arrived | |
| the | # of ms remaining otherwise |
Definition at line 3316 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(), dictate_exec(), disa_exec(), disable_t38(), 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().
03317 { 03318 int oldms = ms; /* -1 if no timeout */ 03319 03320 ast_waitfor_nandfds(&c, 1, NULL, 0, NULL, NULL, &ms); 03321 if ((ms < 0) && (oldms < 0)) 03322 ms = 0; 03323 return ms; 03324 }
| 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 3311 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(), rpt(), rpt_exec(), wait_for_answer(), and wait_for_winner().
03312 { 03313 return ast_waitfor_nandfds(c, n, NULL, 0, NULL, NULL, ms); 03314 }
| int ast_waitfor_n_fd | ( | int * | fds, | |
| int | n, | |||
| int * | ms, | |||
| int * | exception | |||
| ) |
Waits for input on an fd.
Definition at line 2952 of file channel.c.
References ast_waitfor_nandfds().
Referenced by dundi_lookup_internal(), dundi_precache_internal(), and softmix_bridge_thread().
02953 { 02954 int winner = -1; 02955 ast_waitfor_nandfds(NULL, 0, fds, n, exception, &winner, ms); 02956 return winner; 02957 }
| 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 |
Definition at line 2964 of file channel.c.
References ast_channel::_softhangup, ast_add_fd(), ast_channel_lock, ast_channel_unlock, ast_clear_flag, ast_do_masquerade(), AST_FLAG_BLOCKING, AST_FLAG_EXCEPTION, ast_log(), AST_MAX_FDS, ast_poll, ast_set_flag, AST_SOFTHANGUP_TIMEOUT, ast_tvcmp(), ast_tvdiff_ms(), ast_tvnow(), ast_tvsub(), ast_tvzero(), CHECK_BLOCKING, errno, ast_channel::fdno, and LOG_WARNING.
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().
02967 { 02968 struct timeval start = { 0 , 0 }; 02969 struct pollfd *pfds = NULL; 02970 int res; 02971 long rms; 02972 int x, y, max; 02973 int sz; 02974 struct timeval now = { 0, 0 }; 02975 struct timeval whentohangup = { 0, 0 }, diff; 02976 struct ast_channel *winner = NULL; 02977 struct fdmap { 02978 int chan; 02979 int fdno; 02980 } *fdmap = NULL; 02981 02982 if ((sz = n * AST_MAX_FDS + nfds)) { 02983 pfds = alloca(sizeof(*pfds) * sz); 02984 fdmap = alloca(sizeof(*fdmap) * sz); 02985 } 02986 02987 if (outfd) 02988 *outfd = -99999; 02989 if (exception) 02990 *exception = 0; 02991 02992 /* Perform any pending masquerades */ 02993 for (x = 0; x < n; x++) { 02994 if (c[x]->masq && ast_do_masquerade(c[x])) { 02995 ast_log(LOG_WARNING, "Masquerade failed\n"); 02996 *ms = -1; 02997 return NULL; 02998 } 02999 03000 ast_channel_lock(c[x]); 03001 if (!ast_tvzero(c[x]->whentohangup)) { 03002 if (ast_tvzero(whentohangup)) 03003 now = ast_tvnow(); 03004 diff = ast_tvsub(c[x]->whentohangup, now); 03005 if (diff.tv_sec < 0 || ast_tvzero(diff)) { 03006 /* Should already be hungup */ 03007 c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT; 03008 ast_channel_unlock(c[x]); 03009 return c[x]; 03010 } 03011 if (ast_tvzero(whentohangup) || ast_tvcmp(diff, whentohangup) < 0) 03012 whentohangup = diff; 03013 } 03014 ast_channel_unlock(c[x]); 03015 } 03016 /* Wait full interval */ 03017 rms = *ms; 03018 /* INT_MAX, not LONG_MAX, because it matters on 64-bit */ 03019 if (!ast_tvzero(whentohangup) && whentohangup.tv_sec < INT_MAX / 1000) { 03020 rms = whentohangup.tv_sec * 1000 + whentohangup.tv_usec / 1000; /* timeout in milliseconds */ 03021 if (*ms >= 0 && *ms < rms) { /* original *ms still smaller */ 03022 rms = *ms; 03023 } 03024 } else if (!ast_tvzero(whentohangup) && rms < 0) { 03025 /* Tiny corner case... call would need to last >24 days */ 03026 rms = INT_MAX; 03027 } 03028 /* 03029 * Build the pollfd array, putting the channels' fds first, 03030 * followed by individual fds. Order is important because 03031 * individual fd's must have priority over channel fds. 03032 */ 03033 max = 0; 03034 for (x = 0; x < n; x++) { 03035 for (y = 0; y < AST_MAX_FDS; y++) { 03036 fdmap[max].fdno = y; /* fd y is linked to this pfds */ 03037 fdmap[max].chan = x; /* channel x is linked to this pfds */ 03038 max += ast_add_fd(&pfds[max], c[x]->fds[y]); 03039 } 03040 CHECK_BLOCKING(c[x]); 03041 } 03042 /* Add the individual fds */ 03043 for (x = 0; x < nfds; x++) { 03044 fdmap[max].chan = -1; 03045 max += ast_add_fd(&pfds[max], fds[x]); 03046 } 03047 03048 if (*ms > 0) 03049 start = ast_tvnow(); 03050 03051 if (sizeof(int) == 4) { /* XXX fix timeout > 600000 on linux x86-32 */ 03052 do { 03053 int kbrms = rms; 03054 if (kbrms > 600000) 03055 kbrms = 600000; 03056 res = ast_poll(pfds, max, kbrms); 03057 if (!res) 03058 rms -= kbrms; 03059 } while (!res && (rms > 0)); 03060 } else { 03061 res = ast_poll(pfds, max, rms); 03062 } 03063 for (x = 0; x < n; x++) 03064 ast_clear_flag(c[x], AST_FLAG_BLOCKING); 03065 if (res < 0) { /* Simulate a timeout if we were interrupted */ 03066 if (errno != EINTR) 03067 *ms = -1; 03068 return NULL; 03069 } 03070 if (!ast_tvzero(whentohangup)) { /* if we have a timeout, check who expired */ 03071 now = ast_tvnow(); 03072 for (x = 0; x < n; x++) { 03073 if (!ast_tvzero(c[x]->whentohangup) && ast_tvcmp(c[x]->whentohangup, now) <= 0) { 03074 c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT; 03075 if (winner == NULL) 03076 winner = c[x]; 03077 } 03078 } 03079 } 03080 if (res == 0) { /* no fd ready, reset timeout and done */ 03081 *ms = 0; /* XXX use 0 since we may not have an exact timeout. */ 03082 return winner; 03083 } 03084 /* 03085 * Then check if any channel or fd has a pending event. 03086 * Remember to check channels first and fds last, as they 03087 * must have priority on setting 'winner' 03088 */ 03089 for (x = 0; x < max; x++) { 03090 res = pfds[x].revents; 03091 if (res == 0) 03092 continue; 03093 if (fdmap[x].chan >= 0) { /* this is a channel */ 03094 winner = c[fdmap[x].chan]; /* override previous winners */ 03095 if (res & POLLPRI) 03096 ast_set_flag(winner, AST_FLAG_EXCEPTION); 03097 else 03098 ast_clear_flag(winner, AST_FLAG_EXCEPTION); 03099 winner->fdno = fdmap[x].fdno; 03100 } else { /* this is an fd */ 03101 if (outfd) 03102 *outfd = pfds[x].fd; 03103 if (exception) 03104 *exception = (res & POLLPRI) ? -1 : 0; 03105 winner = NULL; 03106 } 03107 } 03108 if (*ms > 0) { 03109 *ms -= ast_tvdiff_ms(ast_tvnow(), start); 03110 if (*ms < 0) 03111 *ms = 0; 03112 } 03113 return winner; 03114 }
| 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 |
Definition at line 3327 of file channel.c.
References ast_waitfordigit_full().
Referenced by __analog_ss_thread(), _while_exec(), advanced_options(), analog_my_getsigstr(), analog_ss_thread(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_print(), ast_adsi_read_encoded_dtmf(), ast_adsi_transmit_message_full(), ast_app_dtget(), ast_control_streamfile(), ast_record_review(), bridge_channel_feature(), builtin_atxfer(), collect_digits(), common_exec(), cpeid_exec(), dialout(), directory_exec(), forward_message(), get_folder(), ivr_dispatch(), mgcp_ss(), my_getsigstr(), pbx_builtin_waitexten(), play_record_review(), 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().
03328 { 03329 return ast_waitfordigit_full(c, ms, -1, -1); 03330 }
| 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 | |
| audiofd | audio file descriptor to write to if audio frames are received | |
| ctrlfd | control file descriptor to monitor for reading |
Definition at line 3365 of file channel.c.
References ast_check_hangup(), ast_clear_flag, AST_CONTROL_ANSWER, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_HANGUP, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, 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_set_flag, ast_test_flag, 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().
03366 { 03367 /* Stop if we're a zombie or need a soft hangup */ 03368 if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) 03369 return -1; 03370 03371 /* Only look for the end of DTMF, don't bother with the beginning and don't emulate things */ 03372 ast_set_flag(c, AST_FLAG_END_DTMF_ONLY); 03373 03374 /* Wait for a digit, no more than ms milliseconds total. */ 03375 03376 while (ms) { 03377 struct ast_channel *rchan; 03378 int outfd=-1; 03379 03380 errno = 0; 03381 rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms); 03382 03383 if (!rchan && outfd < 0 && ms) { 03384 if (errno == 0 || errno == EINTR) 03385 continue; 03386 ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno)); 03387 ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY); 03388 return -1; 03389 } else if (outfd > -1) { 03390 /* The FD we were watching has something waiting */ 03391 ast_log(LOG_WARNING, "The FD we were waiting for has something waiting. Waitfordigit returning numeric 1\n"); 03392 ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY); 03393 return 1; 03394 } else if (rchan) { 03395 int res; 03396 struct ast_frame *f = ast_read(c); 03397 if (!f) 03398 return -1; 03399 03400 switch (f->frametype) { 03401 case AST_FRAME_DTMF_BEGIN: 03402 break; 03403 case AST_FRAME_DTMF_END: 03404 res = f->subclass.integer; 03405 ast_frfree(f); 03406 ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY); 03407 return res; 03408 case AST_FRAME_CONTROL: 03409 switch (f->subclass.integer) { 03410 case AST_CONTROL_HANGUP: 03411 ast_frfree(f); 03412 ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY); 03413 return -1; 03414 case AST_CONTROL_RINGING: 03415 case AST_CONTROL_ANSWER: 03416 case AST_CONTROL_SRCUPDATE: 03417 case AST_CONTROL_SRCCHANGE: 03418 case AST_CONTROL_CONNECTED_LINE: 03419 case AST_CONTROL_REDIRECTING: 03420 case AST_CONTROL_UPDATE_RTP_PEER: 03421 case -1: 03422 /* Unimportant */ 03423 break; 03424 default: 03425 ast_log(LOG_WARNING, "Unexpected control subclass '%d'\n", f->subclass.integer); 03426 break; 03427 } 03428 break; 03429 case AST_FRAME_VOICE: 03430 /* Write audio if appropriate */ 03431 if (audiofd > -1) { 03432 if (write(audiofd, f->data.ptr, f->datalen) < 0) { 03433 ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); 03434 } 03435 } 03436 default: 03437 /* Ignore */ 03438 break; 03439 } 03440 ast_frfree(f); 03441 } 03442 } 03443 03444 ast_clear_flag(c, AST_FLAG_END_DTMF_ONLY); 03445 03446 return 0; /* Time is up */ 03447 }
| 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 4644 of file channel.c.
References ast_channel::_softhangup, apply_plc(), ast_audiohook_detach_list(), AST_AUDIOHOOK_DIRECTION_WRITE, ast_audiohook_write_list(), ast_audiohook_write_list_empty(), ast_channel_lock, ast_channel_name(), ast_channel_trylock, ast_channel_unlock, 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(), ast_channel::audiohooks, calc_monitor_jump(), CHECK_BLOCKING, ast_frame::data, ast_frame::datalen, DEBUGCHAN_FLAG, ast_filestream::fmt, ast_format_def::format, ast_frame_subclass::format, ast_channel::fout, FRAMECOUNT_INC, ast_channel::framehooks, ast_frame::frametype, ast_channel::generatordata, ast_format::id, ast_channel_tech::indicate, ast_channel::insmpl, ast_frame_subclass::integer, ast_frame::len, LOG_WARNING, ast_channel::masq, ast_channel::masqr, ast_channel::monitor, ast_channel::nativeformats, chanlist::next, ast_channel::outsmpl, ast_frame::ptr, ast_channel::rawwriteformat, ast_channel_monitor::read_stream, ast_frame::samples, SEEK_FORCECUR, send_dtmf_event(), ast_channel_tech::send_html, ast_channel_tech::send_text, ast_frame::src, ast_channel_monitor::state, ast_frame::subclass, ast_channel::tech, ast_channel_tech::write, ast_channel_monitor::write_stream, ast_channel_tech::write_text, ast_channel_tech::write_video, ast_channel::writeformat, and ast_channel::writetrans.
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(), function_ilink(), gen_generate(), generic_fax_exec(), handle_jack_audio(), handle_link_data(), 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(), rpt(), rpt_exec(), send_link_dtmf(), send_link_keyquery(), send_tone_burst(), send_usb_txt(), 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().
04645 { 04646 int res = -1; 04647 struct ast_frame *f = NULL; 04648 int count = 0; 04649 04650 /*Deadlock avoidance*/ 04651 while(ast_channel_trylock(chan)) { 04652 /*cannot goto done since the channel is not locked*/ 04653 if(count++ > 10) { 04654 ast_debug(1, "Deadlock avoided for write to channel '%s'\n", ast_channel_name(chan)); 04655 return 0; 04656 } 04657 usleep(1); 04658 } 04659 /* Stop if we're a zombie or need a soft hangup */ 04660 if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) 04661 goto done; 04662 04663 /* Handle any pending masquerades */ 04664 if (chan->masq) { 04665 ast_channel_unlock(chan); 04666 if (ast_do_masquerade(chan)) { 04667 ast_log(LOG_WARNING, "Failed to perform masquerade\n"); 04668 return res; /* no need to goto done: chan is already unlocked for masq */ 04669 } 04670 ast_channel_lock(chan); 04671 } 04672 if (chan->masqr) { 04673 res = 0; /* XXX explain, why 0 ? */ 04674 goto done; 04675 } 04676 04677 /* Perform the framehook write event here. After the frame enters the framehook list 04678 * there is no telling what will happen, how awesome is that!!! */ 04679 if (!(fr = ast_framehook_list_write_event(chan->framehooks, fr))) { 04680 res = 0; 04681 goto done; 04682 } 04683 04684 if (chan->generatordata && (!fr->src || strcasecmp(fr->src, "ast_prod"))) { 04685 if (ast_test_flag(chan, AST_FLAG_WRITE_INT)) { 04686 ast_deactivate_generator(chan); 04687 } else { 04688 if (fr->frametype == AST_FRAME_DTMF_END) { 04689 /* There is a generator running while we're in the middle of a digit. 04690 * It's probably inband DTMF, so go ahead and pass it so it can 04691 * stop the generator */ 04692 ast_clear_flag(chan, AST_FLAG_BLOCKING); 04693 ast_channel_unlock(chan); 04694 res = ast_senddigit_end(chan, fr->subclass.integer, fr->len); 04695 ast_channel_lock(chan); 04696 CHECK_BLOCKING(chan); 04697 } else if (fr->frametype == AST_FRAME_CONTROL && fr->subclass.integer == AST_CONTROL_UNHOLD) { 04698 /* This is a side case where Echo is basically being called and the person put themselves on hold and took themselves off hold */ 04699 res = (chan->tech->indicate == NULL) ? 0 : 04700 chan->tech->indicate(chan, fr->subclass.integer, fr->data.ptr, fr->datalen); 04701 } 04702 res = 0; /* XXX explain, why 0 ? */ 04703 goto done; 04704 } 04705 } 04706 /* High bit prints debugging */ 04707 if (chan->fout & DEBUGCHAN_FLAG) 04708 ast_frame_dump(ast_channel_name(chan), fr, ">>"); 04709 CHECK_BLOCKING(chan); 04710 switch (fr->frametype) { 04711 case AST_FRAME_CONTROL: 04712 res = (chan->tech->indicate == NULL) ? 0 : 04713 chan->tech->indicate(chan, fr->subclass.integer, fr->data.ptr, fr->datalen); 04714 break; 04715 case AST_FRAME_DTMF_BEGIN: 04716 if (chan->audiohooks) { 04717 struct ast_frame *old_frame = fr; 04718 fr = ast_audiohook_write_list(chan, chan->audiohooks, AST_AUDIOHOOK_DIRECTION_WRITE, fr); 04719 if (old_frame != fr) 04720 f = fr; 04721 } 04722 send_dtmf_event(chan, "Sent", fr->subclass.integer, "Yes", "No"); 04723 ast_clear_flag(chan, AST_FLAG_BLOCKING); 04724 ast_channel_unlock(chan); 04725 res = ast_senddigit_begin(chan, fr->subclass.integer); 04726 ast_channel_lock(chan); 04727 CHECK_BLOCKING(chan); 04728 break; 04729 case AST_FRAME_DTMF_END: 04730 if (chan->audiohooks) { 04731 struct ast_frame *new_frame = fr; 04732 04733 new_frame = ast_audiohook_write_list(chan, chan->audiohooks, AST_AUDIOHOOK_DIRECTION_WRITE, fr); 04734 if (new_frame != fr) { 04735 ast_frfree(new_frame); 04736 } 04737 } 04738 send_dtmf_event(chan, "Sent", fr->subclass.integer, "No", "Yes"); 04739 ast_clear_flag(chan, AST_FLAG_BLOCKING); 04740 ast_channel_unlock(chan); 04741 res = ast_senddigit_end(chan, fr->subclass.integer, fr->len); 04742 ast_channel_lock(chan); 04743 CHECK_BLOCKING(chan); 04744 break; 04745 case AST_FRAME_TEXT: 04746 if (fr->subclass.integer == AST_FORMAT_T140) { 04747 res = (chan->tech->write_text == NULL) ? 0 : 04748 chan->tech->write_text(chan, fr); 04749 } else { 04750 res = (chan->tech->send_text == NULL) ? 0 : 04751 chan->tech->send_text(chan, (char *) fr->data.ptr); 04752 } 04753 break; 04754 case AST_FRAME_HTML: 04755 res = (chan->tech->send_html == NULL) ? 0 : 04756 chan->tech->send_html(chan, fr->subclass.integer, (char *) fr->data.ptr, fr->datalen); 04757 break; 04758 case AST_FRAME_VIDEO: 04759 /* XXX Handle translation of video codecs one day XXX */ 04760 res = (chan->tech->write_video == NULL) ? 0 : 04761 chan->tech->write_video(chan, fr); 04762 break; 04763 case AST_FRAME_MODEM: 04764 res = (chan->tech->write == NULL) ? 0 : 04765 chan->tech->write(chan, fr); 04766 break; 04767 case AST_FRAME_VOICE: 04768 if (chan->tech->write == NULL) 04769 break; /*! \todo XXX should return 0 maybe ? */ 04770 04771 if (ast_opt_generic_plc && fr->subclass.format.id == AST_FORMAT_SLINEAR) { 04772 apply_plc(chan, fr); 04773 } 04774 04775 /* If the frame is in the raw write format, then it's easy... just use the frame - otherwise we will have to translate */ 04776 if (ast_format_cmp(&fr->subclass.format, &chan->rawwriteformat) != AST_FORMAT_CMP_NOT_EQUAL) { 04777 f = fr; 04778 } else { 04779 /* XXX Something is not right we are not compatible with this frame bad things can happen 04780 * problems range from no/one-way audio to unexplained line hangups as a last resort try adjust the format 04781 * ideally we do not want to do this and this indicates a deeper problem for now we log these events to 04782 * eliminate user impact and help identify the problem areas 04783 * JIRA issues related to this :- 04784 * ASTERISK-14384, ASTERISK-17502, ASTERISK-17541, ASTERISK-18063, ASTERISK-18325, ASTERISK-18422*/ 04785 if ((!ast_format_cap_iscompatible(chan->nativeformats, &fr->subclass.format)) && 04786 (ast_format_cmp(&chan->writeformat, &fr->subclass.format) != AST_FORMAT_CMP_EQUAL)) { 04787 char nf[512]; 04788 ast_log(LOG_WARNING, "Codec mismatch on channel %s setting write format to %s from %s native formats %s\n", 04789 ast_channel_name(chan), ast_getformatname(&fr->subclass.format), ast_getformatname(&chan->writeformat), 04790 ast_getformatname_multiple(nf, sizeof(nf), chan->nativeformats)); 04791 ast_set_write_format_by_id(chan, fr->subclass.format.id); 04792 } 04793 04794 f = (chan->writetrans) ? ast_translate(chan->writetrans, fr, 0) : fr; 04795 } 04796 04797 if (!f) { 04798 res = 0; 04799 break; 04800 } 04801 04802 if (chan->audiohooks) { 04803 struct ast_frame *prev = NULL, *new_frame, *cur, *dup; 04804 int freeoldlist = 0; 04805 04806 if (f != fr) { 04807 freeoldlist = 1; 04808 } 04809 04810 /* Since ast_audiohook_write may return a new frame, and the cur frame is 04811 * an item in a list of frames, create a new list adding each cur frame back to it 04812 * regardless if the cur frame changes or not. */ 04813 for (cur = f; cur; cur = AST_LIST_NEXT(cur, frame_list)) { 04814 new_frame = ast_audiohook_write_list(chan, chan->audiohooks, AST_AUDIOHOOK_DIRECTION_WRITE, cur); 04815 04816 /* if this frame is different than cur, preserve the end of the list, 04817 * free the old frames, and set cur to be the new frame */ 04818 if (new_frame != cur) { 04819 04820 /* doing an ast_frisolate here seems silly, but we are not guaranteed the new_frame 04821 * isn't part of local storage, meaning if ast_audiohook_write is called multiple 04822 * times it may override the previous frame we got from it unless we dup it */ 04823 if ((dup = ast_frisolate(new_frame))) { 04824 AST_LIST_NEXT(dup, frame_list) = AST_LIST_NEXT(cur, frame_list); 04825 if (freeoldlist) { 04826 AST_LIST_NEXT(cur, frame_list) = NULL; 04827 ast_frfree(cur); 04828 } 04829 if (new_frame != dup) { 04830 ast_frfree(new_frame); 04831 } 04832 cur = dup; 04833 } 04834 } 04835 04836 /* now, regardless if cur is new or not, add it to the new list, 04837 * if the new list has not started, cur will become the first item. */ 04838 if (prev) { 04839 AST_LIST_NEXT(prev, frame_list) = cur; 04840 } else { 04841 f = cur; /* set f to be the beginning of our new list */ 04842 } 04843 prev = cur; 04844 } 04845 } 04846 04847 /* If Monitor is running on this channel, then we have to write frames out there too */ 04848 /* the translator on chan->writetrans may have returned multiple frames 04849 from the single frame we passed in; if so, feed each one of them to the 04850 monitor */ 04851 if (chan->monitor && chan->monitor->write_stream) { 04852 struct ast_frame *cur; 04853 04854 for (cur = f; cur; cur = AST_LIST_NEXT(cur, frame_list)) { 04855 /* XXX must explain this code */ 04856 #ifndef MONITOR_CONSTANT_DELAY 04857 int jump = chan->insmpl - chan->outsmpl - 4 * cur->samples; 04858 if (jump >= 0) { 04859 jump = calc_monitor_jump((chan->insmpl - chan->outsmpl), ast_format_rate(&f->subclass.format), ast_format_rate(&chan->monitor->read_stream->fmt->format)); 04860 if (ast_seekstream(chan->monitor->write_stream, jump, SEEK_FORCECUR) == -1) 04861 ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n"); 04862 chan->outsmpl += (chan->insmpl - chan->outsmpl) + cur->samples; 04863 } else { 04864 chan->outsmpl += cur->samples; 04865 } 04866 #else 04867 int jump = calc_monitor_jump((chan->insmpl - chan->outsmpl), ast_format_rate(f->subclass.codec), ast_format_rate(chan->monitor->read_stream->fmt->format)); 04868 if (jump - MONITOR_DELAY >= 0) { 04869 if (ast_seekstream(chan->monitor->write_stream, jump - cur->samples, SEEK_FORCECUR) == -1) 04870 ast_log(LOG_WARNING, "Failed to perform seek in monitoring write stream, synchronization between the files may be broken\n"); 04871 chan->outsmpl += chan->insmpl - chan->outsmpl; 04872 } else { 04873 chan->outsmpl += cur->samples; 04874 } 04875 #endif 04876 if (chan->monitor->state == AST_MONITOR_RUNNING) { 04877 if (ast_writestream(chan->monitor->write_stream, cur) < 0) 04878 ast_log(LOG_WARNING, "Failed to write data to channel monitor write stream\n"); 04879 } 04880 } 04881 } 04882 04883 /* the translator on chan->writetrans may have returned multiple frames 04884 from the single frame we passed in; if so, feed each one of them to the 04885 channel, freeing each one after it has been written */ 04886 if ((f != fr) && AST_LIST_NEXT(f, frame_list)) { 04887 struct ast_frame *cur, *next = NULL; 04888 unsigned int skip = 0; 04889 04890 cur = f; 04891 while (cur) { 04892 next = AST_LIST_NEXT(cur, frame_list); 04893 AST_LIST_NEXT(cur, frame_list) = NULL; 04894 if (!skip) { 04895 if ((res = chan->tech->write(chan, cur)) < 0) { 04896 chan->_softhangup |= AST_SOFTHANGUP_DEV; 04897 skip = 1; 04898 } else if (next) { 04899 /* don't do this for the last frame in the list, 04900 as the code outside the loop will do it once 04901 */ 04902 chan->fout = FRAMECOUNT_INC(chan->fout); 04903 } 04904 } 04905 ast_frfree(cur); 04906 cur = next; 04907 } 04908 04909 /* reset f so the code below doesn't attempt to free it */ 04910 f = NULL; 04911 } else { 04912 res = chan->tech->write(chan, f); 04913 } 04914 break; 04915 case AST_FRAME_NULL: 04916 case AST_FRAME_IAX: 04917 /* Ignore these */ 04918 res = 0; 04919 break; 04920 default: 04921 /* At this point, fr is the incoming frame and f is NULL. Channels do 04922 * not expect to get NULL as a frame pointer and will segfault. Hence, 04923 * we output the original frame passed in. */ 04924 res = chan->tech->write(chan, fr); 04925 break; 04926 } 04927 04928 if (f && f != fr) 04929 ast_frfree(f); 04930 ast_clear_flag(chan, AST_FLAG_BLOCKING); 04931 04932 /* Consider a write failure to force a soft hangup */ 04933 if (res < 0) { 04934 chan->_softhangup |= AST_SOFTHANGUP_DEV; 04935 } else { 04936 chan->fout = FRAMECOUNT_INC(chan->fout); 04937 } 04938 done: 04939 if (chan->audiohooks && ast_audiohook_write_list_empty(chan->audiohooks)) { 04940 /* The list gets recreated if audiohooks are added again later */ 04941 ast_audiohook_detach_list(chan->audiohooks); 04942 chan->audiohooks = NULL; 04943 } 04944 ast_channel_unlock(chan); 04945 return res; 04946 }
| 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 4529 of file channel.c.
References ast_write(), ast_channel::tech, and ast_channel_tech::write_video.
04530 { 04531 int res; 04532 if (!chan->tech->write_video) 04533 return 0; 04534 res = ast_write(chan, fr); 04535 if (!res) 04536 res = 1; 04537 return res; 04538 }
| const char* channelreloadreason2txt | ( | enum channelreloadreason | reason | ) |
Convert enum channelreloadreason to text string for manager event.
| reason | The reason for reload (manager, cli, start etc) |
Definition at line 8092 of file channel.c.
References CHANNEL_CLI_RELOAD, CHANNEL_MODULE_LOAD, and CHANNEL_MODULE_RELOAD.
Referenced by reload_config().
08093 { 08094 switch (reason) { 08095 case CHANNEL_MODULE_LOAD: 08096 return "LOAD (Channel module load)"; 08097 08098 case CHANNEL_MODULE_RELOAD: 08099 return "RELOAD (Channel module reload)"; 08100 08101 case CHANNEL_CLI_RELOAD: 08102 return "CLIRELOAD (Channel module reload by CLI command)"; 08103 08104 default: 08105 return "MANAGERRELOAD (Channel module reload by manager)"; 08106 } 08107 };
| struct ast_channel_tech ast_kill_tech |
Kill the channel channel driver technology descriptor.
Kill the channel channel driver technology descriptor.
The purpose of this channel technology is to encourage the channel to hangup as quickly as possible.
Definition at line 447 of file channel.c.
Referenced by ast_do_masquerade().
| 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 97 of file channel.c.
Referenced by handle_core_set_debug_channel().
| unsigned long global_fout |
1.5.6