This is my new extensions.conf which seems to have solved the problem
[default]
exten => s,1,System(asterisk -rx 'sip reload') ; hack to force sip reload
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(vm-extension)
exten => s,n,WaitExten()
exten => 0011,1,Goto(outbound,s,1)
exten => 11,1,Dial(SIP/mysipuser/5555555555,30,g) ;calls 555-555-5555
exten => 11,n,Goto(closechannel,s,1)
exten => 77,1,Dial(SIP/mysipuser/1111111111,30,g) ;calls 111-111-1111
exten => 77,n,Goto(closechannel,s,1)
[outbound]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(vm-extension)
exten => s,n,WaitExten()
exten => _NXXNXXNXXX,1,Dial(SIP/mysipuser/${EXTEN})
exten => _NXXNXXNXXX,n,Hangup
[closechannel]
exten => s,1,System(asterisk -rx 'sip reload')
exten => s,n,Hangup()
So the three changes I made were the addition of the exten => s,1,System(asterisk -rx 'sip reload')
statement, [closechannel]
context, and the ,30,g
to the Dial() command. The System command forces a sip reload every time someone tries to call in. The ,g
flag tells asterisk to continue executing code after calling parties disconnect.
This seems to work "most" of the times.
Early media is possible with Asterisk, but only in certain situations, and only with the cooperation/support of all the devices and services involved. Some phones and/or service providers do not support early media. Support for early voice and early DTMF may vary.
You have a SIP phone registered to Asterisk, which places a call to an external number. Asterisk in turn Dials that number over a separate SIP trunk. These are two separate call legs. Asterisk can play early media back to the caller (a custom ringtone or music on hold, for instance) and Asterisk can receive early media from the external party over the SIP trunk. However, a standard Dial() statement will automatically Answer() and bridge the call legs together when remote party answers.
It seems you wish to avoid this usually-desired behavior, and bridge the call legs without Answer()ing them. The Dial() application allows you to defer the usually-automatic Answer() using the 'd' or 'D' options. I'm not aware of any Dial() option that will allow you to bridge the call legs without Answer()ing.
Please see the Asterisk wiki for further discussion and examples of early media with Asterisk.
Best Answer
Realtime doesnt support inlcudes within realtime. Thereby you can tweak a little with the Goto function.
If you do this in your extensions.conf
And then in the database do this:
The above needs to translated to a query, I think you know how you need to do that since you are using Realtime.