[asterisk-dev] channel on hold

Russell Bryant russell at digium.com
Wed Aug 22 10:27:45 CDT 2007

Clod Patry wrote:
> i'd like to know if there's a much cleaner way to know if a specific chan is
> on hold.
> The goal behind is simpler: make a new CLI command to list all the channels
> that are currently on hold.
> Based on that, i could use the ast_channel struct with music_state, since
> all on hold starts it, right (if res_musiconhold.so is loaded) ?
> Something like:
> if ( chan->music_state) {
>    //the call is onhold
> }

That won't work, because MOH is not always in use when channels are on hold.
Channel drivers choose how to handle being put on hold.  The most common thing
to do is just play MOH to the channel.  However, there are some channels that
can pass this information as signalling across the network.  For example, this
can be signalled over PRI in chan_zap, and in chan_iax2.  In theory, we could
add support for signalling HOLD in chan_sip, but it's not that way yet.

Russell Bryant
Software Engineer
Digium, Inc.

More information about the asterisk-dev mailing list