Asterisk voicemail hangs up on callers after a few seconds.

I’ve spent about an hour and a half on this problem and the internet has nearly no results on how to fix the issue so I’m going to post the solution.

Problem

Phone system based on asterisk 1.8 (running on OpenWRT on an AMD Geode ALIX box) is working fine for all internal calls, external to internal calls and internal to external calls.

Internal calls to voicemail work

External calls to voicemail plays the greeting and asks the caller to record a message. Asterisk records 1 or 2 seconds of audio and then the caller gets cut off.

Asterisk reports:

[May  9 22:57:09] WARNING[3547]: app.c:977 __ast_play_and_record: No audio available on SIP/siptrunkprovider-1-00000005??

If you enable debug logging you see a bit more information that you think might point you in the right direction..

[May 9 22:57:04] DEBUG[3547]: channel.c:5297 set_format: Set channel SIP/siptrunkprovider-1-00000005 to write format alaw
[May 9 22:57:04] DEBUG[3547]: app.c:1490 ast_lock_path_lockfile: Locked path '/var/spool/asterisk/voicemail/default/0404/INBOX'
[May 9 22:57:04] DEBUG[3547]: app.c:1507 ast_unlock_path_lockfile: Unlocked path '/var/spool/asterisk/voicemail/default/0404/INBOX'
[May 9 22:57:04] DEBUG[3547]: channel.c:5297 set_format: Set channel SIP/siptrunkprovider-1-00000005 to write format gsm
[May 9 22:57:04] DEBUG[3547]: channel.c:5297 set_format: Set channel SIP/siptrunkprovider-1-00000005 to write format alaw
[May 9 22:57:04] DEBUG[3547]: app.c:894 __ast_play_and_record: play_and_record: <None>, /var/spool/asterisk/voicemail/default/0404/tmp/1s4hH1, 'wav49|gsm|wav'
[May 9 22:57:04] DEBUG[3547]: app.c:918 __ast_play_and_record: Recording Formats: sfmts=wav49
[May 9 22:57:04] DEBUG[3547]: dsp.c:489 ast_tone_detect_init: Setup tone 1100 Hz, 500 ms, block_size=160, hits_required=21
[May 9 22:57:04] DEBUG[3547]: dsp.c:489 ast_tone_detect_init: Setup tone 2100 Hz, 2600 ms, block_size=160, hits_required=116
[May 9 22:57:04] DEBUG[3547]: channel.c:5297 set_format: Set channel SIP/siptrunkprovider-1-00000005 to read format slin
[May 9 22:57:07] DEBUG[3547]: app.c:974 __ast_play_and_record: One waitfor failed, trying another
[May 9 22:57:09] WARNING[3547]: app.c:977 __ast_play_and_record: No audio available on SIP/siptrunkprovider-1-00000005??
[May 9 22:57:09] DEBUG[3547]: channel.c:5297 set_format: Set channel SIP/siptrunkprovider-1-00000005 to read format alaw
[May 9 22:57:09] DEBUG[3547]: app.c:1490 ast_lock_path_lockfile: Locked path '/var/spool/asterisk/voicemail/default/0404/INBOX'
[May 9 22:57:09] DEBUG[3547]: app.c:1507 ast_unlock_path_lockfile: Unlocked path '/var/spool/asterisk/voicemail/default/0404/INBOX'
[May 9 22:57:09] DEBUG[3547]: app_voicemail.c:4917 sendmail: Attaching file '/var/spool/asterisk/voicemail/default/0404/INBOX/msg0000', format 'WAV', uservm is '2048', global is 2048
[May 9 22:57:09] DEBUG[3547]: app_voicemail.c:4928 sendmail: Sent mail to voicemaildestination@domain.com with command '/usr/sbin/sendmail -t'
[May 9 22:57:09] DEBUG[3547]: pbx.c:5544 __ast_pbx_run: Spawn extension (default,main,3) exited non-zero on 'SIP/siptrunkprovider-1-00000005'
[May 9 22:57:09] DEBUG[3547]: channel.c:2735 ast_softhangup_nolock: Soft-Hanging up channel 'SIP/siptrunkprovider-1-00000005'
[May 9 22:57:09] DEBUG[3547]: channel.c:2884 ast_hangup: Hanging up channel 'SIP/siptrunkprovider-1-00000005'
[May 9 22:57:09] DEBUG[3547]: chan_sip.c:6534 sip_hangup: Hangup call SIP/siptrunkprovider-1-00000005, SIP callid 2017050923565400001@2700-0344-0103-283
[May 9 22:57:09] DEBUG[3547]: chan_sip.c:6150 update_call_counter: Updating call counter for incoming call
[May 9 22:57:09] DEBUG[3547]: res_rtp_asterisk.c:2604 ast_rtp_remote_address_set: Setting RTCP address on RTP instance '0x88152e8'
[May 9 22:57:09] DEBUG[3547]: chan_sip.c:3526 __sip_xmit: Trying to put 'BYE sip:201' onto UDP socket destined for 81.158.130.1:5060

Attempts to fix it.

I tried so many things including changing to “minivm”, changing the recording format, trying to turn off silence detection in voicemail and installing other codecs / translators.

None of this helped. The only other hint I had was watching wireshark on the RTP ports. I could see that as soon as Asterisk started recording the voicemail it stopped sending packets to the SIP provider while the SIP provider continued to send RTP data for a few more seconds… then the call would get cut off.

I knew this wasn’t a SIP provider bug or problem as I have another Asterisk system on a different version of Asterisk and running on a traditional computer which does not exhibit the same problem.

Thinking that the problem was likely something to do with the audio data / RTP stream I searched around using many other keywords. I wanted to work out how to make Asterisk send either silence or comfort noise while it was recording the voicemail.

Eventually I googled for the correct magic keyword “asterisk send audio while recording” and came across this post:
https://www.spinics.net/lists/asterisk/msg168788.html

SOLUTION

It took so long to get to this point but I’m glad I continued

The solution is to edit or add this line into your asterisk.conf in /etc/asterisk (or wherever you keep your asterisk config files):

transmit_silence = yes

The documentation in the config file notes:

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.

I hope this page helps someone!

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Comment on this topic

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s