Asterisk tips answer-before-playback

John Todd, of advises:

  • Before running any application that has sound playback (Playback, Background, VoiceMailMain2, etc.) it would be wise to execute an Answer first, then a Wait(2) to allow for VoIP channels to fully establish and settle.

Wasim adds:

Instead of a wait(2), we generally background an innocous music or a prompt for say 2 seconds, thus, people aren't waiting in dead-air, get some audio-feedback, and if the prompt is truncated, it doesn't matter since it was just a feeder in the first place. Wait will also not take any DTMF input during that time, so repeat users are stuck for that time.

Ofcourse if you notice a significant % of your VoIP sessions take time to settle, then best do a Wait(2), no point in send garble-jumble down the line. JT, as usual has very valuable suggestions.

Scott Stingel, of EVTMedia adds:

  • Be cautious not to add too much delay after the Answer, though, because Telcos start charging the caller (or *you*, on a toll-free line) when the call is answered (the technical term is that you are providing "answer supervision"). Adding 500-1000ms of silence at the beginning of the Playback should be sufficient. Instead of Wait(n), we use a Playback of a file containing 750ms of silence - seems to work well.

  • Also, you should not be tempted to avoid call charging all together by playing prompts and not answering the call. Telcos will generally not connect 2-way audio until you answer, and in any case will view this as not "playing fair" with them, subjecting you to service disconnection.

Note and update

New versions of Asterisk have added "Answer" capabilities to several functions like Playback(), which means that those functions will answer themselves if necessary.

C F, shmaltz at gmail dot com:
I was having problems that zap (FXO) channels were answered when I assumed that they will not be answered because the context didn't have any answer cmd in it. However I found out (the hard way), that you DONT have to do answer before using playback, and even without answer the ZAP line gets answered when using playback.
You can find it all here:
I know that under Note and update someone already posted it, but since I wasn't the only one in the list that didn't notice this note and update I decided to add this.

Back to Asterisk tips and tricks
Created by: oej, Last modification: Tue 08 of Mar, 2011 (00:13 UTC) by casey0999
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+