]> git.ipfire.org Git - thirdparty/asterisk.git/commit
chan_dahdi: Fix wrong channel state when RINGING recieved.
authorNaveen Albert <asterisk@phreaknet.org>
Mon, 16 Dec 2024 13:43:04 +0000 (08:43 -0500)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 23 Jan 2025 18:39:41 +0000 (18:39 +0000)
commit5f0354c287e062098c4a01641c5d192475f5ef9a
tree257c4aa27b6323c2e915ea0cccf0ff5e2be1769b
parent3c1ee3722d40fc8c89e8643bfd13ad7e05ddd2ae
chan_dahdi: Fix wrong channel state when RINGING recieved.

Previously, when AST_CONTROL_RINGING was received by
a DAHDI device, it would set its channel state to
AST_STATE_RINGING. However, an analysis of the codebase
and other channel drivers reveals RINGING corresponds to
physical power ringing, whereas AST_STATE_RING should be
used for audible ringback on the channel. This also ensures
the correct device state is returned by the channel state
to device state conversion.

Since there seems to be confusion in various places regarding
AST_STATE_RING vs. AST_STATE_RINGING, some documentation has
been added or corrected to clarify the actual purposes of these
two channel states, and the associated device state mapping.

An edge case that prompted this fix, but isn't explicitly
addressed here, is that of an incoming call to an FXO port.
The channel state will be "Ring", which maps to a device state
of "In Use", not "Ringing" as would be more intuitive. However,
this is semantic, since technically, Asterisk is treating this
the same as any other incoming call, and so "Ring" is the
semantic state (put another way, Asterisk isn't ringing anything,
like in the cases where channels are in the "Ringing" state).

Since FXO ports don't currently support Call Waiting, a suitable
workaround for the above would be to ignore the device state and
instead check the channel state (e.g. IMPORT(DAHDI/1-1,CHANNEL(state)))
since it will be Ring if the FXO port is idle (but a call is ringing
on it) and Up if the FXO port is actually in use. (In both cases,
the device state would misleadingly be "In Use".)

Resolves: #1029
(cherry picked from commit 9f6f9a60e575211f851ac038bc079c626755e3b9)
channels/chan_dahdi.c
include/asterisk/channelstate.h
main/devicestate.c