Hi,
We have a scenario like this:
ITSP -----> Kamailio -----> Endpoint (UDP) (TLS)
So, TLS is only being used on the last hop, and the upstream interaction with the ITSP is plain-old UDP.
Kamailio has the following listeners:
listen=udp:1.1.1.1:5060 listen=udp:1.1.1.2:5060 listen=tcp:10.0.0.1:5060 listen=tls:1.1.1.1:5061
At some point, 'Endpoint' sends a reinvite which has the following RURI:
INVITE sip:1.1.1.1:5061 SIP/2.0
This is clearly improper, and caused a loop that led to the rtpengine SDP loop issue I previously reported in another thread.
So, in an effort to stop this, I added the following:
if(has_totag()) { if(loose_route()) { ...
if(is_method("INVITE")) { xlog("L_INFO", "[R-MAIN:$ci] Re-INVITE received from $si:$sp to RURI $ru\n"); xlog("L_INFO", "[R-MAIN:$ci] Reinvite body: $mb\n");
if(!is_method("ACK") && uri == myself) { sl_send_reply("400", "Bad Request"); exit; } } }
But it doesn't work. It appears that the '400 Bad Request' rejection never happens, presumably because the this domain doesn't match 'myself'.
Another perplexing mystery: the log message containing the reinvite's '$ru' does not show a RURI of 'sip:1.1.1.1:5061', but rather the remote target in the initial inbound INVITE, which we also logged:
Contact: "Anonymous" sip:Restricted@3.3.3.3:5060
The log message says:
[R-MAIN:...] Re-INVITE received from 4.4.4.4:5060 to RURI sip:Restricted@3.3.3.3:5060;lr.
Note a subtle detail here: the ';lr' parameter is present, which is an attribute of the Record-Route inserted by the sending ITSP (3.3.3.3). It's at the bottom of the Route set, of course, below Kamailio's two RRs (inserted for the ingress UDP interface and the egress TLS interface):
Route: sip:Restricted@3.3.3.3:5060;lr
This leads to two questions whose causes seem to be related:
1. Why does Kamailio think the request URI of this re-invite is something other than what $mb reveals it to be?
2. Is that, presumably, why it does not match 'myself'?
3. Why would Kamailio think it is actually set to the far-end Record-Route URI?
This is version: kamailio 4.4.5 (x86_64/linux) d48094.
Thanks,
-- Alex