Dear Bogdan,<br><br>I meet the issues of callee reply &quot;400 - bad request&quot; <br><br>Attach is my trace from opensips server.<br><br>Bellow is my configure of Opensips. Please take a time for my issues:<br><br>route {<br>
    log(1, &quot;----------------------------------------------------------------------------------&quot;);<br>    log(1, &quot; ENTER MAIN LOOP\n&quot;);<br>    log(1, &quot;----------------------------------------------------------------------------------&quot;);<br>
    #---------<br>    #Sanity Check<br>    #-------------<br>    if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>        sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>        exit;<br>    };<br>    if ( msg:len &gt;= max_len ) {<br>
        sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;);<br>        exit;<br>    }<br>    <br>    #--------------------------------------<br>    #Record-Route all messages <br>    #-- to make sure subsequent messages will go through our proxy<br>
    #--------------------------------------<br>    if (method!=&quot;REGISTER&quot;) {<br>        record_route();<br>    }<br>    #-------------------------------<br>    # Loose-Route<br>    #-------------------------------<br>
    if (loose_route()) {<br>        append_hf(&quot;P-hint: rr-enforced\r\n&quot;);<br>        route(1);<br>        exit;<br>    }<br>    #--------------------------------<br>    # uri != myself<br>    #--------------------------------------<br>
    if (uri!=myself) {<br>        append_hf(&quot;P-hint: Outbound\r\n&quot;);<br>        route(1);<br>        exit;<br>    }<br>    #----------------------------------<br>    # uri==myself<br>    #--------------------------------<br>
    if (uri==myself) {<br>        if (method==&quot;REGISTER&quot;) {<br>            if (nat_uac_test(&quot;19&quot;)) {<br>                setbflag(6);<br>                force_rport();<br>                fix_nated_register();<br>
            <br>            }<br>            sl_send_reply(&quot;100&quot;, &quot; Trying\r\n&quot;);<br>            #AUTHENTICATE<br>            if(!www_authorize(&quot;174.132.X.Y&quot;, &quot;subscriber&quot;)) {<br>                www_challenge(&quot;174.132.X.Y&quot;, &quot;0&quot;);<br>
                exit;<br>            }<br>            consume_credentials();<br>            <br>            save(&quot;location&quot;);<br>            exit;<br>        <br>        }<br>        lookup(&quot;aliases&quot;);<br>
        if (uri!=myself) {<br>            append_hf(&quot;P-hint:  outbound alias\r\n&quot;);<br>            route(1);<br>            exit;<br>        }<br>        if (!lookup(&quot;location&quot;)) {<br>            sl_send_reply(&quot;404&quot;, &quot; Not Found&quot;);<br>
            exit;<br>        }<br>        <br>    } #End uri==myself<br>    <br>    #<br>    #<br>    #<br>    if (method==&quot;INVITE&quot;) {<br>        t_on_failure(&quot;1&quot;);<br>    } else if (method==&quot;BYE&quot; || method==&quot;CANCEL&quot;) {<br>
        unforce_rtp_proxy();<br>    }<br>    <br>    #---------------------------------------------------------------------<br>    # LOOSE_ROUTE - INVITE - FORCE_RTP_PROXY<br>    #-----------------------------------------------------------------------<br>
    if (loose_route()) {<br>        if (method==&quot;INVITE&quot; || method==&quot;ACK&quot;) {<br>            append_hf(&quot;P-hint:- LOOSE ROUTE - Relay re-INVITE + FORCE_RTP_PROXY\r\n&quot;);<br>            force_rtp_proxy();<br>
        }<br>        # t-relay()<br>        t_relay();<br>        exit;<br>    }<br>    <br>    #-----------------------------------------------------------------------<br>    #NAT - fix_nated_contact()<br>    #------------------------------------------------------------------------<br>
    if (nat_uac_test(&quot;19&quot;) &amp;&amp; !search(&quot;^Record-Route:&quot;)) {<br>        append_hf(&quot;P-hint: Fix nated contact\r\n&quot;);<br>        force_rport();<br>        fix_nated_contact();<br>    }<br>
    <br>    if (method==&quot;INVITE&quot;) {<br>        append_hf(&quot;P-hint:  INVITE go to on_reply_route[1]\r\n&quot;);<br>        t_on_reply(&quot;1&quot;);<br>    }<br>    <br>    if (method==&quot;INVITE&quot; || method==&quot;ACK&quot;) {<br>
        append_hf(&quot;P-hint: INVITE||ACK + FORCE_RTP_PROXY\r\n&quot;);<br>        force_rtp_proxy();<br>    }<br>    <br>    if (!t_relay()) {<br>        append_hf(&quot;P-hint: INVITE||ACK - UNFORCE_RTP_PROXY\r\n&quot;);<br>
        if (method==&quot;INVITE&quot; || method==&quot;ACK&quot;) {<br>            unforce_rtp_proxy();<br>        }<br>        sl_reply_error();<br>    }<br>    <br>    append_hf(&quot;P-hint: usrloc applied\r\n&quot;);<br>
    <br><br>}<br><br>route[1] {<br>    append_hf(&quot;P-hint:Route[1] Processing\r\n&quot;);<br>    if (!t_relay()) {<br>        sl_reply_error();<br>    }<br>}<br><br>failure_route[1] {<br>    unforce_rtp_proxy();<br>}<br>
<br>onreply_route[1] {<br>    append_hf(&quot;P-hint: On_reply_route[1] processing\r\n&quot;);<br>    if (status=~&quot;(180)|(183)|2[0-9][0-9]&quot;) {<br>        if (nat_uac_test(&quot;1&quot;)) {<br>            fix_nated_contact();<br>
        }<br>        force_rtp_proxy();<br>    }<br>}<br><br>Thanks and Regards,<br>-LN<br><div class="gmail_quote">On Wed, Apr 1, 2009 at 5:46 PM, 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="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
risntance is just an URI parameter and from server pov it is opaque - has no meaning. It is exclusively used by phone (X-lite). Tipically such param is used by phones that register multiple accounts, in order to make distinction between the accounts (as for all of them , the IP and port from contact will be the same).<br>

<br>
To see why the call is drop, you need to take a sip trace (use ngrep) to see the signalling on the proxy.<div class="im"><br>
<br>
Regards,<br>
Bogdan<br>
<br>
<br>
oso che bol wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
Dear Bogdan,<br>
<br>
Regarding about old question, could you please tell me why:<br>
- Contact of Mobile: sip:8000@212.15.B.C:1120<br>
- Contact of X-Lite: sip:6000@58.186.Y.Z:14553;rinstance=abb597b601e7398b<br>
<br>
What is rinstance and does it impact to the call. I make call from Mobile (SJPhone on winCE) to X-Lite and after 32s, it drop call. Both UAs behind NAT.<br>
<br>
But, x-lite --to/from -- x-lite: call successful, no drop.<br>
<br>
Thanks,<br>
-LN<br>
<br></div><div class="im">
On Tue, Mar 31, 2009 at 11:09 PM, oso che bol &lt;<a href="mailto:ndlgroup1@gmail.com" target="_blank">ndlgroup1@gmail.com</a> &lt;mailto:<a href="mailto:ndlgroup1@gmail.com" target="_blank">ndlgroup1@gmail.com</a>&gt;&gt; wrote:<br>

<br>
    Dear Bogdan,<br>
<br>
    Thanks very much for your time.<br>
<br>
    Regards,<br>
    -LN<br>
<br>
<br>
    On Tue, Mar 31, 2009 at 8:53 PM, Bogdan-Andrei Iancu<br></div><div><div></div><div class="h5">
    &lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> &lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;&gt; wrote:<br>
<br>
        Please use fix_nated_register() for REGISTER requests - this<br>
        will set the appropriate info to be saved in usrloc.<br>
<br>
        fix_nated_register() is not changing the contact (so the<br>
        usrloc will save the real contact), but is just setting some<br>
        additional info to be saved in usrloc (the received field)<br>
<br>
        fix_nated_contact() is actually changing the contact from the<br>
        request - this is to be used for non-REGISTER requests.<br>
<br>
<br>
        Regards,<br>
        Bogdan<br>
<br>
        oso che bol wrote:<br>
<br>
<br>
            Dear Bogdan<br>
<br>
            I change the config of NATed REGISTER request to:<br>
<br>
            /    if (nat_uac_test(&quot;19&quot;)) {<br>
                   if (is_method(&quot;REGISTER&quot;) ||<br>
            !search(&quot;^Record-Route&quot;)) {<br>
                       log(&quot;LOG:  Someone trying to register from<br>
            private IP, rewriting\n&quot;);<br>
                       fix_nated_contact(); # Rewrite contact with<br>
            source IP of signalling<br>
                       force_rport(); # Add rport parameter to topmost Via<br>
                       setbflag(6);    # Mark as NATed<br>
                   if (method==&quot;INVITE&quot;) {<br>
                       fix_nated_sdp(&quot;1&quot;); # Add direction=active to SDP<br>
                       force_rport(); # Add rport parameter to topmost Via<br>
                       setbflag(6); # Mark as NATed<br>
                    };<br>
                   };/<br>
<br>
            Output of &quot;opensipsctl ul show&quot;:<br>
<br>
            /[root@LN]# opensipsctl ul show<br>
            database engine &#39;MYSQL&#39; loaded<br>
            Control engine &#39;FIFO&#39; loaded<br>
            entering fifo_cmd ul_dump<br>
            Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_parse_node: end of<br>
            input tree<br>
            Mar 31 07:17:27 [6412] DBG:mi_fifo:mi_fifo_server: done<br>
            parsing the mi tree<br>
            Domain:: aliases table=512 records=0 max_slot=0<br>
            Domain:: location table=512 records=2 max_slot=1<br>
               AOR:: 5000<br>
                   Contact:: sip:5000@77.69.220.94:5060;transport=UDP Q=<br>
                       Expires:: 1038<br>
                       Callid:: A9AOj5F5oIeDS04U53IMr4_65zZvf5<br>
                       Cseq:: 6049<br>
                       User-agent:: E66-1 RM-343 102.07.81<br>
                       State:: CS_SYNC<br>
                       Flags:: 0<br>
                       Cflag:: 64<br>
                       Socket:: udp:174.132.X.Y:5060<br>
                       Methods:: 4294967295<br>
               AOR:: 6000<br>
                   Contact::<br>
            sip:6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4 Q=<br>
                       Expires:: 1060<br>
                       Callid::<br>
            MDdmOTVkNzAzODAxN2JiMjk0MTk1NTEwNThjOWE2ZTM.<br>
                       Cseq:: 6<br>
                       User-agent:: X-Lite release 1100l stamp 47546<br>
                       State:: CS_SYNC<br>
                       Flags:: 0<br>
                       Cflag:: 64<br>
                       Socket:: udp:174.132.X.Y:5060<br>
                       Methods:: 5951<br>
            FIFO command was:<br>
            :ul_dump:opensips_receiver_6568/<br>
<br>
            Could you please explain why with mobile user 5000, the<br>
            contact /sip:5000@77.69.220.94:5060;transport=UDP /and<br>
            with X-Lite User 6000 the contact is<br>
            /6000@58.186.156.135:11370;rinstance=dbe921dccef4bee4/<br>
<br>
            How fix_nated_register() differ with fix_nated_register(),<br>
            do we need to call fix_nated_register() at REGISTER<br>
            processing?<br>
<br>
            Thanks and Regards,<br>
<br>
            -LN<br>
<br>
            On Tue, Mar 31, 2009 at 6:19 PM, Bogdan-Andrei Iancu<br>
            &lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> &lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;<br>
            &lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a><br>
            &lt;mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>&gt;&gt;&gt; wrote:<br>
<br>
               Hi,<br>
<br>
               if the online-user info is correct, it looks like the<br>
               fix_nated_register() is not done.<br>
<br>
               Please post the output of &quot;opensipsctl ul show&quot;, for<br>
            that specific<br>
               user.<br>
<br>
               Also test by using xlog if the at register time your<br>
            processing<br>
               gets inside the &quot;if (!search(&quot;^Contact:[ ]*\*&quot;) &amp;&amp;<br>
               nat_uac_test(&quot;19&quot;)) {&quot;.<br>
<br>
               Regards,<br>
               Bogdan<br>
<br>
               oso che bol wrote:<br>
<br>
                   Dear All,<br>
<br>
                   I use Opensips 1.4.1 with rtpproxy 1.2 for NAT support.<br>
<br>
                   I use X-Lite which is Behind NAT, register to<br>
            OpenSIPs proxy,<br>
                   Opensips store right contact address. But, when i<br>
            use Nokia<br>
                   E66 to register to Opensips, the contact address is<br>
            bellow:<br>
                   Online SIP Users<br>
                   Username Domain Contact Expires User Agent<br>
                   5000 *<a href="mailto:sip%3A5000@192.168.1.100" target="_blank">sip:5000@192.168.1.100</a><br>
            &lt;mailto:<a href="mailto:sip%253A5000@192.168.1.100" target="_blank">sip%3A5000@192.168.1.100</a>&gt;<br>
            &lt;mailto:<a href="mailto:sip%253A5000@192.168.1.100" target="_blank">sip%3A5000@192.168.1.100</a><br>
            &lt;mailto:<a href="mailto:sip%25253A5000@192.168.1.100" target="_blank">sip%253A5000@192.168.1.100</a>&gt;&gt;<br>
                   &lt;mailto:<a href="mailto:sip%253A5000@192.168.1.100" target="_blank">sip%3A5000@192.168.1.100</a><br>
            &lt;mailto:<a href="mailto:sip%25253A5000@192.168.1.100" target="_blank">sip%253A5000@192.168.1.100</a>&gt;<br>
                   &lt;mailto:<a href="mailto:sip%25253A5000@192.168.1.100" target="_blank">sip%253A5000@192.168.1.100</a><br></div></div>
            &lt;mailto:<a href="mailto:sip%2525253A5000@192.168.1.100" target="_blank">sip%25253A5000@192.168.1.100</a>&gt;&gt;&gt;;transport=UDP*<div><div></div><div class="h5"><br>
            2009-03-30<br>
<br>
                   07:20:24.0 E66-1 RM-343 102.07.81<br>
<br>
<br>
                   User 5000 do not store with external IP address of its<br>
                   (external address not 192.168.1.100). Do you have<br>
            any ideas<br>
                   about this?<br>
<br>
                   Bellow is my Opensips.conf<br>
<br>
                   Thanks and Regards,<br>
<br>
                   -LN<br>
<br>
                   Opensips.conf<br>
<br>
                   ==================<br>
<br>
                   ####### Global Parameters #########<br>
<br>
                   debug=4<br>
                   log_stderror=yes<br>
                   log_facility=LOG_LOCAL0<br>
<br>
                   fork=yes<br>
                   children=4<br>
<br>
                   /* uncomment the following lines to enable debugging */<br>
                   #debug=6<br>
                   #fork=no<br>
                   #log_stderror=yes<br>
<br>
                   #disable_tcp=yes<br>
                   #disable_dns_blacklist=no<br>
                   #dns_try_ipv6=yes<br>
                   #auto_aliases=no<br>
<br>
                   /* uncomment the following lines to enable TLS support<br>
                    (default off) */<br>
                   #disable_tls = no<br>
                   #listen = tls:your_IP:5061<br>
                   #tls_verify_server = 1<br>
                   #tls_verify_client = 1<br>
                   #tls_require_client_certificate = 0<br>
                   #tls_method = TLSv1<br>
                   #tls_certificate =<br>
            &quot;//etc/opensips/tls/user/user-cert.pem&quot;<br>
                   #tls_private_key =<br>
            &quot;//etc/opensips/tls/user/user-privkey.pem&quot;<br>
                   #tls_ca_list =<br>
            &quot;//etc/opensips/tls/user/user-calist.pem&quot;<br>
<br>
<br>
                   port=5060<br>
                   listen=udp:MY_OPENSIP_IP:5060<br>
<br>
<br>
                   ####### Modules Section ########<br>
<br>
                   #set module path<br>
                   mpath=&quot;//lib/opensips/modules/&quot;<br>
<br>
                   /* uncomment next line for MySQL DB support */<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_db.so&quot;<br>
                   loadmodule &quot;uri.so&quot;<br>
                   loadmodule &quot;xlog.so&quot;<br>
                   loadmodule &quot;acc.so&quot;<br>
                   loadmodule &quot;auth.so&quot;<br>
                   loadmodule &quot;auth_db.so&quot;<br>
<br>
                   #loadmodule &quot;presence.so&quot;<br>
                   #loadmodule &quot;presence_xml.so&quot;<br>
<br>
                   loadmodule &quot;nathelper.so&quot;<br>
                   loadmodule &quot;avpops.so&quot;<br>
                   ######################<br>
<br>
<br>
                   modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br>
                   modparam(&quot;rr&quot;, &quot;enable_full_lr&quot;, 1)<br>
                   modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 0)<br>
                   modparam(&quot;registrar&quot;, &quot;method_filtering&quot;, 1)<br>
<br>
                   /* uncomment the next line to disable parallel<br>
            forking via<br>
                   location */<br>
                   # modparam(&quot;registrar&quot;, &quot;append_branches&quot;, 0)<br>
                   /* uncomment the next line not to allow more than<br>
            10 contacts<br>
                   per AOR */<br>
                   #modparam(&quot;registrar&quot;, &quot;max_contacts&quot;, 10)<br>
                   modparam(&quot;uri_db&quot;, &quot;use_uri_table&quot;, 1)<br>
                   modparam(&quot;uri_db&quot;, &quot;db_url&quot;,<br>
                   &quot;mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin&quot;)<br>
                   #them for bug9, like guide in bug9<br>
                   modparam(&quot;uri_db&quot;, &quot;db_table&quot;, &quot;uri&quot;)<br>
<br>
<br>
                   # ----- acc params -----<br>
                   /* what sepcial events should be accounted ? */<br>
                   modparam(&quot;acc&quot;, &quot;early_media&quot;, 1)<br>
                   modparam(&quot;acc&quot;, &quot;report_ack&quot;, 1)<br>
                   modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 1)<br>
                   modparam(&quot;acc&quot;, &quot;detect_direction&quot;, 0)<br>
                   modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, 3)<br>
                   modparam(&quot;acc&quot;, &quot;log_flag&quot;, 1)<br>
                   modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;, 2)<br>
                   modparam(&quot;acc&quot;, &quot;db_flag&quot;, 1)<br>
                   modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 2)<br>
<br>
                   modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   2)<br>
                   modparam(&quot;usrloc&quot;, &quot;db_url&quot;,<br>
                                 &quot;mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin&quot;)<br>
<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|permission&quot;, &quot;db_url&quot;,<br>
                                 &quot;mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin&quot;)<br>
<br>
                   modparam(&quot;avpops&quot;, &quot;avp_url&quot;,<br>
                   &quot;mysql://sermyadmin:secret@MY_DATABASE_IP/sermyadmin&quot;)<br>
                   modparam(&quot;avpops&quot;, &quot;avp_table&quot;, &quot;usr_preferences&quot;)<br>
<br>
                   #try for fix error of Mobile Address<br>
                   modparam(&quot;registrar&quot;, &quot;received_avp&quot;, &quot;$avp(s:rcv)&quot;)<br>
                   modparam(&quot;nathelper&quot;, &quot;received_avp&quot;, &quot;$avp(s:rcv)&quot;)<br>
<br>
                   #Theo guide<br>
                              <a href="http://www.opensips.org/html/docs/modules/1.4.x/registrar.html" target="_blank">http://www.opensips.org/html/docs/modules/1.4.x/registrar.html</a><br>
                   modparam(&quot;usrloc&quot;, &quot;nat_bflag&quot;, 6)<br>
                   modparam(&quot;nathelper&quot;, &quot;ping_nated_only&quot;, 1)<br>
                   modparam(&quot;nathelper&quot;, &quot;sipping_bflag&quot;, 8)<br>
<br>
                   #modparam(&quot;nathelper&quot;, &quot;rtpproxy_sock&quot;,<br>
            &quot;udp:MY_RTPPROXY_IP:7890&quot;)<br>
                   modparam(&quot;nathelper&quot;, &quot;force_socket&quot;,<br>
            &quot;udp:MY_RTPPROXY_IP:7890&quot;)<br>
                   modparam(&quot;nathelper&quot;, &quot;natping_interval&quot;, 89)<br>
                   modparam(&quot;nathelper&quot;, &quot;sipping_from&quot;,<br>
            &quot;sip:1000@MY_OPENSIP_IP&quot;)<br>
<br>
<br>
                   # main request routing logic<br>
<br>
                   route {<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # Sanity Check Section<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>
                          sl_send_reply(&quot;483&quot;, &quot;Too Many Hops&quot;);<br>
                          exit;<br>
                      }<br>
<br>
                      if (msg:len &gt; max_len) {<br>
                          sl_send_reply(&quot;513&quot;, &quot;Message Overflow&quot;);<br>
                          exit;<br>
                      }<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # Record Route Section<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      if (method!=&quot;REGISTER&quot;) {<br>
                          record_route();<br>
                      }<br>
<br>
                      if (method==&quot;BYE&quot; || method==&quot;CANCEL&quot;) {<br>
                          unforce_rtp_proxy();<br>
                      }<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # Loose Route Section<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      if (loose_route()) {<br>
<br>
                          if ((method==&quot;INVITE&quot; || method==&quot;REFER&quot;) &amp;&amp;<br>
                   !has_totag()) {<br>
                              sl_send_reply(&quot;403&quot;, &quot;Forbidden&quot;);<br>
                              exit;<br>
                          }<br>
<br>
                          if (method==&quot;INVITE&quot;) {<br>
<br>
                              if<br>
            (!proxy_authorize(&quot;MY_OPENSIPS_IP&quot;,&quot;subscriber&quot;)) {<br>
                                  proxy_challenge(&quot;MY_OPENSIPS_IP&quot;,&quot;0&quot;);<br>
                                  exit;<br>
                              } else if (!check_from()) {<br>
                                  sl_send_reply(&quot;403&quot;, &quot;Use From=ID&quot;);<br>
                                  exit;<br>
                              }<br>
                              consume_credentials();<br>
<br>
                              if (nat_uac_test(&quot;19&quot;)) {<br>
                                  setflag(6);<br>
                                  force_rport();<br>
                                  fix_nated_contact();<br>
                              }<br>
                              force_rtp_proxy(&quot;l&quot;);<br>
                          }<br>
                          route(1);<br>
                          exit;<br>
                      }<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # Call Type Processing Section<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      if (uri!=myself) {<br>
                          route(4);<br>
                          route(1);<br>
                          exit;<br>
                      }<br>
<br>
                      if (method==&quot;ACK&quot;) {<br>
                          route(1);<br>
                          exit;<br>
                      } else if (method==&quot;CANCEL&quot;) {<br>
                          route(1);<br>
                          exit;<br>
                      } else if (method==&quot;INVITE&quot;) {<br>
                          route(3);<br>
                          exit;<br>
                      } else  if (method==&quot;REGISTER&quot;) {<br>
                          route(2);<br>
                          exit;<br>
                      }<br>
<br>
                      lookup(&quot;aliases&quot;);<br>
                      if (uri!=myself) {<br>
                          route(4);<br>
                          route(1);<br>
                          exit;<br>
                      }<br>
<br>
                      if (!lookup(&quot;location&quot;)) {<br>
                          sl_send_reply(&quot;404&quot;, &quot;User Not Found&quot;);<br>
                          exit;<br>
                      }<br>
<br>
                      route(1);<br>
                   }<br>
<br>
                   route[1] {<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # Default Message Handler<br>
                      #<br>
                              -----------------------------------------------------------------<br>
<br>
                      t_on_reply(&quot;1&quot;);<br>
<br>
                      if (!t_relay()) {<br>
                          if (method==&quot;INVITE&quot; &amp;&amp; isflagset(6)) {<br>
                              unforce_rtp_proxy();<br>
                          };<br>
                          sl_reply_error();<br>
                      }<br>
                   }<br>
<br>
                   route[2] {<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # REGISTER Message Handler<br>
                      #<br>
                              ----------------------------------------------------------------<br>
<br>
                      if (!search(&quot;^Contact:[ ]*\*&quot;) &amp;&amp;<br>
            nat_uac_test(&quot;19&quot;)) {<br>
                          setflag(6);<br>
                          fix_nated_register();<br>
                          force_rport();<br>
                      }<br>
<br>
                      sl_send_reply(&quot;100&quot;, &quot;Trying&quot;);<br>
<br>
                      if (!www_authorize(&quot;MY_OPENSIPS_IP&quot;,&quot;subscriber&quot;)) {<br>
                          www_challenge(&quot;MY_OPENSIPS_IP&quot;,&quot;0&quot;);<br>
                          exit;<br>
                      }<br>
<br>
                      #if (!check_to()) {<br>
                      #    sl_send_reply(&quot;401&quot;, &quot;Unauthorized Loi Ngo&quot;);<br>
                      #    exit;<br>
                      #}<br>
<br>
                      consume_credentials();<br>
<br>
                      if (!save(&quot;location&quot;)) {<br>
                          sl_reply_error();<br>
                      };<br>
                   }<br>
<br>
                   route[3] {<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # INVITE Message Handler<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                        #Drop because error Use From=ID when call. Open<br>
                      #if (!proxy_authorize(&quot;&quot;,&quot;subscriber&quot;)) {<br>
                      #    proxy_challenge(&quot;&quot;,&quot;0&quot;);<br>
                      #    exit;<br>
                      #} else if (!check_from()) {<br>
                      #    sl_send_reply(&quot;403&quot;, &quot;Use From=ID&quot;);<br>
                      #    exit;<br>
                      #}<br>
<br>
                      #consume_credentials();<br>
<br>
                      if (nat_uac_test(&quot;19&quot;)) {<br>
                          setflag(6);<br>
                      }<br>
<br>
                      lookup(&quot;aliases&quot;);<br>
                      if (uri!=myself) {<br>
                          route(4);<br>
                          route(1);<br>
                          exit;<br>
                      }<br>
<br>
                      if (!lookup(&quot;location&quot;)) {<br>
                          sl_send_reply(&quot;404&quot;, &quot;User Not Found&quot;);<br>
                          exit;<br>
                      }<br>
<br>
                      route(4);<br>
                      route(1);<br>
                   }<br>
<br>
                   route[4] {<br>
<br>
                      #<br>
                              -----------------------------------------------------------------<br>
                      # NAT Traversal Section<br>
                      #<br>
                              -----------------------------------------------------------------<br>
<br>
                      if (isflagset(6)) {<br>
                          force_rport();<br>
                          fix_nated_contact();<br>
                          force_rtp_proxy();<br>
                      }<br>
                   }<br>
<br>
                   onreply_route[1] {<br>
<br>
                      if (isflagset(6) &amp;&amp;<br>
            status=~&quot;(180)|(183)|2[0-9][0-9]&quot;) {<br>
                          if (!search(&quot;^Content-Length:[ ]*0&quot;)) {<br>
                              force_rtp_proxy();<br>
                          }<br>
                      }<br>
<br>
                      if (nat_uac_test(&quot;1&quot;)) {<br>
                          fix_nated_contact();<br>
                      }<br>
                   }<br>
<br>
                              ------------------------------------------------------------------------<br>
<br>
                   _______________________________________________<br>
                   Users mailing list<br>
                   <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
            &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>&gt;<br>
            &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
            &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>&gt;&gt;<br>
<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>
                   <br>
<br>
<br>
<br>
<br>
</div></div></blockquote>
<br>
</blockquote></div><br>