In Dial-plan how to detect SIP response 4xx/5xx/6xx

Taking that literally, although I think it is really a case of overspecifying, translating the ISDN code will not help, as I think the same ISDN codes is likely to be used for callee not registered, or callee failed qualify, as for an actual rejection from the callee.

Also, do you really want to treat an initial response timeout as a successful call?

It seems to me that you most likely only need to look at DIALSTATUS, and, if the callee not picking up is also a valid reason to cancel the conference, you just need to see whether Dial returns. (I don’t see why an explicit rejection by the callee is likely to need to be treated differently from the callee rejecting by simply not answering.)

Your [456]?? requirement is basically saying, if the call succeeds enough to get any response from the callee, but is otherwise rejected by the called system, you want the conference abandoned. It seems to me that what you more likely want, that it be abandoned if the all fails for any reason at all.

To literally implement your requirement, you must forget the ISDN cause code, and use the mechanisms mentioned by Joshua for obtaining the actual SIP cause code that was received. However, even then, I have suspicion that ta failure to obtain an initial response is faked locally as a 408, even though, by definition, no code was received.

Please ask the specifier what condition they really want to detect, rather than their proposed method of detecting that condition.

same => n,Verbose(2,Hangup cause SIP MESSAGE: ${HANGUPCAUSE(${CHANNEL},tech)})

I am able to get SIP Error code using above line in dial-plan.

1 Like

I still think you should go back to your specifier, as I strongly suspect they really want device not registered to be treated the same as a [456]?? status code, but I don’t think that Asterisk fakes a SIP code for that case.

Device not Registered means it is UNRECHABLE ,right ?

For this I have different requirement ,where caller starts conference and sends SIP INVITE to callee to join conference . Now callee is UNREACHABLE so terminate the conference.

And I just checked for this scenario , I am not getting any hangupcause code as handler is not created in call files

the logic is completely wrong, why not just call everyone, then count the number of participants, if less than the required number then terminate the conference, or maybe retry some of the missing members.

I’ve just realised this is really part of In Dial-plan how to detect SIP response 4xx/5xx/6xx and needs merging with it.

You can retrieve that at h exten.

Use this:

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