Correspondence between ast_channel_state and ast_device_state

I have some confusion about the correspondence between ast_channel_state and ast_device_state.
2023-05-19_09-51

AST_STATE_RING: Line is ringing
AST_STATE_RINGING: Remote end is ringing

What does AST_ DEVICE_ RINGING mean, is the device in a ringback state or in ring state?If it is not ring state, then there is no identification of the ring state.If it is the ring state, is there a problem with the corresponding relationship.Should it be changed to the following corresponding relationship?

/*!\brief Mapping for channel states to device states */
static const struct chan2dev {
enum ast_channel_state chan;
enum ast_device_state dev;
} chan2dev = {
{ AST_STATE_DOWN, AST_DEVICE_NOT_INUSE },
{ AST_STATE_RESERVED, AST_DEVICE_INUSE },
{ AST_STATE_OFFHOOK, AST_DEVICE_INUSE },
{ AST_STATE_DIALING, AST_DEVICE_INUSE },
{ AST_STATE_RING, AST_DEVICE_RINGING },
{ AST_STATE_RINGING, AST_DEVICE_INUSE },
{ AST_STATE_UP, AST_DEVICE_INUSE },
{ AST_STATE_BUSY, AST_DEVICE_BUSY },
{ AST_STATE_DIALING_OFFHOOK, AST_DEVICE_INUSE },
{ AST_STATE_PRERING, AST_DEVICE_RINGING },
};

I don’t know if there is a problem with my understanding. Looking forward to your answers.

Hi
the AST_DEVICE is indicating what state the phone is in
for RING the user has picked up the handset and dialed a number and remote end is sending 180 RINGING, where for RINGING the phone has recived an INVITE and has responded with a 180 RINGING

I don’t think that is right, even for this new fangled SIP stuff.

As far as I know RING means that the line is seeing AC ringing current, or has seen the start of an incoming ISDN call, or has seen a SIP INVITE, but Asterisk hasn’t yet looped the line, answered the cal, or sent 200 OK.

RINGING means Asterisk is generating AC ringing current, has received ISDN Alerting, or has received a SIP 180.

Other channel drivers, and other DAHDI signalling options, may have something similar to one of the three examples above.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.