I want to detect 4xx/5xx/6xx SIP response error and want to trigger context in dial-plan. How it is possible ?
I think you can’t get the SIP code responses in the dialplan, you have to use the DIALSTATUS variable.
See if this answers your question: How to check the result of the Dial application
Hangup cause allows inspection of protocol specific information.
Yes, I looked at Hangup cause and It seems it will do what I want.
But in my case, I am using call files to add end-point into a conference.
How I can create a hangup cause handler for the end-point before end-point ANSWER?
CALL FILE AS BELOW
Here , I want to create hangup cause handler for SIP/1332 , But I could not create it untill it ANSWER
Make the A side a local channel.
Hi David , I am new to asterisks. Can you post any example or link? It will help me.
If you are referring to adding a hangup handler then you can use the variables functionality in call files to set one.
Do you mean that by setting an appropriate variable in call files, It is possible to create a handler ?
Can you tell me which channel variable require to set?
You can use dialplan functions alongside variables in call files. The wiki page I’ve linked includes example usage in the dialplan, but it can also be used in call files.
I added the below lines to call files and now it is working.
Getting code 21 for call rejection
– Executing [s@hangcausehandler:2] Verbose(“SIP/9003-00000003”, “2, #####hangup cause: 21”) in new stack
== #####hangup cause: 21
– Executing [s@hangcausehandler:3] Verbose(“SIP/9003-00000003”, “2, #####hangup cause: SIP/9003-00000003”) in new stack
== #####hangup cause: SIP/9003-00000003
No, I’m telling you that, by using a local channel, you can run dialplan which can do what you want.
You can use the failed function in dialplan, if any call failed due to any cause code it will go in failed context.
Is there any function available in dial-plan for converting ISDN hangup cause code to SIP equivalent ?
Hard-coded mapping is required to implement in dial-plan ?
Any link to an example is welcome!
This isn’t core functionality, it’s up to the SIP channel drivers to do it, and they do not provide a dialplan function for such a conversion.
To further clarify, Asterisk uses ISDN cause codes internally and these are translated to SIP codes, automatically, when sending a a SIP response. The reverse happens when Asterisk receives a SIP response code.
In Dialplan, How can I receive equivalent SIP codes? I am able to received ISDN cause code properly.
I gave you a link to the wiki for such functionality in your other thread. It allows protocol specific, such as SIP response code, access.
What problem are you trying to solve?
Asterisk can provide the actual SIP codes, but there is no capability to return to the dialplan user what would be used if the current technology, at the time the channel was actually hung up, was SIP or PJSIP. (although possibly not common, the A side of a call can be redirected from SIP to, say, DAHDI, and vice versa, so the technology at the time of hang up may not be that when the dialplan looks at the ISDN cause code).
All translations are lossy and I don’t think sip2cause(cause2sip(x)) is always a 1:1 mapping.
I have to terminate conference when there is 4xx/5xx/6xx SIP error from callee while SIP INVITE sent to callee to join conference.