[Home]

Summary:ASTERISK-24373: Sub-second silence
Reporter:Corey Farrell (coreyfarrell)Labels:
Date Opened:2014-09-29 23:27:34Date Closed:2015-10-19 19:08:08
Priority:MinorRegression?
Status:Closed/CompleteComponents:Sounds
Versions:SVN Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20ms.ulaw
Description:In some situations it is necessary to send at least 1 audio frame to a channel before audio can be received.  I believe it would be very helpful to add silence/20ms audio files to the standard audio distribution.  I'm unsure if other lengths would also be useful.  For my own use 20ms is enough to allow audio to start flowing in both directions.

As another thought, maybe it would be useful to have an option for Wait to play silence of arbitrary length, for example: Wait(0.02,s).  I still think adding a minimum length silent audio to the sounds distribution would be useful since an option to generate silence from Wait() is unlikely to happen in released branches.

[Edit by Rusty - Adding Corey's use case below]

My use case for this audio is in an outbound dialer using SIP through a Cisco firewall. A call is originated and processed with the following dialplan:

{noformat}
exten => s,1,Answer()
same => n,Playback(silence/20ms)
same => n,AMD()
same => n,NoOp(do stuff based on AMD results)
{noformat}

Initially I was using Wait(0.1) in place the Playback, however for reasons unknown to me this prevented the dialer from receiving any audio, and AMD() timed out with silence. I verified that the PBX which received the call was sending RTP to the correct IP immediately upon Answer, but the dialer didn't receive RTP until after it sent RTP. So I needed to add silence before running AMD, but silence/1 would be too large of a delay.
Comments:By: Corey Farrell (coreyfarrell) 2014-09-29 23:30:20.950-0500

20ms of silence generated by Audacity in ulaw format.  If this contribution is desired I can provide the same in all (or at least most) formats.

By: Rusty Newton (rnewton) 2014-10-01 13:21:53.857-0500

{quote}
In some situations it is necessary ...<snip>
{quote}

Corey can you add a description of a use case or two where this solution is necessary? That will help others decide whether it is useful for them or overall.

By: Corey Farrell (coreyfarrell) 2014-10-01 14:17:05.725-0500

My use case for this audio is in an outbound dialer using SIP through a Cisco firewall.  A call is originated and processed with the following dialplan:
{code}
exten => s,1,Answer()
same => n,Playback(silence/20ms)
same => n,AMD()
same => n,NoOp(do stuff based on AMD results)
{code}

Initially I was using Wait(0.1) in place the Playback, however for reasons unknown to me this prevented the dialer from receiving any audio, and AMD() timed out with silence.  I verified that the PBX which received the call was sending RTP to the correct IP immediately upon Answer, but the dialer didn't receive RTP until after it sent RTP.  So I needed to add silence before running AMD, but silence/1 would be too large of a delay.

By: Richard Mudgett (rmudgett) 2014-10-01 14:54:06.472-0500

@Corey
Wait() can generate silence frames.  You just need to enable the feature that would do it.  However, it may do more than you would like.

In asterisk.conf
{noformat}
;transmit_silence = yes ; Transmit silence while a channel is in a
; waiting state, a recording only state, or
; when DTMF is being generated.  Note that the
; silence internally is generated in raw signed
; linear format. This means that it must be
; transcoded into the native format of the
; channel before it can be sent to the device.
; It is for this reason that this is optional,
; as it may result in requiring a temporary
; codec translation path for a channel that may
; not otherwise require one.
{noformat}

By: Corey Farrell (coreyfarrell) 2014-10-01 15:26:19.326-0500

@Richard,

I was not aware of this, good to know.  However I have to agree this does more than I want.  I do not need a constant stream of RTP to be sent from the call source, I only need a single frame at the start of the call to pierce the firewall.

By: Corey Farrell (coreyfarrell) 2015-10-17 09:58:26.504-0500

I was just looking at this again, could my problem be solved by Playtones?
{{code}}
same => n,Playtones(0/20)
same => n,Wait(0.02)
same => n,StopPlayTones()
{{code}}

Again the goal being to force generation of a silent RTP frame.  Is 0.02 second wait long enough to guarantee that a frame will be generated?

By: Richard Mudgett (rmudgett) 2015-10-19 12:16:31.414-0500

Due to timing tolerances, I'd say that a 20 ms wait is too short to guarantee one frame.

By: Corey Farrell (coreyfarrell) 2015-10-19 18:04:23.550-0500

What would you say is a better amount of time?  Would 100ms be enough?

By: Richard Mudgett (rmudgett) 2015-10-19 18:19:22.386-0500

A 100 ms wait should give you 5 plus/minus 1 packets.
A 40 ms wait should give you 2 plus/minus 1 packets.