1
votes

I'm using a cloud-based Asterisk server as my PBX. At my current location, the Internet is rather shaky, but cell phones are reliable and commonplace. However, international cell calls are expensive, VOIP calls are much cheaper.

So, I came up with a script in Asterisk which dials my local cell phone:

exten => _abcd.,1,NoOp(-- Making outbound call to number ${EXTEN:4} --)
same  => n,Answer()
same  => n,Wait(1)
same  =>  n,Originate(SIP/+86[my_cell_no]@[voip_provider],exten,incoming_remote,##${EXTEN:4})
same  => n,Hangup()

Let's say I want to call a UK mobile number, +4477something. I would use my softphone to dial abcd+4477something. The script above runs, makes a call into my local cell phone. As soon as I answer, it jumps into another extension _##. which dials the outbound number, and connects the two together.

It works perfectly. However, whilst I'm waiting for the local cell to connect, I've got silence on the line. I'd quite like to play music... but I can't use the MusicOnHold() application, because it just sits there & does nothing until I hang up!

I can't add any "DIAL" style commands (i.e. "m") to the Originate command because it doesn't support them.

Is there any known way of playing (one of) the MusicOnHold channels asynchronously whilst the rest of my dialplan gets on with it?

Would the AGI command SET MUSIC do what I wanted?

e.g.

exten => _abcd.,1,NoOp(-- Making outbound call to number ${EXTEN:4} --)
same  => n,AGI(turn_music_on.sh)
same  => n,Answer()
.....etc.

I'm using Asterisk 1.8, if a newer version fixes/changes the MusicOnHold behaviour, then that will be the accepted answer (but the documentation seems to suggest it's the same).

1

1 Answers

1
votes

You can call to Local channel(dialplan). After that in dialplan you can use m of dial command.

https://www.voip-info.org/wiki/view/Asterisk+local+channels

same  =>  n,Originate(Local/[my_cell_no]@out/n,exten,incoming_remote,##${EXTEN:4})

[out]
exten => _X.,1,Dial(SIP/+86${EXTEN}@[voip_provider],,m)