Asterisk - Call Progress And Early Media

When you make a phone call, say to your grandma, you hear her phone ringing. It's called ringback and its purpose is fairly obvious. But have you ever wondered where it comes from? As a kid I assumed I was hearing grandma's phone ringing which, if you think about long enough, is kinda ludicrous. I haven't read up enough to know where it actually came from but I can tell you where it comes from in a SIP environment. There are basically two options.

First of all, the called party sends a 183 Ringing message to the caller. That's how your phone knows that grandma's is ringing. Your phone also then plays some sort of ring noise to let you know.

There's another possibility though. Instead of just saying 183 and being done, the callee can send back an RTP stream with the ringing noise of its choosing. I'm sure you've heard different types of ringback before (different pitch, different frequency, different volume) and that's because voice switches each have slight variations on the same theme.

Now, take that one step further and consider that an RTP stream is just an RTP stream and doesn't have to conform to some traditional ringing sound. It could be beeping, or honking, or whatever you want. Screeching monkeys, did I hear you say? Oh yeah. But probably more useful is the ability to send music. Here is how to set it up in Asterisk. (BTW, this will work with SIP, IAX2, or PRI. Basically any of the cool signaling methods, but it won't work with analog POTS.)

First we set up a music on hold class which is our ring noise. This can contain any file you want, but since Asterisk will play it from the beginning each time, best to be something that sounds cool immediately. Or pull it up in Audacity and trim out your favorite 60 seconds.



Then in our dialplan we use it. First we play a message to the caller that we're trying to find the user, otherwise they might get confused as to why they are hearing music. Then we pass the "m" option to Dial which specifies our music on hold class. It's really as easy as that.


exten => s,1,Progress
exten => s,n,Playback(followme/pls-hold-while-try)
exten => s,n,Dial(SIP/you||m(ring1))



sorry, does not work... with S675IP

I just tried to implement your idea, but sorry, even though I got no errors I am still getting the darn Call Progress Tones.... I am using a Siemens S675IP with an asterisk.

re: sorry, does not work... with S675IP

It could be that your upstream peer doesn't support early media then. They are probably generating their own and ignoring yours.


I noticed an error in the dialplan. It should read:

exten => s,1,Progress
exten => s,n,Playback(followme/pls-hold-while-try|noanswer)
exten => s,n,Dial(SIP/you||m(ring1))
Subscribe to Comments for "Asterisk - Call Progress And Early Media" Subscribe to - All comments