PJSIP not passing correct SIP code to endpoint


#1

I have an asterisk 15.5 with PJSIP configured with two endpoints: 1 sip trunk and 1 sip extension. When placing a call from extension through that trunk, and destination number is not in service, from the trunk I receive a 404 but PJSIP reply to my extension with a 503, that is not precise as much as I need.

00017 1544111045 * <== #.#.5.12:5060          SIP/2.0 404 Not Found
00018 1544111045 * ==> #.#.5.12:5060          ACK sip:092532145@#.#.5.12:5060 SIP/2.0
00019 1544111045 * ==> 192.168.1.243:65104      SIP/2.0 503 Service Unavailable

Is there any documented/undocumented settings I can configure to refer to the extension the exact failure code?


#2

There is no configuration, but the Hangup application accepts a cause code[1] and there are methods to query the cause codes of the outgoing side. As for why it didn’t forward the 404, it’s because to the calling party the extension was found in Asterisk.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Hangup


#3

Behind that extension there is a webrtc client that needs to know the 404 failure code. How can I get that? You talked about methods to query cause codes? How?


#4

There are dialplan functions[1] to inspect and the wiki contains a mapping[2].

[1] https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause
[2] https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause+Mappings


#5

You are incredible! Thank you very much! You saved my day. Wish I had a better way to thank you