[asterisk-dev] [Code Review] 3771: device state: Update core to report ONHOLD if channel is on hold

Matt Jordan reviewboard at asterisk.org
Thu Jul 24 10:21:02 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3771/
-----------------------------------------------------------

(Updated July 24, 2014, 10:21 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers.


Changes
-------

Committed in revision 419358


Bugs: ASTERISK-24038
    https://issues.asterisk.org/jira/browse/ASTERISK-24038


Repository: Asterisk


Description
-------

In Asterisk, it is possible for a device to have a status of ONHOLD. This is not typically an easy thing to determine, as a channel being on hold is not a direct channel state. Typically, this has to be calculated outside of the core independently in channel drivers, notably, chan_sip and chan_pjsip. Both of these channel drivers already have to calculate device state in a fashion more complex than the core can handle, as they aggregate all state of all channels associated with a peer/endpoint; they also independently track whether or not one of those channels is currently on hold and mark the device state appropriately.

In 12+, we now have the ability to report a AST_DEVICE_ONHOLD state for all channels that defer their device state to the core. This is due to channel hold state actually now being tracked on the channel itself. If a channel driver defers its device state to the core (which many, such as DAHDI, IAX2, and others do in most situations), the device state core already goes out to get a channel associated with the device. As such, it can now also factor the channel hold state in its calculation.

This patch adds this logic to the device state core. It also uses an existing mapping between device state and channel state to handle more channel states. chan_pjsip has been updated slightly as well to make use of this (as it was, for some reason, reporting a channel state of BUSY as a device state of INUSE, which feels slightly wrong).


Diffs
-----

  /trunk/main/devicestate.c 418565 
  /trunk/channels/chan_pjsip.c 418565 

Diff: https://reviewboard.asterisk.org/r/3771/diff/


Testing
-------

Some manual testing was done. Additionally, the pjsip hold test was modified to report back the device state using the DEVICE_STATE function which verified the correct hold state coming back from that channel driver.

New tests should be added to check the core logic; this review will be updated when those tests are added.


Thanks,

Matt Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140724/2b0abff4/attachment.html>


More information about the asterisk-dev mailing list