Hi,
I'm having a problem with routing of BYEs in my multi homed
Kamailio.
My setup is a phone on 172.16.230.1, talking to Kamailio on
172.16.230.128.
On the "outside" Kamailio uses 10.64.5.16 and its talking to
41.221.230.60
I'm using the stock Kamailio 4.0.3 kamailio.cfg, with:
WITH_NAT defined
mhomed=1
Little change in NATMANAGE to do the rtpproxy_manage with
ie or ei as appropriate, coming from my previous post and the
response from Alex.
Here's the invite from the phone:
Via: SIP/2.0/UDP
172.16.230.1:3694;branch=z9hG4bK-d8754z-6a91626ae4c3f625-1---d8754z-;rport.
Call-ID: ZDQ4YThjNzEzOTBhOTE5NGViNTFhM2Q5MTY2ZmY1ZDc.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
NOTIFY, MESSAGE, SUBSCRIBE, INFO.
Content-Type: application/sdp.
Proxy-Authorization: ...some stuff...
User-Agent: Bria 3 release 3.5.3 stamp 70600.
o=- 1377005946728952 1 IN IP4 172.16.230.1.
s=Bria 3 release 3.5.3 stamp 70600.
m=audio 52448 RTP/AVP 8 18 101.
a=rtpmap:101 telephone-event/8000.
Kamailio forwards with double-Record-Route with both of its
addresses. I believe this is per SIP OUTBOUND RFC:
Via: SIP/2.0/UDP
10.64.5.16;branch=z9hG4bKe355.e526ca52.0.
Via: SIP/2.0/UDP
172.16.230.1:3694;branch=z9hG4bK-d8754z-6a91626ae4c3f625-1---d8754z-;rport=3694.
Call-ID: ZDQ4YThjNzEzOTBhOTE5NGViNTFhM2Q5MTY2ZmY1ZDc.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
NOTIFY, MESSAGE, SUBSCRIBE, INFO.
Content-Type: application/sdp.
Proxy-Authorization: ...some stuff...
User-Agent: Bria 3 release 3.5.3 stamp 70600.
o=- 1377005946728952 1 IN IP4 10.64.5.16.
s=Bria 3 release 3.5.3 stamp 70600.
m=audio 59194 RTP/AVP 8 18 101.
a=rtpmap:101 telephone-event/8000.
So that behaviour seems OK. The call does get correctly
established and rtpproxy is correctly setup and audio passes
in both directions.
But when the BYE is sent (from the outside), though, things
go wrong:
Here's what arrives from upstream. Route: has the two
entries per the RR that was sent.
Via: SIP/2.0/UDP
41.221.230.60;branch=z9hG4bKbd37.4108b6b2.0.
Via: SIP/2.0/UDP
41.221.230.60:5070;received=41.221.230.60;branch=z9hG4bK4e6b38bf;rport=5070.
Call-ID: ZDQ4YThjNzEzOTBhOTE5NGViNTFhM2Q5MTY2ZmY1ZDc.
X-Asterisk-HangupCause: Normal Clearing.
X-Asterisk-HangupCauseCode: 16.
So Kamailio peels off the first route and then sends the BYE
actually to itself. With an oddly formed blank Route: header.
Tracing through the kamailio.cfg the BYE is processed in
WITHINDLG - loose_route() succeeds
It logs that 172.16.230.128 "is loose router".
Via: SIP/2.0/UDP
10.64.5.16;branch=z9hG4bKbd37.25d16bf3.0.
Via: SIP/2.0/UDP
41.221.230.60;rport=5060;branch=z9hG4bKbd37.4108b6b2.0.
Via: SIP/2.0/UDP
41.221.230.60:5070;received=41.221.230.60;branch=z9hG4bK4e6b38bf;rport=5070.
Call-ID: ZDQ4YThjNzEzOTBhOTE5NGViNTFhM2Q5MTY2ZmY1ZDc.
X-Asterisk-HangupCause: Normal Clearing.
X-Asterisk-HangupCauseCode: 16.
When Kamailio receives the BYE from itself it sends a 404
Not here. Which is forwarded back upstream. This 404 Not
here is generated in WITHINDLG too; looks like loose_route()
fails (which makes sense since there is nothing in the Route
header), and in that case WINTHINDLG only has code for
dealing with SUBSCRIBE and ACK.
Via: SIP/2.0/UDP
10.64.5.16;branch=z9hG4bKbd37.25d16bf3.0;rport=5060.
Via: SIP/2.0/UDP
41.221.230.60;rport=5060;branch=z9hG4bKbd37.4108b6b2.0.
Via: SIP/2.0/UDP
41.221.230.60:5070;received=41.221.230.60;branch=z9hG4bK4e6b38bf;rport=5070.
Call-ID: ZDQ4YThjNzEzOTBhOTE5NGViNTFhM2Q5MTY2ZmY1ZDc.
Server: kamailio (4.0.3 (i386/linux)).
Via: SIP/2.0/UDP
41.221.230.60;rport=5060;branch=z9hG4bKbd37.4108b6b2.0.
Via: SIP/2.0/UDP
41.221.230.60:5070;received=41.221.230.60;branch=z9hG4bK4e6b38bf;rport=5070.
Call-ID: ZDQ4YThjNzEzOTBhOTE5NGViNTFhM2Q5MTY2ZmY1ZDc.
Server: kamailio (4.0.3 (i386/linux)).
I tried with enable_double_rr as 0 and that did send only
one Record-Route with the relayed INVITE, but the record
route uses the inside address of the proxy and so we never
even receive the BYE from the upstream system in that case.
I'm kinda lost about where this is going wrong - so
pointers would be welcome!
Thanks,
Steve