Following situation
Inbound call to customer
voip carrier => opensips => asterisk => class5 System => pbx
the pbx generates an 603 error that needs to be sent back to opensips/voip carrier.
But the asterisk in between changes the 603 to a 403 error.
voip carrier <= (403) opensips <= (403) asterisk <= (603) class5 System <= (603) pbx
opensips uses just the extension.conf and the sip.conf with a call comming from peer opensips through the dialplan to an other peer (class5).
Is there a way to give back the “original” error code coming from class5/pbx side to the opensips/voice carrier side without translation/mapping inside the asterisk?
No, internally things are communicated as ISDN cause codes which are not a perfect mapping. There is no ability to forward the SIP response code itself.
Further to Joshua’s answer, there is no cause code that maps to 603 in either the relevant RFC (RFC 3398), or in at least the chan_sip implementation of the the cause code mapping (I don’t know which part of chan_pjsip to look in for this), so I don’t think there is any way of forcing Asterisk to return 603. chan_sip seems to correctly follow the RFC, in this case, for a back to back conversion from SIP to ISDN and ISDN to SIP.
Asterisk converts 603 to ISDN code 21 and ISDN code 21 to 403.