Reputation: 472
I need to execute AGI scripts when following events occur:
AGI()
function).<-- Problem, how to do this?
U(answer^${CALLID})
option in Dial()
).h
special extension).My dialplan looks like this:
[from_origin]
exten => _X.,1,NoOp(${CALLER_USERNAME} from ${CHANNEL(pjsip,remote_addr)})
same => n,AGI(agi://127.0.0.1/incoming)
same => n,Dial(${DIALSTR},45,U(answer^${CALLID}))
exten => h,1,AGI(agi://127.0.0.1/hangup,${CDR(uniqueid)})
[answer]
exten => s,1,Set(theCallID=${ARG1})
same => n,AGI(agi://127.0.0.1/answered)
same => n,Return()
Look, I have called 3
fast-agi
scripts: incoming
, answered
and hangup
. Now I need to call similar script like ringing
when the called party is "ringing". How to achieve this ?
Upvotes: 0
Views: 1168
Reputation: 15247
Ringing status is status of the channel(chan_pjsip.so) and it not sent outside channel code.
So no, you can't get it in Dial app. Because it can't be get for some channels types and Dial still should work for those types.
For some channels you can get it via AMI in event listening loop in NewState event. But there are no garantee it will be exactly at same time when you got ringing sip message.
https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+ManagerEvent_Newstate
Upvotes: 1