core: Don't play silence for Busy() and Congestion() applications.

When using the Busy() and Congestion() applications the
function ast_safe_sleep is used by wait_for_hangup to safely
wait on the channel. This function may send silence if Asterisk
is configured to do so using the transmit_silence option.

In a scenario where an answered channel dials a Local channel
either directly or through call forwarding and the Busy()
or Congestion() dialplan applications were executed with the
transmit_silence option enabled the busy or congestion
tone would not be heard.

This is because inband generation of tones (such as busy
and congestion) is stopped when other audio is sent to
the channel they are being played to. In the given
scenario the transmit_silence option would result in
silence being sent to the channel, thus stopping the
inband generation.

This change adds a variant of ast_safe_sleep which can be
used when silence should not be played to the channel. The
wait_for_hangup function has been updated to use this
resulting in the tones being generated as expected.

ASTERISK-29485

Change-Id: I066bfc987a3ad6f0ccc88e0af4cd63f6a4729133
This commit is contained in:
Joshua C. Colp
2021-06-21 08:31:41 -03:00
committed by Friendly Automation
parent 6b041d1092
commit 5e1cb3253c
3 changed files with 25 additions and 4 deletions

View File

@@ -1969,6 +1969,17 @@ int ast_is_deferrable_frame(const struct ast_frame *frame);
*/
int ast_safe_sleep(struct ast_channel *chan, int ms);
/*!
* \brief Wait for a specified amount of time, looking for hangups, and do not generate silence
* \param chan channel to wait for
* \param ms length of time in milliseconds to sleep. This should never be less than zero.
* \details
* Waits for a specified amount of time, servicing the channel as required.
* \return returns -1 on hangup, otherwise 0.
* \note Unlike ast_safe_sleep this will not generate silence if Asterisk is configured to do so.
*/
int ast_safe_sleep_without_silence(struct ast_channel *chan, int ms);
/*!
* \brief Wait for a specified amount of time, looking for hangups and a condition argument
* \param chan channel to wait for