I need to execute AGI scripts when following events occur:
- An incoming call (it is simple just call
AGI()
function). - When a call is "Ringing" (I cannot figure it out!).
<-- Problem, how to do this?
- When a call is "Answered" (I do it using
U(answer^${CALLID})
option inDial()
). - When a call hangs up (I do it using
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 ?