<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:o = "urn:schemas-microsoft-com:office:office"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2604" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Vivienne,</DIV>
<DIV>&nbsp;</DIV>
<DIV>This is the first INVITE going from SER to your public phone.&nbsp; I have 
prefixed my comments with *==&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>U 84.203.148.146:5060 -&gt; 157.190.74.151:5060</DIV>
<DIV>&nbsp;INVITE sip:2092@157.190.74.151 SIP/2.0..Via: SIP/2.0/UDP 
84.203.148.146;branch=z9hG4bK77bc.b54ca216.0..</DIV>
<DIV>Via: SIP/2.0/UDP 
172.16.3.31;rport=5060;received=84.203.148.14;branch=z9hG4bK1a48edc121f5bc1f..</DIV>
<DIV>From: "2093" &lt;sip:2093@84.203.148.146&gt;;tag=2dc376dcd4655094..</DIV>
<DIV>To: &lt;sip:2092@84.203.148.146&gt;..</DIV>
<DIV>Contact: &lt;sip:2093@84.203.148.14:5060&gt;..</DIV>
<DIV>*==&gt; Correctly changed to the public address and port of 2093</DIV>
<DIV>Supported: replaces..Call-ID: 44e1ae63c476fbf<A 
href="mailto:44e1ae63c476fbff@172.16.3.31..CSeq">f@172.16.3.31..CSeq</A>: 10327 
INVITE..</DIV>
<DIV>User-Agent: Grandstream BT100 1.0.5.18..</DIV>
<DIV>Max-Forwards: 69..Allow: 
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..</DIV>
<DIV>Content-Type: application/sdp..</DIV>
<DIV>Content-Length: 443....v=0..</DIV>
<DIV>o=2093&nbsp;8000 0 IN IP4 172.16.3.31..</DIV>
<DIV>s=SIP Call..</DIV>
<DIV>c=IN IP4 84.203.148.1484.203.148.146..</DIV>
<DIV>*==&gt; Here it seems that first fix_nated_sdp("3") is called (replace 
private IP with public IP), then force_rtp_proxy() (replace with proxy 
IP).&nbsp; You must only call one of them (fix_nated_sdp("1") is ok)</DIV>
<DIV>t=0 0..</DIV>
<DIV>m=audio 35006 RTP/AVP 0 8 4 18 2 15 99 9..</DIV>
<DIV>a=sendrecv..</DIV>
<DIV>a=rtpmap:0 PCMU/8000/3..</DIV>
<DIV>a=rtpmap:8 PCMA/8000/3..</DIV>
<DIV>a=rtpmap:4 G723/8000/3..a=rtpmap:18 G729/8000/3..</DIV>
<DIV>a=rtpmap:2 G726-32/8000/3..</DIV>
<DIV>a=rtpmap:15 G728/8000/3..</DIV>
<DIV>a=rtpmap:99 iLBC/8000/3..</DIV>
<DIV>a=fmtp:99 mode=20..</DIV>
<DIV>a=rtpmap:9 G722/8000/3..</DIV>
<DIV>a=ptime:20..</DIV>
<DIV>a=direction:active..</DIV>
<DIV>*==&gt; Added by fix_nated_sdp("1") (and "3")</DIV>
<DIV>a=oldmediaip:172.16.3.31..</DIV>
<DIV>
<DIV>*==&gt; Added by fix_nated_sdp("3")</DIV>
<DIV>a=nortpproxy:yes..</DIV></DIV>
<DIV>*==&gt; Added by force_rtp_proxy()</DIV>
<DIV>&nbsp;</DIV>
<DIV>So, your call is proxied. Try using fix_nated_sdp("1"). It should make the 
INVITE correct.&nbsp; You have not posted the OK, so I don't know what is 
happening there.&nbsp; If you have followed the rtpproxy ONsip.org example in 
your onreply_route, you should be fine.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Good luck!</DIV>
<DIV>g-)</DIV>
<DIV>&nbsp;</DIV>
<DIV>---- Original Message ----<BR>From: Vivienne Curran<BR>To: 
serusers@lists.iptel.org<BR>Sent: Tuesday, April 05, 2005 01:23 PM<BR>Subject: 
[Serusers] Contact Header and SDP not rewritten<BR><BR>&gt; Hello,<BR>&gt; 
<BR>&gt; I have a problem whereby when a private client rings a public 
client<BR>&gt; only the public user can hear voice and when the public user 
rings<BR>&gt; the private user, no audio is transmitted. After looking at 
the<BR>&gt; messages I have have determined that the contact header and sdp 
part<BR>&gt; of the invite contains the private address of the natted client. 
This<BR>&gt; would lead me to believe that the registration process is 
incorrect.<BR>&gt; My problem is that I believe my script should handle the 
registration<BR>&gt; process correctly and I suspect that the following code is 
being<BR>&gt; skipped: I tried changing it to nat_uac_test("19") and<BR>&gt; 
fix_nated_sdp("3") but that didnt 
help.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&gt; <BR>&gt; if 
(nat_uac_test("3")){<BR>&gt;&nbsp;&nbsp; if (method == "REGISTER" || ! 
search("^Record-Route:")){<BR>&gt;&nbsp;&nbsp;&nbsp; log("Log: Someone trying to 
register from private IP,rewriting\n");<BR>&gt;&nbsp;&nbsp;&nbsp; 
fix_nated_contact(); #Rewrite contact with source IP<BR>&gt;&nbsp;&nbsp;&nbsp; 
if (method == "INVITE"){<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; fix_nated_sdp("1"); 
#Add direction=active to SDP<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
force_rtp_proxy();<BR>&gt;&nbsp;&nbsp;&nbsp; };<BR>&gt;&nbsp;&nbsp;&nbsp; 
force_rport(); # Add rport parameter to topmost Via<BR>&gt;&nbsp;&nbsp;&nbsp; 
setflag(6); # Mark as Nated<BR>&gt;&nbsp;&nbsp; };<BR>&gt;&nbsp; };<BR>&gt; 
<BR>&gt; I have included the log message below and my ser.cfg as an<BR>&gt; 
attachment. Please let me know where I could be going wrong. <BR>&gt; <BR>&gt; 
Thank you,<BR>&gt; Vivienne.<BR>&gt; <BR>&gt; 2093 (private) ringing 2092 
(public)<BR>&gt; <BR>&gt; U 84.203.148.14:5060 -&gt; 
84.203.148.146:5060<BR>&gt;&nbsp;&nbsp; INVITE sip:2092@84.203.148.146 
SIP/2.0..Via: SIP/2.0/UDP<BR>&gt; 172.16.3.31;branch <BR>&gt;&nbsp;&nbsp; 
=z9hG4bK1a48edc121f5bc1f..From: "2093"<BR>&gt; 
&lt;sip:2093@84.203.148.146&gt;;tag=2dc376 <BR>&gt;&nbsp;&nbsp; dcd4655094..To: 
&lt;sip:2092@84.203.148.146&gt;..Contact:<BR>&gt; &lt;sip:2093@172.16.3.31&gt;. 
<BR>&gt;&nbsp;&nbsp; .Supported: replaces..Call-ID: 
44e1ae63c476fbff@172.16.3.31..CSeq:<BR>&gt; 10327 IN <BR>&gt;&nbsp;&nbsp; 
VITE..User-Agent: Grandstream BT100 1.0.5.18..Max-Forwards:<BR>&gt; 70..Allow: 
INVI <BR>&gt;&nbsp; <BR>&gt; 
TE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE..Content-Type:<BR>&gt; 
applic&nbsp; <BR>&gt;&nbsp;&nbsp; ation/sdp..Content-Length: 362....v=0..o=2093 
8000 0 IN IP4<BR>&gt; 172.16.3.31..s= <BR>&gt;&nbsp;&nbsp; SIP Call..c=IN IP4 
172.16.3.31..t=0 0..m=audio 5004 RTP/AVP 0 8 4<BR>&gt; 18 2 15 9 
<BR>&gt;&nbsp;&nbsp; 9 9..a=sendrecv..a=rtpmap:0 PCMU/8000/3..a=rtpmap:8<BR>&gt; 
PCMA/8000/3..a=rtpmap:4 <BR>&gt;&nbsp;&nbsp;&nbsp; G723/8000/3..a=rtpmap:18 
G729/8000/3..a=rtpmap:2<BR>&gt; G726-32/8000/3..a=rtpmap: <BR>&gt;&nbsp;&nbsp; 
15 G728/8000/3..a=rtpmap:99 iLBC/8000/3..a=fmtp:99<BR>&gt; mode=20..a=rtpmap:9 
G722 <BR>&gt;&nbsp;&nbsp; /8000/3..a=ptime:20..<BR>&gt; <BR>&gt; U 
84.203.148.146:5060 -&gt; 84.203.148.14:5060<BR>&gt;&nbsp;&nbsp; SIP/2.0 100 
trying -- your call is important to us..Via:<BR>&gt; SIP/2.0/UDP 172.16 
<BR>&gt;&nbsp; <BR>&gt; 
.3.31;branch=z9hG4bK1a48edc121f5bc1f;rport=5060;received=84.203.148.14..Fro<BR>&gt;&nbsp;&nbsp; 
m: "2093" &lt;sip:2093@84.203.148.146&gt;;tag=2dc376dcd4655094..To:<BR>&gt; 
&lt;sip:2092@84. <BR>&gt;&nbsp;&nbsp; 203.148.146&gt;..Call-ID: 
44e1ae63c476fbff@172.16.3.31..CSeq: 10327<BR>&gt; INVITE..Se 
<BR>&gt;&nbsp;&nbsp; rver: Sip EXpress router (0.8.14 
(i386/linux))..Content-Length:<BR>&gt; 0..Warning: <BR>&gt;&nbsp;&nbsp;&nbsp; 
392 84.203.148.146:5060 "Noisy feedback tells:&nbsp; pid=4732<BR>&gt; 
req_src_ip=84.203 <BR>&gt;&nbsp;&nbsp; .148.14 req_src_port=5060 
in_uri=sip:2092@84.203.148.146<BR>&gt; out_uri=sip:2092@1 <BR>&gt;&nbsp;&nbsp; 
57.190.74.151 via_cnt==1"....<BR>&gt; <BR>&gt; U 84.203.148.146:5060 -&gt; 
157.190.74.151:5060<BR>&gt;&nbsp;&nbsp; INVITE sip:2092@157.190.74.151 
SIP/2.0..Via: SIP/2.0/UDP<BR>&gt; 84.203.148.146;bra <BR>&gt;&nbsp;&nbsp; 
nch=z9hG4bK77bc.b54ca216.0..Via: SIP/2.0/UDP<BR>&gt; 
172.16.3.31;rport=5060;receive <BR>&gt;&nbsp;&nbsp; 
d=84.203.148.14;branch=z9hG4bK1a48edc121f5bc1f..From: "2093"<BR>&gt; 
&lt;sip:2093@84.2 <BR>&gt;&nbsp;&nbsp; 
03.148.146&gt;;tag=2dc376dcd4655094..To:<BR>&gt; 
&lt;sip:2092@84.203.148.146&gt;..Contact: &lt; <BR>&gt;&nbsp;&nbsp; 
sip:2093@84.203.148.14:5060&gt;..Supported: replaces..Call-ID:<BR>&gt; 
44e1ae63c476fbf <BR>&gt;&nbsp;&nbsp; f@172.16.3.31..CSeq: 10327 
INVITE..User-Agent: Grandstream BT100<BR>&gt; 1.0.5.18.. <BR>&gt;&nbsp;&nbsp; 
Max-Forwards: 69..Allow:<BR>&gt; 
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SU <BR>&gt;&nbsp;&nbsp; 
BSCRIBE..Content-Type: application/sdp..Content-Length:<BR>&gt; 
443....v=0..o=2093 <BR>&gt;&nbsp;&nbsp; 8000 0 IN IP4 172.16.3.31..s=SIP 
Call..c=IN IP4<BR>&gt; 84.203.148.1484.203.148.146 <BR>&gt;&nbsp;&nbsp; ..t=0 
0..m=audio 35006 RTP/AVP 0 8 4 18 2 15 99<BR>&gt; 9..a=sendrecv..a=rtpmap:0 P 
<BR>&gt;&nbsp;&nbsp; CMU/8000/3..a=rtpmap:8 PCMA/8000/3..a=rtpmap:4<BR>&gt; 
G723/8000/3..a=rtpmap:18 G72 <BR>&gt;&nbsp;&nbsp; 9/8000/3..a=rtpmap:2 
G726-32/8000/3..a=rtpmap:15<BR>&gt; G728/8000/3..a=rtpmap:99 i 
<BR>&gt;&nbsp;&nbsp; LBC/8000/3..a=fmtp:99 mode=20..a=rtpmap:9<BR>&gt; 
G722/8000/3..a=ptime:20..a=direct <BR>&gt;&nbsp;&nbsp; 
ion:active..a=oldmediaip:172.16.3.31..a=nortpproxy:yes..<BR>&gt; <BR>&gt; U 
84.203.148.146:5060 -&gt; 157.190.74.150:5060<BR>&gt;&nbsp;&nbsp; INVITE 
sip:2092@157.190.74.150 SIP/2.0..Via: SIP/2.0/UDP<BR>&gt; 84.203.148.146;bra 
<BR>&gt;&nbsp;&nbsp; nch=z9hG4bK77bc.b54ca216.1..Via: SIP/2.0/UDP<BR>&gt; 
172.16.3.31;rport=5060;receive <BR>&gt;&nbsp;&nbsp; 
d=84.203.148.14;branch=z9hG4bK1a48edc121f5bc1f..From: "2093"<BR>&gt; 
&lt;sip:2093@84.2 <BR>&gt;&nbsp;&nbsp; 
03.148.146&gt;;tag=2dc376dcd4655094..To:<BR>&gt; 
&lt;sip:2092@84.203.148.146&gt;..Contact: &lt; <BR>&gt;&nbsp;&nbsp; 
sip:2093@84.203.148.14:5060&gt;..Supported: replaces..Call-ID:<BR>&gt; 
44e1ae63c476fbf <BR>&gt;&nbsp;&nbsp; f@172.16.3.31..CSeq: 10327 
INVITE..User-Agent: Grandstream BT100<BR>&gt; 1.0.5.18.. <BR>&gt;&nbsp;&nbsp; 
Max-Forwards: 69..Allow:<BR>&gt; 
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SU <BR>&gt;&nbsp;&nbsp; 
BSCRIBE..Content-Type: application/sdp..Content-Length:<BR>&gt; 
443....v=0..o=2093 <BR>&gt;&nbsp;&nbsp; 8000 0 IN IP4 172.16.3.31..s=SIP 
Call..c=IN IP4<BR>&gt; 84.203.148.1484.203.148.146 <BR>&gt;&nbsp;&nbsp; ..t=0 
0..m=audio 35006 RTP/AVP 0 8 4 18 2 15 99<BR>&gt; 9..a=sendrecv..a=rtpmap:0 P 
<BR>&gt;&nbsp;&nbsp; CMU/8000/3..a=rtpmap:8 PCMA/8000/3..a=rtpmap:4<BR>&gt; 
G723/8000/3..a=rtpmap:18 G72 <BR>&gt;&nbsp;&nbsp; 9/8000/3..a=rtpmap:2 
G726-32/8000/3..a=rtpmap:15<BR>&gt; G728/8000/3..a=rtpmap:99 i 
<BR>&gt;&nbsp;&nbsp; LBC/8000/3..a=fmtp:99 mode=20..a=rtpmap:9<BR>&gt; 
G722/8000/3..a=ptime:20..a=direct <BR>&gt;&nbsp;&nbsp; 
ion:active..a=oldmediaip:172.16.3.31..a=nortpproxy:yes..<BR>&gt; <BR>&gt; U 
157.190.74.151:5060 -&gt; 84.203.148.146:5060<BR>&gt;&nbsp;&nbsp; SIP/2.0 100 
Trying..Via: SIP/2.0/UDP<BR>&gt; 84.203.148.146;branch=z9hG4bK77bc.b54c 
<BR>&gt;&nbsp;&nbsp; a216.0..Via: SIP/2.0/UDP<BR>&gt; 
172.16.3.31;rport=5060;received=84.203.148.14;bran <BR>&gt;&nbsp;&nbsp; 
ch=z9hG4bK1a48edc121f5bc1f..From: "2093"<BR>&gt; 
&lt;sip:2093@84.203.148.146&gt;;tag=2dc3 <BR>&gt;&nbsp;&nbsp; 76dcd4655094..To: 
&lt;sip:2092@84.203.148.146&gt;..Call-ID:<BR>&gt; 44e1ae63c476fbff@172. 
<BR>&gt;&nbsp;&nbsp; 16.3.31..CSeq: 10327 INVITE..User-Agent: Grandstream 
BT100<BR>&gt; 1.0.5.18..Conten <BR>&gt;&nbsp;&nbsp; t-Length: 0....<BR>&gt; 
<BR>&gt; U 157.190.74.151:5060 -&gt; 84.203.148.146:5060<BR>&gt;&nbsp;&nbsp; 
SIP/2.0 180 Ringing..Via: SIP/2.0/UDP<BR>&gt; 
84.203.148.146;branch=z9hG4bK77bc.b54 <BR>&gt;&nbsp;&nbsp; ca216.0..Via: 
SIP/2.0/UDP<BR>&gt; 172.16.3.31;rport=5060;received=84.203.148.14;bra 
<BR>&gt;&nbsp;&nbsp; nch=z9hG4bK1a48edc121f5bc1f..From: "2093"<BR>&gt; 
&lt;sip:2093@84.203.148.146&gt;;tag=2dc <BR>&gt;&nbsp;&nbsp; 
376dcd4655094..To:<BR>&gt; 
&lt;sip:2092@84.203.148.146&gt;;tag=10bdf2044401a257..Call-ID: 
<BR>&gt;&nbsp;&nbsp;&nbsp; 44e1ae63c476fbff@172.16.3.31..CSeq: 10327 
INVITE..User-Agent:<BR>&gt; Grandstream <BR>&gt;&nbsp;&nbsp; BT100 
1.0.5.18..Content-Length: 0....<BR>&gt; <BR>&gt; Send instant messages to your 
online friends<BR>&gt; http://uk.messenger.yahoo.com <BR>&gt; <BR>&gt; <BR>&gt; 
<BR>&gt; #<BR>&gt; # $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp 
$<BR>&gt; #<BR>&gt; # simple quick-start config script<BR>&gt; #<BR>&gt; 
<BR>&gt; # ----------- global configuration parameters 
------------------------<BR>&gt; <BR>&gt; 
#debug=3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # debug level (cmd 
line: -dddddddddd)<BR>&gt; #fork=yes<BR>&gt; #log_stderror=no # (cmd line: 
-E)<BR>&gt; <BR>&gt; /* Uncomment these lines to enter debugging mode<BR>&gt; 
debug=7<BR>&gt; fork=no<BR>&gt; log_stderror=yes<BR>&gt; */<BR>&gt; <BR>&gt; 
check_via=no # (cmd. line: -v)<BR>&gt; 
dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: 
-r)<BR>&gt; rev_dns=no&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # (cmd. line: -R)<BR>&gt; 
#port=5060<BR>&gt; #children=4<BR>&gt; fifo="/tmp/ser_fifo"<BR>&gt; <BR>&gt; 
alias="157.190.74.152:5060"<BR>&gt; <BR>&gt; # ------------------ module loading 
----------------------------------<BR>&gt; <BR>&gt; # Uncomment this if you want 
to use SQL database<BR>&gt; loadmodule "/usr/lib/ser/modules/mysql.so"<BR>&gt; 
<BR>&gt; loadmodule "/usr/lib/ser/modules/sl.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/tm.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/rr.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/maxfwd.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/usrloc.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/registrar.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/textops.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/nathelper.so"<BR>&gt; #loadmodule 
"/usr/lib/ser/modules/pa.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/cpl-c.so"<BR>&gt; <BR>&gt; # Uncomment this if you want 
digest authentication<BR>&gt; # mysql.so must be loaded !<BR>&gt; loadmodule 
"/usr/lib/ser/modules/auth.so"<BR>&gt; loadmodule 
"/usr/lib/ser/modules/auth_db.so"<BR>&gt; <BR>&gt; # ----------------- setting 
module-specific parameters ---------------<BR>&gt; <BR>&gt; # -- usrloc params 
--<BR>&gt; <BR>&gt; #modparam("usrloc", "db_mode",&nbsp;&nbsp; 0)<BR>&gt; 
<BR>&gt; # Uncomment this if you want to use SQL database<BR>&gt; # for 
persistent storage and comment the previous line<BR>&gt; modparam("usrloc", 
"db_mode", 2)<BR>&gt; <BR>&gt; # -- auth params --<BR>&gt; # Uncomment if you 
are using auth module<BR>&gt; #<BR>&gt; modparam("auth_db", "calculate_ha1", 
yes)<BR>&gt; #<BR>&gt; # If you set "calculate_ha1" parameter to yes (which true 
in this<BR>&gt; config), <BR>&gt; # uncomment also the following 
parameter)<BR>&gt; #<BR>&gt; modparam("auth_db", "password_column", 
"password")<BR>&gt; <BR>&gt; # -- rr params --<BR>&gt; # add value to ;lr param 
to make some broken UAs happy<BR>&gt; #NB Had to up this value from 1 to 11 
because reinvites were<BR>&gt; bombarding called phone <BR>&gt; modparam("rr", 
"enable_full_lr", 11)<BR>&gt; <BR>&gt; #!! Nathelper<BR>&gt; 
modparam("registrar", "nat_flag", 60)<BR>&gt; modparam("nathelper", 
"natping_interval", 30) #Ping interval 30 s<BR>&gt; modparam("nathelper", 
"ping_nated_only", 1)&nbsp;&nbsp; #Ping only clients<BR>&gt; behind NAT <BR>&gt; 
modparam("nathelper", "rtpproxy_sock", "/var/run/rtpproxy.sock")<BR>&gt; 
<BR>&gt; modparam("tm", "fr_inv_timer", 20)<BR>&gt; <BR>&gt; #modparam("pa", 
"default_expires", 3600)<BR>&gt; <BR>&gt; modparam("usrloc", "db_url", 
"sql://root:1alfa156@localhost/ser")<BR>&gt; <BR>&gt; #modparam("cpl-c", 
"cpl_db", "mysql://root:1alfa156@localhost/ser")<BR>&gt; #modparam("cpl-c", 
"cpl_table", "cpl")<BR>&gt; #modparam("cpl-c", "cpl_dtd_file",<BR>&gt; 
"/work/sip_router/modules/cpl-ccpl-06.dtd") <BR>&gt; <BR>&gt; # 
-------------------------&nbsp; request routing logic 
-------------------<BR>&gt; <BR>&gt; # main routing logic<BR>&gt; <BR>&gt; 
route{<BR>&gt; <BR>&gt; # initial sanity checks -- messages with<BR>&gt; # 
max_forwards==0, or excessively long requests<BR>&gt; if 
(!mf_process_maxfwd_header("10")) {<BR>&gt; sl_send_reply("483","Too Many 
Hops");<BR>&gt; break;<BR>&gt; };<BR>&gt; if ( msg:len &gt; max_len ) {<BR>&gt; 
sl_send_reply("513", "Message too big");<BR>&gt; break;<BR>&gt; };<BR>&gt; 
<BR>&gt; 
#######################################################################################<BR>&gt; 
if (nat_uac_test("3")){<BR>&gt; if (method == "REGISTER" || ! 
search("^Record-Route:")){<BR>&gt; log("Log: Someone trying to register from 
private IP,rewriting\n");<BR>&gt; fix_nated_contact(); #Rewrite contact with 
source IP<BR>&gt; if (method == "INVITE"){<BR>&gt; fix_nated_sdp("1"); #Add 
direction=active to SDP<BR>&gt; force_rtp_proxy();<BR>&gt; };<BR>&gt; 
force_rport(); # Add rport parameter to topmost Via<BR>&gt; setflag(6); # Mark 
as Nated<BR>&gt; };<BR>&gt; };<BR>&gt; 
########################################################################################<BR>&gt; 
<BR>&gt; # we record-route all messages -- to make sure that<BR>&gt; # 
subsequent messages will go through our proxy; that's<BR>&gt; # particularly 
good if upstream and downstream entities<BR>&gt; # use different transport 
protocol<BR>&gt; <BR>&gt; if (method =="REGISTER") record_route();<BR>&gt; 
<BR>&gt; # loose-route processing<BR>&gt; if (loose_route()) {<BR>&gt; 
#commented 11/02/05<BR>&gt; #t_relay();<BR>&gt; route(1);<BR>&gt; break;<BR>&gt; 
};<BR>&gt; <BR>&gt; # if the request is for other domain use UsrLoc<BR>&gt; # 
(in case, it does not work, use the following command<BR>&gt; # with proper 
names and addresses in it)<BR>&gt; if (uri==myself) {<BR>&gt; <BR>&gt; 
log(1,"into loop");<BR>&gt; if (method=="REGISTER") {<BR>&gt; <BR>&gt; # 
Uncomment this if you want to use digest authentication<BR>&gt; # if 
(!www_authorize("157.190.74.152", "subscriber")) {<BR>&gt; # 
www_challenge("157.190.74.152", "0");<BR>&gt; # break;<BR>&gt; # };<BR>&gt; 
<BR>&gt; #cpl_process_register();<BR>&gt; <BR>&gt; save("location");<BR>&gt; 
break;<BR>&gt; };<BR>&gt; <BR>&gt; # if (method=="SUBSCRIBE")<BR>&gt; # 
{<BR>&gt; # log(1, "Subscribe\n");<BR>&gt; # if(t_newtran())<BR>&gt; # {<BR>&gt; 
# log(1, "Registrar\n");<BR>&gt; # handle_subscription("registrar");<BR>&gt; # 
};<BR>&gt; # break;<BR>&gt; # };<BR>&gt; <BR>&gt; lookup("aliases");<BR>&gt; if 
(!uri==myself) {<BR>&gt; append_hf("P-hint: outbound alias\r\n");<BR>&gt; 
route(1);<BR>&gt; break;<BR>&gt; };<BR>&gt; <BR>&gt; if 
(method=="INVITE"){<BR>&gt; <BR>&gt; log(1,"in invite loop");<BR>&gt; #break; 
#no 100 trying<BR>&gt; #if (!cpl_run_script("incoming","is_stateless"))<BR>&gt; 
#{<BR>&gt; # #script execution failed<BR>&gt; # t_reply("500", "CPL script 
execution failed");<BR>&gt; #};<BR>&gt; <BR>&gt; t_on_failure("1");<BR>&gt; 
};<BR>&gt; <BR>&gt; # native SIP destinations are handled using our USRLOC 
DB<BR>&gt; if (!lookup("location")) {<BR>&gt; #sl_send_reply("404", "Not 
Found");<BR>&gt; route(2);<BR>&gt; break;<BR>&gt; };<BR>&gt; };<BR>&gt; <BR>&gt; 
# forward to current uri now; use stateful forwarding; that<BR>&gt; # works 
reliably even if we forward from TCP to UDP<BR>&gt; #commented 
11/02/05#######################<BR>&gt; if (!t_relay()) {<BR>&gt; 
sl_reply_error();<BR>&gt; };<BR>&gt; <BR>&gt; #route(1);<BR>&gt; }<BR>&gt; 
<BR>&gt; ######################################entered<BR>&gt; 
11/02/05############################################################ <BR>&gt; 
route[1]<BR>&gt; {<BR>&gt; #!!Nathelper<BR>&gt; 
if(uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &amp;&amp;<BR>&gt; 
!search("^Route:")){ <BR>&gt; sl_send_reply("479", "We don't forward to private 
IP addresses");<BR>&gt; break;<BR>&gt; };<BR>&gt; <BR>&gt; if 
(isflagset(6)){<BR>&gt; force_rtp_proxy();<BR>&gt; }<BR>&gt; <BR>&gt; 
t_on_reply("1");<BR>&gt; <BR>&gt; if(!t_relay()){<BR>&gt; 
sl_reply_error();<BR>&gt; break;<BR>&gt; };<BR>&gt; <BR>&gt; }<BR>&gt; <BR>&gt; 
######################################entered<BR>&gt; 
11/02/05############################################################ <BR>&gt; 
#!! Nathelper<BR>&gt; onreply_route[1] {<BR>&gt; if(isflagset(6) &amp;&amp; 
status =~ "(183)|2[0-9][0-9]"){<BR>&gt; fix_nated_contact();<BR>&gt; 
force_rtp_proxy();<BR>&gt; }else if (nat_uac_test("1")){<BR>&gt; 
fix_nated_contact();<BR>&gt; };<BR>&gt; }<BR>&gt; 
#################################################################################################################<BR>&gt; 
<BR>&gt; # ------------- handling of unavailable user ------------------<BR>&gt; 
route[2] {<BR>&gt; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 
non-Voip -- just send 
"off-line"<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!(method 
== "INVITE" || method == "ACK" || method ==<BR>&gt; "CANCEL")) { 
<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
sl_send_reply("404", "Not 
Found");<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
break;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>&gt; 
<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # forward to voicemail 
now<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
rewritehostport("157.190.74.152:5062");<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
t_relay_to_udp("157.190.74.152", "5062");<BR>&gt; }<BR>&gt; <BR>&gt; # if 
forwarding downstream did not succeed, try voicemail running<BR>&gt; # at 
172.16.2.120:5062<BR>&gt; <BR>&gt; failure_route[1] 
{<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
revert_uri();<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
rewritehostport("157.190.74.152:5062");<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
append_branch();<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
t_relay_to_udp("157.190.74.152", "5062");<BR>&gt; }<BR>&gt; <BR>&gt; <BR>&gt; 
<BR>&gt; <BR>&gt; <BR>&gt; 
_______________________________________________<BR>&gt; Serusers mailing 
list<BR>&gt; serusers@lists.iptel.org<BR>&gt; 
http://lists.iptel.org/mailman/listinfo/serusers</DIV></BODY></HTML>