What is the Asterisk Dial() Option to Call Subroutine on "Ringing" Status Received from Called Party?

I need to execute AGI scripts when following events occur:

  1. An incoming call (it is simple just call AGI() function).
  2. When a call is "Ringing" (I cannot figure it out!). <-- Problem, how to do this?
  3. When a call is "Answered" (I do it using U(answer^${CALLID}) option in Dial()).
  4. 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 ?

1

1 Answer

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like