Ignacio,<div><br></div><div>Your configuration script heavily depends on your network setup:</div><div><br></div><div>1- Is your proxy server behind a nat? If so, do you know your public IP address?</div><div>2- Are you using rtp proxy? What&#39;s the path for your rtp - through what devices with what IPs?</div>
<div><br></div><div><br></div><div><div class="gmail_quote">On Tue, Aug 7, 2012 at 2:53 PM, Ignacio Gonzalez <span dir="ltr">&lt;<a href="mailto:mylaneza@gmail.com" target="_blank">mylaneza@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ali, I use this configuration script to start my opensips proxy and it start, I only want to know, Do you see something wrong?<br>
I put in bold the modifications a made to add the nat_traversal module and the advertised_address parameter.<br>
<br>In the documentation it says that nat_traversal is straight forward when using a single proxy, ( that is my case ).<br><br>&quot;In this case the usage is straight forward. The nat_keepalive() function
        needs to be called before save_location() for REGISTER requests, before
        handle_subscribe() for SUBSCRIBE requests and before t_relay() for the
        first INVITE of a dialog.
&quot;<br><br>I do not configure any subscription, and I did not find the save_location function, I assumed that save(&quot;location&quot;) is a newer version of this function.<br><br>#CONFIG FILE<br><br>debug=3<br>log_stderror=no<br>

log_facility=LOG_LOCAL1<br><br>fork=yes<br>children=4<br><br>#debug=6<br>#fork=no<br>#log_stderror=yes<br><br>#disable_dns_blacklist=no<br><br>#dns_try_ipv6=yes<br><br>auto_aliases=no<br><br><b>advertised_address=&quot;<a href="http://mydomain.com" target="_blank">mydomain.com</a>&quot;</b><br>

<br>listen=udp:<a href="http://192.168.1.220:5060" target="_blank">192.168.1.220:5060</a>   # CUSTOMIZE ME<br><br>disable_tcp=no<br>listen=tcp:<a href="http://192.168.1.220:5060" target="_blank">192.168.1.220:5060</a>   # CUSTOMIZE ME <br>
<br>disable_tls=yes<br>
<br>mpath=&quot;/home/syrium/opensips_proxy/lib/opensips/modules/&quot;<br><br>loadmodule &quot;signaling.so&quot;<br><br>loadmodule &quot;sl.so&quot;<br><br>loadmodule &quot;tm.so&quot;<br>modparam(&quot;tm&quot;, &quot;fr_timer&quot;, 5)<br>

modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 30)<br>modparam(&quot;tm&quot;, &quot;restart_fr_on_each_reply&quot;, 0)<br>modparam(&quot;tm&quot;, &quot;onreply_avp_mode&quot;, 1)<br><br>loadmodule &quot;rr.so&quot;<br>

modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 0)<br><br>loadmodule &quot;maxfwd.so&quot;<br><br>loadmodule &quot;sipmsgops.so&quot;<br><br>loadmodule &quot;mi_fifo.so&quot;<br>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br>

modparam(&quot;mi_fifo&quot;, &quot;fifo_mode&quot;, 0666)<br><br>loadmodule &quot;uri.so&quot;<br>modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)<br>modparam(&quot;uri&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;) # CUSTOMIZE ME<br>

<br>loadmodule &quot;db_mysql.so&quot;<br><br>loadmodule &quot;usrloc.so&quot;<br>modparam(&quot;usrloc&quot;, &quot;nat_bflag&quot;, 10)<br>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   2)<br>modparam(&quot;usrloc&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;) # CUSTOMIZE ME<br>

<br>loadmodule &quot;registrar.so&quot;<br>modparam(&quot;registrar&quot;, &quot;tcp_persistent_flag&quot;, 7)<br>modparam(&quot;registrar&quot;, &quot;received_avp&quot;, &quot;$avp(received_nh)&quot;)<br>#modparam(&quot;registrar&quot;, &quot;max_contacts&quot;, 10)<br>

<br>loadmodule &quot;acc.so&quot;<br>modparam(&quot;acc&quot;, &quot;early_media&quot;, 0)<br>modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 0)<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;db_flag&quot;, 1)<br>modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 2)<br>modparam(&quot;acc&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;) # CUSTOMIZE ME<br>

<br>loadmodule &quot;auth.so&quot;<br>loadmodule &quot;auth_db.so&quot;<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;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;) # CUSTOMIZE ME<br>modparam(&quot;auth_db&quot;, &quot;load_credentials&quot;, &quot;&quot;)<br><br>loadmodule &quot;domain.so&quot;<br>

modparam(&quot;domain&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;) # CUSTOMIZE ME<br>modparam(&quot;domain&quot;, &quot;db_mode&quot;, 1)   # Use caching<br>modparam(&quot;auth_db|usrloc|uri&quot;, &quot;use_domain&quot;, 1)<br>

<br>loadmodule &quot;dialog.so&quot;<br>modparam(&quot;dialog&quot;, &quot;dlg_match_mode&quot;, 1)<br>modparam(&quot;dialog&quot;, &quot;default_timeout&quot;, 21600)  # 6 hours timeout<br>modparam(&quot;dialog&quot;, &quot;db_mode&quot;, 2)<br>

modparam(&quot;dialog&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;) # CUSTOMIZE ME<br><br><b>loadmodule &quot;nat_traversal.so&quot;</b><br><br>loadmodule &quot;nathelper.so&quot;<br>

modparam(&quot;nathelper&quot;, &quot;natping_interval&quot;, 10)<br>modparam(&quot;nathelper&quot;, &quot;ping_nated_only&quot;, 1)<br>modparam(&quot;nathelper&quot;, &quot;received_avp&quot;, &quot;$avp(received_nh)&quot;)<br>

<br>loadmodule &quot;rtpproxy.so&quot;<br>modparam(&quot;rtpproxy&quot;, &quot;rtpproxy_sock&quot;, &quot;udp:localhost:12221&quot;) # CUSTOMIZE ME<br><br>####### Routing Logic ########<br><br>route{<br>    force_rport();<br>

    if (nat_uac_test(&quot;23&quot;)) {<br>        if (is_method(&quot;REGISTER&quot;)) {<br>            fix_nated_register();<br>            setbflag(10);<br>        } else {<br>            fix_nated_contact();<br>            setflag(10);<br>

        }<br>    }<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 (has_totag()) {<br>        # sequential request withing a dialog should<br>

        # take the path determined by record-routing<br>        if (loose_route()) {<br>            <br>            # validate the sequential request against dialog<br>            if ( $DLG_status!=NULL &amp;&amp; !validate_dialog() ) {<br>

                xlog(&quot;In-Dialog $rm from $si (callid=$ci) is not valid according to dialog\n&quot;);<br>                ## exit;<br>            }<br>            <br>            if (is_method(&quot;BYE&quot;)) {<br>                setflag(1); # do accounting ...<br>

                setflag(3); # ... even if the transaction fails<br>            } else if (is_method(&quot;INVITE&quot;)) {<br>                # even if in most of the cases is useless, do RR for<br>                # re-INVITEs alos, as some buggy clients do change route set<br>

                # during the dialog.<br>                record_route();<br>            }<br><br>            if (check_route_param(&quot;nat=yes&quot;)) <br>                setflag(10);<br><br>            # route it out to whatever destination was set by loose_route()<br>

            # in $du (destination URI).<br>            route(1);<br>        } else {<br>            <br>            if ( is_method(&quot;ACK&quot;) ) {<br>                if ( t_check_trans() ) {<br>                    # non loose-route, but stateful ACK; must be an ACK after <br>

                    # a 487 or e.g. 404 from upstream server<br>                    t_relay();<br>                    exit;<br>                } else {<br>                    # ACK without matching transaction -&gt;<br>                    # ignore and discard<br>

                    exit;<br>                }<br>            }<br>            sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>        }<br>        exit;<br>    }<br><br>    # CANCEL processing<br>    if (is_method(&quot;CANCEL&quot;))<br>

    {<br>        if (t_check_trans())<br>            t_relay();<br>        exit;<br>    }<br><br>    t_check_trans();<br><br>    if ( !(is_method(&quot;REGISTER&quot;)  ) ) {<br>        <br>        if (is_from_local())<br>

        {<br>            <br>            # authenticate if from local subscriber<br>            # authenticate all initial non-REGISTER request that pretend to be<br>            # generated by local subscriber (domain from FROM URI is local)<br>

            if (!proxy_authorize(&quot;&quot;, &quot;subscriber&quot;)) {<br>                proxy_challenge(&quot;&quot;, &quot;0&quot;);<br>                exit;<br>            }<br>            if (!db_check_from()) {<br>

                sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>                exit;<br>            }<br>        <br>            consume_credentials();<br>            # caller authenticated<br>            <br>

        } else {<br>            # if caller is not local, then called number must be local<br>            <br>            if (!is_uri_host_local()) {<br>                send_reply(&quot;403&quot;,&quot;Rely forbidden&quot;);<br>

                exit;<br>            }<br>        }<br><br>    }<br><br>    # preloaded route checking<br>    if (loose_route()) {<br>        xlog(&quot;L_ERR&quot;, &quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);<br>

        if (!is_method(&quot;ACK&quot;))<br>            sl_send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);<br>        exit;<br>    }<br><br>    # record routing<br>    if (!is_method(&quot;REGISTER|MESSAGE&quot;))<br>

        record_route();<br><br>    # account only INVITEs<br>    if (is_method(&quot;INVITE&quot;)) {<br>        <br>        # create dialog with timeout<br>        if ( !create_dialog(&quot;B&quot;) ) {<br>            send_reply(&quot;500&quot;,&quot;Internal Server Error&quot;);<br>

            exit;<br>        }<br>        <br>        setflag(1); # do accounting<br>    }<br><br>    <br>    if (!is_uri_host_local()) {<br>        append_hf(&quot;P-hint: outbound\r\n&quot;); <br>        <br>        route(1);<br>

    }<br><br>    # requests for my domain<br>    <br>    if (is_method(&quot;PUBLISH|SUBSCRIBE&quot;))<br>    {<br>        sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>        exit;<br>    }<br><br>

    if (is_method(&quot;REGISTER&quot;))<br>    {<br>        <br>        # authenticate the REGISTER requests<br>        if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;))<br>        {<br>            www_challenge(&quot;&quot;, &quot;0&quot;);<br>

            exit;<br>        }<br>        <br>        if (!db_check_to()) <br>        {<br>            sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>            exit;<br>        }<br><br>        if ( proto==TCP ||  0 ) <br>

            setflag(7);<br><br>        <b>if ( client_nat_test(&quot;3&quot;) ) {<br>                nat_keepalive();<br>         }</b><br>        <br>        if (!save(&quot;location&quot;))<br>            sl_reply_error();<br>

<br>        exit;<br>    }<br><br>    if ($rU==NULL) {<br>        # request with no Username in RURI<br>        sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);<br>        exit;<br>    }<br><br>    # do lookup with method filtering<br>

    if (!lookup(&quot;location&quot;,&quot;m&quot;)) {<br>        if (!db_does_uri_exist()) {<br>            send_reply(&quot;420&quot;,&quot;Bad Extension&quot;);<br>            exit;<br>        }<br>        <br>        t_newtran();<br>

        t_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>        exit;<br>    } <br><br>    if ( isbflagset(10) ) <br>        setflag(10);<br><br>    # when routing via usrloc, log the missed calls also<br>    setflag(2);<br>

    route(1);<br>}<br><br><br>route[1] {<br>    # for INVITEs enable some additional helper routes<br>    if (is_method(&quot;INVITE&quot;)) {<br>        <br>        if (isflagset(10)) {<br>            rtpproxy_offer(&quot;ro&quot;);<br>

        }<br><br>        t_on_branch(&quot;2&quot;);<br>        t_on_reply(&quot;2&quot;);<br>        t_on_failure(&quot;1&quot;);<br>        <br>        <b>if ( client_nat_test(&quot;3&quot;) ) {<br>                nat_keepalive();<br>

            }</b><br>        <br>    }<br><br>    if (isflagset(10)) {<br>        add_rr_param(&quot;;nat=yes&quot;);<br>    }<br><br>    <br><br>    if (!t_relay()) {<br>        send_reply(&quot;500&quot;,&quot;Internal Error&quot;);<br>

    };<br>    exit;<br>}<br><br>branch_route[2] {<br>    xlog(&quot;new branch at $ru\n&quot;);<br>}<br><br>onreply_route[2] {<br>    if ( nat_uac_test(&quot;1&quot;) )<br>        fix_nated_contact();<br>    if ( isflagset(10) )<br>

        rtpproxy_answer(&quot;ro&quot;);<br>    xlog(&quot;incoming reply\n&quot;);<br>}<br><br>failure_route[1] {<br>    if ( t_was_cancelled() ) {<br>        exit;<br>    }    <br>}<br><br>local_route {<br>    if (is_method(&quot;BYE&quot;) &amp;&amp; $DLG_dir==&quot;UPSTREAM&quot;) {<br>

        <br>        acc_db_request(&quot;200 Dialog Timeout&quot;, &quot;acc&quot;);<br>        <br>    }<br>}<br><br>Thanks for your time Ali.<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">2012/8/7 Ignacio Gonzalez <span dir="ltr">&lt;<a href="mailto:mylaneza@gmail.com" target="_blank">mylaneza@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok aly, I will read more, i have created the configuration script already with opensips-cp, I created a residential script and I selected the NAT option but that option just install nathelper module, and this why I asked you if nathelper and nat traversal module were mutually exclusive. I will add nat traversal to my configuration script. <div>


<br></div><div>Another question, where can I read about the differences between residential and trunking scripts?<div><div><br><br><div class="gmail_quote">2012/8/7 Ali Pey <span dir="ltr">&lt;<a href="mailto:alipey@gmail.com" target="_blank">alipey@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ignacio,<div><br></div><div>You need to implement nat traversal in your routing script - opensips.cfg. IMO, forget about the opensips-cp until you get it to work. Once you know how it works, then you know how you can do with the config tool. Sounds like you need lots more reading/testing :)</div>



<div><br></div><div>Regards,</div><div>Ali Pey<div><div><br><br><div class="gmail_quote">On Mon, Aug 6, 2012 at 1:38 PM, Ignacio Gonzalez <span dir="ltr">&lt;<a href="mailto:mylaneza@gmail.com" target="_blank">mylaneza@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok, i red the NAT_TRAVERSAL module, i don&#39;t know how to configure using the configuration tool, do I have to configure it manual? The NAT_TRAVERSAL module and the NATHELPER module are mutually exclusive?<div>



<div><br><br><div class="gmail_quote">
2012/8/5 Ali Pey <span dir="ltr">&lt;<a href="mailto:alipey@gmail.com" target="_blank">alipey@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




Hello Ignacio,<div><br></div><div>Yes, you can handle nat and you don&#39;t need stun, turn or ICE. In fact, it&#39;s always better to turn off any nat traversal feature on the phone when you are using a proxy server such as OpenSIPS.</div>





<div><br></div><div>Check out the nat traveral module and advertized_ip. How you implement it depends on your network setup:</div><div><a href="http://www.opensips.org/html/docs/modules/1.8.x/nat_traversal.html" target="_blank">http://www.opensips.org/html/docs/modules/1.8.x/nat_traversal.html</a></div>





<div><br></div><div>Regards,</div><div>Ali Pey </div><div><br><div class="gmail_quote"><div><div>On Sat, Aug 4, 2012 at 5:31 PM, Ignacio Gonzalez <span dir="ltr">&lt;<a href="mailto:mylaneza@gmail.com" target="_blank">mylaneza@gmail.com</a>&gt;</span> wrote:<br>





</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hello everybody, I have configured my opensips proxy with NAT_TRAVERSAL support using the new tool for configuration. I developed a softphone using JAIN-SIP, I think JAIN-SIP does not implements STUN, TURN and ICE for NAT Traversal ( RFC 6314), is any way to do nat traversal without making a new softphone with another library? <br>






<br>I also have tested this softphone with Inphonex, and this company use openSER in its proxy and the softphone works fine, but i don&#39;t know how they do that, so I thought to ask if is something I can do in the configuration file of my proxy or they use something else to solve this problem. <br>






<br>Thanks for all.<br>
<br></div></div>_______________________________________________<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>
<br></blockquote></div><br></div>
<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>
<br></blockquote></div><br>
</div></div><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>
<br></blockquote></div><br></div></div></div>
<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>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">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>
<br></blockquote></div><br></div>