How to detect the DIALSTATUS?

Hi all.

I have made an outbound call using Asterisk and SIP Trunk provided from Telnyx.

My extension is like the following:

[outbound]
exten => _X.,1,Dial(PJSIP/+{EXTEN}@mytrunk)
same => n,Goto(s-${DIALSTATUS},1)

same => s-Answer,1,NoOp(Call is answered)
same => s-BUSY,1,Hangup()
same => s-NOANSWER,1,Hangup()
same => s-CONGESTION,1,Congestion()

However, ${DIALSTAUS} always holds the value of CHANUNAVIAL, even the call is answered or rejected.

Please help me.

Thanks in advance.

Please provide the full log at verbosity 3 or higher. Please do not use an image; use the actual text. You should also issue “pjsip set logger on”.

Your screenshot doesn’t match your text.

The text dialplan will terminate before the Goto if the call really is answered. Extensions are case sensitive, so s-Answer won’t work, even if you had used g on Dial. The screenshot one does not look at DIALSTATUS.

Oh, Sorry.

I made a mistake in uploading the screenshot.

Sorry. So you mean set the ‘pjsip set logger on’, I can see the DIALSTATUS?

No. That is to help us understand why you think the call has been answered when Asterisk thinks it has not.

For those cases where Asterisk does think it has been answered, you would need to add the g option to Dial and change “Answer” to “ANSWER”, for the answered case in your code to be executed. However, you should not be getting CHANUNAVAIL on your answered cases, and the logging is an attempt to find out why that is happening. None of your code after Dial should be being executed if the call is answered.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.