Not sure if it's a default Kamailio behavior or something I'm doing wrong...
When receiving a negative reply for an INVITE (more like in the 5xx range), proxy doesn't relay the message to the originator but instead issues it's own "500 Service Unavailable".
That doesn't happen, from observations so far, to "603 Declined" or "486 Busy Here" or "404 Not Found" or "200 OK" replies.
For example, here's the negative reply proxy receives from the callee:
2018/05/14 10:52:37.716627 65.XX.XX.166:5060 -> 65.XX.XX.167:5060
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP 65.xx.xx.167;branch=z9hG4bK9223.00b4f3143d245a895c4bb6a107add258.0;received=65.xx.xx.167;rport=5060
Via: SIP/2.0/UDP 205.xx.xx.221;received=205.xx.xx.221;rport=5060;branch=z9hG4bKQ4XpXga0vgZ8B
From: "514XXXXXXX" <sip:
514XXXXXXX
@205.xx.xx.221>;tag=tXj0NHrje9jNS
To: <sip:450XXXXXXX@65.xx.xx.167>;tag=as18e452b7
Call-ID: 48eac296-d229-1236-a685-005056a149a4
CSeq: 122818714 INVITE
Server: Asterisk
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
X-Asterisk-HangupCause: Subscriber absent
X-Asterisk-HangupCauseCode: 20
Content-Length: 0
Here's what the originator gets in the final message:
2018/05/14 10:52:37.718143 65.xx.xx.167:5060 -> 205.xx.xx.221:5060
SIP/2.0 500 Service Unavailable
Via: SIP/2.0/UDP 205.xx.xx.221;rport=5060;branch=z9hG4bKQ4XpXga0vgZ8B;received=205.xx.xx.221
From: "514XXXXXXX" <sip:514XXXXXXX@205.xx.xx.221>;tag=tXj0NHrje9jNS
To: <sip:450XXXXXXX@65.xx.xx.167>;tag=31a2c69b5d434ef4a60796e26f568bf0-9343
Call-ID: 48eac296-d229-1236-a685-005056a149a4
CSeq: 122818714 INVITE
Server: Kamailio 5.1
Content-Length: 0
I'd like any reply to be relayed back as is, unless I do some t_check_status() => t_reply() for specific reasons (which I have none at this point).
Thanks
Sergiu