How to designate file "type" to Playback()/Backgro

Asterisk 1.4 on Debian. Installed via aptitude.
Asterisk built by pbuilder @ grnetbox on a x86_64 running Linux on 2009-01-04 19:22:45 UTC

Using a scratch-built extensions.conf.

I was writing to ask why Asterisk wouldn’t Playback() or Background() a particular GSM file, say x.gsm, which it WOULD if I copied or renamed it to, say, y.gsm.

As I was lining up my ducks to be shot down, I realized the GLARING difference.

BEFORE copying x.gsm to y.gsm, I had ALSO already created x.mp3 (sox, toolame), so I suspect that Playback(x) and Background(x) don’t know WHICH x to pick. (I email BOTH to be politically correct.)

However, Playback(x.gsm) fails, and the docs don’t mention how to provide a filetype hint.

I’d appreciate a hint though. :astonished:) Thanks! GR

Dear GR,

I am sorry no one else was able or willing to help.

Try this workaround:
When you generate the MP3 file from the GSM, ADD ONE CHARACTER (e.g., ‘_’) to the end of the filename as an EXTRA indicator to Asterisk of the type difference.

Original: recording.gsm
MP3: recording_.mp3

will mean that Asterisk will treat Playback(recording) by finding the GSM.

Sincerely and affectionately yours,


Firstly how did you expect any one to assist you, You provided no example of your config and no verbose output from the CLI when it is running this dialplan.

Then you dont mention but imply that you are copying mp3 files to the sounds directory.

I would guess its trying to play the mp3 file but has no codec to transcode it via slin to your callers codec.

The sounds directory is for valid file types that can be played.

But As I first said its not realy possible to advise further with nothing to go on.


Thanks, Ian. I sought to keep the clutter down by what I thought was extraneous.

The result of:
exten => s,n,Playback(x)

when both x.gsm and x.mp3 are in the sounds directory is that Playback(x) will play nothing.

If x.gsm is there alone, Playback(x) plays fine.

Q. Is there a way to inform the Playback application which of the two forms it should playback?

I note that MP3Player() takes a file extension.

And thank you again.


I believe Asterisk expects sound files with the same filename, but different extensions to represent the same sound, and tries to pick the least expensive one for the output codec.

If you are not able to transcode mp3, you should not have mp3 files. If you are, the mp3 file should be equivalent to the gsm one.


why have you got mp3 files in the sounds directory ? This is for soundfiles that are COMPATIBLE and used by the system.


David and Ian,

I have MP3 files because I email the messages in two forms: GSM and MP3. (you correctly surmise that I cannot play them yet: there’s some extra work required for my Debian install)

I don’t use “the” sounds directory because I keep messages in an archive directory, along with a copy of all the callfiles created to forward them.

It allows one-stop trolling to see what-happened-when.

Files are named:
[There are multiple groups and whos and each who may have multiple phone#s to try.]

Note how sort will group msgs and callfiles together in time-received order.

Filetimes are also ‘touched’ to indicate the time they were recorded and (initially) forwarded (by moving a copy into “the” outgoing directory).

If a message-leaving caller aborts, I can rm CCYYMMDDHHMMSS* to clean up, and if a message-receiving caller wishes to take the ticket and spare everyone else in the group the trouble of receiving the same message, I can rm CCYYMMDDHHMMSScall.

So it would be helpful, to me at least, if Playback() could be told “try to play the GSM file first” or “play this fully specified filename”.