<div>Hi Bogdan</div>
<div>&nbsp;</div>
<div>Thank you for your help.</div>
<div>&nbsp;</div>
<div>The nated client does register to opensips.&nbsp; It is set to register every 3600 sec, min time&nbsp; is 20 s and max time is 1800 s.&nbsp; It is default xLite setting.</div>
<div>&nbsp;</div>
<div>Here is the 200OK I captured from my nated client box:</div>
<div>&nbsp;</div>
<div>!&#39;DVVEGTeEd=3SIP/2.0 200 OK<br>Via: SIP/2.0/UDP <a href="http://192.168.1.101">192.168.1.101</a>;branch=z9hG4bKbf91.9b9bad57.0;received=233.32.345.5<br>Via: SIP/2.0/UDP 233.32.345.5:5800;received=233.32.345.5;rport=5800;branch=z9hG4bKNj4y6pUrS49FF<br>
Record-Route: &lt;sip:<a href="http://192.168.1.101">192.168.1.101</a>;lr;ftag=UD1K6e2FpUgNj&gt;<br>Contact: &lt;<a href="http://sip:1000@192.168.1.100:33756">sip:1000@192.168.1.100:33756</a>&gt;<br>To: &quot;1000&quot;&lt;sip:1000@233.32.345.5:5060&gt;;tag=194ddb10<br>
From: &quot;0&quot;&lt;sip:0@233.32.345.5:5060&gt;;tag=UD1K6e2FpUgNj<br>Call-ID: MGUzMzZjNGNhNGM3MzY4ZDVjMjg3M2I2OGI2OTc0OWE.<br>CSeq: 107790129 BYE<br>User-Agent: X-Lite release 1011s stamp 41150<br>Content-Length: 0</div>

<div>&nbsp;</div>
<div>Here is the INVITE request:</div>
<div>&nbsp;</div>
<div>!&#39;DVVEMKd=*INVITE sip:0@233.32.345.5:5060 SIP/2.0<br>Via: SIP/2.0/UDP 192.168.1.100:33756;branch=z9hG4bK-d87543-8e2c20026843651b-1--d87543-;rport<br>Max-Forwards: 70<br>Contact: &lt;<a href="http://sip:1000@192.168.1.100:33756">sip:1000@192.168.1.100:33756</a>&gt;<br>
To: &quot;0&quot;&lt;sip:0@233.32.345.5:5060&gt;<br>From: &quot;1000&quot;&lt;sip:1000@233.32.345.5:5060&gt;;tag=194ddb10<br>Call-ID: MGUzMzZjNGNhNGM3MzY4ZDVjMjg3M2I2OGI2OTc0OWE.<br>CSeq: 1 INVITE<br>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO<br>
Content-Type: application/sdp<br>User-Agent: X-Lite release 1011s stamp 41150<br>Content-Length: 423</div>
<div>v=0<br>o=- 9 2 IN IP4 <a href="http://192.168.1.100">192.168.1.100</a><br>s=CounterPath X-Lite 3.0<br>c=IN IP4 <a href="http://192.168.1.100">192.168.1.100</a><br>t=0 0<br>m=audio 26258 RTP/AVP 107 119 100 106 0 105 98 8 101<br>
a=alt:1 1 : LGfU4oal SL5N8UZJ <a href="http://192.168.1.100">192.168.1.100</a> 26258<br>a=fmtp:101 0-15<br>a=rtpmap:107 BV32/16000<br>a=rtpmap:119 BV32-FEC/16000<br>a=rtpmap:100 SPEEX/16000<br>a=rtpmap:106 SPEEX-FEC/16000<br>
a=rtpmap:105 SPEEX-FEC/8000<br>a=rtpmap:98 iLBC/8000<br>a=rtpmap:101 telephone-event/8000<br>a=sendrecv<br></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div><br><br>&nbsp;</div>
<div class="gmail_quote">On Thu, Nov 27, 2008 at 1:53 AM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Juan,<br><br>I need to see the request part also to figure out if the flow through the NAT is ok or not.<br>
<br>As a side note - could you check if the device behind the nat is actually receiving the 200 OK?. Because a typical reason for a missing ACK is &nbsp;a missing 200 OK.<br><br>Another question - the device placing the call (from behind the nat) is registered or not? what is the estimated setup time in this case (time between invite and 200 OK) ?<br>
<br>Regards,<br>Bogdan<br><br>Juan Backson wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">Hi,<br><br>I am having problem with configuring opensips to work with NATed clients. &nbsp;In my configuration, I am using a B2BUA and Opensips as the sip proxy. <br></div>The problem I am having is that when the B2BUA(233.32.345.5:5800) sends out 200 OK, Opensips (192.168.1.101:5060)is able to proxy it to the NATed client ( <a href="http://116.24.163.21:2751/" target="_blank">116.24.163.21:2751</a> &lt;<a href="http://116.24.163.21:2751/" target="_blank">http://116.24.163.21:2751</a>&gt;), but the NATed client is not sending back any ACK, so the B2BUA hangs up after 30 second. <br>

<div class="Ih2E3d">Could someone give me any suggestion on what may be wrong in my config?<br><br>Thanks in advance for all the help.<br><br><br></div>U 233.32.345.5:5800 -&gt; <a href="http://192.168.1.101:5060/" target="_blank">192.168.1.101:5060</a> &lt;<a href="http://192.168.1.101:5060/" target="_blank">http://192.168.1.101:5060</a>&gt; 
<div class="Ih2E3d"><br>SIP/2.0 200 OK.<br></div>Via: SIP/2.0/UDP <a href="http://192.168.1.101/" target="_blank">192.168.1.101</a> &lt;<a href="http://192.168.1.101/" target="_blank">http://192.168.1.101</a>&gt;;branch=z9hG4bK3ab5.9b17c4a1.0;received=233.32.345.5.<br>
Via: SIP/2.0/UDP 192.168.1.100:26682;received=<a href="http://116.24.163.21/" target="_blank">116.24.163.21</a> &lt;<a href="http://116.24.163.21/" target="_blank">http://116.24.163.21</a>&gt;;branch=z9hG4bK-d87543-1a09c008b901bc5c-1--d87543-;rport=2751.<br>
Record-Route: &lt;sip:<a href="http://192.168.1.101/" target="_blank">192.168.1.101</a> &lt;<a href="http://192.168.1.101/" target="_blank">http://192.168.1.101</a>&gt;;lr=on;ftag=b81a6b5e;nat=yes&gt;. 
<div>
<div></div>
<div class="Wj3C7c"><br>From: &quot;1000&quot; &lt;sip:1000@233.32.345.5:5060&gt;;tag=b81a6b5e.<br>To: &quot;0&quot; &lt;sip:0@233.32.345.5:5060&gt;;tag=Sy7K9eUFg61tB.<br>Call-ID: ODRiMGUzMGFiZDg2OGU0OGNiYmE0MWY5OWRkMTMxOTA..<br>
CSeq: 2 INVITE.<br>Contact: &lt;sip:mod_sofia@233.32.345.5:5800;transport=udp&gt;.<br>User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-10454M.<br>Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE, REGISTER, INFO.<br>
Supported: timer, precondition, path, replaces.<br>Allow-Events: talk.<br>Session-Expires: 120;refresher=uas.<br>Min-SE: 120.<br>Content-Type: application/sdp.<br>Content-Disposition: session.<br>Content-Length: 269.<br>.<br>
v=0.<br>o=FreeSWITCH 5494423604621376967 2638962022927722250 IN IP4 233.32.345.5.<br>s=FreeSWITCH.<br>c=IN IP4 233.32.345.5.<br>t=0 0.<br>m=audio 10272 RTP/AVP 0 101.<br>a=rtpmap:0 PCMU/8000.<br>a=rtpmap:101 telephone-event/8000.<br>
a=fmtp:101 0-16.<br>a=silenceSupp:off - - - -.<br>a=ptime:20.<br><br><br></div></div>U <a href="http://192.168.1.101:5060/" target="_blank">192.168.1.101:5060</a> &lt;<a href="http://192.168.1.101:5060/" target="_blank">http://192.168.1.101:5060</a>&gt; -&gt; <a href="http://116.24.163.21:2751/" target="_blank">116.24.163.21:2751</a> &lt;<a href="http://116.24.163.21:2751/" target="_blank">http://116.24.163.21:2751</a>&gt; 
<div class="Ih2E3d"><br>SIP/2.0 200 OK.<br></div>Via: SIP/2.0/UDP 192.168.1.100:26682;received=<a href="http://116.24.163.21/" target="_blank">116.24.163.21</a> &lt;<a href="http://116.24.163.21/" target="_blank">http://116.24.163.21</a>&gt;;branch=z9hG4bK-d87543-1a09c008b901bc5c-1--d87543-;rport=2751.<br>
Record-Route: &lt;sip:<a href="http://192.168.1.101/" target="_blank">192.168.1.101</a> &lt;<a href="http://192.168.1.101/" target="_blank">http://192.168.1.101</a>&gt;;lr=on;ftag=b81a6b5e;nat=yes&gt;. 
<div>
<div></div>
<div class="Wj3C7c"><br>From: &quot;1000&quot; &lt;sip:1000@233.32.345.5:5060&gt;;tag=b81a6b5e.<br>To: &quot;0&quot; &lt;sip:0@233.32.345.5:5060&gt;;tag=Sy7K9eUFg61tB.<br>Call-ID: ODRiMGUzMGFiZDg2OGU0OGNiYmE0MWY5OWRkMTMxOTA..<br>
CSeq: 2 INVITE.<br>Contact: &lt;sip:mod_sofia@233.32.345.5:5800;transport=udp&gt;.<br>User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-10454M.<br>Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE, REGISTER, INFO.<br>
Supported: timer, precondition, path, replaces.<br>Allow-Events: talk.<br>Session-Expires: 120;refresher=uas.<br>Min-SE: 120.<br>Content-Type: application/sdp.<br>Content-Disposition: session.<br>Content-Length: 269.<br>.<br>
v=0.<br>o=FreeSWITCH 5494423604621376967 2638962022927722250 IN IP4 233.32.345.5.<br>s=FreeSWITCH.<br>c=IN IP4 233.32.345.5.<br>t=0 0.<br>m=audio 10272 RTP/AVP 0 101.<br>a=rtpmap:0 PCMU/8000.<br>a=rtpmap:101 telephone-event/8000.<br>
a=fmtp:101 0-16.<br>a=silenceSupp:off - - - -.<br>a=ptime:20.<br><br><br></div></div>U <a href="http://192.168.1.101:5800/" target="_blank">192.168.1.101:5800</a> &lt;<a href="http://192.168.1.101:5800/" target="_blank">http://192.168.1.101:5800</a>&gt; -&gt; 233.32.345.5:5060<br>
BYE <a href="http://sip:1000@116.24.163.21:2751" target="_blank">sip:1000@116.24.163.21:2751</a> &lt;<a href="http://sip:1000@116.24.163.21:2751" target="_blank">http://sip:1000@116.24.163.21:2751</a>&gt; SIP/2.0. 
<div class="Ih2E3d"><br>Via: SIP/2.0/UDP 233.32.345.5:5800;rport;branch=z9hG4bK01H0jSevQ2Nmc.<br></div>Route: &lt;sip:<a href="http://192.168.1.101/" target="_blank">192.168.1.101</a> &lt;<a href="http://192.168.1.101/" target="_blank">http://192.168.1.101</a>&gt;;lr=on;ftag=b81a6b5e;nat=yes&gt;. 
<div>
<div></div>
<div class="Wj3C7c"><br>Max-Forwards: 70.<br>From: &quot;0&quot; &lt;sip:0@233.32.345.5:5060&gt;;tag=Sy7K9eUFg61tB.<br>To: &quot;1000&quot; &lt;sip:1000@233.32.345.5:5060&gt;;tag=b81a6b5e.<br>Call-ID: ODRiMGUzMGFiZDg2OGU0OGNiYmE0MWY5OWRkMTMxOTA..<br>
CSeq: 107702524 BYE.<br>Contact: &lt;sip:mod_sofia@233.32.345.5:5800;transport=udp&gt;.<br>User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-10454M.<br>Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE, REGISTER, INFO.<br>
Supported: timer, precondition, path, replaces.<br>Reason: SIP;cause=408;text=&quot;ACK Timeout&quot;.<br>Content-Length: 0.<br>.<br><br><br><br><br>#<br># $Id: openser.cfg 1676 2007-02-21 13:16:34Z bogdan_iancu $<br>#<br>
#simple quick-start config script<br>#Please refer to the Core CookBook at <a href="http://www.openser.org/dokuwiki/doku.php" target="_blank">http://www.openser.org/dokuwiki/doku.php</a><br>#for a explanation of possible statements, functions and parameters.<br>
#<br># ----------- global configuration parameters ------------------------<br>debug=3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# debug level (cmd line: -dddddddddd)<br>fork=no<br>log_stderror=yes &nbsp; &nbsp;# (cmd line: -E)<br>children=4<br>port=5060<br>mpath=&quot;/usr/local/lib64/opensips/modules/&quot;<br>
loadmodule &quot;db_mysql.so&quot;<br>loadmodule &quot;sl.so&quot;<br>loadmodule &quot;tm.so&quot;<br>loadmodule &quot;rr.so&quot;<br>loadmodule &quot;maxfwd.so&quot;<br>loadmodule &quot;usrloc.so&quot;<br>loadmodule &quot;registrar.so&quot;<br>
loadmodule &quot;textops.so&quot;<br>loadmodule &quot;mi_fifo.so&quot;<br>loadmodule &quot;uri.so&quot;<br>loadmodule &quot;uri_db.so&quot;<br>loadmodule &quot;domain.so&quot;<br>loadmodule &quot;xlog.so&quot;<br>loadmodule &quot;permissions.so&quot;<br>
loadmodule &quot;auth.so&quot;<br>loadmodule &quot;auth_db.so&quot;<br>loadmodule &quot;dispatcher.so&quot;<br>loadmodule &quot;nathelper.so&quot;<br>loadmodule &quot;mediaproxy.so&quot;<br><br><br><br>&nbsp;<br><br><br><br><br>
modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;, 2)<br><br>&nbsp;&nbsp;modparam(&quot;rr&quot;, &quot;enable_full_lr&quot;, 1)<br></div></div>
&nbsp;modparam(&quot;auth_db|usrloc|domain|uri_db|permissions|dispatcher&quot;,&quot;db_url&quot;,&quot;mysql://<a href="http://root:sqlpass@192.168.1.105/app" target="_blank">root:sqlpass@192.168.1.105/app</a> &lt;<a href="http://root:sqlpass@192.168.1.105/app" target="_blank">http://root:sqlpass@192.168.1.105/app</a>&gt;&quot;) 
<div class="Ih2E3d"><br>modparam(&quot;auth_db&quot;,&quot;calculate_ha1&quot;,yes)<br>modparam(&quot;auth_db&quot;,&quot;password_column&quot;,&quot;password&quot;)<br>modparam(&quot;auth_db&quot;,&quot;user_column&quot;,&quot;sip_user&quot;)<br>
modparam(&quot;auth_db&quot;,&quot;load_credentials&quot;,&quot;agent_id&quot;)<br>&nbsp;modparam(&quot;uri_db&quot;,&quot;db_table&quot;,&quot;agent&quot;)<br>modparam(&quot;uri_db&quot;,&quot;user_column&quot;,&quot;sip_user&quot;)<br>
modparam(&quot;uri_db&quot;,&quot;use_uri_table&quot;,0)<br>modparam(&quot;auth_db&quot;,&quot;use_domain&quot;,0)<br>&nbsp;modparam(&quot;permissions&quot;, &quot;db_mode&quot;, 1)<br>modparam(&quot;permissions&quot;, &quot;trusted_table&quot;, &quot;server&quot;)<br>
modparam(&quot;permissions&quot;,&quot;source_col&quot;,&quot;server_ip&quot;)<br>modparam(&quot;permissions&quot;,&quot;proto_col&quot;,&quot;transport&quot;)<br>modparam(&quot;permissions&quot;,&quot;from_col&quot;,&quot;from_pattern&quot;)<br>
modparam(&quot;permissions&quot;,&quot;tag_col&quot;,&quot;peer_tag&quot;)<br>&nbsp;modparam(&quot;dispatcher&quot;,&quot;table_name&quot;,&quot;dispatcher&quot;)<br>modparam(&quot;dispatcher&quot;,&quot;setid_col&quot;,&quot;setid&quot;)<br>
modparam(&quot;dispatcher&quot;,&quot;destination_col&quot;,&quot;destination&quot;)<br>modparam(&quot;dispatcher&quot;,&quot;flags_col&quot;,&quot;flags&quot;)<br>modparam(&quot;dispatcher&quot;,&quot;flags&quot;,3)<br>&nbsp;modparam(&quot;auth_db&quot;,&quot;load_credentials&quot;,&quot;enable&quot;)<br>
<br><br>modparam(&quot;nathelper&quot;,&quot;received_avp&quot;, &quot;$avp(i:42)&quot;)<br><br>modparam(&quot;nathelper&quot;,&quot;received_avp&quot;, &quot;$avp(i:42)&quot;)<br></div>modparam(&quot;nathelper&quot;, &quot;rtpproxy_sock&quot;, &quot;udp:<a href="http://127.0.0.1:7890/" target="_blank">127.0.0.1:7890</a> &lt;<a href="http://127.0.0.1:7890/" target="_blank">http://127.0.0.1:7890</a>&gt;&quot;) 
<div class="Ih2E3d"><br>modparam(&quot;nathelper&quot;, &quot;natping_interval&quot;, 30)<br>modparam(&quot;nathelper&quot;, &quot;ping_nated_only&quot;, 0)<br>modparam(&quot;nathelper&quot;, &quot;sipping_bflag&quot;, 7)<br>
</div>modparam(&quot;nathelper&quot;, &quot;sipping_from&quot;, &quot;<a href="mailto:sip%3Apinger@8.8.1.20" target="_blank">sip:pinger@8.8.1.20</a> &lt;mailto:<a href="mailto:sip%253Apinger@8.8.1.20" target="_blank">sip%3Apinger@8.8.1.20</a>&gt;&quot;)<br>
<br><br>&nbsp;listen=udp:<a href="http://192.168.1.101:5060/" target="_blank">192.168.1.101:5060</a> &lt;<a href="http://192.168.1.101:5060/" target="_blank">http://192.168.1.101:5060</a>&gt;<br>listen=tcp:<a href="http://192.168.1.101:5060/" target="_blank">192.168.1.101:5060</a> &lt;<a href="http://192.168.1.101:5060/" target="_blank">http://192.168.1.101:5060</a>&gt; 
<div>
<div></div>
<div class="Wj3C7c"><br>listen=udp:233.32.345.5:5060<br>listen=tcp:233.32.345.5:5060<br>&nbsp;&nbsp;# ------------------------- &nbsp; &nbsp;request routing logic -------------------<br># main routing logic<br>route{<br>&nbsp;xlog(&quot;method &lt;$rm&gt; from-header &lt;$fu&gt;\n&quot;);<br>
&nbsp; &nbsp; &nbsp; &nbsp; # initial sanity checks -- messages with<br>&nbsp; &nbsp; &nbsp; &nbsp; # max_forwards==0, or excessively long requests<br>&nbsp; &nbsp; &nbsp; &nbsp; if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; };<br>&nbsp; &nbsp; &nbsp; &nbsp; if (msg:len &gt;= 2048 ) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; };<br>&nbsp; &nbsp; &nbsp; &nbsp; # we record-route all messages -- to make sure that<br>
&nbsp; &nbsp; &nbsp; &nbsp; # subsequent messages will go through our proxy; that&#39;s<br>&nbsp; &nbsp; &nbsp; &nbsp; # particularly good if upstream and downstream entities<br>&nbsp; &nbsp; &nbsp; &nbsp; # use different transport protocol<br>&nbsp;<br>&nbsp; &nbsp;## NAT Detection &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#<br>
&nbsp; &nbsp; &nbsp; &nbsp;force_rport();<br>&nbsp; &nbsp; &nbsp; &nbsp;if (nat_uac_test(&quot;19&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (method==&quot;REGISTER&quot;) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fix_nated_register();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fix_nated_contact();<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;setflag(5);<br>&nbsp; &nbsp; &nbsp; &nbsp;};<br>&nbsp; &nbsp;<br>&nbsp; &nbsp;if(!is_method(&quot;REGISTER&quot;)){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(nat_uac_test(&quot;19&quot;)){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;record_route(&quot;;nat=yes&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;record_route();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };<br>&nbsp; &nbsp;};<br>&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (has_totag()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (loose_route()) {<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(method==&quot;INVITE&quot; &amp;&amp; (!allow_trusted())) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!proxy_authorize(&quot;&quot;,&quot;auth&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; proxy_challenge(&quot;&quot;,&quot;0&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else if (!check_from()) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sl_send_reply(&quot;403&quot;, &quot;Forbidden, use From=ID&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ($avp(s:enable)==&quot;0&quot;) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_send_reply(&quot;403&quot;, &quot;Forbidden, use From=ID&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;route(1);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp;route(1);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (is_method(&quot;CANCEL&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (t_check_trans()) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;t_relay();<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp;}<br>&nbsp; &nbsp;if (method==&quot;REGISTER&quot;) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; route(2);<br>&nbsp; &nbsp;} else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; route(3);<br>&nbsp; &nbsp;};<br>&nbsp;}<br>route[1] {<br><br><br>&nbsp; &nbsp; &nbsp; &nbsp;# send it out now; use stateful forwarding as it works<br>
&nbsp; &nbsp; &nbsp; &nbsp;# reliably even for UDP2TCP<br>&nbsp; &nbsp; &nbsp;t_on_reply(&quot;1&quot;);<br>&nbsp; &nbsp;t_on_failure(&quot;1&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!t_relay()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_reply_error();<br>&nbsp; &nbsp; &nbsp; &nbsp;};<br>&nbsp; &nbsp; &nbsp; &nbsp;exit;<br>}<br>&nbsp;route[2] {<br>
&nbsp; &nbsp; &nbsp; &nbsp;#<br>&nbsp; &nbsp; &nbsp; &nbsp;# -- Register request handler --<br>&nbsp; &nbsp; &nbsp; &nbsp;#<br>&nbsp; &nbsp; &nbsp; &nbsp;if (is_uri_host_local()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!www_authorize(&quot;&quot;, &quot;auth&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;www_challenge(&quot;&quot;, &quot;0&quot;);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!check_to()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_send_reply(&quot;403&quot;, &quot;Forbidden&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};<br><br>&nbsp; &nbsp; &nbsp; &nbsp; if ($avp(s:enable)==&quot;0&quot;) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_send_reply(&quot;403&quot;, &quot;Forbidden, use From=ID&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;save(&quot;location&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp; &nbsp; &nbsp;} else if {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_send_reply(&quot;403&quot;, &quot;Forbidden&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp;};<br>
}<br>&nbsp;route[3] {<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (is_from_local()){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# From an internal domain -&gt; check the credentials and the FROM<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!proxy_authorize(&quot;&quot;,&quot;auth&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_challenge(&quot;&quot;,&quot;0&quot;);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else if (!check_from()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_send_reply(&quot;403&quot;, &quot;Forbidden, use From=ID&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;};<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;consume_credentials();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Verify aliases<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (is_uri_host_local()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# -- Inbound to Inbound<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;route(10);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# -- Inbound to outbound<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;route(11);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };<br>&nbsp; &nbsp; &nbsp;} else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (is_uri_host_local()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#-- Outbound to inbound<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;route(12);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# -- Outbound to outbound<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;route(13);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };<br>&nbsp; &nbsp; &nbsp;};<br>}<br>&nbsp;&nbsp;route[4] {<br>&nbsp; &nbsp;revert_uri();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rewritehostport(&quot;233.32.345.5:5800&quot;);<br>&nbsp; &nbsp;route(1);<br>
<br><br><br><br>}<br>&nbsp;<br><br>route[6] {<br>&nbsp; &nbsp;if (is_method(&quot;BYE&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else if ((is_method(&quot;INVITE&quot;))){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;append_hf(&quot;P-hint: Route[6]: Rtpproxy \r\n&quot;);<br>&nbsp; &nbsp; t_on_failure(&quot;3&quot;);<br>
&nbsp; &nbsp;};<br>&nbsp;}<br>&nbsp;&nbsp;route[10] {<br>&nbsp; &nbsp; append_hf(&quot;P-hint: inbound-&gt;inbound \r\n&quot;);<br>&nbsp; &nbsp; route(4);<br>&nbsp;}<br>route[11] {<br>&nbsp; &nbsp; append_hf(&quot;P-hint: inbound-&gt;outbound \r\n&quot;);<br>&nbsp; &nbsp; route(1);<br>}<br>
route[12] {<br>&nbsp; &nbsp; lookup(&quot;aliases&quot;);<br>&nbsp; &nbsp; if (!lookup(&quot;location&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sl_send_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp; };<br>&nbsp; &nbsp; route(1);<br>}<br>route[13] {<br>
&nbsp; &nbsp; append_hf(&quot;P-hint: outbound-&gt;inbound \r\n&quot;);<br>&nbsp; &nbsp; sl_send_reply(&quot;403&quot;, &quot;Forbidden&quot;);<br>&nbsp; &nbsp; exit;<br>}<br>&nbsp;&nbsp;onreply_route[1] {<br>&nbsp; &nbsp;xlog(&quot;L_INFO&quot;, &quot;Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci\n&quot;);<br>
&nbsp; &nbsp; &nbsp; &nbsp;search_append(&#39;Contact:.*sip:[^&gt;[:cntrl:]]*&#39;, &#39;;nat=yes&#39;);<br>&nbsp; &nbsp;fix_nated_contact();<br>&nbsp; &nbsp;exit;<br><br>&nbsp;}<br>failure_route[1] {<br>&nbsp; append_hf(&quot;P-hint: (4)passed thru failure_route[1]\r\n&quot;);<br>
<br><br><br><br><br><br>&nbsp; &nbsp; &nbsp; if (t_was_cancelled()) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit;<br>&nbsp; &nbsp;};<br>&nbsp; &nbsp;if (t_check_status(&quot;486&quot;)) {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; revert_uri();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;prefix(&quot;b&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;xlog(&quot;L_ERR&quot;,&quot;Stepped into the 486 ruri=&lt;$ru&gt;&quot;);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #ds_select_dst(&quot;2&quot;, &quot;4&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp;rewritehostport(&quot;233.32.345.5:5800&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp;append_branch();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; route(1);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp;};<br>&nbsp; &nbsp;if (t_check_status(&quot;408&quot;) || t_check_status(&quot;480&quot;)) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; revert_uri();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prefix(&quot;u&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xlog(&quot;L_ERR&quot;,&quot;Stepped into the 480 ruri=&lt;$ru&gt;&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #ds_select_dst(&quot;2&quot;, &quot;4&quot;);<br>&nbsp; &nbsp; &nbsp; &nbsp;rewritehostport(&quot;233.32.345.5:5800&quot;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;append_branch();<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; route(1);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp;};<br>&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;}<br><br><br>failure_route[3] {<br>&nbsp; &nbsp;if (isbflagset(6) || isflagset(5)) {<br>&nbsp; &nbsp; &nbsp;}<br>&nbsp;}<br><br></div></div>------------------------------------------------------------------------<br>
<br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
&nbsp;<br></blockquote><br></blockquote></div><br>