Reputation: 6370
Salvete! How can I dial a number and have Asterisk originate a call from extension sipX to sipY?
Both sipX and sipY appear in extensions.conf of my dialplan.
The trick is that I want to dial 337 on my phone, and then my phone goes out of the picture, then sipX calls sipY.
Say I want to be able to push 337 on the phone, and have a sound played over the speakerphone of another phone, say, as an alarm.
Another way to consider it is, how can I do this:
When running the #2 action (completing the caller's session) and letting the rest of the process complete afterward, can we use something like the pre-dial handlers in Asterisk 11?
Upvotes: 3
Views: 17705
Reputation: 6370
Here is the answer.
You place Answer
as the first part, and end with 'hangup'. That takes care of the "busy signal".
No AGI. This works.
[from-internal]
exten => 3334,1,Goto(AngelusBell,startbell,1)
[AngelusBell]
exten => startbell,1,Answer
exten => startbell,n,System(asterisk -rx "channel originate Local/callviking@AngelusBell/n extension playbell@AngelusBell")
exten => startbell,n,Hangup
exten => callviking,1,Dial(SIP/Y,10,D(5)) ;calls my ATA to my paging box and plays 5 tone
exten => callviking,2,Hangup
exten => playbell,1,Answer
exten => playbell,2,Playback(custom/angelusbellWAV)
exten => playbell,3,Hangup
Upvotes: 2
Reputation: 2884
You could do this with the Originate application. Something like the following:
[default]
exten => 337,1,NoOp()
same => n,Originate(SIP/Y,exten,default,originated,1)
same => n,Hangup()
exten => originated,1,NoOp()
same => n,Playback(tt-monkeys)
same => n,Hangup()
The difference, of course, is that the Originate blocks the pbx_thread executing extension 337 until SIP/Y answers or otherwise fails. That being said, the actual call between SIP/Y and the application in extension originated occurs on its own thread, so once the state of SIP/Y is known, 337 will be hung up. So its fairly close to what you were looking for, and doesn't involve external mechanisms like a call file.
Upvotes: 4
Reputation: 1865
An idea would be to create a call file and move it to /var/spool/asterisk/outgoing/ using agi scripts.
Upvotes: 1