Asterisk - The Open Source Telephony Project GIT-master-67613d1
Enumerations | Functions
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.

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

Detailed Description

Channel states.

See also:

Definition in file channelstate.h.

Enumeration Type Documentation

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

35 {
36 AST_STATE_DOWN, /*!< Channel is down and available */
37 AST_STATE_RESERVED, /*!< Channel is down, but reserved */
38 AST_STATE_OFFHOOK, /*!< Channel is off hook */
39 AST_STATE_DIALING, /*!< Digits (or equivalent) have been dialed */
40 AST_STATE_RING, /*!< Line is ringing */
41 AST_STATE_RINGING, /*!< Remote end is ringing */
42 AST_STATE_UP, /*!< Line is up */
43 AST_STATE_BUSY, /*!< Line is busy */
44 AST_STATE_DIALING_OFFHOOK, /*!< Digits (or equivalent) have been dialed while offhook */
45 AST_STATE_PRERING, /*!< Channel has detected an incoming call and is waiting for ring */
46
47 AST_STATE_MUTE = (1 << 16), /*!< Do not transmit voice data */
48};
@ AST_STATE_MUTE
Definition: channelstate.h:47
@ AST_STATE_RING
Definition: channelstate.h:40
@ AST_STATE_DIALING_OFFHOOK
Definition: channelstate.h:44
@ AST_STATE_RINGING
Definition: channelstate.h:41
@ AST_STATE_PRERING
Definition: channelstate.h:45
@ AST_STATE_DOWN
Definition: channelstate.h:36
@ AST_STATE_OFFHOOK
Definition: channelstate.h:38
@ AST_STATE_BUSY
Definition: channelstate.h:43
@ AST_STATE_DIALING
Definition: channelstate.h:39
@ AST_STATE_UP
Definition: channelstate.h:42
@ AST_STATE_RESERVED
Definition: channelstate.h:37

Function Documentation

◆ ast_setstate()

int ast_setstate ( struct ast_channel chan,
enum  ast_channel_state 
)

Change the state of a channel.

Precondition
chan is locked

Definition at line 7385 of file channel.c.

7386{
7387 int oldstate = ast_channel_state(chan);
7388 char name[AST_CHANNEL_NAME], *dashptr;
7389
7390 if (oldstate == state)
7391 return 0;
7392
7393 ast_copy_string(name, ast_channel_name(chan), sizeof(name));
7394 if ((dashptr = strrchr(name, '-'))) {
7395 *dashptr = '\0';
7396 }
7397
7399
7401
7402 /* We have to pass AST_DEVICE_UNKNOWN here because it is entirely possible that the channel driver
7403 * for this channel is using the callback method for device state. If we pass in an actual state here
7404 * we override what they are saying the state is and things go amuck. */
7406
7407 return 0;
7408}
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
#define AST_CHANNEL_NAME
Definition: channel.h:171
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state)
@ AST_FLAG_DISABLE_DEVSTATE_CACHE
Definition: channel.h:1029
ast_channel_state
ast_channel states
Definition: channelstate.h:35
@ AST_DEVSTATE_CACHABLE
Definition: devicestate.h:70
@ AST_DEVSTATE_NOT_CACHABLE
Definition: devicestate.h:69
int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cachable, const char *device)
Tells Asterisk the State for Device is changed.
Definition: devicestate.c:471
@ AST_DEVICE_UNKNOWN
Definition: devicestate.h:53
static const char name[]
Definition: format_mp3.c:68
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
#define ast_test_flag(p, flag)
Definition: utils.h:63

References ast_channel_flags(), AST_CHANNEL_NAME, ast_channel_name(), ast_channel_publish_snapshot(), 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_test_flag, and name.

Referenced by __analog_handle_event(), __analog_ss_thread(), __ast_read(), __dahdi_exception(), analog_answer(), analog_call(), analog_exception(), analog_ss_thread(), ast_raw_answer_with_stream_topology(), AST_TEST_DEFINE(), chan_pjsip_answer(), chan_pjsip_incoming_response(), console_answer(), dahdi_answer(), dahdi_call(), dahdi_handle_event(), dahdi_indicate(), dahdi_read(), handle_response_ciev(), iax2_call(), indicate_busy(), indicate_congestion(), jingle_action_session_info(), jingle_action_session_initiate(), jingle_call(), mbl_hangup(), my_set_waitingfordt(), onAlerting(), onProgress(), ooh323_answer(), ooh323_new(), refer_incoming_invite_request(), unistim_answer(), unistim_call(), unistim_new(), unistim_ss(), and unreal_queue_frame().