Recently (in another thread) I was trying to figure out how to do a multicast page, play a message, and hang up. This could be useful to, say, set a speed dial that announces fire drill, lunch break, or in my case “The mail is ready”.
Here’s how I did it.
First, I had our receptionist who would normally page “The mail is ready” record herself saying that. I saved it in /var/lib/asterisk/sounds/en_US as a .ulaw file with the standard parameters.
In /etc/asterisk/extensions_custom.conf I created an entry for an extension (in my case, I used 9901). The issue that I had is that it worked, but it never hung up. Once it created the multicast stream, it pretty much ignored anything after that. I could dial the number, but I would have to manually hang it up. I didn’t want that… I just wanted to push a button on the phone and have it play the announcement then hang up.
The secret to this was to set an absolute timeout for the call. 2 seconds was long enough for me to play the message… so, in /etc/asterisk/extensions_custom.conf I put:
exten => 9901,1,Answer()
exten => 9901,n,Set(TIMEOUT(absolute)=2)
exten => 9901,n,Dial(MulticastRTP/basic/224.5.6.10:10010,,gA(MailIsReady))
exten => 9901,n,Hangup()
This works perfectly, and I was able to add a speed-dial button to the phone in the mailroom. Just tap the button, it plays “The Mail is Ready” over all the phones with multicast, then times out and hangs up. Done.
Just posting for posterity.