I am encountering an issue with playing back custom audio files in Asterisk. I have tried multiple formats including WAV, SLN, and GSM with 8000 Hz mono sound, but none of them work. The only audio file that plays successfully is the default “hello world” sound.
Here are the steps I have followed:
I placed the custom audio file in the /var/lib/asterisk/sounds/ directory.
I provided the necessary permissions and ownership to the Asterisk user:
I used the following dialplan configuration to attempt to play the audio file:
>
> [incoming]
> exten => 1,1,NoOp(Incoming call from ${CALLERID(num)})
> same => n,Answer()
> same => n,Playback(output222) ; Attempt to play custom audio file
> same => n,Hangup()
Despite following these steps, the call drops immediately without playing the custom audio file. Here are some logs that might be relevant:
Executing [1@incoming:1] NoOp("PJSIP/sipnet_endpoint-00000000", "Incoming call from +2") in new stack
Executing [1@incoming:2] Answer("PJSIP/sipnet_endpoint-00000000", "") in new stack
Executing [1@incoming:3] Playback("PJSIP/sipnet_endpoint-00000000", "output222") in new stack
[WARNING] file.c:804 ast_openstream_full: File /var/lib/asterisk/sounds/output222 does not exist in any format
[WARNING] app_playback.c:497 playback_exec: Playback failed on PJSIP/sipnet_endpoint-00000000 for output222
Executing [1@incoming:4] Hangup("PJSIP/sipnet_endpoint-00000000", "") in new stack
System Details:
Asterisk Version: 18.10.0
OS: Ubuntu
I have verified that the file exists and is in the correct directory. The file permissions and ownership are set correctly. I have also tried converting the file to different formats (WAV, SLN, GSM) using sox, but the issue persists.
Could someone please help me understand what might be going wrong and how to resolve this issue?
Show us the ownership and permissons of each directory down through the
path /var /var/lib /var/lib/asterisk /var/lib/asterisk/sounds
What’s the output of “file /var/lib/asterisk/sounds/output222.wav”?
What does “ps auwx” show for the user which Asterisk is running as?
You say that “the default Hello World sound” plays okay.
a) is this file in the same directory?
b) what is its filename?
c) what happens if you copy its content to
/var/lib/asterisk/sounds/sound222.XXX where XXX is the same extension as the
original Hello World file and then try to play sound222?
Antony.
–
Python is executable pseudocode.
Perl is executable line noise.
4/ regarding Hello-world file:
a) i have this file both in /var/lib/asterisk/sounds and in /var/lib/asterisk/sounds/en folders.
b) hello-world.gsm
c) changed Hello-world.gsm filename into sound333.gsm. after specifying full path asterisk returned correct playback “hello world” same => n,Playback(/var/lib/asterisk/sounds/en/sound333)
That might be screwing it up. Typically for wav it expects 8khz/16bit PCM. If you’re running alaw or ulaw then it expects headerless raw files with the .*law extension.
I still wonder if this isn’t a situation where you’re missing a codec or file handler. There could be something messed up with your paths. Usually the default sounds path will be /var/lib/asterisk/sounds/{language}/, so /var/lib/asterisk/sounds/en/ is where it defaults to audio files for channels set to english. It’s possible to change the default language of the PBX or a specific call channel and pull an entirely different set of audio files for that language.