Mon Jun 27 16:51:12 2011

Asterisk developer's documentation


channelstate.h File Reference

Channel states. More...

#include "asterisk.h"

Go to the source code of this file.

Enumerations

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

Functions

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

enum ast_channel_state

ast_channel states

Note:
Bits 0-15 of state are reserved for the state (up/down) of the line Bits 16-32 of state are reserved for flags
Enumerator:
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 */
00046 
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.

Definition at line 6667 of file channel.c.

References ast_channel::_state, AST_CHANNEL_NAME, ast_copy_string(), AST_DEVICE_UNKNOWN, ast_devstate_changed_literal(), ast_manager_event, ast_state2str(), ast_channel::caller, chanlist::chan, EVENT_FLAG_CALL, ast_party_caller::id, name, ast_channel::name, ast_party_id::name, ast_party_id::number, S_COR, ast_party_number::str, ast_party_name::str, ast_channel::uniqueid, ast_party_number::valid, and ast_party_name::valid.

Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_read(), __dahdi_exception(), __oh323_update_info(), agent_call(), alsa_answer(), analog_answer(), analog_call(), analog_exception(), analog_ss_thread(), ast_raw_answer(), cb_events(), check_availability(), console_answer(), dahdi_answer(), dahdi_call(), dahdi_handle_event(), dahdi_indicate(), dahdi_read(), do_bridge_masquerade(), gtalk_call(), gtalk_newcall(), handle_invite_replaces(), handle_offhook_message(), handle_request_invite(), handle_response_invite(), handle_soft_key_event_message(), handle_stimulus_message(), iax2_call(), jingle_call(), jingle_newcall(), local_queue_frame(), mgcp_answer(), mgcp_call(), mgcp_ss(), misdn_call(), misdn_indication(), my_set_waitingfordt(), nbs_call(), nbs_hangup(), oh323_answer(), oss_answer(), pbx_builtin_busy(), pbx_builtin_congestion(), phone_answer(), phone_call(), phone_exception(), phone_hangup(), phone_write(), pri_ss_thread(), release_chan(), release_chan_early(), sig_pri_answer(), sig_pri_call(), sig_pri_indicate(), sip_answer(), skinny_answer(), skinny_call(), skinny_newcall(), unistim_answer(), unistim_call(), unistim_new(), unistim_ss(), update_state(), usbradio_answer(), and usbradio_call().

06668 {
06669    int oldstate = chan->_state;
06670    char name[AST_CHANNEL_NAME], *dashptr;
06671 
06672    if (oldstate == state)
06673       return 0;
06674 
06675    ast_copy_string(name, chan->name, sizeof(name));
06676    if ((dashptr = strrchr(name, '-'))) {
06677       *dashptr = '\0';
06678    }
06679 
06680    chan->_state = state;
06681 
06682    /* We have to pass AST_DEVICE_UNKNOWN here because it is entirely possible that the channel driver
06683     * for this channel is using the callback method for device state. If we pass in an actual state here
06684     * we override what they are saying the state is and things go amuck. */
06685    ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, name);
06686 
06687    /* setstate used to conditionally report Newchannel; this is no more */
06688    ast_manager_event(chan, EVENT_FLAG_CALL, "Newstate",
06689       "Channel: %s\r\n"
06690       "ChannelState: %d\r\n"
06691       "ChannelStateDesc: %s\r\n"
06692       "CallerIDNum: %s\r\n"
06693       "CallerIDName: %s\r\n"
06694       "Uniqueid: %s\r\n",
06695       chan->name, chan->_state, ast_state2str(chan->_state),
06696       S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""),
06697       S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, ""),
06698       chan->uniqueid);
06699 
06700    return 0;
06701 }


Generated on Mon Jun 27 16:51:12 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7