[Users] Why is fix_nated_sdp appending 127.0.0.1 at the end of my c= lines?

nick nick at mobilia.it
Tue Nov 21 12:28:23 CET 2006


Everything seems fine, the SIP messages go tot he right place, the NAT 
tests are finding everything as they should.. and in the o= row, they're 
being replaced (more as a test, I don't think it's completely 
neccessary) without an issue. However, in the c= line, it adds the IP 
I've specified (for some reason, if I leave it blank it only puts 
127.0.0.1; or a mashup of the public address and localhost (as 
mediaproxy runs on the same machine for the moment).

here are the two sections of code I've added.. these are the only places 
I call fix_nated_sdp()



if (method=="INVITE") {
        if (nat_uac_test("8")) {
               fix_nated_sdp("10","89.xxx.xxx.16");
        };
         t_on_failure("1");
     } else if (method == "BYE" || method == "CANCEL") {
         end_media_session();
     };




onreply_route[1] {
     if (status=~"(183)|(2[0-9][0-9])") {
     if (client_nat_test("1")) {
           fix_contact();
       };
     if (nat_uac_test("8")) {
	fix_nated_sdp("10","89.xxx.xxx.16");
       };
         use_media_proxy();
     };
}

I'm using openser 1.1.0 notls, on a dual opteron server running CentOS 4.3

here is a trace of the code in action.. (names changed.. because I enjoy 
search and replace)



U 89.xxx.xxx.8:30626 -> 89.xxx.xxx.16:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 89.xxx.xxx.16;branch=z9hG4bK674e.0d2a4f64.0.
Via: SIP/2.0/UDP 
192.168.20.16:38000;received=87.xxx.xxx.99;branch=z9hG4bK-d87543-b3783334b231975b-1--d87543-;rport=38000.
Record-Route: <sip:89.xxx.xxx.16;lr;ftag=5c63711f>.
Contact: <sip:nick at 89.xxx.xxx.8:30626;rinstance=f0677dc7f7d4d2f0>.
To: "Joe Blow"<sip:joe at blow.com>;tag=ee11f527.
From: "Tom"<sip:tom at blow.com>;tag=5c63711f.
Call-ID: NTFjYmM5Y2JhNWE5MzU2NzQ1NTMxYTg2NGQ3ZDYzNmM..
CSeq: 1 INVITE.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, 
SUBSCRIBE, INFO.
Content-Type: application/sdp.
User-Agent: X-Lite release 1006e stamp 34025.
Content-Length: 237.
.
v=0.
o=- 1 2 IN IP4 192.168.1.67.
s=CounterPath X-Lite 3.0.
c=IN IP4 192.168.1.67.
t=0 0.
m=audio 31556 RTP/AVP 0 8 3 101.
a=alt:1 1 : 0W8e8Rrk y9fAinpH 192.168.1.67 31556.
a=fmtp:101 0-15.
a=rtpmap:101 telephone-event/8000.
a=sendrecv.

#
U 89.xxx.xxx.16:5060 -> 87.xxx.xxx.99:38000
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 
192.168.20.16:38000;received=87.xxx.xxx.99;branch=z9hG4bK-d87543-b3783334b231975b-1--d87543-;rport=38000.
Record-Route: <sip:89.xxx.xxx.16;lr;ftag=5c63711f>.
Contact: <sip:nick at 89.xxx.xxx.8:30626;rinstance=f0677dc7f7d4d2f0>.
To: "Joe Blow"<sip:joe at blow.com>;tag=ee11f527.
From: "Tom"<sip:tom at blow.com>;tag=5c63711f.
Call-ID: NTFjYmM5Y2JhNWE5MzU2NzQ1NTMxYTg2NGQ3ZDYzNmM..
CSeq: 1 INVITE.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, 
SUBSCRIBE, INFO.
Content-Type: application/sdp.
User-Agent: X-Lite release 1006e stamp 34025.
Content-Length: 302.
.
v=0.
o=- 1 2 IN IP4 89.xxx.xxx.16.
s=CounterPath X-Lite 3.0.
c=IN IP4 89.xxx.xxx.16127.0.0.1.
t=0 0.
m=audio 60070 RTP/AVP 0 8 3 101.
a=alt:1 1 : 0W8e8Rrk y9fAinpH 192.168.1.67 31556.
a=fmtp:101 0-15.
a=rtpmap:101 telephone-event/8000.
a=sendrecv.
a=oldmediaip:192.168.1.67.
a=oldmediaip:192.168.1.67.

#
U 87.xxx.xxx.99:38000 -> 89.xxx.xxx.16:5060
ACK sip:nick at 89.xxx.xxx.8:30626;rinstance=f0677dc7f7d4d2f0 SIP/2.0.
Via: SIP/2.0/UDP 
192.168.20.16:38000;branch=z9hG4bK-d87543-7e77316e3b41bd7d-1--d87543-;rport.
Max-Forwards: 70.
Route: <sip:89.xxx.xxx.16;lr;ftag=5c63711f>.
Contact: <sip:thomas at 87.xxx.xxx.99:38000>.
To: "Joe Blow"<sip:joe at blow.com>;tag=ee11f527.
From: "Tom"<sip:tom at blow.com>;tag=5c63711f.
Call-ID: NTFjYmM5Y2JhNWE5MzU2NzQ1NTMxYTg2NGQ3ZDYzNmM..
CSeq: 1 ACK.
User-Agent: X-Lite release 1006e stamp 34025.
Content-Length: 0.
.

#
U 89.xxx.xxx.16:5060 -> 89.xxx.xxx.8:30626
ACK sip:nick at 89.xxx.xxx.8:30626;rinstance=f0677dc7f7d4d2f0 SIP/2.0.
Record-Route: <sip:89.xxx.xxx.16;lr=on;ftag=5c63711f>.
Via: SIP/2.0/UDP 89.xxx.xxx.16;branch=z9hG4bK674e.0d2a4f64.2.
Via: SIP/2.0/UDP 
192.168.20.16:38000;received=87.xxx.xxx.99;branch=z9hG4bK-d87543-7e77316e3b41bd7d-1--d87543-;rport=38000.
Max-Forwards: 69.
Contact: <sip:thomas at 87.xxx.xxx.99:38000>.
To: "Joe Blow"<sip:joe at blow.com>;tag=ee11f527.
From: "Tom"<sip:tom at blow.com>;tag=5c63711f.
Call-ID: NTFjYmM5Y2JhNWE5MzU2NzQ1NTMxYTg2NGQ3ZDYzNmM..
CSeq: 1 ACK.
User-Agent: X-Lite release 1006e stamp 34025.
Content-Length: 0.
P-hint: rr-enforced.
.



As you can see, the code is appending 127.0.0.1 for no good reason (at 
least that I can tell)

Any ideas (bug fixes, or tricks...)?

Nick




More information about the Users mailing list