channelstate.h File Reference

Channel states. More...

#include "asterisk.h"

Include dependency graph for channelstate.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


enum  ast_channel_state {
 ast_channel states More...


int ast_setstate (struct ast_channel *chan, enum ast_channel_state)
 Change the state of a channel.

Detailed Description

Channel states.

See also:

Definition in file channelstate.h.

Enumeration Type Documentation

ast_channel states

Bits 0-15 of state are reserved for the state (up/down) of the line Bits 16-32 of state are reserved for flags
AST_STATE_DOWN  Channel is down and available
AST_STATE_RESERVED  Channel is down, but reserved
AST_STATE_OFFHOOK  Channel is off hook
AST_STATE_DIALING  Digits (or equivalent) have been dialed
AST_STATE_RING  Line is ringing
AST_STATE_RINGING  Remote end is ringing
AST_STATE_UP  Line is up
AST_STATE_BUSY  Line is busy
AST_STATE_DIALING_OFFHOOK  Digits (or equivalent) have been dialed while offhook
AST_STATE_PRERING  Channel has detected an incoming call and is waiting for ring
AST_STATE_MUTE  Do not transmit voice data

Definition at line 35 of file channelstate.h.

00035                        {
00036    AST_STATE_DOWN,         /*!< Channel is down and available */
00037    AST_STATE_RESERVED,     /*!< Channel is down, but reserved */
00038    AST_STATE_OFFHOOK,      /*!< Channel is off hook */
00039    AST_STATE_DIALING,      /*!< Digits (or equivalent) have been dialed */
00040    AST_STATE_RING,         /*!< Line is ringing */
00041    AST_STATE_RINGING,      /*!< Remote end is ringing */
00042    AST_STATE_UP,        /*!< Line is up */
00043    AST_STATE_BUSY,         /*!< Line is busy */
00044    AST_STATE_DIALING_OFFHOOK, /*!< Digits (or equivalent) have been dialed while offhook */
00045    AST_STATE_PRERING,      /*!< Channel has detected an incoming call and is waiting for ring */
00047    AST_STATE_MUTE = (1 << 16),   /*!< Do not transmit voice data */
00048 };

Function Documentation

int ast_setstate ( struct ast_channel chan,
enum  ast_channel_state 

Change the state of a channel.

chan is locked

Definition at line 7021 of file channel.c.

References ast_channel_flags(), ast_channel_name(), AST_CHANNEL_NAME, ast_channel_state_set(), ast_copy_string(), AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, ast_devstate_changed_literal(), AST_DEVSTATE_NOT_CACHABLE, AST_FLAG_DISABLE_DEVSTATE_CACHE, ast_publish_channel_state(), ast_test_flag, and name.

Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_read(), __dahdi_exception(), alsa_answer(), analog_answer(), analog_call(), analog_exception(), analog_ss_thread(), ast_raw_answer(), AST_TEST_DEFINE(), cb_events(), chan_pjsip_answer(), chan_pjsip_incoming_response(), console_answer(), dahdi_answer(), dahdi_call(), dahdi_handle_event(), dahdi_indicate(), dahdi_read(), handle_invite_replaces(), handle_request_invite(), handle_response_ciev(), handle_response_invite(), iax2_call(), jingle_action_session_info(), jingle_action_session_initiate(), jingle_call(), mbl_hangup(), mgcp_answer(), mgcp_call(), mgcp_ss(), misdn_call(), misdn_indication(), my_set_waitingfordt(), nbs_call(), nbs_hangup(), onAlerting(), onProgress(), ooh323_answer(), ooh323_new(), oss_answer(), pbx_builtin_busy(), pbx_builtin_congestion(), phone_answer(), phone_call(), phone_exception(), phone_hangup(), phone_write(), refer_incoming_invite_request(), release_chan(), release_chan_early(), setsubstate(), sip_answer(), skinny_newcall(), unistim_answer(), unistim_call(), unistim_new(), unistim_ss(), and unreal_queue_frame().

07022 {
07023    int oldstate = ast_channel_state(chan);
07024    char name[AST_CHANNEL_NAME], *dashptr;
07026    if (oldstate == state)
07027       return 0;
07029    ast_copy_string(name, ast_channel_name(chan), sizeof(name));
07030    if ((dashptr = strrchr(name, '-'))) {
07031       *dashptr = '\0';
07032    }
07034    ast_channel_state_set(chan, state);
07036    ast_publish_channel_state(chan);
07038    /* We have to pass AST_DEVICE_UNKNOWN here because it is entirely possible that the channel driver
07039     * for this channel is using the callback method for device state. If we pass in an actual state here
07040     * we override what they are saying the state is and things go amuck. */
07041    ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, (ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_DEVSTATE_CACHE) ? AST_DEVSTATE_NOT_CACHABLE : AST_DEVSTATE_CACHABLE), name);
07043    return 0;
07044 }

Generated on Thu Apr 16 06:30:10 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6