<div dir="ltr"><div><div>Hello,<br><br></div>I am using OpenSIPs as a SIP server solution.I just finished a server configuration which permits NAT traversal (I used RTP proxy)(on Debian).<br></div><div>As a SIP client application I am using CSipSimple(Android) (which uses PJSUA as backend solution).<br>
</div><div>The setup works fine and the NAT traversal problem is solved. (I am able to call from a 3G network provider to my wireless LAN-it uses NAT on both sides and it works great).<br></div><div>However sometimes I am getting the 488 Not acceptable here error. Sometimes this error appears even when both of the phones are in the same LAN.<br>
<br></div><div>Also this error appeared when I called from the 3G network operator to my wireless LAN.(when I called from my wireless LAN to the 3G operator it worked fine).<br><br></div><div>The conclusion is that I cannot replicate this error every time.<br>
<br>I know that is a SDP issue.<br><br></div><div>Here is my opensips.cfg</div><div><br>#<br># $Id: nathelper.cfg 9345 2012-10-18 20:24:22Z osas $<br>#<br># simple quick-start config script including nathelper support<br>
<br># This default script includes nathelper support. To make it work<br># you will also have to install Maxim&#39;s RTP proxy. The proxy is enforced<br># if one of the parties is behind a NAT.<br>#<br># If you have an endpoing in the public internet which is known to<br>
# support symmetric RTP (Cisco PSTN gateway or voicemail, for example),<br># then you don&#39;t have to force RTP proxy. If you don&#39;t want to enforce<br># RTP proxy for some destinations than simply use t_relay() instead of<br>
# route(1)<br>#<br># Sections marked with !! Nathelper contain modifications for nathelper<br>#<br># NOTE !! This config is EXPERIMENTAL !<br>#<br># ----------- global configuration parameters ------------------------<br>
<br>debug=5<br>log_stderror=no<br>log_facility=LOG_LOCAL0<br>#log_name=opensips.log<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><br>check_via=no    # (cmd. line: -v)<br>dns=no           # (cmd. line: -r)<br>rev_dns=no      # (cmd. line: -R)<br><br>#port=5060<br>listen=udp:<a href="http://195.95.167.214:8899">195.95.167.214:8899</a><br>#advertised_address=&quot;195.95.167.194&quot;<br>
#advertised_port=5060<br>port=8899<br><br><br>children=4<br><br>disable_tcp=yes<br><br>alias=<a href="http://voip.certsign.ro">voip.certsign.ro</a><br>alias=195.95.167.214<br>#alias=192.168.185.26<br># ------------------ module loading ----------------------------------<br>
<br>#set module path<br>mpath=&quot;/usr/lib/opensips/modules/&quot;<br><br># Uncomment this if you want to use SQL database<br>loadmodule &quot;db_mysql.so&quot;<br><br>loadmodule &quot;sl.so&quot;<br>loadmodule &quot;tm.so&quot;<br>
loadmodule &quot;signaling.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;sipmsgops.so&quot;<br>loadmodule &quot;dialog.so&quot;<br>loadmodule &quot;avpops.so&quot;<br>loadmodule &quot;domain.so&quot;<br>#loadmodule &quot;xlog.so&quot;<br>loadmodule &quot;acc.so&quot;<br><br># Uncomment this if you want digest authentication<br>
# db_mysql.so must be loaded !<br>loadmodule &quot;auth.so&quot;<br>loadmodule &quot;auth_db.so&quot;<br><br># !! Nathelper<br>loadmodule &quot;nathelper.so&quot;<br>loadmodule &quot;rtpproxy.so&quot;<br><br># ----------------- setting module-specific parameters ---------------<br>
<br># -- mi_fifo params --<br>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br><br># -- usrloc params --<br>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   2)<br>modparam(&quot;usrloc&quot;, &quot;db_url&quot;, &quot;mysql://opensips:qwe123@localhost/opensips&quot;)<br>
<br><br># -- auth params --<br># Uncomment if you are using auth module<br>modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, yes)<br>#<br># If you set &quot;calculate_ha1&quot; parameter to yes (which true in this config),<br>
# uncomment also the following parameter)<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:qwe123@localhost/opensips&quot;)<br>
modparam(&quot;auth_db&quot;, &quot;load_credentials&quot;, &quot;&quot;)<br><br>db_default_url=&quot;mysql://opensips:qwe123@localhost/opensips&quot;<br><br><br>#<br># !! Nathelper<br>#<br>modparam(&quot;usrloc&quot;, &quot;nat_bflag&quot;, 6)<br>
modparam(&quot;nathelper&quot;, &quot;ping_nated_only&quot;, 1) # Ping only clients behind NAT<br>modparam(&quot;nathelper&quot;, &quot;sipping_bflag&quot;, 8)<br>modparam(&quot;nathelper&quot;, &quot;received_avp&quot;, &quot;$avp(i:801)&quot;)<br>
<br># RTPProxy setup<br>#modparam(&quot;nathelper&quot;, &quot;rtpproxy_sock&quot;, &quot;udp:<a href="http://127.0.0.1:7789">127.0.0.1:7789</a>&quot;)<br>modparam(&quot;nathelper&quot;, &quot;force_socket&quot;, &quot;udp:<a href="http://127.0.0.1:7789">127.0.0.1:7789</a>&quot;)<br>
<br>modparam(&quot;rtpproxy&quot;, &quot;rtpproxy_sock&quot;, &quot;udp:<a href="http://127.0.0.1:7789">127.0.0.1:7789</a>&quot;)<br>modparam(&quot;rtpproxy&quot;, &quot;rtpproxy_autobridge&quot;, 1)<br>modparam(&quot;rtpproxy&quot;, &quot;rtpproxy_timeout&quot;, &quot;0.5&quot;)<br>
modparam(&quot;rtpproxy&quot;, &quot;rtpproxy_retr&quot;, 3)<br><br><br>#<br># ------- dialog --------<br>#**<br>modparam(&quot;dialog&quot;, &quot;db_mode&quot;, 1)<br>modparam(&quot;dialog&quot;, &quot;db_update_period&quot;, 30)<br>
#modparam(&quot;dialog&quot;, &quot;dlg_flag&quot;, 4)<br>modparam(&quot;dialog&quot;, &quot;dlg_match_mode&quot;, 1)<br><br>#<br># --&gt; avpops params -----<br>#**<br>modparam(&quot;avpops&quot;, &quot;avp_table&quot;, &quot;usr_preferences&quot;)<br>
modparam(&quot;avpops&quot;, &quot;use_domain&quot;, 1)<br><br><br><br># ************<br># ----- presence params -----<br>/* uncomment the following lines if you want to enable presence */<br>#modparam(&quot;presencepresence_xml&quot;, &quot;db_url&quot;,<br>
# &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>#modparam(&quot;presence_xml&quot;, &quot;force_active&quot;, 1)<br>#modparam(&quot;presence&quot;, &quot;server_address&quot;, &quot;sip:localhost:5060&quot;)<br>
<br><br># -------------------------  request routing logic -------------------<br><br># main routing logic<br><br>route{<br>        # initial sanity checks -- messages with<br>        # max_forwards==0, or excessively long requests<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;=  2048 ) {<br>                sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;);<br>
                exit;<br>        };<br><br>        # !! Nathelper<br>        # Special handling for NATed clients; first, NAT test is<br>        # executed: it looks for via!=received and RFC1918 addresses<br>        # in Contact (may fail if line-folding is used); also,<br>
        # the received test should, if completed, should check all<br>        # vias for rpesence of received<br>        #if (nat_uac_test(&quot;3&quot;)) {<br>                # Allow RR-ed requests, as these may indicate that<br>
                # a NAT-enabled proxy takes care of it; unless it is<br>                # a REGISTER<br><br>                if (is_method(&quot;REGISTER&quot;) || !is_present_hf(&quot;Record-Route&quot;)) {<br>                        log(&quot;LOG:Someone trying to register from private IP, rewriting\n&quot;);<br>
                        # This will work only for user agents that support symmetric<br>                        # communication. We tested quite many of them and majority is<br>                        # smart enough to be symmetric. In some phones it takes a<br>
                        # configuration option. With Cisco 7960, it is called<br>                        # NAT_Enable=Yes, with kphone it is called &quot;symmetric media&quot; and<br>                        # &quot;symmetric signalling&quot;.<br>
<br>                        # Rewrite contact with source IP of signalling<br>                        fix_nated_contact();<br>                        if ( is_method(&quot;INVITE&quot;) ) {<br>                                log(&quot;@DEBUG:FIX SDP&quot;);<br>
                                fix_nated_sdp(&quot;2&quot;); # Add direction=active to SDP<br>                        };<br>                        force_rport(); # Add rport parameter to topmost Via<br>                        setbflag(6);    # Mark as NATed<br>
<br>                        # if you want sip nat pinging<br>                        # setbflag(8);<br>                };<br>        #};<br><br>        # subsequent messages withing a dialog should take the<br>        # path determined by record-routing<br>
        if (loose_route()) {<br>                # mark routing logic in request<br>                append_hf(&quot;P-hint: rr-enforced\r\n&quot;);<br>                route(1);<br>                exit;<br>        };<br> # we record-route all messages -- to make sure that<br>
        # subsequent messages will go through our proxy; that&#39;s<br>        # particularly good if upstream and downstream entities<br>        # use different transport protocol<br>        if (!is_method(&quot;REGISTER&quot;))<br>
                record_route();<br><br>        if (!uri==myself) {<br>                # mark routing logic in request<br>                append_hf(&quot;P-hint: outbound\r\n&quot;);<br>                route(1);<br>                exit;<br>
        };<br><br>        # if the request is for other domain use UsrLoc<br>        # (in case, it does not work, use the following command<br>        # with proper names and addresses in it)<br>        if (uri==myself) {<br>
<br>                if (is_method(&quot;REGISTER&quot;)) {<br><br>                        # Uncomment this if you want to use digest authentication<br>                        #if (!www_authorize(&quot;<a href="http://siphub.org">siphub.org</a>&quot;, &quot;subscriber&quot;)) {<br>
                        #       www_challenge(&quot;<a href="http://siphub.org">siphub.org</a>&quot;, &quot;0&quot;);<br>                        #       return;<br>                        #};<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><br>                # native SIP destinations are handled using our USRLOC DB<br>                if (!lookup(&quot;location&quot;)) {<br>
                        sl_send_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>                        exit;<br>                };<br>        };<br>        append_hf(&quot;P-hint: usrloc applied\r\n&quot;);<br>        log(&quot;@DEBUG:LINE BEFORE ROUTE[1]&quot;);<br>
        route(1);<br>}<br><br>route[1]<br>{<br>        # !! Nathelper<br>        if (uri=~&quot;[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)&quot; &amp;&amp; !search(&quot;^Route:&quot;)){<br>               sl_send_reply(&quot;479&quot;, &quot;We don&#39;t forward to private IP addresses&quot;);<br>
                exit;<br>        };<br><br>        # if client or server know to be behind a NAT, enable relay<br>        if (isbflagset(6)){<br><br>                if (is_method(&quot;INVITE&quot;)) {<br>                        log(&quot;@DEBUG:INVITE METHOD&quot;);<br>
                        if (has_body(&quot;application/sdp&quot;)) {<br>                                log(&quot;@DEBUG:application/sdp&quot;);<br>                                if (rtpproxy_offer(&quot;195.95.167.214&quot;)) {<br>
                                        t_on_reply(&quot;2&quot;);<br>                                        log(&quot;@DEBUG:RTP PROXY OFFER&quot;);<br>                                        }<br>                } else {<br>
                        t_on_reply(&quot;3&quot;);<br>                }<br>    }<br>    if (is_method(&quot;ACK&quot;) &amp;&amp; has_body(&quot;application/sdp&quot;))<br>        rtpproxy_answer();<br>        };<br><br>        # NAT processing of replies; apply to all transactions (for example,<br>
        # re-INVITEs from public to private UA are hard to identify as<br>        # NATed at the moment of request processing); look at replies<br>        t_on_reply(&quot;1&quot;);<br><br>        # send it out now; use stateful forwarding as it works reliably<br>
        # even for UDP2TCP<br>        if (!t_relay()) {<br>                sl_reply_error();<br>        };<br>}<br><br># !! Nathelper<br>onreply_route[1] {<br>        # NATed transaction ?<br>        if (isbflagset(6) &amp;&amp; status =~ &quot;(183)|2[0-9][0-9]&quot;) {<br>
                fix_nated_contact();<br>                rtpproxy_answer();<br>        # otherwise, is it a transaction behind a NAT and we did not<br>        # know at time of request processing ? (RFC1918 contacts)<br>        } else if (nat_uac_test(&quot;1&quot;)) {<br>
                fix_nated_contact();<br>        };<br>}<br>onreply_route[2]<br>{<br><br>    if (has_body(&quot;application/sdp&quot;))<br>        rtpproxy_answer(&quot;195.95.167.214&quot;);<br>}<br><br>onreply_route[3]<br>
{<br><br>    if (has_body(&quot;application/sdp&quot;))<br>        rtpproxy_offer(&quot;195.95.167.214&quot;);<br>}<br><br><br><br>
<div>Please help me.<br>
<br>
</div>Thank you very much,<br><br></div><div>Chifor Bogdan<br></div></div>