#include "asterisk/abstract_jb.h"
#include "asterisk/astobj2.h"
#include "asterisk/poll-compat.h"
#include "asterisk/frame.h"
#include "asterisk/sched.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"

Go to the source code of this file.
Data Structures | |
| struct | ast_bridge_config |
| bridge configuration More... | |
| struct | ast_callerid |
| Structure for all kinds of caller ID identifications. 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_id |
| Information needed to identify an endpoint 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 | 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_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, linkedid, amaflag,...) |
| #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_MAX_CONTEXT 80 |
| #define | AST_MAX_EXTENSION 80 |
| #define | AST_MAX_FDS 10 |
| #define | AST_TIMING_FD (AST_MAX_FDS-2) |
| #define | CHECK_BLOCKING(c) |
| #define | DATASTORE_INHERIT_FOREVER INT_MAX |
| #define | DEBUGCHAN_FLAG 0x80000000 |
| #define | FRAMECOUNT_INC(x) ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) ) |
| #define | MAX_LANGUAGE 20 |
| #define | MAX_MUSICCLASS 80 |
Typedefs | |
| 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_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_CDR_TRANSFER = (1 << 0), AST_CDR_FORWARD = (1 << 1), AST_CDR_CALLWAIT = (1 << 2), AST_CDR_CONFERENCE = (1 << 3) } |
| 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) } |
| enum | ast_bridge_result { AST_BRIDGE_COMPLETE = 0, AST_BRIDGE_FAILED = -1, AST_BRIDGE_FAILED_NOWARN = -2, AST_BRIDGE_RETRY = -3 } |
| enum | ast_channel_adsicpe { AST_ADSI_UNKNOWN, AST_ADSI_AVAILABLE, AST_ADSI_UNAVAILABLE, AST_ADSI_OFFHOOKONLY } |
| enum | ast_channel_state { AST_STATE_DOWN, AST_STATE_RESERVED, AST_STATE_OFFHOOK, AST_STATE_DIALING, AST_STATE_RING, AST_STATE_RINGING, AST_STATE_UP, AST_STATE_BUSY, AST_STATE_DIALING_OFFHOOK, AST_STATE_PRERING, AST_STATE_MUTE = (1 << 16) } |
| ast_channel states More... | |
| 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, int format, const struct ast_channel *requestor, void *data, 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_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) |
| int | ast_best_codec (int fmts) |
| Pick the best audio codec. | |
| struct ast_channel * | ast_bridged_channel (struct ast_channel *chan) |
| Find bridged channel. | |
| int | ast_call (struct ast_channel *chan, char *addr, int timeout) |
| Make a call. | |
| struct ast_channel * | ast_call_forward (struct ast_channel *caller, struct ast_channel *orig, int *timeout, int format, 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. | |
| 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. | |
| 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_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_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. | |
| int | ast_channel_early_bridge (struct ast_channel *c0, struct ast_channel *c1) |
| Bridge two channels together (early). | |
| static enum ast_t38_state | ast_channel_get_t38_state (struct ast_channel *chan) |
| Retrieves the current T38 state of a channel. | |
| void | ast_channel_inherit_variables (const struct ast_channel *parent, struct ast_channel *child) |
| Inherits channel variable from parent to child channel. | |
| 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. | |
| 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) |
| 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) |
| 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_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_connected_line (struct ast_channel *chan, const struct ast_party_connected_line *connected) |
| 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) |
| 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. | |
| void | ast_channel_undefer_dtmf (struct ast_channel *chan) |
| Unset defer DTMF flag on channel. | |
| 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) |
| Indicate that the connected line information has changed. | |
| void | ast_channel_update_redirecting (struct ast_channel *chan, const struct ast_party_redirecting *redirecting) |
| Indicate that the redirecting id has changed. | |
| 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) |
| Build the connected line information data frame. | |
| void | ast_connected_line_copy_from_caller (struct ast_party_connected_line *dest, const struct ast_callerid *src) |
| Copy the caller information to the connected line information. | |
| void | ast_connected_line_copy_to_caller (struct ast_callerid *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. | |
| void | ast_party_caller_copy (struct ast_callerid *dest, const struct ast_callerid *src) |
| Copy the source caller information to the destination caller. | |
| void | ast_party_caller_init (struct ast_party_caller *init) |
| Initialize the given caller structure. | |
| void | ast_party_connected_line_collect_caller (struct ast_party_connected_line *connected, struct ast_callerid *cid) |
| 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) |
| 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_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_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 subadress 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) |
| 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, int format, const struct ast_channel *requestor, void *data, int *status) |
| Requests a channel. | |
| struct ast_channel * | ast_request_and_dial (const char *type, int format, const struct ast_channel *requestor, void *data, 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. | |
| static int | ast_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tvp) |
| Waits for activity on a group of channels. | |
| 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. | |
| 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, int format) |
| Sets read format on channel chan 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, int format) |
| Sets write format on channel chan Set write format for channel to whichever component of "format" is best. | |
| int | ast_setstate (struct ast_channel *chan, enum ast_channel_state) |
| Change the state of a channel. | |
| 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. | |
| static void | timersub (struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff) |
| 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 | |
| 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 161 of file channel.h.
Referenced by agent_read().
| #define AST_ALERT_FD (AST_MAX_FDS-1) |
used for alertpipe
Definition at line 159 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 1705 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 1707 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 1713 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_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__)
Definition at line 990 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(), 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(), sip_new(), sip_park(), skinny_new(), unistim_new(), and usbradio_new().
Definition at line 2192 of file channel.h.
Referenced by __ast_answer(), __ast_queue_frame(), __ast_read(), __oh323_destroy(), __sip_destroy(), _macro_exec(), _while_exec(), acf_odbc_read(), action_add_agi_cmd(), action_coreshowchannels(), action_hangup(), action_redirect(), action_sendtext(), action_status(), action_timeout(), add_features_datastores(), add_to_agi(), agent_hangup(), agent_indicate(), array_insert(), array_remove(), ast_activate_generator(), ast_async_goto(), ast_audiohook_attach(), ast_audiohook_detach_source(), ast_audiohook_remove(), ast_autochan_destroy(), ast_autochan_setup(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_call(), ast_bridge_timelimit(), ast_call(), ast_call_forward(), ast_cel_report_event(), ast_change_name(), ast_channel_cmp_cb(), ast_channel_connected_line_macro(), ast_channel_destructor(), ast_channel_masquerade(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_check_hangup_locked(), ast_complete_channels(), ast_deactivate_generator(), ast_dial_join(), ast_do_masquerade(), ast_eivr_getvariable(), ast_explicit_goto(), ast_hangup(), 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_set_callerid(), ast_set_hangupsource(), ast_settimeout(), 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(), bridge_play_sounds(), builtin_atxfer(), builtin_automixmonitor(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), callerid_read(), callerid_write(), change_t38_state(), channel_set_debug(), channel_spy(), common_exec(), conf_run(), conf_start_moh(), confbridge_exec(), connectedline_read(), connectedline_write(), crement_function_read(), dahdi_bridge(), dahdi_call(), dahdi_handle_dtmfup(), dial_exec_full(), dialog_unlink_all(), disable_jack_hook(), do_forward(), dundi_query_read(), dundi_result_read(), enable_jack_hook(), end_bridge_callback(), enum_query_read(), enum_result_read(), feature_interpret(), feature_request_and_dial(), find_by_mark(), find_calling_channel(), find_conf_realtime(), find_transaction(), func_channel_read(), func_channel_write(), func_channels_read(), func_header_read(), func_inheritance_write(), func_mute_write(), function_sipchaninfo_read(), generator_force(), get_agi_cmd(), get_cid_name(), handle_chanlist(), handle_cli_mixmonitor(), handle_invite_replaces(), handle_request_bye(), handle_request_invite(), handle_showchan(), handle_softhangup(), import_ch(), import_helper(), init_jack_data(), jack_hook_callback(), leave_voicemail(), linkedid_match(), listfilter(), local_attended_transfer(), local_call(), local_hangup(), local_read(), login_exec(), lua_get_state(), manage_parkinglot(), manager_mutestream(), manager_park(), mark_transaction_active(), minivm_delete_exec(), minivm_notify_exec(), misdn_answer(), misdn_hangup(), morsecode_exec(), mute_callback(), my_handle_dtmfup(), notify_new_message(), park_call_full(), park_exec_full(), park_space_reserve(), pbx_builtin_getvar_helper(), pbx_builtin_pushvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setvar_helper(), peek_read(), pickup_by_exten(), pickup_by_mark(), pickup_by_name_cb(), pickup_do(), queue_exec(), redirecting_read(), redirecting_write(), release_transaction(), retrydial_exec(), ring_entry(), run_agi(), sendtext_exec(), set_ext_pri(), set_format(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_transfer_datastore(), shared_read(), shared_write(), sip_addheader(), sip_dtmfmode(), sip_removeheader(), smdi_msg_read(), smdi_msg_retrieve_read(), softhangup_exec(), speech_background(), speex_read(), speex_write(), start_monitor_action(), state_notify_build_xml(), transmit_invite(), try_calling(), update_bridge_vars(), and wait_for_answer().
| #define ast_channel_lock_both | ( | chan1, | |||
| chan2 | ) |
Lock two channels.
Definition at line 2199 of file channel.h.
Referenced by ast_pickup_call(), and do_bridge_masquerade().
| #define AST_CHANNEL_NAME 80 |
Max length of an ast_channel name
Definition at line 137 of file channel.h.
Referenced by ast_channel_destructor(), ast_do_masquerade(), ast_parse_device_state(), ast_setstate(), common_exec(), create_jb(), fast_originate(), page_exec(), park_call_full(), 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 2217 of file channel.h.
Referenced by ast_autochan_new_channel(), ast_autochan_setup(), ast_cel_report_event(), handle_getvariablefull(), handle_invite_replaces(), local_attended_transfer(), and try_suggested_sip_codec().
Definition at line 2194 of file channel.h.
Referenced by __analog_handle_event(), __oh323_rtp_create(), agent_indicate(), agent_logoff(), ast_call_forward(), ast_channel_masquerade(), 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(), bridge_queue_hangup(), bridge_write(), check_bridge(), check_rtp_timeout(), cleanup_connection(), dahdi_bridge(), dahdi_handle_event(), dahdi_queue_frame(), dahdi_softhangup_all(), dial_exec_full(), do_forward(), get_sip_pvt_byid_locked(), grab_owner(), handle_request_bye(), handle_request_do(), handle_request_refer(), hangup_connection(), iax2_destroy(), iax2_queue_control_data(), iax2_queue_frame(), iax2_queue_hangup(), local_call(), local_hangup(), local_queue_frame(), manager_park(), mgcp_queue_frame(), mgcp_queue_hangup(), oh323_rtp_read(), oh323_simulate_dtmf_end(), proc_session_timer(), receive_digit(), remote_hold(), retrans_pkt(), ring_entry(), scheduler_process_request_queue(), set_hangup_source_and_cause(), setup_rtp_connection(), sip_hangup(), sip_park(), socket_process(), try_suggested_sip_codec(), update_state(), wait_for_answer(), and wakeup_sub().
Definition at line 2193 of file channel.h.
Referenced by __analog_handle_event(), __ast_answer(), __ast_queue_frame(), __ast_read(), __oh323_destroy(), __oh323_rtp_create(), __sip_destroy(), _macro_exec(), _while_exec(), acf_odbc_read(), action_add_agi_cmd(), action_coreshowchannels(), action_hangup(), action_redirect(), action_sendtext(), action_status(), action_timeout(), add_features_datastores(), add_to_agi(), agent_hangup(), agent_indicate(), agent_logoff(), alsa_call(), analog_attempt_transfer(), array_insert(), array_remove(), ast_activate_generator(), ast_async_goto(), ast_audiohook_attach(), ast_audiohook_detach_source(), ast_audiohook_remove(), ast_autochan_destroy(), ast_autochan_setup(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_call(), ast_bridge_timelimit(), ast_call(), ast_call_forward(), ast_cel_report_event(), ast_change_name(), ast_channel_cmp_cb(), ast_channel_connected_line_macro(), ast_channel_destructor(), ast_channel_masquerade(), ast_channel_set_connected_line(), ast_channel_set_redirecting(), ast_check_hangup_locked(), ast_complete_channels(), ast_deactivate_generator(), ast_dial_join(), ast_do_masquerade(), ast_eivr_getvariable(), ast_explicit_goto(), ast_hangup(), 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_set_callerid(), ast_set_hangupsource(), ast_settimeout(), 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(), auto_congest(), bridge_exec(), bridge_play_sounds(), bridge_queue_hangup(), bridge_write(), builtin_atxfer(), builtin_automixmonitor(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), callerid_read(), callerid_write(), change_t38_state(), channel_set_debug(), channel_spy(), check_bridge(), check_rtp_timeout(), cleanup_connection(), common_exec(), conf_run(), conf_start_moh(), confbridge_exec(), connectedline_read(), connectedline_write(), console_answer(), console_hangup(), console_sendtext(), crement_function_read(), dahdi_bridge(), dahdi_call(), dahdi_handle_dtmfup(), dahdi_handle_event(), dahdi_queue_frame(), dahdi_softhangup_all(), dial_exec_full(), 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(), fast_originate(), feature_interpret(), feature_request_and_dial(), find_by_mark(), find_calling_channel(), find_conf_realtime(), find_transaction(), func_channel_read(), func_channel_write(), func_channels_read(), func_header_read(), func_inheritance_write(), func_mute_write(), function_sipchaninfo_read(), generator_force(), get_agi_cmd(), get_cid_name(), handle_chanlist(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), 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(), leave_voicemail(), linkedid_match(), listfilter(), local_attended_transfer(), local_bridge_loop(), local_call(), local_hangup(), local_queue_frame(), local_read(), login_exec(), lua_get_state(), manage_parkinglot(), manager_mutestream(), manager_park(), mark_transaction_active(), mgcp_queue_frame(), mgcp_queue_hangup(), minivm_delete_exec(), minivm_notify_exec(), misdn_answer(), misdn_hangup(), morsecode_exec(), mute_callback(), my_handle_dtmfup(), notify_new_message(), oh323_rtp_read(), oh323_simulate_dtmf_end(), park_call_full(), park_exec_full(), park_space_reserve(), pbx_builtin_getvar_helper(), pbx_builtin_pushvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setvar_helper(), peek_read(), pickup_by_channel(), pickup_by_exten(), pickup_by_mark(), pickup_by_name_cb(), pickup_do(), proc_session_timer(), queue_exec(), receive_digit(), redirecting_read(), redirecting_write(), release_transaction(), remote_bridge_loop(), remote_hold(), retrans_pkt(), retrydial_exec(), ring_entry(), run_agi(), scheduler_process_request_queue(), sendtext_exec(), set_ext_pri(), set_format(), set_hangup_source_and_cause(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_rtp_connection(), setup_transfer_datastore(), shared_read(), shared_write(), sip_addheader(), sip_dtmfmode(), sip_hangup(), sip_park(), sip_removeheader(), smdi_msg_read(), smdi_msg_retrieve_read(), socket_process(), softhangup_exec(), speech_background(), speex_read(), speex_write(), start_monitor_action(), state_notify_build_xml(), transmit_invite(), try_calling(), try_suggested_sip_codec(), update_bridge_vars(), update_state(), 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 2228 of file channel.h.
Referenced by __ast_channel_alloc_ap(), action_add_agi_cmd(), action_atxfer(), action_bridge(), action_coreshowchannels(), action_getvar(), action_hangup(), action_redirect(), action_sendtext(), action_setvar(), action_status(), action_timeout(), ast_async_goto_by_name(), ast_autochan_destroy(), ast_autochan_new_channel(), ast_bridge_call(), ast_cel_check_retire_linkedid(), ast_cel_report_event(), ast_channel_release(), ast_complete_channels(), ast_dummy_channel_alloc(), ast_parse_device_state(), ast_pickup_call(), ast_var_channel_bridge(), ast_var_channel_types_table(), ast_var_channels_table(), asyncgoto_exec(), bridge_exec(), change_monitor_action(), common_exec(), 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_invite_replaces(), handle_redirect(), handle_set_chanvar(), handle_show_chanvar(), handle_showchan(), handle_softhangup(), import_helper(), local_attended_transfer(), manager_mutestream(), manager_park(), manager_play_dtmf(), park_call_full(), pbx_builtin_importvar(), pickup_by_channel(), pickup_by_exten(), pickup_by_mark(), shared_read(), shared_write(), softhangup_exec(), start_monitor_action(), state_notify_build_xml(), stop_monitor_action(), and try_suggested_sip_codec().
| #define AST_GENERATOR_FD (AST_MAX_FDS-4) |
used by generator
Definition at line 162 of file channel.h.
Referenced by __ast_read(), ast_deactivate_generator(), and ast_do_masquerade().
| #define AST_MAX_CONTEXT 80 |
Max length of a context
Definition at line 136 of file channel.h.
Referenced by _macro_exec(), cleanup_stale_contexts(), common_exec(), conf_run(), config_parse_variables(), dial_transfer(), do_magic_pickup(), gtalk_load_config(), handle_gosub(), handle_request_invite(), 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(), add_extensions(), advanced_options(), analog_ss_thread(), ast_device_state_changed(), ast_devstate_changed(), ast_ivr_menu_run_internal(), begin_dial_channel(), build_device(), conf_run(), destroy_station(), dial_exec_full(), dial_transfer(), disa_exec(), do_forward(), 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(), manager_show_dialplan_helper(), mgcp_ss(), phone_check_exception(), process_dahdi(), realtime_switch_common(), search_directory_sub(), show_dialplan_helper(), skinny_extensionstate_cb(), skinny_ss(), sla_build_station(), speech_background(), state_notify_build_xml(), try_calling(), vm_authenticate(), and vmauthenticate().
| #define AST_MAX_FDS 10 |
Definition at line 154 of file channel.h.
Referenced by __ast_channel_alloc_ap(), ast_channel_destructor(), ast_do_masquerade(), ast_poll_channel_add(), ast_poll_channel_del(), ast_waitfor_nandfds(), and manage_parkinglot().
| #define AST_TIMING_FD (AST_MAX_FDS-2) |
used for timingfd
Definition at line 160 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 2153 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 152 of file channel.h.
Referenced by _macro_exec(), acf_iaxvar_write(), add_features_datastores(), ast_channel_datastore_inherit(), ast_iax2_new(), authenticate_reply(), calendar_query_exec(), 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 525 of file channel.h.
Referenced by __ast_read(), ast_write(), channel_set_debug(), handle_core_set_debug_channel(), handle_showchan(), and serialize_showchan().
| #define FRAMECOUNT_INC | ( | x | ) | ( ((x) & DEBUGCHAN_FLAG) | (((x)+1) & ~DEBUGCHAN_FLAG) ) |
| #define MAX_LANGUAGE 20 |
| #define MAX_MUSICCLASS 80 |
| typedef unsigned long long ast_group_t |
| anonymous enum |
ast_channel_tech Properties
Definition at line 773 of file channel.h.
00773 { 00774 /*! 00775 * \brief Channels have this property if they can accept input with jitter; 00776 * i.e. most VoIP channels 00777 */ 00778 AST_CHAN_TP_WANTSJITTER = (1 << 0), 00779 /*! 00780 * \brief Channels have this property if they can create jitter; 00781 * i.e. most VoIP channels 00782 */ 00783 AST_CHAN_TP_CREATESJITTER = (1 << 1), 00784 };
| 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. |
Definition at line 787 of file channel.h.
00787 { 00788 /*! Queue incoming DTMF, to be released when this flag is turned off */ 00789 AST_FLAG_DEFER_DTMF = (1 << 1), 00790 /*! write should be interrupt generator */ 00791 AST_FLAG_WRITE_INT = (1 << 2), 00792 /*! a thread is blocking on this channel */ 00793 AST_FLAG_BLOCKING = (1 << 3), 00794 /*! This is a zombie channel */ 00795 AST_FLAG_ZOMBIE = (1 << 4), 00796 /*! There is an exception pending */ 00797 AST_FLAG_EXCEPTION = (1 << 5), 00798 /*! Listening to moh XXX anthm promises me this will disappear XXX */ 00799 AST_FLAG_MOH = (1 << 6), 00800 /*! This channel is spying on another channel */ 00801 AST_FLAG_SPYING = (1 << 7), 00802 /*! This channel is in a native bridge */ 00803 AST_FLAG_NBRIDGE = (1 << 8), 00804 /*! the channel is in an auto-incrementing dialplan processor, 00805 * so when ->priority is set, it will get incremented before 00806 * finding the next priority to run */ 00807 AST_FLAG_IN_AUTOLOOP = (1 << 9), 00808 /*! This is an outgoing call */ 00809 AST_FLAG_OUTGOING = (1 << 10), 00810 /*! A DTMF_BEGIN frame has been read from this channel, but not yet an END */ 00811 AST_FLAG_IN_DTMF = (1 << 12), 00812 /*! A DTMF_END was received when not IN_DTMF, so the length of the digit is 00813 * currently being emulated */ 00814 AST_FLAG_EMULATE_DTMF = (1 << 13), 00815 /*! This is set to tell the channel not to generate DTMF begin frames, and 00816 * to instead only generate END frames. */ 00817 AST_FLAG_END_DTMF_ONLY = (1 << 14), 00818 /*! Flag to show channels that this call is hangup due to the fact that the call 00819 was indeed answered, but in another channel */ 00820 AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), 00821 /*! This flag indicates that on a masquerade, an active stream should not 00822 * be carried over */ 00823 AST_FLAG_MASQ_NOSTREAM = (1 << 16), 00824 /*! This flag indicates that the hangup exten was run when the bridge terminated, 00825 * a message aimed at preventing a subsequent hangup exten being run at the pbx_run 00826 * level */ 00827 AST_FLAG_BRIDGE_HANGUP_RUN = (1 << 17), 00828 /*! This flag indicates that the hangup exten should NOT be run when the 00829 * bridge terminates, this will allow the hangup in the pbx loop to be run instead. 00830 * */ 00831 AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18), 00832 };
| anonymous enum |
ast_bridge_config flags
Definition at line 835 of file channel.h.
00835 { 00836 AST_FEATURE_PLAY_WARNING = (1 << 0), 00837 AST_FEATURE_REDIRECT = (1 << 1), 00838 AST_FEATURE_DISCONNECT = (1 << 2), 00839 AST_FEATURE_ATXFER = (1 << 3), 00840 AST_FEATURE_AUTOMON = (1 << 4), 00841 AST_FEATURE_PARKCALL = (1 << 5), 00842 AST_FEATURE_AUTOMIXMON = (1 << 6), 00843 AST_FEATURE_NO_H_EXTEN = (1 << 7), 00844 AST_FEATURE_WARNING_ACTIVE = (1 << 8), 00845 };
| anonymous enum |
Definition at line 883 of file channel.h.
00883 { 00884 AST_CDR_TRANSFER = (1 << 0), 00885 AST_CDR_FORWARD = (1 << 1), 00886 AST_CDR_CALLWAIT = (1 << 2), 00887 AST_CDR_CONFERENCE = (1 << 3), 00888 };
| anonymous enum |
Definition at line 890 of file channel.h.
00890 { 00891 /*! Soft hangup by device */ 00892 AST_SOFTHANGUP_DEV = (1 << 0), 00893 /*! Soft hangup for async goto */ 00894 AST_SOFTHANGUP_ASYNCGOTO = (1 << 1), 00895 AST_SOFTHANGUP_SHUTDOWN = (1 << 2), 00896 AST_SOFTHANGUP_TIMEOUT = (1 << 3), 00897 AST_SOFTHANGUP_APPUNLOAD = (1 << 4), 00898 AST_SOFTHANGUP_EXPLICIT = (1 << 5), 00899 AST_SOFTHANGUP_UNBRIDGE = (1 << 6), 00900 };
| enum ast_bridge_result |
Definition at line 164 of file channel.h.
00164 { 00165 AST_BRIDGE_COMPLETE = 0, 00166 AST_BRIDGE_FAILED = -1, 00167 AST_BRIDGE_FAILED_NOWARN = -2, 00168 AST_BRIDGE_RETRY = -3, 00169 };
| enum ast_channel_adsicpe |
Definition at line 536 of file channel.h.
00536 { 00537 AST_ADSI_UNKNOWN, 00538 AST_ADSI_AVAILABLE, 00539 AST_ADSI_UNAVAILABLE, 00540 AST_ADSI_OFFHOOKONLY, 00541 };
| enum ast_channel_state |
ast_channel states
Definition at line 549 of file channel.h.
00549 { 00550 AST_STATE_DOWN, /*!< Channel is down and available */ 00551 AST_STATE_RESERVED, /*!< Channel is down, but reserved */ 00552 AST_STATE_OFFHOOK, /*!< Channel is off hook */ 00553 AST_STATE_DIALING, /*!< Digits (or equivalent) have been dialed */ 00554 AST_STATE_RING, /*!< Line is ringing */ 00555 AST_STATE_RINGING, /*!< Remote end is ringing */ 00556 AST_STATE_UP, /*!< Line is up */ 00557 AST_STATE_BUSY, /*!< Line is busy */ 00558 AST_STATE_DIALING_OFFHOOK, /*!< Digits (or equivalent) have been dialed while offhook */ 00559 AST_STATE_PRERING, /*!< Channel has detected an incoming call and is waiting for ring */ 00560 00561 AST_STATE_MUTE = (1 << 16), /*!< Do not transmit voice data */ 00562 };
| enum ast_t38_state |
Possible T38 states on channels.
Definition at line 567 of file channel.h.
00567 { 00568 T38_STATE_UNAVAILABLE, /*!< T38 is unavailable on this channel or disabled by configuration */ 00569 T38_STATE_UNKNOWN, /*!< The channel supports T38 but the current status is unknown */ 00570 T38_STATE_NEGOTIATING, /*!< T38 is being negotiated */ 00571 T38_STATE_REJECTED, /*!< Remote side has rejected our offer */ 00572 T38_STATE_NEGOTIATED, /*!< T38 established */ 00573 };
| enum channelreloadreason |
Channel reload reasons for manager events at load or reload of configuration.
Definition at line 904 of file channel.h.
00904 { 00905 CHANNEL_MODULE_LOAD, 00906 CHANNEL_MODULE_RELOAD, 00907 CHANNEL_CLI_RELOAD, 00908 CHANNEL_MANAGER_RELOAD, 00909 };
| 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 2314 of file channel.c.
References ast_channel::_state, ast_channel_lock, 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, ast_frame::frame_list, frames, ast_frame::frametype, LOG_WARNING, MAX, ast_channel::name, and ast_frame::subclass.
Referenced by ast_answer(), dial_exec_full(), pbx_builtin_answer(), and pbx_builtin_incomplete().
02315 { 02316 int res = 0; 02317 enum ast_channel_state old_state; 02318 02319 old_state = chan->_state; 02320 if ((res = ast_raw_answer(chan, cdr_answer))) { 02321 return res; 02322 } 02323 02324 switch (old_state) { 02325 case AST_STATE_RINGING: 02326 case AST_STATE_RING: 02327 /* wait for media to start flowing, but don't wait any longer 02328 * than 'delay' or 500 milliseconds, whichever is longer 02329 */ 02330 do { 02331 AST_LIST_HEAD_NOLOCK(, ast_frame) frames; 02332 struct ast_frame *cur, *new; 02333 int ms = MAX(delay, 500); 02334 unsigned int done = 0; 02335 02336 AST_LIST_HEAD_INIT_NOLOCK(&frames); 02337 02338 for (;;) { 02339 ms = ast_waitfor(chan, ms); 02340 if (ms < 0) { 02341 ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", chan->name, strerror(errno)); 02342 res = -1; 02343 break; 02344 } 02345 if (ms == 0) { 02346 ast_debug(2, "Didn't receive a media frame from %s within %d ms of answering. Continuing anyway\n", chan->name, MAX(delay, 500)); 02347 break; 02348 } 02349 cur = ast_read(chan); 02350 if (!cur || ((cur->frametype == AST_FRAME_CONTROL) && 02351 (cur->subclass == AST_CONTROL_HANGUP))) { 02352 if (cur) { 02353 ast_frfree(cur); 02354 } 02355 res = -1; 02356 ast_debug(2, "Hangup of channel %s detected in answer routine\n", chan->name); 02357 break; 02358 } 02359 02360 if ((new = ast_frisolate(cur)) != cur) { 02361 ast_frfree(cur); 02362 } 02363 02364 AST_LIST_INSERT_HEAD(&frames, new, frame_list); 02365 02366 /* if a specific delay period was requested, continue 02367 * until that delay has passed. don't stop just because 02368 * incoming media has arrived. 02369 */ 02370 if (delay) { 02371 continue; 02372 } 02373 02374 switch (new->frametype) { 02375 /* all of these frametypes qualify as 'media' */ 02376 case AST_FRAME_VOICE: 02377 case AST_FRAME_VIDEO: 02378 case AST_FRAME_TEXT: 02379 case AST_FRAME_DTMF_BEGIN: 02380 case AST_FRAME_DTMF_END: 02381 case AST_FRAME_IMAGE: 02382 case AST_FRAME_HTML: 02383 case AST_FRAME_MODEM: 02384 done = 1; 02385 break; 02386 case AST_FRAME_CONTROL: 02387 case AST_FRAME_IAX: 02388 case AST_FRAME_NULL: 02389 case AST_FRAME_CNG: 02390 break; 02391 } 02392 02393 if (done) { 02394 break; 02395 } 02396 } 02397 02398 if (res == 0) { 02399 ast_channel_lock(chan); 02400 while ((cur = AST_LIST_REMOVE_HEAD(&frames, frame_list))) { 02401 ast_queue_frame_head(chan, cur); 02402 ast_frfree(cur); 02403 } 02404 ast_channel_unlock(chan); 02405 } 02406 } while (0); 02407 break; 02408 default: 02409 break; 02410 } 02411 02412 return res; 02413 }
| struct ast_channel* attribute_malloc __ast_channel_alloc | ( | int | needqueue, | |
| int | state, | |||
| const char * | cid_num, | |||
| const char * | cid_name, | |||
| const char * | acctcode, | |||
| const char * | exten, | |||
| const char * | context, | |||
| const char * | linkedid, | |||
| const int | amaflag, | |||
| const char * | file, | |||
| int | line, | |||
| const char * | function, | |||
| const char * | name_fmt, | |||
| ... | ||||
| ) | [read] |
Create a channel structure.
| NULL | failure | |
| non-NULL | successfully allocated channel |
Definition at line 1002 of file channel.c.
References __ast_channel_alloc_ap().
01008 { 01009 va_list ap1, ap2; 01010 struct ast_channel *result; 01011 01012 va_start(ap1, name_fmt); 01013 va_start(ap2, name_fmt); 01014 result = __ast_channel_alloc_ap(needqueue, state, cid_num, cid_name, acctcode, exten, context, 01015 linkedid, amaflag, file, line, function, name_fmt, ap1, ap2); 01016 va_end(ap1); 01017 va_end(ap2); 01018 01019 return result; 01020 }
| struct ast_channel* __ast_request_and_dial | ( | const char * | type, | |
| int | format, | |||
| const struct ast_channel * | requestor, | |||
| void * | data, | |||
| 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 | requested channel format | |
| data | data to pass to the channel requester | |
| 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 4342 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_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_datastore_inherit(), ast_channel_inherit_variables(), ast_channel_set_connected_line(), AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, 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_callerid(), ast_set_flag, ast_set_variables(), AST_STATE_UP, ast_strlen_zero(), ast_waitfor(), ast_channel::call_forward, 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, f, ast_frame::frametype, handle_cause(), ast_channel::hangupcause, ast_party_connected_line::id, LOG_NOTICE, ast_party_id::name, ast_party_id::number, ast_party_id::number_presentation, outgoing_helper::parent_channel, ast_channel::priority, outgoing_helper::priority, ast_frame::subclass, and outgoing_helper::vars.
Referenced by ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_request_and_dial(), and parkandannounce_exec().
04343 { 04344 int dummy_outstate; 04345 int cause = 0; 04346 struct ast_channel *chan; 04347 int res = 0; 04348 int last_subclass = 0; 04349 struct ast_party_connected_line connected; 04350 04351 if (outstate) 04352 *outstate = 0; 04353 else 04354 outstate = &dummy_outstate; /* make outstate always a valid pointer */ 04355 04356 chan = ast_request(type, format, requestor, data, &cause); 04357 if (!chan) { 04358 ast_log(LOG_NOTICE, "Unable to request channel %s/%s\n", type, (char *)data); 04359 handle_cause(cause, outstate); 04360 return NULL; 04361 } 04362 04363 if (oh) { 04364 if (oh->vars) 04365 ast_set_variables(chan, oh->vars); 04366 /* XXX why is this necessary, for the parent_channel perhaps ? */ 04367 if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name)) 04368 ast_set_callerid(chan, oh->cid_num, oh->cid_name, oh->cid_num); 04369 if (oh->parent_channel) { 04370 ast_channel_inherit_variables(oh->parent_channel, chan); 04371 ast_channel_datastore_inherit(oh->parent_channel, chan); 04372 } 04373 if (oh->account) 04374 ast_cdr_setaccount(chan, oh->account); 04375 } 04376 04377 ast_set_callerid(chan, cid_num, cid_name, cid_num); 04378 ast_set_flag(chan->cdr, AST_CDR_FLAG_ORIGINATED); 04379 ast_party_connected_line_set_init(&connected, &chan->connected); 04380 connected.id.number = (char *) cid_num; 04381 connected.id.name = (char *) cid_name; 04382 connected.id.number_presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; 04383 ast_channel_set_connected_line(chan, &connected); 04384 04385 if (ast_call(chan, data, 0)) { /* ast_call failed... */ 04386 ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, (char *)data); 04387 } else { 04388 res = 1; /* mark success in case chan->_state is already AST_STATE_UP */ 04389 while (timeout && chan->_state != AST_STATE_UP) { 04390 struct ast_frame *f; 04391 res = ast_waitfor(chan, timeout); 04392 if (res == 0) { /* timeout, treat it like ringing */ 04393 *outstate = AST_CONTROL_RINGING; 04394 break; 04395 } 04396 if (res < 0) /* error or done */ 04397 break; 04398 if (timeout > -1) 04399 timeout = res; 04400 if (!ast_strlen_zero(chan->call_forward)) { 04401 if (!(chan = ast_call_forward(NULL, chan, &timeout, format, oh, outstate))) { 04402 return NULL; 04403 } 04404 continue; 04405 } 04406 04407 f = ast_read(chan); 04408 if (!f) { 04409 *outstate = AST_CONTROL_HANGUP; 04410 res = 0; 04411 break; 04412 } 04413 if (f->frametype == AST_FRAME_CONTROL) { 04414 switch (f->subclass) { 04415 case AST_CONTROL_RINGING: /* record but keep going */ 04416 *outstate = f->subclass; 04417 break; 04418 04419 case AST_CONTROL_BUSY: 04420 case AST_CONTROL_CONGESTION: 04421 case AST_CONTROL_ANSWER: 04422 *outstate = f->subclass; 04423 timeout = 0; /* trick to force exit from the while() */ 04424 break; 04425 04426 /* Ignore these */ 04427 case AST_CONTROL_PROGRESS: 04428 case AST_CONTROL_PROCEEDING: 04429 case AST_CONTROL_HOLD: 04430 case AST_CONTROL_UNHOLD: 04431 case AST_CONTROL_VIDUPDATE: 04432 case AST_CONTROL_SRCUPDATE: 04433 case AST_CONTROL_CONNECTED_LINE: 04434 case AST_CONTROL_REDIRECTING: 04435 case -1: /* Ignore -- just stopping indications */ 04436 break; 04437 04438 default: 04439 ast_log(LOG_NOTICE, "Don't know what to do with control frame %d\n", f->subclass); 04440 } 04441 last_subclass = f->subclass; 04442 } 04443 ast_frfree(f); 04444 } 04445 } 04446 04447 /* Final fixups */ 04448 if (oh) { 04449 if (!ast_strlen_zero(oh->context)) 04450 ast_copy_string(chan->context, oh->context, sizeof(chan->context)); 04451 if (!ast_strlen_zero(oh->exten)) 04452 ast_copy_string(chan->exten, oh->exten, sizeof(chan->exten)); 04453 if (oh->priority) 04454 chan->priority = oh->priority; 04455 } 04456 if (chan->_state == AST_STATE_UP) 04457 *outstate = AST_CONTROL_ANSWER; 04458 04459 if (res <= 0) { 04460 if ( AST_CONTROL_RINGING == last_subclass ) 04461 chan->hangupcause = AST_CAUSE_NO_ANSWER; 04462 if (!chan->cdr && (chan->cdr = ast_cdr_alloc())) 04463 ast_cdr_init(chan->cdr, chan); 04464 if (chan->cdr) { 04465 char tmp[256]; 04466 snprintf(tmp, sizeof(tmp), "%s/%s", type, (char *)data); 04467 ast_cdr_setapp(chan->cdr,"Dial",tmp); 04468 ast_cdr_update(chan); 04469 ast_cdr_start(chan->cdr); 04470 ast_cdr_end(chan->cdr); 04471 /* If the cause wasn't handled properly */ 04472 if (ast_cdr_disposition(chan->cdr,chan->hangupcause)) 04473 ast_cdr_failed(chan->cdr); 04474 } 04475 ast_hangup(chan); 04476 chan = NULL; 04477 } 04478 return chan; 04479 }
| int ast_activate_generator | ( | struct ast_channel * | chan, | |
| struct ast_generator * | gen, | |||
| void * | params | |||
| ) |
Activate a given generator
Definition at line 2465 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(), and transmit_audio().
02466 { 02467 int res = 0; 02468 02469 ast_channel_lock(chan); 02470 02471 if (chan->generatordata) { 02472 if (chan->generator && chan->generator->release) 02473 chan->generator->release(chan, chan->generatordata); 02474 chan->generatordata = NULL; 02475 } 02476 02477 ast_prod(chan); 02478 if (gen->alloc && !(chan->generatordata = gen->alloc(chan, params))) { 02479 res = -1; 02480 } 02481 02482 if (!res) { 02483 ast_settimeout(chan, 50, generator_force, chan); 02484 chan->generator = gen; 02485 } 02486 02487 ast_channel_unlock(chan); 02488 02489 return res; 02490 }
| int ast_active_channels | ( | void | ) |
returns number of active/allocated channels
Definition at line 513 of file channel.c.
References ao2_container_count(), and channels.
Referenced by action_corestatus(), ast_var_channels(), ast_var_channels_table(), dahdi_restart(), handle_chanlist(), handle_show_settings(), and quit_handler().
00514 { 00515 return channels ? ao2_container_count(channels) : 0; 00516 }
| static int ast_add_fd | ( | struct pollfd * | pfd, | |
| int | fd | |||
| ) | [inline, static] |
if fd is a valid descriptor, set *pfd with the descriptor
Definition at line 2065 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 2415 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_pickup_call(), auth_exec(), background_detect_exec(), bridge_exec(), builtin_parkcall(), common_exec(), conf_exec(), count_exec(), dahdiras_exec(), 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(), park_exec_full(), pbx_builtin_background(), pickup_do(), playback_exec(), privacy_exec(), read_exec(), readexten_exec(), record_exec(), rpt_exec(), sayunixtime_exec(), send_waveform_to_channel(), setup_privacy_args(), skel_exec(), sla_station_exec(), speech_background(), testclient_exec(), testserver_exec(), transmit(), vm_exec(), vm_execmain(), waitfor_exec(), and zapateller_exec().
02416 { 02417 return __ast_answer(chan, 0, 1); 02418 }
| 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 192 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(), ast_app_run_macro(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), bridge_playfile(), builtin_atxfer(), builtin_automixmonitor(), builtin_blindtransfer(), conf_play(), confbridge_exec(), dial_exec_full(), feature_exec_app(), 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_in_bridged_call(), post_join_marked(), realtimefield_read(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), system_exec_helper(), try_calling(), and trylock_read().
00193 { 00194 int res = 0; 00195 struct asent *as; 00196 00197 AST_LIST_LOCK(&aslist); 00198 AST_LIST_TRAVERSE(&aslist, as, list) { 00199 if (as->chan == chan) { 00200 as->use_count++; 00201 break; 00202 } 00203 } 00204 AST_LIST_UNLOCK(&aslist); 00205 00206 if (as) { 00207 /* Entry exists, autoservice is already handling this channel */ 00208 return 0; 00209 } 00210 00211 if (!(as = ast_calloc(1, sizeof(*as)))) 00212 return -1; 00213 00214 /* New entry created */ 00215 as->chan = chan; 00216 as->use_count = 1; 00217 00218 ast_channel_lock(chan); 00219 as->orig_end_dtmf_flag = ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY) ? 1 : 0; 00220 if (!as->orig_end_dtmf_flag) 00221 ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY); 00222 ast_channel_unlock(chan); 00223 00224 AST_LIST_LOCK(&aslist); 00225 00226 if (AST_LIST_EMPTY(&aslist) && asthread != AST_PTHREADT_NULL) { 00227 ast_cond_signal(&as_cond); 00228 } 00229 00230 AST_LIST_INSERT_HEAD(&aslist, as, list); 00231 00232 if (asthread == AST_PTHREADT_NULL) { /* need start the thread */ 00233 if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) { 00234 ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n"); 00235 /* There will only be a single member in the list at this point, 00236 the one we just added. */ 00237 AST_LIST_REMOVE(&aslist, as, list); 00238 free(as); 00239 asthread = AST_PTHREADT_NULL; 00240 res = -1; 00241 } else { 00242 pthread_kill(asthread, SIGURG); 00243 } 00244 } 00245 00246 AST_LIST_UNLOCK(&aslist); 00247 00248 return res; 00249 }
| int ast_autoservice_stop | ( | struct ast_channel * | chan | ) |
Stop servicing a channel for us...
| 0 | success | |
| -1 | error, or the channel has been hungup |
Definition at line 251 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::frame_list, free, 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(), array(), ast_app_run_macro(), ast_dtmf_stream(), ast_get_enum(), ast_get_srv(), ast_get_txt(), ast_hangup(), bridge_playfile(), builtin_atxfer(), builtin_automixmonitor(), conf_play(), confbridge_exec(), dial_exec_full(), feature_exec_app(), 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_in_bridged_call(), post_join_marked(), realtimefield_read(), shell_helper(), sla_station_exec(), smdi_msg_retrieve_read(), system_exec_helper(), try_calling(), and trylock_read().
00252 { 00253 int res = -1; 00254 struct asent *as, *removed = NULL; 00255 struct ast_frame *f; 00256 int chan_list_state; 00257 00258 AST_LIST_LOCK(&aslist); 00259 00260 /* Save the autoservice channel list state. We _must_ verify that the channel 00261 * list has been rebuilt before we return. Because, after we return, the channel 00262 * could get destroyed and we don't want our poor autoservice thread to step on 00263 * it after its gone! */ 00264 chan_list_state = as_chan_list_state; 00265 00266 /* Find the entry, but do not free it because it still can be in the 00267 autoservice thread array */ 00268 AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) { 00269 if (as->chan == chan) { 00270 as->use_count--; 00271 if (as->use_count < 1) { 00272 AST_LIST_REMOVE_CURRENT(list); 00273 removed = as; 00274 } 00275 break; 00276 } 00277 } 00278 AST_LIST_TRAVERSE_SAFE_END; 00279 00280 if (removed && asthread != AST_PTHREADT_NULL) { 00281 pthread_kill(asthread, SIGURG); 00282 } 00283 00284 AST_LIST_UNLOCK(&aslist); 00285 00286 if (!removed) { 00287 return 0; 00288 } 00289 00290 /* Wait while autoservice thread rebuilds its list. */ 00291 while (chan_list_state == as_chan_list_state) { 00292 usleep(1000); 00293 } 00294 00295 /* Now autoservice thread should have no references to our entry 00296 and we can safely destroy it */ 00297 00298 if (!chan->_softhangup) { 00299 res = 0; 00300 } 00301 00302 if (!as->orig_end_dtmf_flag) { 00303 ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY); 00304 } 00305 00306 ast_channel_lock(chan); 00307 while ((f = AST_LIST_REMOVE_HEAD(&as->deferred_frames, frame_list))) { 00308 ast_queue_frame_head(chan, f); 00309 ast_frfree(f); 00310 } 00311 ast_channel_unlock(chan); 00312 00313 free(as); 00314 00315 return res; 00316 }
| 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 503 of file channel.c.
References ao2_callback, ast_channel_softhangup_cb(), channels, OBJ_MULTIPLE, and OBJ_NODATA.
Referenced by quit_handler().
00504 { 00505 shutting_down = 1; 00506 00507 if (hangup) { 00508 ao2_callback(channels, OBJ_NODATA | OBJ_MULTIPLE, ast_channel_softhangup_cb, NULL); 00509 } 00510 }
| int ast_best_codec | ( | int | fmts | ) |
Pick the best audio codec.
Pick the best codec Choose the best codec... Uhhh... Yah.
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
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 722 of file channel.c.
References ARRAY_LEN, AST_FORMAT_ADPCM, AST_FORMAT_ALAW, AST_FORMAT_AUDIO_MASK, 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_SIREN14, AST_FORMAT_SIREN7, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, AST_FORMAT_SPEEX, AST_FORMAT_ULAW, ast_log(), LOG_WARNING, and prefs.
Referenced by __oh323_new(), agent_call(), ast_codec_choose(), ast_iax2_new(), ast_speech_new(), bridge_make_compatible(), builtin_atxfer(), echo_exec(), findmeexec(), gtalk_new(), handle_open_receive_channel_ack_message(), iax2_request(), jingle_new(), local_new(), login_exec(), mgcp_new(), multicast_rtp_request(), set_format(), sip_new(), skinny_new(), skinny_set_rtp_peer(), socket_process(), start_rtp(), transmit_connect(), and unistim_new().
00723 { 00724 /* This just our opinion, expressed in code. We are asked to choose 00725 the best codec to use, given no information */ 00726 int x; 00727 static const int prefs[] = 00728 { 00729 /*! Okay, ulaw is used by all telephony equipment, so start with it */ 00730 AST_FORMAT_ULAW, 00731 /*! Unless of course, you're a silly European, so then prefer ALAW */ 00732 AST_FORMAT_ALAW, 00733 AST_FORMAT_SIREN14, 00734 AST_FORMAT_SIREN7, 00735 /*! G.722 is better then all below, but not as common as the above... so give ulaw and alaw priority */ 00736 AST_FORMAT_G722, 00737 /*! Okay, well, signed linear is easy to translate into other stuff */ 00738 AST_FORMAT_SLINEAR16, 00739 AST_FORMAT_SLINEAR, 00740 /*! G.726 is standard ADPCM, in RFC3551 packing order */ 00741 AST_FORMAT_G726, 00742 /*! G.726 is standard ADPCM, in AAL2 packing order */ 00743 AST_FORMAT_G726_AAL2, 00744 /*! ADPCM has great sound quality and is still pretty easy to translate */ 00745 AST_FORMAT_ADPCM, 00746 /*! Okay, we're down to vocoders now, so pick GSM because it's small and easier to 00747 translate and sounds pretty good */ 00748 AST_FORMAT_GSM, 00749 /*! iLBC is not too bad */ 00750 AST_FORMAT_ILBC, 00751 /*! Speex is free, but computationally more expensive than GSM */ 00752 AST_FORMAT_SPEEX, 00753 /*! Ick, LPC10 sounds terrible, but at least we have code for it, if you're tacky enough 00754 to use it */ 00755 AST_FORMAT_LPC10, 00756 /*! G.729a is faster than 723 and slightly less expensive */ 00757 AST_FORMAT_G729A, 00758 /*! Down to G.723.1 which is proprietary but at least designed for voice */ 00759 AST_FORMAT_G723_1, 00760 }; 00761 00762 /* Strip out video */ 00763 fmts &= AST_FORMAT_AUDIO_MASK; 00764 00765 /* Find the first preferred codec in the format given */ 00766 for (x = 0; x < ARRAY_LEN(prefs); x++) { 00767 if (fmts & prefs[x]) 00768 return prefs[x]; 00769 } 00770 00771 ast_log(LOG_WARNING, "Don't know any of 0x%x formats\n", fmts); 00772 00773 return 0; 00774 }
| struct ast_channel* ast_bridged_channel | ( | struct ast_channel * | chan | ) | [read] |
Find bridged channel.
| chan | Current channel |
Definition at line 5504 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(), __dahdi_exception(), _skinny_show_lines(), action_agents(), action_coreshowchannels(), agents_show(), agents_show_online(), analog_attempt_transfer(), analog_exception(), analog_hangup(), analog_ss_thread(), ast_bridge_call(), ast_cel_report_event(), ast_channel_masquerade(), ast_channel_set_linkgroup(), 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(), 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(), mgcp_hangup(), mgcp_ss(), misdn_attempt_transfer(), mixmonitor_thread(), my_get_sigpvt_bridged_channel(), park_call_full(), schedule_delivery(), sip_hangup(), sip_read(), sip_set_rtp_peer(), skinny_transfer(), socket_process(), start_spying(), startmon(), TransferCallStep1(), and unistim_hangup().
05505 { 05506 struct ast_channel *bridged; 05507 bridged = chan->_bridge; 05508 if (bridged && bridged->tech->bridged_channel) 05509 bridged = bridged->tech->bridged_channel(chan, bridged); 05510 return bridged; 05511 }
| int ast_call | ( | struct ast_channel * | chan, | |
| 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 |
Definition at line 4542 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(), ast_call_forward(), attempt_reconnect(), begin_dial_channel(), connect_link(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), play_sound_file(), ring_entry(), rpt(), rpt_exec(), and wait_for_answer().
04543 { 04544 /* Place an outgoing call, but don't wait any longer than timeout ms before returning. 04545 If the remote end does not answer within the timeout, then do NOT hang up, but 04546 return anyway. */ 04547 int res = -1; 04548 /* Stop if we're a zombie or need a soft hangup */ 04549 ast_channel_lock(chan); 04550 if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) { 04551 if (chan->cdr) 04552 ast_set_flag(chan->cdr, AST_CDR_FLAG_DIALED); 04553 if (chan->tech->call) 04554 res = chan->tech->call(chan, addr, timeout); 04555 ast_set_flag(chan, AST_FLAG_OUTGOING); 04556 } 04557 ast_channel_unlock(chan); 04558 return res; 04559 }
| struct ast_channel* ast_call_forward | ( | struct ast_channel * | caller, | |
| struct ast_channel * | orig, | |||
| int * | timeout, | |||
| int | format, | |||
| 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 | requested channel format | |
| oh | outgoing helper used with original channel | |
| outstate | reason why unsuccessful (if uncuccessful) |
Definition at line 4266 of file channel.c.
References outgoing_helper::account, ast_channel::accountcode, accountcode, ast_call(), AST_CDR_FLAG_ORIGINATED, ast_cdr_setaccount(), ast_channel_datastore_inherit(), ast_channel_inherit_variables(), ast_channel_lock, ast_channel_set_redirecting(), ast_channel_trylock, ast_channel_unlock, ast_channel_update_redirecting(), ast_copy_flags, ast_copy_string(), ast_hangup(), ast_log(), ast_party_caller_copy(), ast_party_connected_line_copy(), ast_request(), ast_set_callerid(), ast_set_variables(), ast_string_field_set, ast_strlen_zero(), ast_channel::call_forward, cause, ast_channel::cdr, CHANNEL_DEADLOCK_AVOIDANCE, ast_channel::cid, outgoing_helper::cid_name, outgoing_helper::cid_num, 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().
04267 { 04268 char tmpchan[256]; 04269 struct ast_channel *new = NULL; 04270 struct ast_party_redirecting *apr = &orig->redirecting; 04271 char *data, *type; 04272 int cause = 0; 04273 04274 /* gather data and request the new forward channel */ 04275 ast_copy_string(tmpchan, orig->call_forward, sizeof(tmpchan)); 04276 if ((data = strchr(tmpchan, '/'))) { 04277 *data++ = '\0'; 04278 type = tmpchan; 04279 } else { 04280 const char *forward_context; 04281 ast_channel_lock(orig); 04282 forward_context = pbx_builtin_getvar_helper(orig, "FORWARD_CONTEXT"); 04283 snprintf(tmpchan, sizeof(tmpchan), "%s@%s", orig->call_forward, S_OR(forward_context, orig->context)); 04284 ast_channel_unlock(orig); 04285 data = tmpchan; 04286 type = "Local"; 04287 } 04288 if (!(new = ast_request(type, format, orig, data, &cause))) { 04289 ast_log(LOG_NOTICE, "Unable to create channel for call forward to '%s/%s' (cause = %d)\n", type, data, cause); 04290 handle_cause(cause, outstate); 04291 ast_hangup(orig); 04292 return NULL; 04293 } 04294 04295 ast_channel_set_redirecting(new, apr); 04296 04297 /* Copy/inherit important information into new channel */ 04298 if (oh) { 04299 if (oh->vars) { 04300 ast_set_variables(new, oh->vars); 04301 } 04302 if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name)) { 04303 ast_set_callerid(new, oh->cid_num, oh->cid_name, oh->cid_num); 04304 } 04305 if (oh->parent_channel) { 04306 ast_channel_update_redirecting(oh->parent_channel, apr); 04307 ast_channel_inherit_variables(oh->parent_channel, new); 04308 ast_channel_datastore_inherit(oh->parent_channel, new); 04309 } 04310 if (oh->account) { 04311 ast_cdr_setaccount(new, oh->account); 04312 } 04313 } else if (caller) { /* no outgoing helper so use caller if avaliable */ 04314 ast_channel_update_redirecting(caller, apr); 04315 ast_channel_inherit_variables(caller, new); 04316 ast_channel_datastore_inherit(caller, new); 04317 } 04318 04319 ast_channel_lock(orig); 04320 while (ast_channel_trylock(new)) { 04321 CHANNEL_DEADLOCK_AVOIDANCE(orig); 04322 } 04323 ast_copy_flags(new->cdr, orig->cdr, AST_CDR_FLAG_ORIGINATED); 04324 ast_string_field_set(new, accountcode, orig->accountcode); 04325 ast_party_caller_copy(&new->cid, &orig->cid); 04326 ast_party_connected_line_copy(&new->connected, &orig->connected); 04327 ast_channel_unlock(new); 04328 ast_channel_unlock(orig); 04329 04330 /* call new channel */ 04331 if ((*timeout = ast_call(new, data, 0))) { 04332 ast_log(LOG_NOTICE, "Unable to call forward to channel %s/%s\n", type, (char *)data); 04333 ast_hangup(orig); 04334 ast_hangup(new); 04335 return NULL; 04336 } 04337 ast_hangup(orig); 04338 04339 return new; 04340 }
| void ast_cancel_shutdown | ( | void | ) |
Cancel a shutdown in progress.
Cancels an existing shutdown and returns to normal operation
Definition at line 519 of file channel.c.
Referenced by handle_abort_shutdown().
00520 { 00521 shutting_down = 0; 00522 }
| 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 640 of file channel.c.
References ARRAY_LEN, and causes.
Referenced by __transmit_response(), ast_do_masquerade(), ast_hangup(), dial_exec_full(), findmeexec(), sip_hangup(), and transmit_request_with_auth().
00641 { 00642 int x; 00643 00644 for (x = 0; x < ARRAY_LEN(causes); x++) { 00645 if (causes[x].cause == cause) 00646 return causes[x].desc; 00647 } 00648 00649 return "Unknown"; 00650 }
| 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 4841 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().
04842 { 04843 /* We must re-link, as the hash value will change here. */ 04844 ao2_unlink(channels, chan); 04845 ast_channel_lock(chan); 04846 __ast_change_name_nolink(chan, newname); 04847 ast_channel_unlock(chan); 04848 ao2_link(channels, chan); 04849 }
| 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 5836 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_make_compatible(), 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_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_channel::cid, ast_callerid::cid_num, ast_bridge_config::end_sound, EVENT_FLAG_CALL, 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::generator, LOG_WARNING, manager_bridge_event(), manager_event, ast_channel::masq, ast_channel::masqr, ast_channel::monitor, ast_channel::name, ast_channel::nativeformats, ast_bridge_config::nexteventts, ast_bridge_config::play_warning, ast_channel::readformat, S_OR, ast_channel_tech::send_digit_begin, ast_bridge_config::start_sound, ast_bridge_config::start_time, ast_channel::tech, ast_bridge_config::timelimit, ast_channel::uniqueid, update_bridge_vars(), ast_bridge_config::warning_freq, ast_bridge_config::warning_sound, and ast_channel::writeformat.
Referenced by ast_bridge_call().
05838 { 05839 struct ast_channel *who = NULL; 05840 enum ast_bridge_result res = AST_BRIDGE_COMPLETE; 05841 int nativefailed=0; 05842 int o0nativeformats; 05843 int o1nativeformats; 05844 long time_left_ms=0; 05845 char caller_warning = 0; 05846 char callee_warning = 0; 05847 05848 if (c0->_bridge) { 05849 ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", 05850 c0->name, c0->_bridge->name); 05851 return -1; 05852 } 05853 if (c1->_bridge) { 05854 ast_log(LOG_WARNING, "%s is already in a bridge with %s\n", 05855 c1->name, c1->_bridge->name); 05856 return -1; 05857 } 05858 05859 /* Stop if we're a zombie or need a soft hangup */ 05860 if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) || 05861 ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) 05862 return -1; 05863 05864 *fo = NULL; 05865 05866 if (ast_tvzero(config->start_time)) { 05867 config->start_time = ast_tvnow(); 05868 if (config->start_sound) { 05869 if (caller_warning) { 05870 bridge_playfile(c0, c1, config->start_sound, config->timelimit / 1000); 05871 } 05872 if (callee_warning) { 05873 bridge_playfile(c1, c0, config->start_sound, config->timelimit / 1000); 05874 } 05875 } 05876 } 05877 05878 /* Keep track of bridge */ 05879 c0->_bridge = c1; 05880 c1->_bridge = c0; 05881 05882 ast_set_owners_and_peers(c0, c1); 05883 05884 o0nativeformats = c0->nativeformats; 05885 o1nativeformats = c1->nativeformats; 05886 05887 if (config->feature_timer && !ast_tvzero(config->nexteventts)) { 05888 config->nexteventts = ast_tvadd(config->feature_start_time, ast_samp2tv(config->feature_timer, 1000)); 05889 } else if (config->timelimit) { 05890 time_left_ms = config->timelimit - ast_tvdiff_ms(ast_tvnow(), config->start_time); 05891 caller_warning = ast_test_flag(&config->features_caller, AST_FEATURE_PLAY_WARNING); 05892 callee_warning = ast_test_flag(&config->features_callee, AST_FEATURE_PLAY_WARNING); 05893 config->nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000)); 05894 if ((caller_warning || callee_warning) && config->play_warning) { 05895 long next_warn = config->play_warning; 05896 if (time_left_ms < config->play_warning) { 05897 /* At least one warning was played, which means we are returning after feature */ 05898 long warns_passed = (config->play_warning - time_left_ms) / config->warning_freq; 05899 /* It is 'warns_passed * warning_freq' NOT '(warns_passed + 1) * warning_freq', 05900 because nexteventts will be updated once again in the 'if (!to)' block */ 05901 next_warn = config->play_warning - warns_passed * config->warning_freq; 05902 } 05903 config->nexteventts = ast_tvsub(config->nexteventts, ast_samp2tv(next_warn, 1000)); 05904 } 05905 } else { 05906 config->nexteventts.tv_sec = 0; 05907 config->nexteventts.tv_usec = 0; 05908 } 05909 05910 if (!c0->tech->send_digit_begin) 05911 ast_set_flag(c1, AST_FLAG_END_DTMF_ONLY); 05912 if (!c1->tech->send_digit_begin) 05913 ast_set_flag(c0, AST_FLAG_END_DTMF_ONLY); 05914 manager_bridge_event(1, 1, c0, c1); 05915 05916 /* Before we enter in and bridge these two together tell them both the source of audio has changed */ 05917 ast_indicate(c0, AST_CONTROL_SRCUPDATE); 05918 ast_indicate(c1, AST_CONTROL_SRCUPDATE); 05919 05920 for (/* ever */;;) { 05921 struct timeval now = { 0, }; 05922 int to; 05923 05924 to = -1; 05925 05926 if (!ast_tvzero(config->nexteventts)) { 05927 now = ast_tvnow(); 05928 to = ast_tvdiff_ms(config->nexteventts, now); 05929 if (to <= 0) { 05930 if (!config->timelimit) { 05931 res = AST_BRIDGE_COMPLETE; 05932 break; 05933 } 05934 to = 0; 05935 } 05936 } 05937 05938 if (config->timelimit) { 05939 time_left_ms = config->timelimit - ast_tvdiff_ms(now, config->start_time); 05940 if (time_left_ms < to) 05941 to = time_left_ms; 05942 05943 if (time_left_ms <= 0) { 05944 if (caller_warning && config->end_sound) 05945 bridge_playfile(c0, c1, config->end_sound, 0); 05946 if (callee_warning && config->end_sound) 05947 bridge_playfile(c1, c0, config->end_sound, 0); 05948 *fo = NULL; 05949 if (who) 05950 *rc = who; 05951 res = 0; 05952 break; 05953 } 05954 05955 if (!to) { 05956 if (time_left_ms >= 5000 && config->warning_sound && config->play_warning && ast_test_flag(config, AST_FEATURE_WARNING_ACTIVE)) { 05957 int t = (time_left_ms + 500) / 1000; /* round to nearest second */ 05958 if (caller_warning) 05959 bridge_playfile(c0, c1, config->warning_sound, t); 05960 if (callee_warning) 05961 bridge_playfile(c1, c0, config->warning_sound, t); 05962 } 05963 05964 if (config->warning_freq && (time_left_ms > (config->warning_freq + 5000))) { 05965 config->nexteventts = ast_tvadd(config->nexteventts, ast_samp2tv(config->warning_freq, 1000)); 05966 } else { 05967 config->nexteventts = ast_tvadd(config->start_time, ast_samp2tv(config->timelimit, 1000)); 05968 } 05969 } 05970 ast_clear_flag(config, AST_FEATURE_WARNING_ACTIVE); 05971 } 05972 05973 if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) { 05974 if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE) 05975 c0->_softhangup = 0; 05976 if (c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) 05977 c1->_softhangup = 0; 05978 c0->_bridge = c1; 05979 c1->_bridge = c0; 05980 ast_debug(1, "Unbridge signal received. Ending native bridge.\n"); 05981 continue; 05982 } 05983 05984 /* Stop if we're a zombie or need a soft hangup */ 05985 if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) || 05986 ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) { 05987 *fo = NULL; 05988 if (who) 05989 *rc = who; 05990 res = 0; 05991 ast_debug(1, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n", 05992 c0->name, c1->name, 05993 ast_test_flag(c0, AST_FLAG_ZOMBIE) ? "Yes" : "No", 05994 ast_check_hangup(c0) ? "Yes" : "No", 05995 ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No", 05996 ast_check_hangup(c1) ? "Yes" : "No"); 05997 break; 05998 } 05999 06000 update_bridge_vars(c0, c1); 06001 06002 bridge_play_sounds(c0, c1); 06003 06004 if (c0->tech->bridge && 06005 (c0->tech->bridge == c1->tech->bridge) && 06006 !nativefailed && !c0->monitor && !c1->monitor && 06007 !c0->audiohooks && !c1->audiohooks && 06008 !c0->masq && !c0->masqr && !c1->masq && !c1->masqr) { 06009 /* Looks like they share a bridge method and nothing else is in the way */ 06010 ast_set_flag(c0, AST_FLAG_NBRIDGE); 06011 ast_set_flag(c1, AST_FLAG_NBRIDGE); 06012 if ((res = c0->tech->bridge(c0, c1, config->flags, fo, rc, to)) == AST_BRIDGE_COMPLETE) { 06013 manager_event(EVENT_FLAG_CALL, "Unlink", 06014 "Channel1: %s\r\n" 06015 "Channel2: %s\r\n" 06016 "Uniqueid1: %s\r\n" 06017 "Uniqueid2: %s\r\n" 06018 "CallerID1: %s\r\n" 06019 "CallerID2: %s\r\n", 06020 c0->name, c1->name, c0->uniqueid, c1->uniqueid, S_OR(c0->cid.cid_num, "<unknown>"), S_OR(c1->cid.cid_num, "<unknown>")); 06021 06022 ast_debug(1, "Returning from native bridge, channels: %s, %s\n", c0->name, c1->name); 06023 06024 ast_clear_flag(c0, AST_FLAG_NBRIDGE); 06025 ast_clear_flag(c1, AST_FLAG_NBRIDGE); 06026 06027 if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) 06028 continue; 06029 06030 c0->_bridge = NULL; 06031 c1->_bridge = NULL; 06032 return res; 06033 } else { 06034 ast_clear_flag(c0, AST_FLAG_NBRIDGE); 06035 ast_clear_flag(c1, AST_FLAG_NBRIDGE); 06036 } 06037 switch (res) { 06038 case AST_BRIDGE_RETRY: 06039 if (config->play_warning) { 06040 ast_set_flag(config, AST_FEATURE_WARNING_ACTIVE); 06041 } 06042 continue; 06043 default: 06044 ast_verb(3, "Native bridging %s and %s ended\n", c0->name, c1->name); 06045 /* fallthrough */ 06046 case AST_BRIDGE_FAILED_NOWARN: 06047 nativefailed++; 06048 break; 06049 } 06050 } 06051 06052 if (((c0->writeformat != c1->readformat) || (c0->readformat != c1->writeformat) || 06053 (c0->nativeformats != o0nativeformats) || (c1->nativeformats != o1nativeformats)) && 06054 !(c0->generator || c1->generator)) { 06055 if (ast_channel_make_compatible(c0, c1)) { 06056 ast_log(LOG_WARNING, "Can't make %s and %s compatible\n", c0->name, c1->name); 06057 manager_bridge_event(0, 1, c0, c1); 06058 return AST_BRIDGE_FAILED; 06059 } 06060 o0nativeformats = c0->nativeformats; 06061 o1nativeformats = c1->nativeformats; 06062 } 06063 06064 update_bridge_vars(c0, c1); 06065 06066 res = ast_generic_bridge(c0, c1, config, fo, rc); 06067 if (res != AST_BRIDGE_RETRY) { 06068 break; 06069 } else if (config->feature_timer) { 06070 /* feature timer expired but has not been updated, sending to ast_bridge_call to do so */ 06071 break; 06072 } 06073 } 06074 06075 ast_clear_flag(c0, AST_FLAG_END_DTMF_ONLY); 06076 ast_clear_flag(c1, AST_FLAG_END_DTMF_ONLY); 06077 06078 /* Now that we have broken the bridge the source will change yet again */ 06079 ast_indicate(c0, AST_CONTROL_SRCUPDATE); 06080 ast_indicate(c1, AST_CONTROL_SRCUPDATE); 06081 06082 c0->_bridge = NULL; 06083 c1->_bridge = NULL; 06084 06085 manager_event(EVENT_FLAG_CALL, "Unlink", 06086 "Channel1: %s\r\n" 06087 "Channel2: %s\r\n" 06088 "Uniqueid1: %s\r\n" 06089 "Uniqueid2: %s\r\n" 06090 "CallerID1: %s\r\n" 06091 "CallerID2: %s\r\n", 06092 c0->name, c1->name, c0->uniqueid, c1->uniqueid, S_OR(c0->cid.cid_num, "<unknown>"), S_OR(c1->cid.cid_num, "<unknown>")); 06093 ast_debug(1, "Bridge stops bridging channels %s and %s\n", c0->name, c1->name); 06094 06095 return res; 06096 }
| 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 1230 of file channel.c.
References ao2_callback_data, and channels.
Referenced by ast_cel_check_retire_linkedid(), ast_pickup_call(), handle_core_set_debug_channel(), my_ast_get_channel_by_name_locked(), pickup_by_mark(), and state_notify_build_xml().
01232 { 01233 return ao2_callback_data(channels, ao2_flags, cb_fn, arg, data); 01234 }
| 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 560 of file channel.c.
References ast_channel_cmpwhentohangup_tv().
00561 { 00562 struct timeval when = { offset, }; 00563 return ast_channel_cmpwhentohangup_tv(chan, when); 00564 }
| 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 545 of file channel.c.
References ast_tvadd(), ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), and ast_channel::whentohangup.
Referenced by ast_channel_cmpwhentohangup().
00546 { 00547 struct timeval whentohangup; 00548 00549 if (ast_tvzero(chan->whentohangup)) 00550 return ast_tvzero(offset) ? 0 : -1; 00551 00552 if (ast_tvzero(offset)) 00553 return 1; 00554 00555 whentohangup = ast_tvadd(offset, ast_tvnow()); 00556 00557 return ast_tvdiff_ms(whentohangup, chan->whentohangup); 00558 }
| 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 7366 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(), ast_channel::connected, chanlist::connected, pbx_builtin_getvar_helper(), and S_OR.
Referenced by ast_bridge_call(), ast_generic_bridge(), ast_pickup_call(), builtin_atxfer(), builtin_blindtransfer(), feature_request_and_dial(), handle_frame(), pickup_do(), and wait_for_answer().
07367 { 07368 const char *macro; 07369 const char *macro_args; 07370 union { 07371 const struct ast_frame *frame; 07372 const struct ast_party_connected_line *connected; 07373 } pointer; 07374 int retval; 07375 07376 if (frame) { 07377 pointer.frame = connected_info; 07378 } else { 07379 pointer.connected = connected_info; 07380 } 07381 07382 ast_channel_lock(macro_chan); 07383 macro = ast_strdupa(S_OR(pbx_builtin_getvar_helper(macro_chan, caller ? "CONNECTED_LINE_CALLER_SEND_MACRO" : "CONNECTED_LINE_CALLEE_SEND_MACRO"), "")); 07384 macro_args = ast_strdupa(S_OR(pbx_builtin_getvar_helper(macro_chan, caller ? "CONNECTED_LINE_CALLER_SEND_MACRO_ARGS" : "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS"), "")); 07385 ast_channel_unlock(macro_chan); 07386 07387 if (ast_strlen_zero(macro)) { 07388 return -1; 07389 } 07390 07391 if (frame) { 07392 ast_connected_line_parse_data(pointer.frame->data.ptr, pointer.frame->datalen, ¯o_chan->connected); 07393 } else { 07394 ast_party_connected_line_copy(¯o_chan->connected, pointer.connected); 07395 } 07396 07397 if (!(retval = ast_app_run_macro(autoservice_chan, macro_chan, macro, macro_args))) { 07398 ast_channel_update_connected_line(macro_chan, ¯o_chan->connected); 07399 } 07400 07401 return retval; 07402 }
| 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 1969 of file channel.c.
References AST_LIST_INSERT_HEAD, and ast_channel::datastores.
Referenced by _macro_exec(), acf_curlopt_write(), acf_iaxvar_write(), acf_odbc_read(), add_features_datastores(), add_to_agi(), ast_iax2_new(), audiohook_volume_get(), authenticate_reply(), calendar_query_exec(), dial_exec_full(), do_notify(), dundi_query_read(), enable_jack_hook(), enum_query_read(), find_transaction(), get_lock(), gosub_exec(), lua_get_state(), mute_add_audiohook(), pbx_builtin_raise_exception(), setup_inheritance_datastore(), setup_mixmonitor_ds(), setup_transfer_datastore(), shared_write(), smdi_msg_retrieve_read(), socket_process(), speech_create(), speex_write(), try_calling(), and volume_write().
01970 { 01971 int res = 0; 01972 01973 AST_LIST_INSERT_HEAD(&chan->datastores, datastore, entry); 01974 01975 return res; 01976 }
| 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 1942 of file channel.c.
References ast_datastore_alloc.
01943 { 01944 return ast_datastore_alloc(info, uid); 01945 }
| 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 1983 of file channel.c.
References AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, 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(), ast_odbc_retrieve_transaction_obj(), attended_transfer_occurred(), audiohook_volume_callback(), audiohook_volume_get(), builtin_atxfer(), calendar_event_read(), calendar_query_exec(), calendar_query_result_exec(), dial_exec_full(), disable_jack_hook(), dundi_result_read(), enable_jack_hook(), enum_result_read(), exec_odbcfinish(), find_speech(), find_transaction(), func_inheritance_write(), func_mute_write(), get_agi_cmd(), get_lock(), gosub_exec(), iax2_call(), jack_hook_callback(), local_read(), local_write(), lock_fixup(), lua_get_state(), manage_parkinglot(), manager_mutestream(), mark_transaction_active(), mute_callback(), park_exec_full(), pbx_builtin_raise_exception(), pop_exec(), queue_transfer_fixup(), release_transaction(), return_exec(), shared_read(), shared_write(), smdi_msg_read(), speech_background(), speech_destroy(), speex_callback(), speex_read(), speex_write(), stop_mixmonitor_exec(), try_calling(), unlock_read(), volume_callback(), and volume_write().
01984 { 01985 struct ast_datastore *datastore = NULL; 01986 01987 if (info == NULL) 01988 return NULL; 01989 01990 AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, entry) { 01991 if (datastore->info != info) { 01992 continue; 01993 } 01994 01995 if (uid == NULL) { 01996 /* matched by type only */ 01997 break; 01998 } 01999 02000 if ((datastore->uid != NULL) && !strcasecmp(uid, datastore->uid)) { 02001 /* Matched by type AND uid */ 02002 break; 02003 } 02004 } 02005 AST_LIST_TRAVERSE_SAFE_END; 02006 02007 return datastore; 02008 }
| int ast_channel_datastore_free | ( | struct ast_datastore * | datastore | ) |
Free a channel data store object.
Definition at line 1947 of file channel.c.
References ast_datastore_free().
01948 { 01949 return ast_datastore_free(datastore); 01950 }
| int ast_channel_datastore_inherit | ( | struct ast_channel * | from, | |
| struct ast_channel * | to | |||
| ) |
Inherit datastores from a parent to a child.
Definition at line 1952 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(), ast_call_forward(), begin_dial_channel(), dial_exec_full(), do_forward(), findmeexec(), local_call(), ring_entry(), and wait_for_answer().
01953 { 01954 struct ast_datastore *datastore = NULL, *datastore2; 01955 01956 AST_LIST_TRAVERSE(&from->datastores, datastore, entry) { 01957 if (datastore->inheritance > 0) { 01958 datastore2 = ast_datastore_alloc(datastore->info, datastore->uid); 01959 if (datastore2) { 01960 datastore2->data = datastore->info->duplicate ? datastore->info->duplicate(datastore->data) : NULL; 01961 datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1; 01962 AST_LIST_INSERT_TAIL(&to->datastores, datastore2, entry); 01963 } 01964 } 01965 } 01966 return 0; 01967 }
| 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 1978 of file channel.c.
References AST_LIST_REMOVE, and ast_channel::datastores.
Referenced by acf_fetch(), acf_odbc_read(), dial_exec_full(), disable_jack_hook(), exec_odbcfinish(), lua_get_state(), queue_transfer_fixup(), speech_background(), speech_destroy(), speex_write(), and try_calling().
01979 { 01980 return AST_LIST_REMOVE(&chan->datastores, datastore, entry) ? 0 : -1; 01981 }
| int ast_channel_defer_dtmf | ( | struct ast_channel * | chan | ) |
Defers DTMF so that you only read things like hangups and audio.
Definition at line 1212 of file channel.c.
References AST_FLAG_DEFER_DTMF, ast_set_flag, and ast_test_flag.
Referenced by __adsi_transmit_messages(), and find_cache().
01213 { 01214 int pre = 0; 01215 01216 if (chan) { 01217 pre = ast_test_flag(chan, AST_FLAG_DEFER_DTMF); 01218 ast_set_flag(chan, AST_FLAG_DEFER_DTMF); 01219 } 01220 return pre; 01221 }
| 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 5738 of file channel.c.
References ast_channel_tech::early_bridge, and ast_channel::tech.
Referenced by dial_exec_full(), and wait_for_answer().
05739 { 05740 /* Make sure we can early bridge, if not error out */ 05741 if (!c0->tech->early_bridge || (c1 && (!c1->tech->early_bridge || c0->tech->early_bridge != c1->tech->early_bridge))) 05742 return -1; 05743 05744 return c0->tech->early_bridge(c0, c1); 05745 }
| struct ast_channel* ast_channel_get_by_exten | ( | const char * | exten, | |
| const char * | context | |||
| ) | [read] |
Find a channel by extension and context.
| a | channel that is at the specified extension and context | |
| NULL | if no channel was found |
Definition at line 1407 of file channel.c.
References ast_channel_get_full().
01408 { 01409 return ast_channel_get_full(NULL, 0, exten, context); 01410 }
| struct ast_channel* ast_channel_get_by_name | ( | const char * | name | ) | [read] |
Find a channel by name.
Channel search functions
| a | channel with the name specified by the argument | |
| NULL | if no channel was found |
Definition at line 1397 of file channel.c.
References ast_channel_get_full().
Referenced by action_add_agi_cmd(), 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_mutestream(), manager_park(), manager_play_dtmf(), park_call_full(), pbx_builtin_importvar(), shared_read(), shared_write(), start_monitor_action(), and stop_monitor_action().
01398 { 01399 return ast_channel_get_full(name, 0, NULL, NULL); 01400 }
| struct ast_channel* ast_channel_get_by_name_prefix | ( | const char * | name, | |
| size_t | name_len | |||
| ) | [read] |
Find a channel by a name prefix.
| a | channel with the name prefix specified by the arguments | |
| NULL | if no channel was found |
Definition at line 1402 of file channel.c.
References ast_channel_get_full().
Referenced by action_bridge(), ast_parse_device_state(), bridge_exec(), common_exec(), handle_cli_mixmonitor(), shared_read(), and shared_write().
01403 { 01404 return ast_channel_get_full(name, name_len, NULL, NULL); 01405 }
| 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 2143 of file channel.h.
References ast_channel_queryoption(), AST_OPTION_T38_STATE, and T38_STATE_UNAVAILABLE.
Referenced by transmit(), transmit_audio(), and transmit_t38().
02144 { 02145 enum ast_t38_state state = T38_STATE_UNAVAILABLE; 02146 int datalen = sizeof(state); 02147 02148 ast_channel_queryoption(chan, AST_OPTION_T38_STATE, &state, &datalen, 0); 02149 02150 return state; 02151 }
| 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 4851 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(), ast_call_forward(), begin_dial_channel(), dial_exec_full(), dial_transfer(), do_forward(), feature_request_and_dial(), findmeexec(), ring_entry(), and wait_for_answer().
04852 { 04853 struct ast_var_t *current, *newvar; 04854 const char *varname; 04855 04856 AST_LIST_TRAVERSE(&parent->varshead, current, entries) { 04857 int vartype = 0; 04858 04859 varname = ast_var_full_name(current); 04860 if (!varname) 04861 continue; 04862 04863 if (varname[0] == '_') { 04864 vartype = 1; 04865 if (varname[1] == '_') 04866 vartype = 2; 04867 } 04868 04869 switch (vartype) { 04870 case 1: 04871 newvar = ast_var_assign(&varname[1], ast_var_value(current)); 04872 if (newvar) { 04873 AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries); 04874 ast_debug(1, "Copying soft-transferable variable %s.\n", ast_var_name(newvar)); 04875 } 04876 break; 04877 case 2: 04878 newvar = ast_var_assign(varname, ast_var_value(current)); 04879 if (newvar) { 04880 AST_LIST_INSERT_TAIL(&child->varshead, newvar, entries); 04881 ast_debug(1, "Copying hard-transferable variable %s.\n", ast_var_name(newvar)); 04882 } 04883 break; 04884 default: 04885 ast_debug(1, "Not copying variable %s.\n", ast_var_name(current)); 04886 break; 04887 } 04888 } 04889 }
| 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 1297 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_var_channel_bridge(), ast_var_channel_types_table(), ast_var_channels_table(), common_exec(), func_channels_read(), and handle_chanlist().
01298 { 01299 struct ast_channel_iterator *i; 01300 01301 if (!(i = ast_calloc(1, sizeof(*i)))) { 01302 return NULL; 01303 } 01304 01305 i->simple_iterator = ao2_iterator_init(channels, 0); 01306 i->active_iterator = &i->simple_iterator; 01307 01308 return i; 01309 }
| 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.
| NULL | on failure | |
| a | new channel iterator based on the specified parameters |
Definition at line 1287 of file channel.c.
References channel_iterator_search().
Referenced by common_exec(), and pickup_by_exten().
01288 { 01289 return channel_iterator_search(NULL, 0, exten, context); 01290 }
| 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.
| NULL | on failure | |
| a | new channel iterator based on the specified parameters |
Definition at line 1292 of file channel.c.
References channel_iterator_search().
Referenced by ast_complete_channels(), common_exec(), and softhangup_exec().
01293 { 01294 return channel_iterator_search(name, name_len, NULL, NULL); 01295 }
| struct ast_channel_iterator* ast_channel_iterator_destroy | ( | struct ast_channel_iterator * | i | ) | [read] |
Destroy a channel iterator.
Definition at line 1245 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(), func_channels_read(), handle_chanlist(), pickup_by_exten(), and softhangup_exec().
01246 { 01247 ao2_iterator_destroy(i->active_iterator); 01248 ast_free(i); 01249 01250 return NULL; 01251 }
| struct ast_channel* ast_channel_iterator_next | ( | struct ast_channel_iterator * | i | ) | [read] |
Get the next channel for a channel iterator.
| 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 1311 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(), func_channels_read(), handle_chanlist(), next_channel(), pickup_by_exten(), and softhangup_exec().
01312 { 01313 return ao2_iterator_next(i->active_iterator); 01314 }
| 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 4735 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(), multiplexed_bridge_join(), park_exec_full(), simple_bridge_join(), try_calling(), and wait_for_answer().
04736 { 04737 /* Some callers do not check return code, and we must try to set all call legs correctly */ 04738 int rc = 0; 04739 04740 /* Set up translation from the chan to the peer */ 04741 rc = ast_channel_make_compatible_helper(chan, peer); 04742 04743 if (rc < 0) 04744 return rc; 04745 04746 /* Set up translation from the peer to the chan */ 04747 rc = ast_channel_make_compatible_helper(peer, chan); 04748 04749 return rc; 04750 }
| 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 4752 of file channel.c.
References ast_channel::_bridge, ast_bridged_channel(), ast_channel_lock, ast_channel_trylock, ast_channel_unlock, ast_debug, ast_log(), ast_null_frame, ast_queue_frame(), ast_channel_tech::get_base_channel, LOG_WARNING, ast_channel::masq, ast_channel::masqr, ast_channel::name, and ast_channel::tech.
Referenced by analog_attempt_transfer(), ast_async_goto(), ast_pickup_call(), attempt_transfer(), builtin_atxfer(), check_availability(), check_bridge(), check_goto_on_transfer(), do_bridge_masquerade(), handle_invite_replaces(), iax_park(), masq_park_call(), misdn_attempt_transfer(), pickup_do(), sip_park(), and skinny_transfer().
04753 { 04754 int res = -1; 04755 struct ast_channel *final_orig, *final_clone, *base; 04756 04757 retrymasq: 04758 final_orig = original; 04759 final_clone = clonechan; 04760 04761 ast_channel_lock(original); 04762 while (ast_channel_trylock(clonechan)) { 04763 ast_channel_unlock(original); 04764 usleep(1); 04765 ast_channel_lock(original); 04766 } 04767 04768 /* each of these channels may be sitting behind a channel proxy (i.e. chan_agent) 04769 and if so, we don't really want to masquerade it, but its proxy */ 04770 if (original->_bridge && (original->_bridge != ast_bridged_channel(original)) && (original->_bridge->_bridge != original)) 04771 final_orig = original->_bridge; 04772 04773 if (clonechan->_bridge && (clonechan->_bridge != ast_bridged_channel(clonechan)) && (clonechan->_bridge->_bridge != clonechan)) 04774 final_clone = clonechan->_bridge; 04775 04776 if (final_clone->tech->get_base_channel && (base = final_clone->tech->get_base_channel(final_clone))) { 04777 final_clone = base; 04778 } 04779 04780 if ((final_orig != original) || (final_clone != clonechan)) { 04781 /* Lots and lots of deadlock avoidance. The main one we're competing with 04782 * is ast_write(), which locks channels recursively, when working with a 04783 * proxy channel. */ 04784 if (ast_channel_trylock(final_orig)) { 04785 ast_channel_unlock(clonechan); 04786 ast_channel_unlock(original); 04787 goto retrymasq; 04788 } 04789 if (ast_channel_trylock(final_clone)) { 04790 ast_channel_unlock(final_orig); 04791 ast_channel_unlock(clonechan); 04792 ast_channel_unlock(original); 04793 goto retrymasq; 04794 } 04795 ast_channel_unlock(clonechan); 04796 ast_channel_unlock(original); 04797 original = final_orig; 04798 clonechan = final_clone; 04799 } 04800 04801 if (original == clonechan) { 04802 ast_log(LOG_WARNING, "Can't masquerade channel '%s' into itself!\n", original->name); 04803 ast_channel_unlock(clonechan); 04804 ast_channel_unlock(original); 04805 return -1; 04806 } 04807 04808 ast_debug(1, "Planning to masquerade channel %s into the structure of %s\n", 04809 clonechan->name, original->name); 04810 if (original->masq) { 04811 ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n", 04812 original->masq->name, original->name); 04813 } else if (clonechan->masqr) { 04814 ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n", 04815 clonechan->name, clonechan->masqr->name); 04816 } else { 04817 original->masq = clonechan; 04818 clonechan->masqr = original; 04819 ast_queue_frame(original, &ast_null_frame); 04820 ast_queue_frame(clonechan, &ast_null_frame); 04821 ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", clonechan->name, original->name); 04822 res = 0; 04823 } 04824 04825 ast_channel_unlock(clonechan); 04826 ast_channel_unlock(original); 04827 04828 return res; 04829 }
| 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 6112 of file channel.c.
References ast_log(), errno, LOG_ERROR, ast_channel_tech::queryoption, and ast_channel::tech.
Referenced by ast_channel_get_t38_state(), rcvfax_exec(), and sndfax_exec().
06113 { 06114 if (!chan->tech->queryoption) { 06115 errno = ENOSYS; 06116 return -1; 06117 } 06118 06119 if (block) 06120 ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n"); 06121 06122 return chan->tech->queryoption(chan, option, data, datalen); 06123 }
| void ast_channel_queue_connected_line_update | ( | struct ast_channel * | chan, | |
| const struct ast_party_connected_line * | connected | |||
| ) |
Queue a connected line update frame on a channel.
| chan | Asterisk channel to indicate connected line information | |
| connected | Connected line information |
Definition at line 6896 of file channel.c.
References ast_connected_line_build_data(), AST_CONTROL_CONNECTED_LINE, and ast_queue_control_data().
Referenced by ast_pickup_call(), handle_request_invite(), handle_request_update(), handle_response_invite(), local_attended_transfer(), misdn_queue_connected_line_update(), and pickup_do().
06897 { 06898 unsigned char data[1024]; /* This should be large enough */ 06899 size_t datalen; 06900 06901 datalen = ast_connected_line_build_data(data, sizeof(data), connected); 06902 if (datalen == (size_t) -1) { 06903 return; 06904 } 06905 06906 ast_queue_control_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen); 06907 }
| void ast_channel_queue_redirecting_update | ( | struct ast_channel * | chan, | |
| const struct ast_party_redirecting * | redirecting | |||
| ) |
Queue a redirecting update frame on a channel.
| chan | Asterisk channel to indicate redirecting id information | |
| redirecting | Redirecting id information |
Definition at line 7353 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().
07354 { 07355 unsigned char data[1024]; /* This should be large enough */ 07356 size_t datalen; 07357 07358 datalen = ast_redirecting_build_data(data, sizeof(data), redirecting); 07359 if (datalen == (size_t) -1) { 07360 return; 07361 } 07362 07363 ast_queue_control_data(chan, AST_CONTROL_REDIRECTING, data, datalen); 07364 }
| 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 4230 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().
04231 { 04232 switch (reason) /* the following appear to be the only ones actually returned by request_and_dial */ 04233 { 04234 case 0: 04235 return "Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)"; 04236 case AST_CONTROL_HANGUP: 04237 return "Hangup"; 04238 case AST_CONTROL_RING: 04239 return "Local Ring"; 04240 case AST_CONTROL_RINGING: 04241 return "Remote end Ringing"; 04242 case AST_CONTROL_ANSWER: 04243 return "Remote end has Answered"; 04244 case AST_CONTROL_BUSY: 04245 return "Remote end is Busy"; 04246 case AST_CONTROL_CONGESTION: 04247 return "Congestion (circuits busy)"; 04248 default: 04249 return "Unknown Reason!!"; 04250 } 04251 }
| 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 567 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().
00568 { 00569 struct chanlist *chan; 00570 00571 AST_RWLIST_WRLOCK(&backends); 00572 00573 AST_RWLIST_TRAVERSE(&backends, chan, list) { 00574 if (!strcasecmp(tech->type, chan->tech->type)) { 00575 ast_log(LOG_WARNING, "Already have a handler for type '%s'\n", tech->type); 00576 AST_RWLIST_UNLOCK(&backends); 00577 return -1; 00578 } 00579 } 00580 00581 if (!(chan = ast_calloc(1, sizeof(*chan)))) { 00582 AST_RWLIST_UNLOCK(&backends); 00583 return -1; 00584 } 00585 chan->tech = tech; 00586 AST_RWLIST_INSERT_HEAD(&backends, chan, list); 00587 00588 ast_debug(1, "Registered handler for '%s' (%s)\n", chan->tech->type, chan->tech->description); 00589 00590 ast_verb(2, "Registered channel type '%s' (%s)\n", chan->tech->type, chan->tech->description); 00591 00592 AST_RWLIST_UNLOCK(&backends); 00593 00594 return 0; 00595 }
| 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 1456 of file channel.c.
References ao2_unlink, ast_channel_unref, and channels.
Referenced by acf_odbc_read(), acf_odbc_write(), action_getvar(), agent_cleanup(), agent_new(), ast_add_extension2_lockopt(), ast_cel_fabricate_channel_from_event(), ast_do_masquerade(), ast_hangup(), ast_iax2_new(), ast_pbx_outgoing_cdr_failed(), ast_str_substitute_variables_full(), bridge_request(), cli_odbc_read(), cli_odbc_write(), custom_log(), do_notify(), gtalk_newcall(), local_new(), make_email_file(), manager_log(), pbx_substitute_variables_helper_full(), rotate_file(), sendmail(), sendpage(), sqlite3_log(), and syslog_log().
01457 { 01458 /* Safe, even if already unlinked. */ 01459 ao2_unlink(channels, chan); 01460 return ast_channel_unref(chan); 01461 }
| 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 4675 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().
04676 { 04677 if (chan->tech->send_html) 04678 return chan->tech->send_html(chan, subclass, data, datalen); 04679 return -1; 04680 }
| 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 4682 of file channel.c.
References ast_channel_sendhtml(), and AST_HTML_URL.
Referenced by dial_exec_full(), sendurl_exec(), and try_calling().
04683 { 04684 return ast_channel_sendhtml(chan, AST_HTML_URL, url, strlen(url) + 1); 04685 }
| void ast_channel_set_connected_line | ( | struct ast_channel * | chan, | |
| const struct ast_party_connected_line * | connected | |||
| ) |
Set the connected line information in the Asterisk channel.
| chan | Asterisk channel to set connected line information | |
| connected | Connected line information |
Definition at line 6643 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(), and connectedline_write().
06644 { 06645 if (&chan->connected == connected) { 06646 /* Don't set to self */ 06647 return; 06648 } 06649 06650 ast_channel_lock(chan); 06651 ast_party_connected_line_set(&chan->connected, connected); 06652 ast_channel_unlock(chan); 06653 }
| void ast_channel_set_fd | ( | struct ast_channel * | chan, | |
| int | which, | |||
| int | fd | |||
| ) |
Set the file descriptor on the channel
Definition at line 2011 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(), jingle_new(), mgcp_new(), misdn_new(), my_swap_subchannels(), nbs_new(), oss_new(), phone_new(), setformat(), sip_new(), skinny_new(), start_rtp(), and swap_subs().
02012 { 02013 #ifdef HAVE_EPOLL 02014 struct epoll_event ev; 02015 struct ast_epoll_data *aed = NULL; 02016 02017 if (chan->fds[which] > -1) { 02018 epoll_ctl(chan->epfd, EPOLL_CTL_DEL, chan->fds[which], &ev); 02019 aed = chan->epfd_data[which]; 02020 } 02021 02022 /* If this new fd is valid, add it to the epoll */ 02023 if (fd > -1) { 02024 if (!aed && (!(aed = ast_calloc(1, sizeof(*aed))))) 02025 return; 02026 02027 chan->epfd_data[which] = aed; 02028 aed->chan = chan; 02029 aed->which = which; 02030 02031 ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP; 02032 ev.data.ptr = aed; 02033 epoll_ctl(chan->epfd, EPOLL_CTL_ADD, fd, &ev); 02034 } else if (aed) { 02035 /* We don't have to keep around this epoll data structure now */ 02036 free(aed); 02037 chan->epfd_data[which] = NULL; 02038 } 02039 #endif 02040 chan->fds[which] = fd; 02041 return; 02042 }
| void ast_channel_set_linkgroup | ( | struct ast_channel * | chan, | |
| struct ast_channel * | peer | |||
| ) |
propagate the linked id between chan and peer
Definition at line 4995 of file channel.c.
References ast_channel::_bridge, ast_bridged_channel(), ast_channel_change_linkedid(), ast_strdupa, ast_channel::linkedid, oldest_linkedid(), and ast_channel::uniqueid.
Referenced by ast_bridge_call(), and ast_do_masquerade().
04996 { 04997 const char* linkedid=NULL; 04998 struct ast_channel *bridged; 04999 05000 linkedid = oldest_linkedid(chan->linkedid, peer->linkedid); 05001 linkedid = oldest_linkedid(linkedid, chan->uniqueid); 05002 linkedid = oldest_linkedid(linkedid, peer->uniqueid); 05003 if (chan->_bridge) { 05004 bridged = ast_bridged_channel(chan); 05005 if (bridged != peer) { 05006 linkedid = oldest_linkedid(linkedid, bridged->linkedid); 05007 linkedid = oldest_linkedid(linkedid, bridged->uniqueid); 05008 } 05009 } 05010 if (peer->_bridge) { 05011 bridged = ast_bridged_channel(peer); 05012 if (bridged != chan) { 05013 linkedid = oldest_linkedid(linkedid, bridged->linkedid); 05014 linkedid = oldest_linkedid(linkedid, bridged->uniqueid); 05015 } 05016 } 05017 05018 /* just in case setting a stringfield to itself causes problems */ 05019 linkedid = ast_strdupa(linkedid); 05020 05021 ast_channel_change_linkedid(chan, linkedid); 05022 ast_channel_change_linkedid(peer, linkedid); 05023 if (chan->_bridge) { 05024 bridged = ast_bridged_channel(chan); 05025 if (bridged != peer) { 05026 ast_channel_change_linkedid(bridged, linkedid); 05027 } 05028 } 05029 if (peer->_bridge) { 05030 bridged = ast_bridged_channel(peer); 05031 if (bridged != chan) { 05032 ast_channel_change_linkedid(bridged, linkedid); 05033 } 05034 } 05035 }
| void ast_channel_set_redirecting | ( | struct ast_channel * | chan, | |
| const struct ast_party_redirecting * | redirecting | |||
| ) |
Set the redirecting id information in the Asterisk channel.
| chan | Asterisk channel to set redirecting id information | |
| redirecting | Redirecting id information |
Definition at line 6909 of file channel.c.
References ast_channel_lock, ast_channel_unlock, ast_free, ast_party_id_set(), ast_channel::cid, ast_callerid::cid_rdnis, ast_party_redirecting::count, ast_party_redirecting::from, ast_party_id::number, ast_party_redirecting::reason, ast_channel::redirecting, and ast_party_redirecting::to.
Referenced by ast_call_forward(), ast_indicate_data(), do_forward(), handle_request_invite(), handle_response(), misdn_copy_redirecting_to_ast(), redirecting_write(), and wait_for_answer().
06910 { 06911 if (&chan->redirecting == redirecting) { 06912 /* Don't set to self */ 06913 return; 06914 } 06915 06916 ast_channel_lock(chan); 06917 06918 ast_party_id_set(&chan->redirecting.from, &redirecting->from); 06919 if (redirecting->from.number 06920 && redirecting->from.number != chan->redirecting.from.number) { 06921 /* 06922 * Must move string to ast_channel.cid.cid_rdnis until it goes away. 06923 */ 06924 if (chan->cid.cid_rdnis) { 06925 ast_free(chan->cid.cid_rdnis); 06926 } 06927 chan->cid.cid_rdnis = chan->redirecting.from.number; 06928 chan->redirecting.from.number = NULL; 06929 } 06930 06931 ast_party_id_set(&chan->redirecting.to, &redirecting->to); 06932 chan->redirecting.reason = redirecting->reason; 06933 chan->redirecting.count = redirecting->count; 06934 06935 ast_channel_unlock(chan); 06936 }
| 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 6099 of file channel.c.
References 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(), handle_tddmode(), play_record_review(), rcvfax_exec(), reset_volumes(), rpt(), rpt_exec(), set_format(), set_listen_volume(), set_talk_volume(), sndfax_exec(), try_calling(), and vm_forwardoptions().
06100 { 06101 if (!chan->tech->setoption) { 06102 errno = ENOSYS; 06103 return -1; 06104 } 06105 06106 if (block) 06107 ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n"); 06108 06109 return chan->tech->setoption(chan, option, data, datalen); 06110 }
| 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 538 of file channel.c.
References ast_channel_setwhentohangup_tv().
00539 { 00540 struct timeval when = { offset, }; 00541 ast_channel_setwhentohangup_tv(chan, when); 00542 }
| 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 531 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().
00532 { 00533 chan->whentohangup = ast_tvzero(offset) ? offset : ast_tvadd(offset, ast_tvnow()); 00534 ast_queue_frame(chan, &ast_null_frame); 00535 return; 00536 }
| 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 6448 of file channel.c.
References ast_activate_generator(), ast_calloc, ast_debug, AST_FORMAT_SLINEAR, ast_free, ast_log(), ast_set_write_format(), LOG_ERROR, ast_channel::name, ast_silence_generator::old_write_format, and ast_channel::writeformat.
Referenced by __ast_play_and_record(), ast_dtmf_stream(), channel_spy(), record_exec(), and TransferCallStep1().
06449 { 06450 struct ast_silence_generator *state; 06451 06452 if (!(state = ast_calloc(1, sizeof(*state)))) { 06453 return NULL; 06454 } 06455 06456 state->old_write_format = chan->writeformat; 06457 06458 if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) { 06459 ast_log(LOG_ERROR, "Could not set write format to SLINEAR\n"); 06460 ast_free(state); 06461 return NULL; 06462 } 06463 06464 ast_activate_generator(chan, &silence_generator, state); 06465 06466 ast_debug(1, "Started silence generator on '%s'\n", chan->name); 06467 06468 return state; 06469 }
| 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 6471 of file channel.c.
References ast_deactivate_generator(), ast_debug, ast_free, ast_log(), ast_set_write_format(), LOG_ERROR, ast_channel::name, and ast_silence_generator::old_write_format.
Referenced by __ast_play_and_record(), ast_dtmf_stream(), channel_spy(), HandleCallOutgoing(), key_dial_page(), record_exec(), and unistim_hangup().
06472 { 06473 if (!state) 06474 return; 06475 06476 ast_deactivate_generator(chan); 06477 06478 ast_debug(1, "Stopped silence generator on '%s'\n", chan->name); 06479 06480 if (ast_set_write_format(chan, state->old_write_format) < 0) 06481 ast_log(LOG_ERROR, "Could not return write format to its original state\n"); 06482 06483 ast_free(state); 06484 }
| int ast_channel_supports_html | ( | struct ast_channel * | channel | ) |
Checks for HTML support on a channel.
Definition at line 4670 of file channel.c.
References ast_channel_tech::send_html, and ast_channel::tech.
Referenced by dial_exec_full(), sendurl_exec(), and try_calling().
| 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 1224 of file channel.c.
References ast_clear_flag, and AST_FLAG_DEFER_DTMF.
Referenced by __adsi_transmit_messages(), find_cache(), and rpt_call().
01225 { 01226 if (chan) 01227 ast_clear_flag(chan, AST_FLAG_DEFER_DTMF); 01228 }
| 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 598 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().
00599 { 00600 struct chanlist *chan; 00601 00602 ast_debug(1, "Unregistering channel type '%s'\n", tech->type); 00603 00604 AST_RWLIST_WRLOCK(&backends); 00605 00606 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&backends, chan, list) { 00607 if (chan->tech == tech) { 00608 AST_LIST_REMOVE_CURRENT(list); 00609 ast_free(chan); 00610 ast_verb(2, "Unregistered channel type '%s'\n", tech->type); 00611 break; 00612 } 00613 } 00614 AST_LIST_TRAVERSE_SAFE_END; 00615 00616 AST_RWLIST_UNLOCK(&backends); 00617 }
| void ast_channel_update_connected_line | ( | struct ast_channel * | chan, | |
| const struct ast_party_connected_line * | connected | |||
| ) |
Indicate that the connected line information has changed.
| chan | Asterisk channel to indicate connected line information | |
| connected | Connected line information |
Definition at line 6883 of file channel.c.
References ast_connected_line_build_data(), AST_CONTROL_CONNECTED_LINE, and ast_indicate_data().
Referenced by ast_channel_connected_line_macro(), ast_pickup_call(), builtin_atxfer(), builtin_blindtransfer(), connectedline_write(), local_attended_transfer(), pickup_do(), and wait_for_answer().
06884 { 06885 unsigned char data[1024]; /* This should be large enough */ 06886 size_t datalen; 06887 06888 datalen = ast_connected_line_build_data(data, sizeof(data), connected); 06889 if (datalen == (size_t) -1) { 06890 return; 06891 } 06892 06893 ast_indicate_data(chan, AST_CONTROL_CONNECTED_LINE, data, datalen); 06894 }
| void ast_channel_update_redirecting | ( | struct ast_channel * | chan, | |
| const struct ast_party_redirecting * | redirecting | |||
| ) |
Indicate that the redirecting id has changed.
| chan | Asterisk channel to indicate redirecting id information | |
| redirecting | Redirecting id information |
Definition at line 7340 of file channel.c.
References AST_CONTROL_REDIRECTING, ast_indicate_data(), and ast_redirecting_build_data().
Referenced by ast_call_forward(), do_forward(), redirecting_write(), and wait_for_answer().
07341 { 07342 unsigned char data[1024]; /* This should be large enough */ 07343 size_t datalen; 07344 07345 datalen = ast_redirecting_build_data(data, sizeof(data), redirecting); 07346 if (datalen == (size_t) -1) { 07347 return; 07348 } 07349 07350 ast_indicate_data(chan, AST_CONTROL_REDIRECTING, data, datalen); 07351 }
| struct ast_variable* ast_channeltype_list | ( | void | ) | [read] |
return an ast_variable list of channeltypes
Definition at line 193 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().
00194 { 00195 struct chanlist *cl; 00196 struct ast_variable *var = NULL, *prev = NULL; 00197 00198 AST_RWLIST_RDLOCK(&backends); 00199 AST_RWLIST_TRAVERSE(&backends, cl, list) { 00200 if (prev) { 00201 if ((prev->next = ast_variable_new(cl->tech->type, cl->tech->description, ""))) 00202 prev = prev->next; 00203 } else { 00204 var = ast_variable_new(cl->tech->type, cl->tech->description, ""); 00205 prev = var; 00206 } 00207 } 00208 AST_RWLIST_UNLOCK(&backends); 00209 00210 return var; 00211 }
| 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 473 of file channel.c.
References ast_channel::_softhangup, 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(), 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(), handle_sendimage(), iax2_bridge(), launch_asyncagi(), local_bridge_loop(), lua_check_hangup(), ospfinished_exec(), pbx_builtin_incomplete(), pbx_exec(), read_exec(), readexten_exec(), remote_bridge_loop(), rpt(), rpt_exec(), run_ras(), try_calling(), and wait_for_answer().
00474 { 00475 if (chan->_softhangup) /* yes if soft hangup flag set */ 00476 return 1; 00477 if (ast_tvzero(chan->whentohangup)) /* no if no hangup scheduled */ 00478 return 0; 00479 if (ast_tvdiff_ms(chan->whentohangup, ast_tvnow()) > 0) /* no if hangup time has not come yet. */ 00480 return 0; 00481 chan->_softhangup |= AST_SOFTHANGUP_TIMEOUT; /* record event */ 00482 return 1; 00483 }
| int ast_check_hangup_locked | ( | struct ast_channel * | chan | ) |
Definition at line 485 of file channel.c.
References ast_channel_lock, ast_channel_unlock, and ast_check_hangup().
Referenced by action_redirect(), and ast_channel_bridge().
00486 { 00487 int res; 00488 ast_channel_lock(chan); 00489 res = ast_check_hangup(chan); 00490 ast_channel_unlock(chan); 00491 return res; 00492 }
| int ast_connected_line_build_data | ( | unsigned char * | data, | |
| size_t | datalen, | |||
| const struct ast_party_connected_line * | connected | |||
| ) |
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 |
| -1 | if error | |
| Amount | of data buffer used |
Definition at line 6671 of file channel.c.
References AST_CONNECTED_LINE_NAME, AST_CONNECTED_LINE_NUMBER, AST_CONNECTED_LINE_NUMBER_PRESENTATION, AST_CONNECTED_LINE_NUMBER_TYPE, 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_log(), ast_party_connected_line::id, LOG_WARNING, ast_party_id::name, ast_party_id::number, ast_party_id::number_presentation, ast_party_id::number_type, ast_party_subaddress::odd_even_indicator, ast_party_connected_line::source, ast_party_subaddress::str, ast_party_id::subaddress, ast_party_subaddress::type, ast_party_subaddress::valid, and value.
Referenced by ast_channel_queue_connected_line_update(), ast_channel_update_connected_line(), and local_indicate().
06672 { 06673 int32_t value; 06674 size_t length; 06675 size_t pos = 0; 06676 06677 /* 06678 * The size of integer values must be fixed in case the frame is 06679 * shipped to another machine. 06680 */ 06681 06682 /* *************** Connected line party id *************** */ 06683 if (connected->id.number) { 06684 length = strlen(connected->id.number); 06685 if (datalen < pos + (sizeof(data[0]) * 2) + length) { 06686 ast_log(LOG_WARNING, "No space left for connected line number\n"); 06687 return -1; 06688 } 06689 data[pos++] = AST_CONNECTED_LINE_NUMBER; 06690 data[pos++] = length; 06691 memcpy(data + pos, connected->id.number, length); 06692 pos += length; 06693 } 06694 06695 if (connected->id.name) { 06696 length = strlen(connected->id.name); 06697 if (datalen < pos + (sizeof(data[0]) * 2) + length) { 06698 ast_log(LOG_WARNING, "No space left for connected line name\n"); 06699 return -1; 06700 } 06701 data[pos++] = AST_CONNECTED_LINE_NAME; 06702 data[pos++] = length; 06703 memcpy(data + pos, connected->id.name, length); 06704 pos += length; 06705 } 06706 06707 if (datalen < pos + (sizeof(data[0]) * 2) + 1) { 06708 ast_log(LOG_WARNING, "No space left for connected line type of number\n"); 06709 return -1; 06710 } 06711 data[pos++] = AST_CONNECTED_LINE_NUMBER_TYPE; 06712 data[pos++] = 1; 06713 data[pos++] = connected->id.number_type; 06714 06715 if (datalen < pos + (sizeof(data[0]) * 2) + 1) { 06716 ast_log(LOG_WARNING, "No space left for connected line presentation\n"); 06717 return -1; 06718 } 06719 data[pos++] = AST_CONNECTED_LINE_NUMBER_PRESENTATION; 06720 data[pos++] = 1; 06721 data[pos++] = connected->id.number_presentation; 06722 06723 /* Connected line source */ 06724 if (datalen < pos + (sizeof(data[0]) * 2) + sizeof(value)) { 06725 ast_log(LOG_WARNING, "No space left for connected line source\n"); 06726 return -1; 06727 } 06728 data[pos++] = AST_CONNECTED_LINE_SOURCE; 06729 data[pos++] = sizeof(value); 06730 value = htonl(connected->source); 06731 memcpy(data + pos, &value, sizeof(value)); 06732 pos += sizeof(value); 06733 06734 /* Connected line Subaddress */ 06735 if (connected->id.subaddress.str) { 06736 length = strlen(connected->id.subaddress.str); 06737 if (datalen < pos + (sizeof(data[0]) * 2) + length) { 06738 ast_log(LOG_WARNING, "No space left for connected line subaddress\n"); 06739 return -1; 06740 } 06741 data[pos++] = AST_CONNECTED_LINE_SUBADDRESS; 06742 data[pos++] = length; 06743 memcpy(data + pos, connected->id.subaddress.str, length); 06744 pos += length; 06745 } 06746 /* Connected line Subaddress Type */ 06747 if (datalen < pos + (sizeof(data[0]) * 2) + 1) { 06748 ast_log(LOG_WARNING, "No space left for connected line type of subaddress\n"); 06749 return -1; 06750 } 06751 data[pos++] = AST_CONNECTED_LINE_SUBADDRESS_TYPE; 06752 data[pos++] = 1; 06753 data[pos++] = connected->id.subaddress.type; 06754 06755 /* Connected line Subaddress Odd/Even indicator */ 06756 if (datalen < pos + (sizeof(data[0]) * 2) + 1) { 06757 ast_log(LOG_WARNING, 06758 "No space left for connected line subaddress odd-even indicator\n"); 06759 return -1; 06760 } 06761 data[pos++] = AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN; 06762 data[pos++] = 1; 06763 data[pos++] = connected->id.subaddress.odd_even_indicator; 06764 06765 /* Connected line Subaddress Valid */ 06766 if (datalen < pos + (sizeof(data[0]) * 2) + 1) { 06767 ast_log(LOG_WARNING, "No space left for connected line subaddress valid\n"); 06768 return -1; 06769 } 06770 data[pos++] = AST_CONNECTED_LINE_SUBADDRESS_VALID; 06771 data[pos++] = 1; 06772 data[pos++] = connected->id.subaddress.valid; 06773 06774 return pos; 06775 }
| void ast_connected_line_copy_from_caller | ( | struct ast_party_connected_line * | dest, | |
| const struct ast_callerid * | src | |||
| ) |
Copy the caller information to the connected line information.
| dest | Destination connected line information | |
| src | Source caller information |
Definition at line 6559 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_free, ast_party_id_copy(), ast_party_subaddress_copy(), ast_strdup, ast_callerid::cid_ani, ast_callerid::cid_ani2, ast_callerid::cid_name, ast_callerid::cid_num, ast_callerid::cid_pres, ast_callerid::cid_ton, ast_party_connected_line::id, ast_party_id::name, ast_party_id::number, ast_party_id::number_presentation, ast_party_id::number_type, ast_callerid::subaddress, and ast_party_id::subaddress.
Referenced by begin_dial_channel(), builtin_atxfer(), dial_exec_full(), feature_request_and_dial(), local_call(), pickup_do(), ring_entry(), and wait_for_answer().
06560 { 06561 #if 1 06562 /* Must manually fill in struct ast_party_id until struct ast_callerid goes away */ 06563 if (dest->id.number) { 06564 ast_free(dest->id.number); 06565 } 06566 dest->id.number = ast_strdup(src->cid_num); 06567 06568 if (dest->id.name) { 06569 ast_free(dest->id.name); 06570 } 06571 dest->id.name = ast_strdup(src->cid_name); 06572 06573 dest->id.number_type = src->cid_ton; 06574 dest->id.number_presentation = src->cid_pres; 06575 06576 06577 if (dest->ani) { 06578 ast_free(dest->ani); 06579 } 06580 dest->ani = ast_strdup(src->cid_ani); 06581 06582 dest->ani2 = src->cid_ani2; 06583 ast_party_subaddress_copy(&dest->id.subaddress, &src->subaddress); 06584 06585 #else 06586 06587 /* The src parameter type will become a struct ast_party_caller ptr. */ 06588 /* This is future code */ 06589 06590 ast_party_id_copy(&dest->id, &src->id); 06591 06592 if (dest->ani) { 06593 ast_free(dest->ani); 06594 } 06595 dest->ani = ast_strdup(src->ani); 06596 06597 dest->ani2 = src->ani2; 06598 #endif 06599 }
| void ast_connected_line_copy_to_caller | ( | struct ast_callerid * | 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 6601 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_free, ast_party_id_copy(), ast_party_subaddress_copy(), ast_strdup, ast_callerid::cid_ani, ast_callerid::cid_ani2, ast_callerid::cid_name, ast_callerid::cid_num, ast_callerid::cid_pres, ast_callerid::cid_ton, ast_party_connected_line::id, ast_party_id::name, ast_party_id::number, ast_party_id::number_presentation, ast_party_id::number_type, ast_party_id::subaddress, and ast_callerid::subaddress.
Referenced by local_call().
06602 { 06603 #if 1 06604 /* Must manually extract from struct ast_party_id until struct ast_callerid goes away */ 06605 if (dest->cid_num) { 06606 ast_free(dest->cid_num); 06607 } 06608 dest->cid_num = ast_strdup(src->id.number); 06609 06610 if (dest->cid_name) { 06611 ast_free(dest->cid_name); 06612 } 06613 dest->cid_name = ast_strdup(src->id.name); 06614 06615 dest->cid_ton = src->id.number_type; 06616 dest->cid_pres = src->id.number_presentation; 06617 06618 06619 if (dest->cid_ani) { 06620 ast_free(dest->cid_ani); 06621 } 06622 dest->cid_ani = ast_strdup(src->ani); 06623 06624 dest->cid_ani2 = src->ani2; 06625 ast_party_subaddress_copy(&dest->subaddress, &src->id.subaddress); 06626 06627 #else 06628 06629 /* The dest parameter type will become a struct ast_party_caller ptr. */ 06630 /* This is future code */ 06631 06632 ast_party_id_copy(&dest->id, &src->id); 06633 06634 if (dest->ani) { 06635 ast_free(dest->ani); 06636 } 06637 dest->ani = ast_strdup(src->ani); 06638 06639 dest->ani2 = src->ani2; 06640 #endif 06641 }
| 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 6777 of file channel.c.
References AST_CONNECTED_LINE_NAME, AST_CONNECTED_LINE_NUMBER, AST_CONNECTED_LINE_NUMBER_PRESENTATION, AST_CONNECTED_LINE_NUMBER_TYPE, 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_free, ast_log(), ast_malloc, ast_party_connected_line::id, LOG_DEBUG, LOG_WARNING, ast_party_id::name, ast_party_id::number, ast_party_id::number_presentation, ast_party_id::number_type, ast_party_subaddress::odd_even_indicator, ast_party_connected_line::source, ast_party_subaddress::str, ast_party_id::subaddress, ast_party_subaddress::type, ast_party_subaddress::valid, and value.
Referenced by ast_channel_connected_line_macro(), ast_indicate_data(), socket_process(), and wait_for_answer().
06778 { 06779 size_t pos; 06780 unsigned char ie_len; 06781 unsigned char ie_id; 06782 int32_t value; 06783 06784 for (pos = 0; pos < datalen; pos += ie_len) { 06785 if (datalen < pos + sizeof(ie_id) + sizeof(ie_len)) { 06786 ast_log(LOG_WARNING, "Invalid connected line update\n"); 06787 return -1; 06788 } 06789 ie_id = data[pos++]; 06790 ie_len = data[pos++]; 06791 if (datalen < pos + ie_len) { 06792 ast_log(LOG_WARNING, "Invalid connected line update\n"); 06793 return -1; 06794 } 06795 06796 switch (ie_id) { 06797 case AST_CONNECTED_LINE_NUMBER: 06798 if (connected->id.number) { 06799 ast_free(connected->id.number); 06800 } 06801 connected->id.number = ast_malloc(ie_len + 1); 06802 if (connected->id.number) { 06803 memcpy(connected->id.number, data + pos, ie_len); 06804 connected->id.number[ie_len] = 0; 06805 } 06806 break; 06807 case AST_CONNECTED_LINE_NAME: 06808 if (connected->id.name) { 06809 ast_free(connected->id.name); 06810 } 06811 connected->id.name = ast_malloc(ie_len + 1); 06812 if (connected->id.name) { 06813 memcpy(connected->id.name, data + pos, ie_len); 06814 connected->id.name[ie_len] = 0; 06815 } 06816 break; 06817 case AST_CONNECTED_LINE_NUMBER_TYPE: 06818 if (ie_len != 1) { 06819 ast_log(LOG_WARNING, "Invalid connected line type of number (%u)\n", (unsigned) ie_len); 06820 break; 06821 } 06822 connected->id.number_type = data[pos]; 06823 break; 06824 case AST_CONNECTED_LINE_NUMBER_PRESENTATION: 06825 if (ie_len != 1) { 06826 ast_log(LOG_WARNING, "Invalid connected line presentation (%u)\n", (unsigned) ie_len); 06827 break; 06828 } 06829 connected->id.number_presentation = data[pos]; 06830 break; 06831 case AST_CONNECTED_LINE_SOURCE: 06832 if (ie_len != sizeof(value)) { 06833 ast_log(LOG_WARNING, "Invalid connected line source (%u)\n", (unsigned) ie_len); 06834 break; 06835 } 06836 memcpy(&value, data + pos, sizeof(value)); 06837 connected->source = ntohl(value); 06838 break; 06839 case AST_CONNECTED_LINE_SUBADDRESS: 06840 if (connected->id.subaddress.str) { 06841 ast_free(connected->id.subaddress.str); 06842 } 06843 connected->id.subaddress.str = ast_malloc(ie_len + 1); 06844 if (connected->id.subaddress.str) { 06845 memcpy(connected->id.subaddress.str, data + pos, ie_len); 06846 connected->id.subaddress.str[ie_len] = 0; 06847 } 06848 break; 06849 case AST_CONNECTED_LINE_SUBADDRESS_TYPE: 06850 if (ie_len != 1) { 06851 ast_log(LOG_WARNING, "Invalid connected line type of subaddress (%u)\n", 06852 (unsigned) ie_len); 06853 break; 06854 } 06855 connected->id.subaddress.type = data[pos]; 06856 break; 06857 case AST_CONNECTED_LINE_SUBADDRESS_ODD_EVEN: 06858 if (ie_len != 1) { 06859 ast_log(LOG_WARNING, 06860 "Invalid connected line subaddress odd-even indicator (%u)\n", 06861 (unsigned) ie_len); 06862 break; 06863 } 06864 connected->id.subaddress.odd_even_indicator = data[pos]; 06865 break; 06866 case AST_CONNECTED_LINE_SUBADDRESS_VALID: 06867 if (ie_len != 1) { 06868 ast_log(LOG_WARNING, "Invalid connected line subaddress valid (%u)\n", 06869 (unsigned) ie_len); 06870 break; 06871 } 06872 connected->id.subaddress.valid = data[pos]; 06873 break; 06874 default: 06875 ast_log(LOG_DEBUG, "Unknown connected line element: %u (%u)\n", (unsigned) ie_id, (unsigned) ie_len); 06876 break; 06877 } 06878 } 06879 06880 return 0; 06881 }
| void ast_deactivate_generator | ( | struct ast_channel * | chan | ) |
Deactivate an active generator
Definition at line 2420 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().
02421 { 02422 ast_channel_lock(chan); 02423 if (chan->generatordata) { 02424 if (chan->generator && chan->generator->release) 02425 chan->generator->release(chan, chan->generatordata); 02426 chan->generatordata = NULL; 02427 chan->generator = NULL; 02428 ast_channel_set_fd(chan, AST_GENERATOR_FD, -1); 02429 ast_clear_flag(chan, AST_FLAG_WRITE_INT); 02430 ast_settimeout(chan, 0, NULL, NULL); 02431 } 02432 ast_channel_unlock(chan); 02433 }
| int ast_do_masquerade | ( | struct ast_channel * | original | ) |
Start masquerading a channel.
| chan | Channel to masquerade |
Definition at line 5100 of file channel.c.
References __ast_change_name_nolink(), ast_channel::_bridge, ast_channel::_softhangup, ast_channel::_state, ast_channel::accountcode, accountcode, ast_channel::adsicpe, ast_channel::alertpipe, ao2_link, ao2_lock(), ao2_unlink, ao2_unlock(), ast_app_group_update(), ast_autochan_new_channel(), ast_cause2str(), AST_CEL_BRIDGE_UPDATE, ast_cel_report_event(), ast_channel_lock, AST_CHANNEL_NAME, ast_channel_release(), ast_channel_set_fd(), ast_channel_set_linkgroup(), ast_channel_trylock, ast_channel_unlock, ast_copy_flags, ast_copy_string(), ast_debug, AST_FLAG_BLOCKING, AST_FLAG_EXCEPTION, AST_FLAG_OUTGOING, AST_FLAG_ZOMBIE, AST_GENERATOR_FD, ast_indicate(), 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_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_string_field_set, ast_test_flag, AST_TIMING_FD, ast_channel::blocker, ast_channel::cdr, ast_datastore_info::chan_fixup, CHANNEL_DEADLOCK_AVOIDANCE, channels, ast_channel::cid, clone_variables(), ast_channel::connected, ast_datastore::data, ast_channel::datastores, 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, ast_channel::language, language, LOG_WARNING, manager_event, ast_channel::masq, ast_channel::masqr, ast_channel::monitor, ast_channel::musicclass, musicclass, ast_channel::name, 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, ast_channel_tech::type, ast_channel::uniqueid, ast_channel::visible_indication, and ast_channel::writeformat.
Referenced by __ast_read(), ast_async_goto(), ast_hangup(), ast_waitfor_nandfds(), ast_write(), do_bridge_masquerade(), handle_invite_replaces(), iax_park(), local_attended_transfer(), sip_park(), and sip_park_thread().
05101 { 05102 int x,i; 05103 int res=0; 05104 int origstate; 05105 struct ast_frame *current; 05106 const struct ast_channel_tech *t; 05107 void *t_pvt; 05108 union { 05109 struct ast_callerid cid; 05110 struct ast_party_connected_line connected; 05111 struct ast_party_redirecting redirecting; 05112 } exchange; 05113 struct ast_channel *clonechan; 05114 struct ast_cdr *cdr; 05115 int rformat = original->readformat; 05116 int wformat = original->writeformat; 05117 char newn[AST_CHANNEL_NAME]; 05118 char orig[AST_CHANNEL_NAME]; 05119 char masqn[AST_CHANNEL_NAME]; 05120 char zombn[AST_CHANNEL_NAME]; 05121 05122 /* XXX This operation is a bit odd. We're essentially putting the guts of 05123 * the clone channel into the original channel. Start by killing off the 05124 * original channel's backend. While the features are nice, which is the 05125 * reason we're keeping it, it's still awesomely weird. XXX */ 05126 05127 /* The reasoning for the channels ao2_container lock here is complex. 05128 * 05129 * In order to check for a race condition, the original channel must 05130 * be locked. If it is determined that the masquerade should proceed 05131 * the original channel can absolutely not be unlocked until the end 05132 * of the function. Since after determining the masquerade should 05133 * continue requires the channels to be unlinked from the ao2_container, 05134 * the container lock must be held first to achieve proper locking order. 05135 */ 05136 ao2_lock(channels); 05137 05138 /* lock the original channel to determine if the masquerade is require or not */ 05139 ast_channel_lock(original); 05140 05141 /* This checks to see if the masquerade has already happened or not. There is a 05142 * race condition that exists for this function. Since all pvt and channel locks 05143 * must be let go before calling do_masquerade, it is possible that it could be 05144 * called multiple times for the same channel. This check verifies whether 05145 * or not the masquerade has already been completed by another thread */ 05146 if (!original->masq) { 05147 ast_channel_unlock(original); 05148 ao2_unlock(channels); 05149 return 0; /* masq already completed by another thread, or never needed to be done to begin with */ 05150 } 05151 05152 /* now that we have verified no race condition exists, set the clone channel */ 05153 clonechan = original->masq; 05154 05155 /* since this function already holds the global container lock, unlocking original 05156 * for deadlock avoidance will not result in any sort of masquerade race condition. 05157 * If masq is called by a different thread while this happens, it will be stuck waiting 05158 * until we unlock the container. */ 05159 while (ast_channel_trylock(clonechan)) { 05160 CHANNEL_DEADLOCK_AVOIDANCE(original); 05161 } 05162 05163 /* clear the masquerade channels */ 05164 original->masq = NULL; 05165 clonechan->masqr = NULL; 05166 05167 /* unlink from channels container as name (which is the hash value) will change */ 05168 ao2_unlink(channels, original); 05169 ao2_unlink(channels, clonechan); 05170 05171 /* now that both channels are locked and unlinked from the container, it is safe to unlock it */ 05172 ao2_unlock(channels); 05173 05174 ast_debug(4, "Actually Masquerading %s(%d) into the structure of %s(%d)\n", 05175 clonechan->name, clonechan->_state, original->name, original->_state); 05176 05177 manager_event(EVENT_FLAG_CALL, "Masquerade", "Clone: %s\r\nCloneState: %s\r\nOriginal: %s\r\nOriginalState: %s\r\n", 05178 clonechan->name, ast_state2str(clonechan->_state), original->name, ast_state2str(original->_state)); 05179 05180 /* Having remembered the original read/write formats, we turn off any translation on either 05181 one */ 05182 free_translation(clonechan); 05183 free_translation(original); 05184 05185 /* Save the original name */ 05186 ast_copy_string(orig, original->name, sizeof(orig)); 05187 /* Save the new name */ 05188 ast_copy_string(newn, clonechan->name, sizeof(newn)); 05189 /* Create the masq name */ 05190 snprintf(masqn, sizeof(masqn), "%s<MASQ>", newn); 05191 05192 /* Mangle the name of the clone channel */ 05193 __ast_change_name_nolink(clonechan, masqn); 05194 05195 /* Copy the name from the clone channel */ 05196 __ast_change_name_nolink(original, newn); 05197 05198 /* share linked id's */ 05199 ast_channel_set_linkgroup(original, clonechan); 05200 05201 /* Swap the technologies */ 05202 t = original->tech; 05203 original->tech = clonechan->tech; 05204 clonechan->tech = t; 05205 05206 /* Swap the cdrs */ 05207 cdr = original->cdr; 05208 original->cdr = clonechan->cdr; 05209 clonechan->cdr = cdr; 05210 05211 t_pvt = original->tech_pvt; 05212 original->tech_pvt = clonechan->tech_pvt; 05213 clonechan->tech_pvt = t_pvt; 05214 05215 /* Swap the alertpipes */ 05216 for (i = 0; i < 2; i++) { 05217 x = original->alertpipe[i]; 05218 original->alertpipe[i] = clonechan->alertpipe[i]; 05219 clonechan->alertpipe[i] = x; 05220 } 05221 05222 /* 05223 * Swap the readq's. The end result should be this: 05224 * 05225 * 1) All frames should be on the new (original) channel. 05226 * 2) Any frames that were already on the new channel before this 05227 * masquerade need to be at the end of the readq, after all of the 05228 * frames on the old (clone) channel. 05229 * 3) The alertpipe needs to get poked for every frame that was already 05230 * on the new channel, since we are now using the alert pipe from the 05231 * old (clone) channel. 05232 */ 05233 { 05234 AST_LIST_HEAD_NOLOCK(, ast_frame) tmp_readq; 05235 AST_LIST_HEAD_SET_NOLOCK(&tmp_readq, NULL); 05236 05237 AST_LIST_APPEND_LIST(&tmp_readq, &original->readq, frame_list); 05238 AST_LIST_APPEND_LIST(&original->readq, &clonechan->readq, frame_list); 05239 05240 while ((current = AST_LIST_REMOVE_HEAD(&tmp_readq, frame_list))) { 05241 AST_LIST_INSERT_TAIL(&original->readq, current, frame_list); 05242 if (original->alertpipe[1] > -1) { 05243 int poke = 0; 05244 05245 if (write(original->alertpipe[1], &poke, sizeof(poke)) < 0) { 05246 ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); 05247 } 05248 } 05249 } 05250 } 05251 05252 /* Swap the raw formats */ 05253 x = original->rawreadformat; 05254 original->rawreadformat = clonechan->rawreadformat; 05255 clonechan->rawreadformat = x; 05256 x = original->rawwriteformat; 05257 original->rawwriteformat = clonechan->rawwriteformat; 05258 clonechan->rawwriteformat = x; 05259 05260 clonechan->_softhangup = AST_SOFTHANGUP_DEV; 05261 05262 /* And of course, so does our current state. Note we need not 05263 call ast_setstate since the event manager doesn't really consider 05264 these separate. We do this early so that the clone has the proper 05265 state of the original channel. */ 05266 origstate = original->_state; 05267 original->_state = clonechan->_state; 05268 clonechan->_state = origstate; 05269 05270 if (clonechan->tech->fixup && clonechan->tech->fixup(original, clonechan)) { 05271 ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clonechan->name); 05272 } 05273 05274 /* Start by disconnecting the original's physical side */ 05275 if (clonechan->tech->hangup && clonechan->tech->hangup(clonechan)) { 05276 ast_log(LOG_WARNING, "Hangup failed! Strange things may happen!\n"); 05277 res = -1; 05278 goto done; 05279 } 05280 05281 /* Mangle the name of the clone channel */ 05282 snprintf(zombn, sizeof(zombn), "%s<ZOMBIE>", orig); /* quick, hide the brains! */ 05283 __ast_change_name_nolink(clonechan, zombn); 05284 05285 /* Update the type. */ 05286 t_pvt = original->monitor; 05287 original->monitor = clonechan->monitor; 05288 clonechan->monitor = t_pvt; 05289 05290 /* Keep the same language. */ 05291 ast_string_field_set(original, language, clonechan->language); 05292 /* Copy the FD's other than the generator fd */ 05293 for (x = 0; x < AST_MAX_FDS; x++) { 05294 if (x != AST_GENERATOR_FD) 05295 ast_channel_set_fd(original, x, clonechan->fds[x]); 05296 } 05297 05298 ast_app_group_update(clonechan, original); 05299 05300 /* Move data stores over */ 05301 if (AST_LIST_FIRST(&clonechan->datastores)) { 05302 struct ast_datastore *ds; 05303 /* We use a safe traversal here because some fixup routines actually 05304 * remove the datastore from the list and free them. 05305 */ 05306 AST_LIST_TRAVERSE_SAFE_BEGIN(&clonechan->datastores, ds, entry) { 05307 if (ds->info->chan_fixup) 05308 ds->info->chan_fixup(ds->data, clonechan, original); 05309 } 05310 AST_LIST_TRAVERSE_SAFE_END; 05311 AST_LIST_APPEND_LIST(&original->datastores, &clonechan->datastores, entry); 05312 } 05313 05314 ast_autochan_new_channel(clonechan, original); 05315 05316 clone_variables(original, clonechan); 05317 /* Presense of ADSI capable CPE follows clone */ 05318 original->adsicpe = clonechan->adsicpe; 05319 /* Bridge remains the same */ 05320 /* CDR fields remain the same */ 05321 /* XXX What about blocking, softhangup, blocker, and lock and blockproc? XXX */ 05322 /* Application and data remain the same */ 05323 /* Clone exception becomes real one, as with fdno */ 05324 ast_copy_flags(original, clonechan, AST_FLAG_EXCEPTION | AST_FLAG_OUTGOING); 05325 original->fdno = clonechan->fdno; 05326 /* Schedule context remains the same */ 05327 /* Stream stuff stays the same */ 05328 /* Keep the original state. The fixup code will need to work with it most likely */ 05329 05330 /* 05331 * Just swap the whole structures, nevermind the allocations, 05332 * they'll work themselves out. 05333 */ 05334 exchange.cid = original->cid; 05335 original->cid = clonechan->cid; 05336 clonechan->cid = exchange.cid; 05337 report_new_callerid(original); 05338 05339 exchange.connected = original->connected; 05340 original->connected = clonechan->connected; 05341 clonechan->connected = exchange.connected; 05342 exchange.redirecting = original->redirecting; 05343 original->redirecting = clonechan->redirecting; 05344 clonechan->redirecting = exchange.redirecting; 05345 05346 /* Restore original timing file descriptor */ 05347 ast_channel_set_fd(original, AST_TIMING_FD, original->timingfd); 05348 05349 /* Our native formats are different now */ 05350 original->nativeformats = clonechan->nativeformats; 05351 05352 /* Context, extension, priority, app data, jump table, remain the same */ 05353 /* pvt switches. pbx stays the same, as does next */ 05354 05355 /* Set the write format */ 05356 ast_set_write_format(original, wformat); 05357 05358 /* Set the read format */ 05359 ast_set_read_format(original, rformat); 05360 05361 /* Copy the music class */ 05362 ast_string_field_set(original, musicclass, clonechan->musicclass); 05363 05364 /* copy over accuntcode and set peeraccount across the bridge */ 05365 ast_string_field_set(original, accountcode, S_OR(clonechan->accountcode, "")); 05366 if (original->_bridge) { 05367 /* XXX - should we try to lock original->_bridge here? */ 05368 ast_string_field_set(original->_bridge, peeraccount, S_OR(clonechan->accountcode, "")); 05369 ast_cel_report_event(original, AST_CEL_BRIDGE_UPDATE, NULL, NULL, NULL); 05370 } 05371 05372 ast_debug(1, "Putting channel %s in %d/%d formats\n", original->name, wformat, rformat); 05373 05374 /* Okay. Last thing is to let the channel driver know about all this mess, so he 05375 can fix up everything as best as possible */ 05376 if (original->tech->fixup) { 05377 if (original->tech->fixup(clonechan, original)) { 05378 ast_log(LOG_WARNING, "Channel for type '%s' could not fixup channel %s\n", 05379 original->tech->type, original->name); 05380 res = -1; 05381 goto done; 05382 } 05383 } else 05384 ast_log(LOG_WARNING, "Channel type '%s' does not have a fixup routine (for %s)! Bad things may happen.\n", 05385 original->tech->type, original->name); 05386 05387 /* 05388 * If an indication is currently playing, maintain it on the channel 05389 * that is taking the place of original 05390 * 05391 * This is needed because the masquerade is swapping out in the internals 05392 * of this channel, and the new channel private data needs to be made 05393 * aware of the current visible indication (RINGING, CONGESTION, etc.) 05394 */ 05395 if (original->visible_indication) { 05396 ast_indicate(original, original->visible_indication); 05397 } 05398 05399 /* Now, at this point, the "clone" channel is totally F'd up. We mark it as 05400 a zombie so nothing tries to touch it. If it's already been marked as a 05401 zombie, then free it now (since it already is considered invalid). */ 05402 if (ast_test_flag(clonechan, AST_FLAG_ZOMBIE)) { 05403 ast_debug(1, "Destroying channel clone '%s'\n", clonechan->name); 05404 ast_channel_unlock(clonechan); 05405 manager_event(EVENT_FLAG_CALL, "Hangup", 05406 "Channel: %s\r\n" 05407 "Uniqueid: %s\r\n" 05408 "Cause: %d\r\n" 05409 "Cause-txt: %s\r\n", 05410 clonechan->name, 05411 clonechan->uniqueid, 05412 clonechan->hangupcause, 05413 ast_cause2str(clonechan->hangupcause) 05414 ); 05415 clonechan = ast_channel_release(clonechan); 05416 } else { 05417 ast_debug(1, "Released clone lock on '%s'\n", clonechan->name); 05418 ast_set_flag(clonechan, AST_FLAG_ZOMBIE); 05419 ast_queue_frame(clonechan, &ast_null_frame); 05420 } 05421 05422 /* Signal any blocker */ 05423 if (ast_test_flag(original, AST_FLAG_BLOCKING)) 05424 pthread_kill(original->blocker, SIGURG); 05425 ast_debug(1, "Done Masquerading %s (%d)\n", original->name, original->_state); 05426 05427 done: 05428 /* it is possible for the clone channel to disappear during this */ 05429 if (clonechan) { 05430 ast_channel_unlock(original); 05431 ast_channel_unlock(clonechan); 05432 ao2_link(channels, clonechan); 05433 ao2_link(channels, original); 05434 } else { 05435 ast_channel_unlock(original); 05436 ao2_link(channels, original); 05437 } 05438 return 0; 05439 }
| struct ast_channel* ast_dummy_channel_alloc | ( | void | ) | [read] |
Create a fake channel structure.
| NULL | failure | |
| non-NULL | successfully allocated channel |
Definition at line 1027 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(), sqlite3_log(), and syslog_log().
01029 { 01030 struct ast_channel *tmp; 01031 struct varshead *headp; 01032 01033 #if defined(REF_DEBUG) 01034 if (!(tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor, "dummy channel", file, line, function, 1))) { 01035 return NULL; 01036 } 01037 #elif defined(__AST_DEBUG_MALLOC) 01038 if (!(tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor, "dummy channel", file, line, function, 0))) { 01039 return NULL; 01040 } 01041 #else 01042 if (!(tmp = ao2_alloc(sizeof(*tmp), ast_dummy_channel_destructor))) { 01043 return NULL; 01044 } 01045 #endif 01046 01047 if ((ast_string_field_init(tmp, 128))) { 01048 ast_channel_unref(tmp); 01049 return NULL; 01050 } 01051 01052 headp = &tmp->varshead; 01053 AST_LIST_HEAD_INIT_NOLOCK(headp); 01054 01055 return tmp; 01056 }
| 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 2073 of file channel.h.
References dummy().
Referenced by do_monitor().
02074 { 02075 int x; 02076 int dummy = 0; 02077 02078 if (fd < 0) 02079 return 0; 02080 if (!start) 02081 start = &dummy; 02082 for (x = *start; x < maximum; x++) 02083 if (pfds[x].fd == fd) { 02084 if (x == *start) 02085 (*start)++; 02086 return pfds[x].revents; 02087 } 02088 return 0; 02089 }
| 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 620 of file channel.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, chanlist::tech, and ast_channel_tech::type.
Referenced by _ast_device_state(), and ast_var_channel_types_table().
00621 { 00622 struct chanlist *chanls; 00623 const struct ast_channel_tech *ret = NULL; 00624 00625 AST_RWLIST_RDLOCK(&backends); 00626 00627 AST_RWLIST_TRAVERSE(&backends, chanls, list) { 00628 if (!strcasecmp(name, chanls->tech->type)) { 00629 ret = chanls->tech; 00630 break; 00631 } 00632 } 00633 00634 AST_RWLIST_UNLOCK(&backends); 00635 00636 return ret; 00637 }
| ast_group_t ast_get_group | ( | const char * | s | ) |
Definition at line 6277 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(), process_dahdi(), and read_agent_config().
06278 { 06279 char *piece; 06280 char *c; 06281 int start=0, finish=0, x; 06282 ast_group_t group = 0; 06283 06284 if (ast_strlen_zero(s)) 06285 return 0; 06286 06287 c = ast_strdupa(s); 06288 06289 while ((piece = strsep(&c, ","))) { 06290 if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) { 06291 /* Range */ 06292 } else if (sscanf(piece, "%30d", &start)) { 06293 /* Just one */ 06294 finish = start; 06295 } else { 06296 ast_log(LOG_ERROR, "Syntax error parsing group configuration '%s' at '%s'. Ignoring.\n", s, piece); 06297 continue; 06298 } 06299 for (x = start; x <= finish; x++) { 06300 if ((x > 63) || (x < 0)) { 06301 ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 63)\n", x); 06302 } else 06303 group |= ((ast_group_t) 1 << x); 06304 } 06305 } 06306 return group; 06307 }
| int ast_hangup | ( | struct ast_channel * | chan | ) |
Hang up a channel.
| chan | channel to hang up |
Definition at line 2143 of file channel.c.
References ao2_unlink, ast_assert, ast_audiohook_detach_list(), ast_autoservice_stop(), ast_cause2str(), 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_lock, ast_channel_release(), ast_channel_unlock, ast_closestream(), ast_debug, ast_do_masquerade(), AST_FLAG_BLOCKING, AST_FLAG_ZOMBIE, ast_log(), ast_set_flag, ast_test_flag, ast_channel::audiohooks, ast_channel::blocker, ast_channel::blockproc, ast_channel::cdr, channels, ast_channel::cid, ast_callerid::cid_name, ast_callerid::cid_num, ast_cdr::disposition, EVENT_FLAG_CALL, free_translation(), ast_channel::generator, ast_channel::generatordata, ast_channel_tech::hangup, ast_channel::hangupcause, ast_channel::hangupsource, LOG_WARNING, manager_event, ast_channel::masq, ast_channel::masqr, ast_channel::name, pbx_builtin_getvar_helper(), ast_generator::release, S_OR, ast_channel::sched, sched_context_destroy(), ast_channel::stream, ast_channel::tech, ast_channel::uniqueid, and ast_channel::vstream.
Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_pbx_run(), __ast_request_and_dial(), __oh323_new(), action_bridge(), 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_compat(), check_goto_on_transfer(), clear_caller(), conf_free(), conf_run(), connect_link(), console_new(), 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(), gtalk_new(), handle_call_forward(), handle_callforward_button(), handle_enbloc_call_message(), handle_frame(), handle_frame_ownerless(), handle_hd_hf(), handle_init_event(), handle_invite_replaces(), handle_offhook_message(), handle_request_invite(), handle_soft_key_event_message(), handle_stimulus_message(), handle_timeout_trip(), handle_transfer_button(), HandleCallOutgoing(), hangup_chan(), hangupcalls(), hanguptree(), iax2_request(), iax_park(), iax_park_thread(), jingle_new(), local_hangup(), manage_parkinglot(), masq_park_call(), mgcp_new(), mgcp_ss(), monitor_dial(), mwi_thread(), my_distinctive_ring(), my_handle_notify_message(), nbs_new(), oss_new(), park_exec_full(), parkandannounce_exec(), phone_new(), play_sound_file(), rpt(), rpt_call(), rpt_exec(), rpt_tele_thread(), sip_new(), sip_park(), sip_park_thread(), skinny_new(), skinny_ss(), try_calling(), unistim_new(), usbradio_new(), wait_for_answer(), and wait_for_winner().
02144 { 02145 int res = 0; 02146 struct ast_cdr *cdr = NULL; 02147 char extra_str[64]; /* used for cel logging below */ 02148 02149 /* Don't actually hang up a channel that will masquerade as someone else, or 02150 if someone is going to masquerade as us */ 02151 ast_channel_lock(chan); 02152 02153 if (chan->audiohooks) { 02154 ast_audiohook_detach_list(chan->audiohooks); 02155 chan->audiohooks = NULL; 02156 } 02157 02158 ast_autoservice_stop(chan); 02159 02160 if (chan->masq) { 02161 ast_channel_unlock(chan); 02162 if (ast_do_masquerade(chan)) { 02163 ast_log(LOG_WARNING, "Failed to perform masquerade\n"); 02164 } 02165 ast_channel_lock(chan); 02166 } 02167 02168 if (chan->masq) { 02169 ast_log(LOG_WARNING, "%s getting hung up, but someone is trying to masq into us?!?\n", chan->name); 02170 ast_channel_unlock(chan); 02171 return 0; 02172 } 02173 /* If this channel is one which will be masqueraded into something, 02174 mark it as a zombie already, so we know to free it later */ 02175 if (chan->masqr) { 02176 ast_set_flag(chan, AST_FLAG_ZOMBIE); 02177 ast_channel_unlock(chan); 02178 return 0; 02179 } 02180 ast_channel_unlock(chan); 02181 02182 ao2_unlink(channels, chan); 02183 02184 ast_channel_lock(chan); 02185 free_translation(chan); 02186 /* Close audio stream */ 02187 if (chan->stream) { 02188 ast_closestream(chan->stream); 02189 chan->stream = NULL; 02190 } 02191 /* Close video stream */ 02192 if (chan->vstream) { 02193 ast_closestream(chan->vstream); 02194 chan->vstream = NULL; 02195 } 02196 if (chan->sched) { 02197 sched_context_destroy(chan->sched); 02198 chan->sched = NULL; 02199 } 02200 02201 if (chan->generatordata) /* Clear any tone stuff remaining */ 02202 if (chan->generator && chan->generator->release) 02203 chan->generator->release(chan, chan->generatordata); 02204 chan->generatordata = NULL; 02205 chan->generator = NULL; 02206 02207 snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", chan->hangupcause, chan->hangupsource, S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), "")); 02208 ast_cel_report_event(chan, AST_CEL_HANGUP, NULL, extra_str, NULL); 02209 02210 if (chan->cdr) { /* End the CDR if it hasn't already */ 02211 ast_cdr_end(chan->cdr); 02212 cdr = chan->cdr; 02213 chan->cdr = NULL; 02214 } 02215 if (ast_test_flag(chan, AST_FLAG_BLOCKING)) { 02216 ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd " 02217 "is blocked by thread %ld in procedure %s! Expect a failure\n", 02218 (long)pthread_self(), chan->name, (long)chan->blocker, chan->blockproc); 02219 ast_assert(ast_test_flag(chan, AST_FLAG_BLOCKING) == 0); 02220 } 02221 if (!ast_test_flag(chan, AST_FLAG_ZOMBIE)) { 02222 ast_debug(1, "Hanging up channel '%s'\n", chan->name); 02223 if (chan->tech->hangup) 02224 res = chan->tech->hangup(chan); 02225 } else { 02226 ast_debug(1, "Hanging up zombie '%s'\n", chan->name); 02227 } 02228 02229 ast_channel_unlock(chan); 02230 manager_event(EVENT_FLAG_CALL, "Hangup", 02231 "Channel: %s\r\n" 02232 "Uniqueid: %s\r\n" 02233 "CallerIDNum: %s\r\n" 02234 "CallerIDName: %s\r\n" 02235 "Cause: %d\r\n" 02236 "Cause-txt: %s\r\n", 02237 chan->name, 02238 chan->uniqueid, 02239 S_OR(chan->cid.cid_num, "<unknown>"), 02240 S_OR(chan->cid.cid_name, "<unknown>"), 02241 chan->hangupcause, 02242 ast_cause2str(chan->hangupcause) 02243 ); 02244 02245 if (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_BRIDGED) && 02246 !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED) && 02247 (chan->cdr->disposition != AST_CDR_NULL || ast_test_flag(chan->cdr, AST_CDR_FLAG_DIALED))) { 02248 ast_channel_lock(chan); 02249 02250 ast_cdr_end(chan->cdr); 02251 ast_cdr_detach(chan->cdr); 02252 chan->cdr = NULL; 02253 ast_channel_unlock(chan); 02254 } 02255 02256 chan = ast_channel_release(chan); 02257 02258 return res; 02259 }
| 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 3551 of file channel.c.
References ast_indicate_data().
Referenced by __ast_play_and_record(), agent_new(), alsa_call(), analog_attempt_transfer(), answer_trunk_chan(), ast_bridge_call(), 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(), manage_parkinglot(), mgcp_ss(), monitor_dial(), oss_call(), park_call_full(), park_exec_full(), pbx_builtin_busy(), pbx_builtin_congestion(), pbx_builtin_proceeding(), pbx_builtin_progress(), pbx_builtin_ringing(), pbx_builtin_waitexten(), queue_exec(), record_exec(), 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().
03552 { 03553 return ast_indicate_data(chan, condition, NULL, 0); 03554 }
| 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 3594 of file channel.c.
References ast_channel::_state, _XXX_AST_CONTROL_T38, ast_channel_lock, 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_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_OFFHOOK, AST_CONTROL_OPTION, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_RADIO_KEY, AST_CONTROL_RADIO_UNKEY, AST_CONTROL_REDIRECTING, AST_CONTROL_RING, AST_CONTROL_RINGING, AST_CONTROL_SRCUPDATE, AST_CONTROL_T38_PARAMETERS, AST_CONTROL_TAKEOFFHOOK, AST_CONTROL_TRANSFER, AST_CONTROL_UNHOLD, AST_CONTROL_VIDUPDATE, AST_CONTROL_WINK, ast_debug, AST_FLAG_ZOMBIE, 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_channel_tech::indicate, is_visible_indication(), LOG_WARNING, ast_channel::name, ast_channel::redirecting, ast_channel::tech, ast_channel::visible_indication, and ast_channel::zone.
Referenced by agent_hangup(), ast_bridge_call(), ast_channel_update_connected_line(), ast_channel_update_redirecting(), ast_generic_bridge(), ast_indicate(), feature_request_and_dial(), handle_frame(), local_bridge_loop(), login_exec(), manage_parkinglot(), park_call_full(), pbx_builtin_waitexten(), remote_bridge_loop(), transmit_audio(), transmit_t38(), and wait_for_answer().
03596 { 03597 /* By using an enum, we'll get compiler warnings for values not handled 03598 * in switch statements. */ 03599 enum ast_control_frame_type condition = _condition; 03600 struct ast_tone_zone_sound *ts = NULL; 03601 int res; 03602 03603 ast_channel_lock(chan); 03604 03605 /* Don't bother if the channel is about to go away, anyway. */ 03606 if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) { 03607 ast_channel_unlock(chan); 03608 return -1; 03609 } 03610 switch (condition) { 03611 case AST_CONTROL_CONNECTED_LINE: 03612 { 03613 struct ast_party_connected_line connected; 03614 03615 ast_party_connected_line_set_init(&connected, &chan->connected); 03616 res = ast_connected_line_parse_data(data, datalen, &connected); 03617 if (!res) { 03618 ast_channel_set_connected_line(chan, &connected); 03619 } 03620 ast_party_connected_line_free(&connected); 03621 } 03622 break; 03623 03624 case AST_CONTROL_REDIRECTING: 03625 { 03626 struct ast_party_redirecting redirecting; 03627 03628 ast_party_redirecting_set_init(&redirecting, &chan->redirecting); 03629 res = ast_redirecting_parse_data(data, datalen, &redirecting); 03630 if (!res) { 03631 ast_channel_set_redirecting(chan, &redirecting); 03632 } 03633 ast_party_redirecting_free(&redirecting); 03634 } 03635 break; 03636 03637 default: 03638 break; 03639 } 03640 03641 if (chan->tech->indicate) { 03642 /* See if the channel driver can handle this condition. */ 03643 res = chan->tech->indicate(chan, condition, data, datalen); 03644 } else { 03645 res = -1; 03646 } 03647 03648 ast_channel_unlock(chan); 03649 03650 if (!res) { 03651 /* The channel driver successfully handled this indication */ 03652 if (is_visible_indication(condition)) { 03653 chan->visible_indication = condition; 03654 } 03655 return 0; 03656 } 03657 03658 /* The channel driver does not support this indication, let's fake 03659 * it by doing our own tone generation if applicable. */ 03660 03661 /*!\note If we compare the enumeration type, which does not have any 03662 * negative constants, the compiler may optimize this code away. 03663 * Therefore, we must perform an integer comparison here. */ 03664 if (_condition < 0) { 03665 /* Stop any tones that are playing */ 03666 ast_playtones_stop(chan); 03667 return 0; 03668 } 03669 03670 /* Handle conditions that we have tones for. */ 03671 switch (condition) { 03672 case _XXX_AST_CONTROL_T38: 03673 /* deprecated T.38 control frame */ 03674 return -1; 03675 case AST_CONTROL_T38_PARAMETERS: 03676 /* there is no way to provide 'default' behavior for these 03677 * control frames, so we need to return failure, but there 03678 * is also no value in the log message below being emitted 03679 * since failure to handle these frames is not an 'error' 03680 * so just return right now. 03681 */ 03682 return -1; 03683 case AST_CONTROL_RINGING: 03684 ts = ast_get_indication_tone(chan->zone, "ring"); 03685 /* It is common practice for channel drivers to return -1 if trying 03686 * to indicate ringing on a channel which is up. The idea is to let the 03687 * core generate the ringing inband. However, we don't want the 03688 * warning message about not being able to handle the specific indication 03689 * to print nor do we want ast_indicate_data to return an "error" for this 03690 * condition 03691 */ 03692 if (chan->_state == AST_STATE_UP) { 03693 res = 0; 03694 } 03695 break; 03696 case AST_CONTROL_BUSY: 03697 ts = ast_get_indication_tone(chan->zone, "busy"); 03698 break; 03699 case AST_CONTROL_CONGESTION: 03700 ts = ast_get_indication_tone(chan->zone, "congestion"); 03701 break; 03702 case AST_CONTROL_PROGRESS: 03703 case AST_CONTROL_PROCEEDING: 03704 case AST_CONTROL_VIDUPDATE: 03705 case AST_CONTROL_SRCUPDATE: 03706 case AST_CONTROL_RADIO_KEY: 03707 case AST_CONTROL_RADIO_UNKEY: 03708 case AST_CONTROL_OPTION: 03709 case AST_CONTROL_WINK: 03710 case AST_CONTROL_FLASH: 03711 case AST_CONTROL_OFFHOOK: 03712 case AST_CONTROL_TAKEOFFHOOK: 03713 case AST_CONTROL_ANSWER: 03714 case AST_CONTROL_HANGUP: 03715 case AST_CONTROL_RING: 03716 case AST_CONTROL_HOLD: 03717 case AST_CONTROL_UNHOLD: 03718 case AST_CONTROL_TRANSFER: 03719 case AST_CONTROL_CONNECTED_LINE: 03720 case AST_CONTROL_REDIRECTING: 03721 /* Nothing left to do for these. */ 03722 res = 0; 03723 break; 03724 } 03725 03726 if (ts) { 03727 /* We have a tone to play, yay. */ 03728 ast_debug(1, "Driver for channel '%s' does not support indication %d, emulating it\n", chan->name, condition); 03729 ast_playtones_start(chan, 0, ts->data, 1); 03730 ts = ast_tone_zone_sound_unref(ts); 03731 res = 0; 03732 chan->visible_indication = condition; 03733 } 03734 03735 if (res) { 03736 /* not handled */ 03737 ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, chan->name); 03738 } 03739 03740 return res; 03741 }
| 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 3534 of file channel.c.
References ast_debug, ast_opt_internal_timing, and ast_channel::timingfd.
Referenced by add_sdp(), and ast_read_generator_actions().
03535 { 03536 int ret = ast_opt_internal_timing && chan->timingfd > -1; 03537 ast_debug(5, "Internal timing is %s (option_internal_timing=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", ast_opt_internal_timing, chan->timingfd); 03538 return ret; 03539 }
| void ast_party_caller_copy | ( | struct ast_callerid * | dest, | |
| const struct ast_callerid * | src | |||
| ) |
Copy the source caller information to the destination caller.
| dest | Destination caller | |
| src | Source caller |
Definition at line 1660 of file channel.c.
References ast_free, ast_party_id_copy(), ast_party_subaddress_copy(), ast_strdup, ast_callerid::cid_ani, ast_callerid::cid_ani2, ast_callerid::cid_name, ast_callerid::cid_num, ast_callerid::cid_pres, ast_callerid::cid_ton, and ast_callerid::subaddress.
Referenced by ast_call_forward(), do_forward(), and wait_for_answer().
01661 { 01662 if (dest == src) { 01663 /* Don't copy to self */ 01664 return; 01665 } 01666 01667 #if 1 01668 /* Copy caller-id specific information ONLY from struct ast_callerid */ 01669 if (dest->cid_num) 01670 { 01671 ast_free(dest->cid_num); 01672 } 01673 dest->cid_num = ast_strdup(src->cid_num); 01674 01675 if (dest->cid_name) 01676 { 01677 ast_free(dest->cid_name); 01678 } 01679 dest->cid_name = ast_strdup(src->cid_name); 01680 01681 dest->cid_ton = src->cid_ton; 01682 dest->cid_pres = src->cid_pres; 01683 01684 01685 if (dest->cid_ani) 01686 { 01687 ast_free(dest->cid_ani); 01688 } 01689 dest->cid_ani = ast_strdup(src->cid_ani); 01690 01691 dest->cid_ani2 = src->cid_ani2; 01692 01693 ast_party_subaddress_copy(&dest->subaddress, &src->subaddress); 01694 01695 #else 01696 01697 /* The src and dest parameter types will become struct ast_party_caller ptrs. */ 01698 /* This is future code */ 01699 01700 ast_party_id_copy(&dest->id, &src->id); 01701 01702 if (dest->ani) { 01703 ast_free(dest->ani); 01704 } 01705 dest->ani = ast_strdup(src->ani); 01706 01707 dest->ani2 = src->ani2; 01708 #endif 01709 }
| void ast_party_caller_init | ( | struct ast_party_caller * | init | ) |
Initialize the given caller structure.
| init | Caller structure to initialize. |
Definition at line 1653 of file channel.c.
References ast_party_caller::ani, ast_party_caller::ani2, ast_party_id_init(), and ast_party_caller::id.
01654 { 01655 ast_party_id_init(&init->id); 01656 init->ani = NULL; 01657 init->ani2 = 0; 01658 }
| void ast_party_connected_line_collect_caller | ( | struct ast_party_connected_line * | connected, | |
| struct ast_callerid * | cid | |||
| ) |
Collect the caller party information into a connected line structure.
| connected | Collected caller information for the connected line | |
| cid | Caller information. |
DO NOT call ast_party_connected_line_free() on the filled in connected line structure!
Definition at line 1760 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN, ast_callerid::cid_ani, ast_callerid::cid_ani2, ast_callerid::cid_name, ast_callerid::cid_num, ast_callerid::cid_pres, ast_callerid::cid_ton, ast_party_connected_line::id, ast_party_id::name, ast_party_id::number, ast_party_id::number_presentation, ast_party_id::number_type, ast_party_connected_line::source, ast_callerid::subaddress, and ast_party_id::subaddress.
Referenced by ast_pickup_call().
01761 { 01762 connected->id.number = cid->cid_num; 01763 connected->id.name = cid->cid_name; 01764 connected->id.number_type = cid->cid_ton; 01765 connected->id.number_presentation = cid->cid_pres; 01766 connected->id.subaddress = cid->subaddress; 01767 01768 connected->ani = cid->cid_ani; 01769 connected->ani2 = cid->cid_ani2; 01770 connected->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN; 01771 }
| 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 1719 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_free, ast_party_id_copy(), ast_strdup, ast_party_connected_line::id, and ast_party_connected_line::source.
Referenced by ast_call_forward(), ast_channel_connected_line_macro(), builtin_atxfer(), dial_exec_full(), do_forward(), local_attended_transfer(), pickup_do(), try_calling(), and wait_for_answer().
01720 { 01721 if (dest == src) { 01722 /* Don't copy to self */ 01723 return; 01724 } 01725 01726 ast_party_id_copy(&dest->id, &src->id); 01727 01728 if (dest->ani) { 01729 ast_free(dest->ani); 01730 } 01731 dest->ani = ast_strdup(src->ani); 01732 01733 dest->ani2 = src->ani2; 01734 dest->source = src->source; 01735 }
| 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 1773 of file channel.c.
References ast_party_connected_line::ani, ast_free, ast_party_id_free(), and ast_party_connected_line::id.
Referenced by ast_channel_destructor(), ast_indicate_data(), builtin_atxfer(), chanlist_free(), hanguptree(), local_attended_transfer(), pickup_do(), socket_process(), and wait_for_answer().
01774 { 01775 ast_party_id_free(&doomed->id); 01776 01777 if (doomed->ani) { 01778 ast_free(doomed->ani); 01779 doomed->ani = NULL; 01780 } 01781 }
| 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 1711 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 builtin_atxfer(), handle_request_invite(), handle_request_update(), handle_response_invite(), local_attended_transfer(), misdn_queue_connected_line_update(), pickup_do(), socket_process(), and wait_for_answer().
01712 { 01713 ast_party_id_init(&init->id); 01714 init->ani = NULL; 01715 init->ani2 = 0; 01716 init->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN; 01717 }
| void ast_party_connected_line_set | ( | struct ast_party_connected_line * | dest, | |
| const struct ast_party_connected_line * | src | |||
| ) |
Set the connected line information based on another connected line source.
| src | The source connected line to use as a guide to set the dest | |
| dest | The connected line one wishes to update |
Definition at line 1745 of file channel.c.
References ast_party_connected_line::ani, ast_party_connected_line::ani2, ast_free, ast_party_id_set(), ast_strdup, ast_party_connected_line::id, and ast_party_connected_line::source.
Referenced by ast_channel_set_connected_line(), and wait_for_answer().
01746 { 01747 ast_party_id_set(&dest->id, &src->id); 01748 01749 if (src->ani && src->ani != dest->ani) { 01750 if (dest->ani) { 01751 ast_free(dest->ani); 01752 } 01753 dest->ani = ast_strdup(src->ani); 01754 } 01755 01756 dest->ani2 = src->ani2; 01757 dest->source = src->source; 01758 }
| 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 1737 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(), and wait_for_answer().
01738 { 01739 ast_party_id_set_init(&init->id, &guide->id); 01740 init->ani = NULL; 01741 init->ani2 = guide->ani2; 01742 init->source = guide->source; 01743 }
| 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 1783 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 begin_dial_channel(), dial_exec_full(), local_call(), and ring_entry().
01784 { 01785 if (dest == src) { 01786 /* Don't copy to self */ 01787 return; 01788 } 01789 01790 ast_party_id_copy(&dest->from, &src->from); 01791 ast_party_id_copy(&dest->to, &src->to); 01792 dest->count = src->count; 01793 dest->reason = src->reason; 01794 }
| void ast_party_redirecting_free | ( | struct ast_party_redirecting * | doomed | ) |
Destroy the redirecting information contents.
| doomed | The redirecting information to destroy. |
Definition at line 1804 of file channel.c.
References ast_party_id_free(), ast_party_redirecting::from, and ast_party_redirecting::to.
Referenced by ast_channel_destructor(), ast_indicate_data(), and redirecting_write().
01805 { 01806 ast_party_id_free(&doomed->from); 01807 ast_party_id_free(&doomed->to); 01808 }
| 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 1796 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().
01797 { 01798 ast_party_id_set_init(&init->from, &guide->from); 01799 ast_party_id_set_init(&init->to, &guide->to); 01800 init->count = guide->count; 01801 init->reason = guide->reason; 01802 }
| 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 1471 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_connected_line_copy_from_caller(), ast_connected_line_copy_to_caller(), ast_party_caller_copy(), and ast_party_id_copy().
01472 { 01473 if (dest == src) { 01474 /* Don't copy to self */ 01475 return; 01476 } 01477 01478 if (dest->str) { 01479 ast_free(dest->str); 01480 } 01481 dest->str = ast_strdup(src->str); 01482 dest->type = src->type; 01483 dest->odd_even_indicator = src->odd_even_indicator; 01484 dest->valid = src->valid; 01485 }
| void ast_party_subaddress_free | ( | struct ast_party_subaddress * | doomed | ) |
Destroy the party subaddress contents.
| doomed | The party subaddress to destroy. |
Definition at line 1514 of file channel.c.
References ast_free, and ast_party_subaddress::str.
Referenced by ast_party_id_free(), and free_cid().
01515 { 01516 if (doomed->str) { 01517 ast_free(doomed->str); 01518 doomed->str = NULL; 01519 } 01520 }
| void ast_party_subaddress_init | ( | struct ast_party_subaddress * | init | ) |
Initialize the given subaddress structure.
| init | Subaddress structure to initialize. |
Definition at line 1463 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_id_init().
01464 { 01465 init->str = NULL; 01466 init->type = 0; 01467 init->odd_even_indicator = 0; 01468 init->valid = 0; 01469 }
| 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 | Destination party subaddress | |
| src | Source party subaddress |
Definition at line 1495 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_id_set().
01496 { 01497 if (dest == src) { 01498 /* Don't set to self */ 01499 return; 01500 } 01501 01502 if (src->str && src->str != dest->str) { 01503 if (dest->str) { 01504 ast_free(dest->str); 01505 } 01506 dest->str = ast_strdup(src->str); 01507 } 01508 01509 dest->type = src->type; 01510 dest->odd_even_indicator = src->odd_even_indicator; 01511 dest->valid = src->valid; 01512 }
| void ast_party_subaddress_set_init | ( | struct ast_party_subaddress * | init, | |
| const struct ast_party_subaddress * | guide | |||
| ) |
Initialize the given party subadress 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 1487 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_id_set_init().
01488 { 01489 init->str = NULL; 01490 init->type = guide->type; 01491 init->odd_even_indicator = guide->odd_even_indicator; 01492 init->valid = guide->valid; 01493 }
| void ast_poll_channel_add | ( | struct ast_channel * | chan0, | |
| struct ast_channel * | chan1 | |||
| ) |
Add a channel to an optimized waitfor
Definition at line 2045 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().
02046 { 02047 #ifdef HAVE_EPOLL 02048 struct epoll_event ev; 02049 int i = 0; 02050 02051 if (chan0->epfd == -1) 02052 return; 02053 02054 /* Iterate through the file descriptors on chan1, adding them to chan0 */ 02055 for (i = 0; i < AST_MAX_FDS; i++) { 02056 if (chan1->fds[i] == -1) 02057 continue; 02058 ev.events = EPOLLIN | EPOLLPRI | EPOLLERR | EPOLLHUP; 02059 ev.data.ptr = chan1->epfd_data[i]; 02060 epoll_ctl(chan0->epfd, EPOLL_CTL_ADD, chan1->fds[i], &ev); 02061 } 02062 02063 #endif 02064 return; 02065 }
| void ast_poll_channel_del | ( | struct ast_channel * | chan0, | |
| struct ast_channel * | chan1 | |||
| ) |
Delete a channel from an optimized waitfor
Definition at line 2068 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().
02069 { 02070 #ifdef HAVE_EPOLL 02071 struct epoll_event ev; 02072 int i = 0; 02073 02074 if (chan0->epfd == -1) 02075 return; 02076 02077 for (i = 0; i < AST_MAX_FDS; i++) { 02078 if (chan1->fds[i] == -1) 02079 continue; 02080 epoll_ctl(chan0->epfd, EPOLL_CTL_DEL, chan1->fds[i], &ev); 02081 } 02082 02083 #endif 02084 return; 02085 }
| char* ast_print_group | ( | char * | buf, | |
| int | buflen, | |||
| ast_group_t | group | |||
| ) |
print call- and pickup groups into buffer
Definition at line 6375 of file channel.c.
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().
06376 { 06377 unsigned int i; 06378 int first = 1; 06379 char num[3]; 06380 06381 buf[0] = '\0'; 06382 06383 if (!group) /* Return empty string if no group */ 06384 return buf; 06385 06386 for (i = 0; i <= 63; i++) { /* Max group is 63 */ 06387 if (group & ((ast_group_t) 1 << i)) { 06388 if (!first) { 06389 strncat(buf, ", ", buflen - strlen(buf) - 1); 06390 } else { 06391 first = 0; 06392 } 06393 snprintf(num, sizeof(num), "%u", i); 06394 strncat(buf, num, buflen - strlen(buf) - 1); 06395 } 06396 } 06397 return buf; 06398 }
| int ast_prod | ( | struct ast_channel * | chan | ) |
Send empty audio to prime a channel driver.
Definition at line 3862 of file channel.c.
References ast_channel::_state, ast_debug, AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, ast_log(), AST_STATE_UP, ast_write(), ast_frame::data, LOG_WARNING, ast_channel::name, ast_frame::ptr, ast_channel::rawwriteformat, ast_frame::src, and ast_frame::subclass.
Referenced by ast_activate_generator().
03863 { 03864 struct ast_frame a = { AST_FRAME_VOICE }; 03865 char nothing[128]; 03866 03867 /* Send an empty audio frame to get things moving */ 03868 if (chan->_state != AST_STATE_UP) { 03869 ast_debug(1, "Prodding channel '%s'\n", chan->name); 03870 a.subclass = chan->rawwriteformat; 03871 a.data.ptr = nothing + AST_FRIENDLY_OFFSET; 03872 a.src = "ast_prod"; 03873 if (ast_write(chan, &a)) 03874 ast_log(LOG_WARNING, "Prodding channel '%s' failed\n", chan->name); 03875 } 03876 return 0; 03877 }
| 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 1189 of file channel.c.
References AST_FRAME_CONTROL, ast_queue_frame(), and ast_frame::subclass.
Referenced by __analog_handle_event(), __analog_ss_thread(), __dahdi_exception(), __oh323_update_info(), analog_attempt_transfer(), analog_call(), analog_exception(), analog_hangup(), analog_ss_thread(), ast_pickup_call(), attempt_transfer(), auto_congest(), cb_events(), dahdi_handle_event(), dahdi_hangup(), gtalk_is_answered(), gtalk_ringing_ack(), handle_hd_hf(), handle_offhook_message(), handle_request(), handle_request_bye(), handle_request_info(), handle_request_invite(), handle_request_refer(), handle_response(), handle_response_invite(), handle_response_refer(), handle_soft_key_event_message(), handle_stimulus_message(), HandleCallIncoming(), jingle_is_answered(), jingle_ringing_ack(), mgcp_call(), misdn_attempt_transfer(), misdn_facility_ie_handler(), multicast_rtp_call(), nbs_call(), phone_call(), pickup_do(), process_sdp(), receive_digit(), remote_hold(), send_cause2ast(), setup_rtp_connection(), skinny_call(), skinny_transfer(), skinny_unhold(), unistim_call(), and update_state().
01190 { 01191 struct ast_frame f = { AST_FRAME_CONTROL, }; 01192 01193 f.subclass = control; 01194 01195 return ast_queue_frame(chan, &f); 01196 }
| 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 1199 of file channel.c.
References AST_FRAME_CONTROL, ast_queue_frame(), ast_frame::data, ast_frame::datalen, ast_frame::ptr, and ast_frame::subclass.
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(), handle_request_notify(), handle_response_refer(), iax2_queue_control_data(), iax2_transfer(), process_sdp(), sip_sipredirect(), and skinny_hold().
01201 { 01202 struct ast_frame f = { AST_FRAME_CONTROL, }; 01203 01204 f.subclass = control; 01205 f.data.ptr = (void *) data; 01206 f.datalen = datalen; 01207 01208 return ast_queue_frame(chan, &f); 01209 }
| 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 1146 of file channel.c.
References __ast_queue_frame().
Referenced by __ast_read(), __oh323_rtp_create(), __oh323_update_info(), action_atxfer(), agent_new(), alsa_call(), ast_channel_masquerade(), ast_channel_setwhentohangup_tv(), ast_do_masquerade(), ast_dsp_process(), ast_queue_control(), ast_queue_control_data(), ast_queue_hangup(), ast_queue_hangup_with_cause(), ast_softhangup_nolock(), bridge_write(), cb_events(), cli_console_answer(), cli_console_dial(), cli_console_flash(), cli_console_sendtext(), console_answer(), console_call(), console_dial(), console_do_answer(), console_flash(), console_sendtext(), dahdi_queue_frame(), 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(), unistim_do_senddigit(), unistim_senddigit_end(), usbradio_read(), and wakeup_sub().
01147 { 01148 return __ast_queue_frame(chan, fin, 0, NULL); 01149 }
| 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 1151 of file channel.c.
References __ast_queue_frame().
Referenced by __ast_answer(), __ast_read(), and ast_autoservice_stop().
01152 { 01153 return __ast_queue_frame(chan, fin, 1, NULL); 01154 }
| int ast_queue_hangup | ( | struct ast_channel * | chan | ) |
Queue a hangup frame.
Definition at line 1157 of file channel.c.
References ast_channel::_softhangup, ast_channel_trylock, ast_channel_unlock, AST_CONTROL_HANGUP, AST_FRAME_CONTROL, ast_queue_frame(), and AST_SOFTHANGUP_DEV.
Referenced by bridge_queue_hangup(), cleanup_connection(), cli_console_hangup(), close_call(), gtalk_hangup_farend(), gtalk_is_answered(), handle_onhook_message(), handle_request_bye(), handle_request_cancel(), handle_soft_key_event_message(), iax2_destroy(), iax2_queue_hangup(), jingle_hangup_farend(), local_hangup(), and mgcp_queue_hangup().
01158 { 01159 struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP }; 01160 /* Yeah, let's not change a lock-critical value without locking */ 01161 if (!ast_channel_trylock(chan)) { 01162 chan->_softhangup |= AST_SOFTHANGUP_DEV; 01163 ast_channel_unlock(chan); 01164 } 01165 return ast_queue_frame(chan, &f); 01166 }
| 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 1169 of file channel.c.
References ast_channel::_softhangup, ast_channel_trylock, ast_channel_unlock, AST_CONTROL_HANGUP, AST_FRAME_CONTROL, ast_queue_frame(), AST_SOFTHANGUP_DEV, ast_frame::data, ast_channel::hangupcause, 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(), handle_response_notify(), HandleCallOutgoing(), hangup_chan(), hangup_connection(), misdn_answer(), retrans_pkt(), and TransferCallStep1().
01170 { 01171 struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP }; 01172 01173 if (cause >= 0) 01174 f.data.uint32 = cause; 01175 01176 /* Yeah, let's not change a lock-critical value without locking */ 01177 if (!ast_channel_trylock(chan)) { 01178 chan->_softhangup |= AST_SOFTHANGUP_DEV; 01179 if (cause < 0) 01180 f.data.uint32 = chan->hangupcause; 01181 01182 ast_channel_unlock(chan); 01183 } 01184 01185 return ast_queue_frame(chan, &f); 01186 }
| 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 2261 of file channel.c.
References ast_channel::_state, ast_channel_tech::answer, ast_cdr_answer(), AST_CEL_ANSWER,