kamailio Version: 5.2.5
kamailio.cfg extract:
route[NATMANAGE] {
...
if (is_request()) {
if (nat_uac_test(8) && has_body("application/sdp"))
fix_nated_sdp("11");
}
...
}
Unsuccessful scenario:
Incoming:
INVITE sip:49421xxxxxxx@xxxxx.de SIP/2.0
Via: SIP/2.0/UDP 78.180.39.169:53619;branch=z9hG4bK-524287-1---6460f3501b47ce09;rport
Max-Forwards: 70
Contact: <sip:np-1@78.180.39.169:53619;rinstance=2b4ff15577cdf3c9>
To: <sip:49421xxxxxxx@xxxxx.de>
From: <sip:np-1@xxxxx.de>;tag=cb17d83f
Call-ID: 100934MDI2ZjE3ZjdkMjVhOTdjOGI5YzBiMWY5MDY4OWYzZmU
CSeq: 2 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, MESSAGE
Content-Type: application/sdp
Proxy-Authorization: Digest username="np-1",realm="xxxxx.de",nonce="Xcu+S13LvR+Mu2XQ1bXzGTiNmuWOtFzf",uri="sip:49421xxxxxxx@xxxxx.de",response="6db6671596b0190e1485fa75a2db26c2",algorithm=MD5
Supported: replaces
User-Agent: Bria 5 release 5.7.1 stamp 100934
Content-Length: 355
v=0
o=- 13218106911457132 1 IN IP4 192.168.1.41
s=Bria 5 release 5.7.1 stamp 100934
c=IN IP4 192.168.1.41
t=0 0
m=audio 56070 RTP/AVP 9 8 18 120 0 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
(Note the three spaces between "Content-Header:" and "355".)
Outgoing:
INVITE sip:49421xxxxxxx@xxxxx.de SIP/2.0
Record-Route: <sip:3.124.64.17;lr=on;ftag=cb17d83f>
Via: SIP/2.0/UDP 3.124.64.17:5060;branch=z9hG4bKa863.1d6bac8d934a03a72929c7477020cb20.0
Via: SIP/2.0/UDP 78.180.39.169:53619;received=78.180.39.169;branch=z9hG4bK-524287-1---6460f3501b47ce09;rport=53619
Max-Forwards: 69
Contact: <sip:np-1@78.180.39.169:53619;rinstance=2b4ff15577cdf3c9>
To: <sip:49421xxxxxxx@xxxxx.de>
From: <sip:np-1@xxxxx.de>;tag=cb17d83f
Call-ID: 100934MDI2ZjE3ZjdkMjVhOTdjOGI5YzBiMWY5MDY4OWYzZmU
CSeq: 2 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: Bria 5 release 5.7.1 stamp 100934
Content-Length: 355
P-hint: REGISTERED
v=0
o=- 13218106911457132 1 IN IP4 192.168.1.41
s=Bria 5 release 5.7.1 stamp 100934
c=IN IP4 192.168.1.41
t=0 0
m=audio 56070 RTP/AVP 9 8 18 120 0 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
(Note that the private IP addresses in o and c were not rewritten.)
Successful scenario:
Incoming:
INVITE sip:0177xxxxxxx@xxxxx.de SIP/2.0
Via: SIP/2.0/UDP 192.168.178.21:53472;branch=z9hG4bK-524287-1---aa3d730dd8fb1114;rport
Max-Forwards: 70
Contact: <sip:xxxxx@46.128.2.109:53472;rinstance=da291090bfcf6825>
To: <sip:0177xxxxxxx@xxxxx.de>
From: <sip:xxxxx@xxxxx.de>;tag=8b94f119
Call-ID: 101912YjE2MDRlODlhMDRhZWQ4ZjE5NzljODNmYzQ1ZTNkZDc
CSeq: 2 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO
Content-Type: application/sdp
Proxy-Authorization: Digest username="xxxxx",realm="xxxxx.de",nonce="XcvQ0V3Lz6V6gZKneV+DjJrYoZ5gK2Rg",uri="sip:0177xxxxxxx@xxxxx.de",response="8293b233e5eb39a1cd3607007c85f822",algorithm=MD5
Supported: replaces
User-xxxxx: Bria release 6.0.0 stamp 101912
Content-Length: 357
v=0
o=- 13218111652540334 1 IN IP4 192.168.178.21
s=Bria release 6.0.0 stamp 101912
c=IN IP4 192.168.178.21
t=0 0
m=audio 53526 RTP/AVP 120 9 18 0 8 101
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
Outgoing:
INVITE sip:0177xxxxxxx@xxxxx.de SIP/2.0
Record-Route: <sip:3.124.64.17;lr=on;ftag=8b94f119;nat=yes>
Via: SIP/2.0/UDP 3.124.64.17:5060;branch=z9hG4bKbc27.3f0bdae2f851ce55b090ac7bec3922bf.0
Via: SIP/2.0/UDP 192.168.178.21:53472;received=46.128.2.109;branch=z9hG4bK-524287-1---aa3d730dd8fb1114;rport=53472
Max-Forwards: 69
Contact: <sip:xxxxx@46.128.2.109:53472;rinstance=da291090bfcf6825;alias=46.128.2.109~53472~1>
To: <sip:0177xxxxxxx@xxxxx.de>
From: <sip:xxxxx@xxxxx.de>;tag=8b94f119
Call-ID: 101912YjE2MDRlODlhMDRhZWQ4ZjE5NzljODNmYzQ1ZTNkZDc
CSeq: 2 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO
Content-Type: application/sdp
Supported: replaces
User-xxxxx: Bria release 6.0.0 stamp 101912
Content-Length: 431
P-hint: REGISTERED
v=0
o=- 13218111652540334 1 IN IP4 46.128.2.109
s=Bria release 6.0.0 stamp 101912
c=IN IP4 46.128.2.109
t=0 0
m=audio 53526 RTP/AVP 120 9 18 0 8 101
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=direction:active
a=oldmediaip:192.168.178.21
a=oldmediaip:192.168.178.21
(Note that the private IP address 192.168.178.21 has been successfully replaced with 46.128.2.109 in o and c.)
So I assume that either the nat_uac_test and/or the has_body and/or the fix_nated_sdp method gets confused with the excessive whitespace characters in the Content-Length header.
The excessive whitespace is probably not caused by the Bria SIP client, but by a home router ZTE ZXHN H298A.
According to RFC 3261, section 7.3.1, more than one space after the colon is allowed, but not recommended. So kamailio should be able to handle it.
The following workaround solves the issue:
if(search("Content-Length: ")) {
xlog("Removing whitespace from Content-Length header\n");
subst('/^Content-Length:\s*(\d*)/Content-Length: \1/i');
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.