Hi List,

im facing an issue that my kamailio proxy did not replace the ip address in the invite and 200OK sdp body.

my rtpproxy is running: rtpproxy -l 192.168.1.3 -u:*:7722 -u user

my kamailio is listening on 192.168.1.3, also define: advertised_address="175.136.223.112"; & advertised_port=5060;

and my asterisk is on 192.168.1.23.

sip signalling and rtp port forwarded to kamailio.

uacs from another nat register successfully.

if i put 2 lines of force_rtp_proxy("fcow","175.136.223.112");

i will get double ip addr in c and o but kamailio ignore my ip addr. example i will get 

c=IN IP4 192.168.1.3192.168.1.3

here is part of my simple script.

hope you can help.

thank you very much.

---------------cfg-------------------

route[RTPPROXY] {
#!ifdef WITH_NAT
if (is_method("BYE")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
force_rtp_proxy("fcow","175.136.223.112");
#force_rtp_proxy("fcow","175.136.223.112");
xlog("L_INFO","offer");
}
if (!has_totag()) add_rr_param(";nat=yes");
#!endif
return;
}

--------------------------------------

and here is the wireshark for uac INVITE and OK.

-----------INVITE-----------------

ve0
EE;p9INVITE sip:102@192.168.2.132:5062 SIP/2.0
Record-Route: <sip:192.168.1.3;lr=on;ftag=as032358a3;nat=yes>
Via: SIP/2.0/UDP 192.168.1.3;branch=z9hG4bK09d5.c5e9e8d2.0
Via: SIP/2.0/UDP 192.168.1.23:5080;branch=z9hG4bK71c27189;rport=5080
Max-Forwards: 69
From: "101" <sip:102@aextddns.dyndns.info>;tag=as032358a3
To: <sip:102@192.168.1.3:5060>
Contact: <sip:102@192.168.1.23:5080>
Call-ID: 416f6e09674ae9671bb7144a1cb11137@aextddns.dyndns.info
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.18
Date: Tue, 05 Jul 2011 07:20:53 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 327

v=0
o=root 1639709788 1639709788 IN IP4 192.168.1.3
s=Asterisk PBX 1.6.2.18
c=IN IP4 192.168.1.3
t=0 0
m=audio 10072 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
a=nortpproxy:yes

-----------200OK---------------

e90
ElE;pX4tSIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.200:5062;rport=2788;received=175.138.21.31;branch=z9hG4bK2086380416
Record-Route: <sip:192.168.1.3;lr=on;ftag=1796959074;nat=yes>
From: "101" <sip:101@aextddns.dyndns.info>;tag=1796959074
To: <sip:102@aextddns.dyndns.info>;tag=as2e4c0125
Call-ID: 1985782590@192.168.2.200
CSeq: 21 INVITE
Server: Asterisk PBX 1.6.2.18
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Contact: <sip:102@192.168.1.23:5080>
Content-Type: application/sdp
Content-Length: 286

v=0
o=root 403900934 403900934 IN IP4 192.168.1.23
s=Asterisk PBX 1.6.2.18
c=IN IP4 192.168.1.23
t=0 0
m=audio 14420 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

------------------------------------

My kamailio log.

-----------LOG------------------

DEBUG: rtpproxy [rtpproxy_funcs.c:148]: type <application/sdp> found valid
DEBUG: rtpproxy [rtpproxy.c:2188]: proxy reply: 10070 192.168.1.3
INFO: <script>: offer

-------------------------------------

double force_rtp_proxy

--------kamailio -> asterisk [INVITE]---------

Pyi-}E7V@:#pINVITE sip:102@aextddns.dyndns.info SIP/2.0
Record-Route: <sip:192.168.1.3;lr=on;ftag=640933430;nat=yes>
Via: SIP/2.0/UDP 192.168.1.3;branch=z9hG4bK89a5.53e9f766.0
Via: SIP/2.0/UDP 192.168.2.200:5062;rport=2788;received=175.138.21.31;branch=z9hG4bK1673765648
From: "101" <sip:101@aextddns.dyndns.info>;tag=640933430
To: <sip:102@aextddns.dyndns.info>
Call-ID: 1909950509@192.168.2.200
CSeq: 21 INVITE
Contact: <sip:101@175.138.21.31:2788>
Content-Type: application/sdp
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 69
User-Agent: T20 9.41.0.80
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 334

v=0
o=20073 20073 IN IP4 192.168.1.3192.168.1.3
s=SDP data
c=IN IP4 192.168.1.3192.168.1.3
t=0 0
m=audio 1006410064 RTP/AVP 0 8 18 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:9 G722/8000
a=fmtp:101 0-15
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=nortpproxy:yes
a=nortpproxy:yes

-----------LOG------------------

DEBUG: rtpproxy [rtpproxy_funcs.c:148]: type <application/sdp> found valid
DEBUG: rtpproxy [rtpproxy.c:2188]: proxy reply: 10068 192.168.1.3
DEBUG: rtpproxy [rtpproxy_funcs.c:148]: type <application/sdp> found valid
DEBUG: rtpproxy [rtpproxy.c:2188]: proxy reply: 10068 192.168.1.3
INFO: <script>: offer

-----------LOG------------------


-- 
Regards,

MingHon