* You are viewing the archive for August 28th, 2010

Play Files To Caller In Asterisk

I want to be able to allow a caller to dial a DDI system to verify identity etc (this is all done), I then want them to sit listening to music, until an event happens.

When this (external) event happens, I want to play a certain file to the caller, using playback (so that they have ff / rw etc), and when finished, go back to the music.

1) I thought of redirecting to an extension that played the file, and then jump back to the original Asterisk dialplan entry to start again. However, If I want to redirect, then this external event would need to know their channel.

2) I thought of a meetme / conference, but then they would not be able to control the playback of the file, right ?

Anyone got any other thoughts ?

Asterisk App Install Bounty

We’re trying to make voice and SMS apps easier and more common. We solved one part of the problem with pay-as-you-go cloud-scale Asterisk hosting, and now we’re trying to make the app setup easier. With a few exceptions, setup docs are too rare, and they depend on knowing too much about Asterisk. That complexity deters businesses from integrating phone calls into their products.

So we just put up $250 bounties for writing simple setup docs for some Asterisk apps: Web-MeetMe, BigBlueButton, MonAst, AsterCRM, Queue-Tip, Flash Operator Panel, and Asterisk PHP Event Monitor.

Basically, install one of these apps interoperating with Asterisk on Cloudvox, document what you did so others can do it too, get $250. Here’s details:


Our goal is to make these apps deployable without needing to know much about voice infrastructure, and hopefully that will encourage others to add phone calls, SMS, and video to their services.


Asterisk Does Not Translate From Wav To Alaw

Use sox to downsample to 8khz (and 1 chan), and the problems should go away. While you are at it, you could use sox to convert to the target format in a single operation.

The scripts that Digium uses to take Allison’s voice prompts (at 48khz) to the different formats, convert things to slin (raw) as a central format, but in my experience, the fewer steps the better. But I doubt that anyone could detect the difference in the end result.

Here’s what I do with CD-qual sounds to turn them into the common Asterisk formats:

Assume $i is the name of the .wav file you want to convert:

x=`basename $i .wav`
sox -v 0.7 $i -r 16000 -c 1 -t sw $x.sln16
sox -v 0.7 $i -r 8000 -c 1 -t sw $x.raw
sox -r 8000 -c 1 -t sw $x.raw -t gsm $x.gsm ## OR ### sox -v 0.7 $i -r 8000 -t gsm $x.gsm
sox -r 8000 -c 1 -t sw $x.raw -t ul $x.ulaw ## OR ### sox -v 0.7 $i -r 8000 -t ul $x.ulaw
sox -r 8000 -c 1 -t sw $x.raw -t al $x.alaw ## OR ### sox -v 0.7 $i -r 8000 -t wav $x.wav
rm $x.raw
sudo asterisk -rx “file convert $y/$i $y/$x.g722″


I’m ignoring the siren & g729 formats; use asterisk for those in like format, depending on your asterisk version and codecs. Allison normalizes the volume of sounds she distributes; use the -v 0.7 to bring the volume down a bit to the standard, and your sounds won’t stick out against rest of Allison’s existing recordings in Asterisk. Digium uses a filter program to ‘heighten’ the sounds a little; That’s the main reason, I think, that they use the .raw format as an in-between. I’ve been skipping this step, as it doesn’t seem critical, in which case the direct conversion is probably preferable.

I suggest, that if you are converting sounds for Asterisk’s sake, that you convert to all the possible formats. Disk space is cheap, and you’ll squeeze a little extra performance out of Asterisk by allowing it to pick the ‘best’ format. Dahdi type interfaces would prefer the ulaw/alaw formats; High-def phones like Snom (and appropriate Polycoms, etc) could use the g722. Ulaw and gsm transcodings are cheap, but no transcoding is cheaper still.

If you load “res_convert.so”, you will have a CLI command “file convert …”.
Usage: file convert
Convert from file_in to file_out. If an absolute path is not given, the default Asterisk sounds directory will be used.

file convert tt-weasels.gsm tt-weasels.ulaw


asterisk -rx “file convert /home/user/tt-weasels.gsm /home/user/tt-weasels.g729″