Asterisk background() audio files doesnt play (does not exist in any format)

my extantion config
[default]
exten => _X.,1,Ringing
exten => _X.,n,Wait(1)
exten => _X.,n,Dial(PJSIP/${EXTEN},25,tT)
exten => _X.,n,Answer()
exten => _X,n,Playback(???)
exten => _X.,n,Hangup

I have installed Asterisk16 with pjsip trunk (OpenWRT 19.0.7)
i am trying to make background sounds but i cant find any sounds anywhere in asterisks folders
where can i get these sounds and how to make them play ?

i found a folder /usr/share/asterisk/sounds and put some gsm examples but stuill no audio

Create a separate extension in the default context for tests. Use the full soundfile path name without the file extension.

exten => 100,1,Answer(500)
 same => n,Playback(/usr/share/asterisk/sounds/mysoundfilename)
 same => n,Hangup()

Open a verbose asterisk console and dial 100. Check for errors if any.

[root@mail asterisk]# asterisk -rvvvvv
  == Using SIP RTP CoS mark 5
    -- Executing [100@test:1] Answer("SIP/999-00000004", "500") in new stack
       > 0x7fc560001600 -- Probation passed - setting RTP source address to 192.168.1.254:40036
    -- Executing [100@test:2] Playback("SIP/999-00000004", "/var/lib/asterisk/sounds/en/hello-world") in new stack
    -- <SIP/999-00000004> Playing '/var/lib/asterisk/sounds/en/hello-world.slin' (language 'en')
    -- Executing [100@test:3] Hangup("SIP/999-00000004", "") in new stack
  == Spawn extension (test, 100, 3) exited non-zero on 'SIP/999-00000004'
mail*CLI>

1 Like

This is my full extentions.conf

[general]
static=yes
writeprotect=no
;autofallthrough=no
clearglobalvars=no
[globals]
CONSOLE=Console/dsp				; Console interface for demo
;CONSOLE=DAHDI/1
;CONSOLE=Phone/phone0
IAXINFO=guest					; IAXtel username/password
;IAXINFO=myuser:mypass
TRUNK=DAHDI/G2					; Trunk interface
TRUNKMSD=1					; MSD digits to strip (usually 1 or 0)



[pipa]
exten => _X.,1,Ringing
exten => _X.,n,Wait(1)
exten => _X.,n,Dial(PJSIP/${EXTEN},25,tT)
exten => _X.,n,Answer()
exten => _X.,n,Hangup



exten => 777,1,Answer(500)
 same => n,Playback(/var/lib/asterisk/sounds/tt-monkeys)
 same => n,Hangup()

[Dec 24 03:50:21] WARNING[5168][C-00000004]: file.c:789 ast_openstream_full: File usr/share/asterisk/sounds/tt-monkeys does not exist in any format
[Dec 24 03:50:21] WARNING[5168][C-00000004]: file.c:1262 ast_streamfile: Unable to open usr/share/asterisk/sounds/tt-monkeys (format (gsm)): Invalid argument
[Dec 24 03:50:21] WARNING[5168][C-00000004]: app_playback.c:497 playback_exec: Playback failed on PJSIP/888-00000004 for usr/share/asterisk/sounds/tt-monkeys
    -- Executing [777@pipa:3] Hangup("PJSIP/888-00000004", "") in new stack

type or paste code here

Well now it says, what is wrong maybe format of audio file ? but gsm is the best format for audio files in Asterisk as i know

Тhis means that the file cannot be found. You have missed the first slash in the absolute path.

1 Like

i added the slash also i set rights for the file like 0775 and still the same (i restart asterisk every change in config )

  -- Executing [888@pipa:2] Playback("PJSIP/777-00000001", "/usr/share/asterisk/sounds/tt-monkeysintro") in new stack
[Dec 24 07:22:56] WARNING[2453][C-00000002]: file.c:789 ast_openstream_full: File /usr/share/asterisk/sounds/tt-monkeysintro does not exist in any format
[Dec 24 07:22:56] WARNING[2453][C-00000002]: file.c:1262 ast_streamfile: Unable to open /usr/share/asterisk/sounds/tt-monkeysintro (format (gsm)): Invalid argument
[Dec 24 07:22:56] WARNING[2453][C-00000002]: app_playback.c:497 playback_exec: Playback failed on PJSIP/777-00000001 for /usr/share/asterisk/sounds/tt-monkeysintro
    -- Executing [888@pipa:3] Hangup("PJSIP/777-00000001", "") in new stack

extentions

exten => _X.,1,Ringing
exten => _X.,n,Wait(1)
exten => _X.,n,Dial(PJSIP/${EXTEN},25,tT)
exten => _X.,n,Answer()
exten => _X.,n,Hangup
exten => 888,1,Answer()
 same => n,Playback(/usr/share/asterisk/sounds/tt-monkeysintro)
 same => n,Hangup()

i donwloaded these files from somwere maybe for asterisk on openwrt format of the audio files are diffrent
could you attach 1 audio in gsm from your server? so i will try.
i also install asterisk16 sounds in gsm so it doesn work with them the same
the files all went to the directory /usr/share/asterisk/sounds/
asterisk.conf:

[directories](!)
astcachedir => /tmp
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /usr/share/asterisk
astagidir => /usr/share/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => /usr/sbin

also tried to change astdatadir => /usr/share/asterisk to astdatadir => /usr/share/asterisk/sounds didnt help

These files work for me.
https://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-gsm-current.tar.gz

Check the supported file formats.

asterisk -rx 'core show file formats'
1 Like

first i cheked it
asterisk -rx 'core show file formats'
it was 0 file formats registered

this appered after i installed asterisk16-format-gsm and asterisk16-format-pcm

88*CLI> core show file formats
Format     Name       Extensions
------     ----       ----------
gsm        gsm        gsm
g722       g722       g722
ulaw       au         au
alaw       alaw       alaw|al|alw
ulaw       pcm        pcm|ulaw|ul|mu|ulw
5 file formats registered.

and my extention

[pipa]
exten => _X.,1,Ringing
exten => _X.,n,Answer(10)
exten => _X.,n,Playback(pls-hold-while-try)
exten => _X.,n,Dial(PJSIP/${EXTEN},25,tT)
exten => _X.,n,Hangup

and now it works! thanks alot for the tip!!

1 Like

What if the extension doesn't answer in the end? Then the caller still has an answered call and needs to pay for it? Needs to pay for listening to the announcement?

:wink:

1 Like

yes, but there is no way to make it free is there?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.