How To Join 2 Channels Using AGI/AMI
Dear all
i’m using an “old” Asterisk 1.6.2.9-2+squeeze12, and want to know if is possible to configure a scenario like this:
1) receive a call and put it on-hold in a queue (OK)
2) monitor the queue and trigger an outbound call to a remote number using AMI, setting the channel of the on-hold on a specific var named channel2Link (OK)
3) when the remote number answer, trigger an AGI/diaplan script that ask to accept the call pressing a specific key (OK)
4) if right key is pressed redirect the current call to the channel2Link, connecting the call in queue with the remote number (?)
Step 1,2,3 works properly but i’m not able to link the two channels, even using redirect,goto or pickupChan.
Any idea or help will be appreciated!
Thanks
10 thoughts on - How To Join 2 Channels Using AGI/AMI
I think the way to achieve that is by using the Bridge application:
https://wiki.asterisk.org/wiki/display/AST/Bridge+Application https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Bridge
oh, yes!
Many thanks
2016-06-30 15:28 GMT+02:00 Guido Falsi:
I think a simpler way to do this would be to define an member in your queues.conf that points to a local channel that calls the remote users cell phone.
You can use the M option in your dial to run a macro to prompt the user to accept the call.
Here’s my connector macro, I call it with:
Dial(LOCAL/${CELLPHONE}@intern,60,M(connector))
[macro-connector]
exten => s,1,NoOP()
same => n(TOP),Read(RESPONSE,beep&accept-reject,1,s,3,5); 3 tries with 5
seconds to respond each time same => n,GotoIf($[${LEN(${RESPONSE})} = 0]?REJECT,1) ;If we didn’t get a response try and fail gracefully same => n,GotoIf($[“${RESPONSE}” = “1”]?ACCEPT,1) ;Take the call same => n,GotoIf($[“${RESPONSE}” = “2”]?REJECT,1) ;Reject the Call same => n,Goto(s,TOP)
exten => ACCEPT,1,NoOP() ;Just connect the caller and callee same => n,Playback(pls-wait-connect-call)
same => n,MacroExit() ;Return
exten => REJECT,1,NoOP()
same => n,Playback(beep&cancelled&goodbye)
same => n,Set(MACRO_RESULT=BUSY) ;Reject the call same => n,Hangup()
same => n,MacroExit() ;Return
thanks John
yeah, your approach is much siple, i’ve tried it but i’m not able do detect DTMF tones.
it seems that on calls that i receive DTMF tones are handled correctly, but on calls generated from Asterisk to the world when the called side sends some DTMF digits they are not detected:
— Executing [s@macro-myconnector:1] NoOp(“SIP/pbx2-000004b2”, “”) in new stack Playing ‘beep.gsm’ (language ‘en’) Playing ‘beep.gsm’ (language ‘en’) Playing ‘beep.gsm’ (language ‘en’)
— Executing [s@macro-myconnector:2] Read(“SIP/pbx2-000004b2”,
“RESPONSE,beep,1,s,3,5”) in new stack
— Accepting a maximum of 1 digits.
—
…
— User entered nothing, 2 chances left
—
…
— User entered nothing, 1 chance left
—
…
— User entered nothing.
— Executing [s@macro-myconnector:3] GotoIf(“SIP/pbx2-000004b2”,
“1?REJECT,1”) in new stack
Any idea?
2016-06-30 21:50 GMT+02:00 John Kiniston:
Looking at your logs it looks like you may need to modify your sip.conf, Check with your provider as to what kind of DTMF they support and configure sip.conf to use that type of signalling.
this is the point, and the strange thing:
DTMF is set to rfc2833, but is working both on incoming and outgoing calls, it is not working only on calls generated with the Originate AMI command, or with the queue member that point to Local dialplan, as you suggested
2016-06-30 22:53 GMT+02:00 John Kiniston:
sorry for top-posting, the two topics started with 2 different reason subject, but then we finished on the same problem.
btw,the 2 show channel are reported above:
the channel with DTMF working
kcenter*CLI> core show channel SIP/pbx2-000004b9
— General
i’ve tried rfc2833,inband and info having the same behaviour in all situation.
2016-06-30 23:53 GMT+02:00 nik600:
to simplify the scenario, i’ve changed some settings to create a more simple test-case:
i’m using this callfile:
Channel: DAHDI/g0/{mycellnumber}
Context:mytestdtmf Extension:01
Priority:1
and this is my dialplan:
[mytestdtmf]
exten => 01,1,Answer exten => 01,n,Read(digito,,1)
exten => 01,n,SayDigits(${digito})
Any idea?
2016-07-01 0:13 GMT+02:00 nik600:
finally i’ve found that the SIP gateway i’m using is based on a DAHDI
channel and it seems that on outgoing calls, if the called leg sends some digit they are not forwarded toAsterisk.
i’m investigating on it….
2016-07-01 4:25 GMT+02:00 Steve Edwards: