<div dir="ltr">Dear Bogdan,<br><br>Kindly note that I did what you asked for...It seems that I still have the same issue...The OpenSIPS replied to INVITE packet where the IN field still the PSTN gateway IP instead of OpenSIPS IP....Please check my config file below:<br>
<br>#<br># $Id: openser.cfg 3284 2007-12-06 18:56:59Z bogdan_iancu $<br>#<br># OpenSER basic configuration script<br>#     by Anca Vamanu &lt;<a href="mailto:anca@voice-system.ro">anca@voice-system.ro</a>&gt;<br>#<br># Please refer to the Core CookBook at <a href="http://www.openser.org/dokuwiki/doku.php">http://www.openser.org/dokuwiki/doku.php</a><br>
# for a explanation of possible statements, functions and parameters.<br>#<br><br><br>####### Global Parameters #########<br><br>debug=7<br>log_stderror=yes<br>log_facility=LOG_LOCAL7<br><br>#fork=yes<br>fork=yes<br>children=4<br>
<br>##NATING OPTIONS<br>check_via=yes<br>dns=no<br>rev_dns=no<br><br>/* uncomment the following lines to enable debugging */<br>#debug=6<br>#fork=no<br>#log_stderror=yes<br><br>/* uncomment the next line to disable TCP (default on) */<br>
#disable_tcp=no<br><br>/* uncomment the next line to enable the auto temporary blacklisting of<br>   not available destinations (default disabled) */<br>#disable_dns_blacklist=no<br><br>/* uncomment the next line to enable IPv6 lookup after IPv4 dns<br>
   lookup failures (default disabled) */<br>#dns_try_ipv6=yes<br><br>/* uncomment the next line to disable the auto discovery of local aliases<br>   based on revers DNS on IPs (default on) */<br>#auto_aliases=no<br><br>#OpenSer Config<br>
alias=<a href="http://domain.net">domain.net</a><br><br>/<br><br>/* uncomment and configure the following line if you want openser to<br>   bind on a specific interface/port/proto (default bind on all available) */<br>listen=udp:<a href="http://sip.domain.net:5060">sip.domain.net:5060</a><br>
<br><br><br>####### Modules Section ########<br><br>#set module path<br>mpath=&quot;/usr/local/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;group.so&quot;<br>loadmodule &quot;nathelper.so&quot;<br>loadmodule &quot;avpops.so&quot;<br>
loadmodule &quot;carrierroute.so&quot;<br>#loadmodule &quot;xcap_client.so&quot;<br><br>/* uncomment next lines for MySQL based authentication support<br>   NOTE: a DB (like mysql) module must be also loaded */<br>loadmodule &quot;auth.so&quot;<br>
loadmodule &quot;auth_db.so&quot;<br>/* uncomment next line for aliases support<br>   NOTE: a DB (like mysql) module must be also loaded */<br>loadmodule &quot;alias_db.so&quot;<br>/* uncomment next line for multi-domain support<br>
   NOTE: a DB (like mysql) module must be also loaded<br>   NOTE: be sure and enable multi-domain support in all used modules<br>         (see &quot;multi-module params&quot; section ) */<br><br><br><br># ----------------- setting module-specific parameters ---------------<br>
<br><br># ---- ACC params # CHANGE BACK ENABLE THE BELOW<br><br><br>modparam(&quot;acc&quot;, &quot;db_url&quot;, &quot;mysql://username:passwd@DB_IP/opensips&quot;)<br>modparam(&quot;acc&quot;, &quot;acc_from_tag_column&quot;, &quot;from_tag&quot;)<br>
modparam(&quot;acc&quot;, &quot;acc_to_tag_column&quot;, &quot;to_tag&quot;)<br>modparam(&quot;acc&quot;, &quot;db_flag&quot;, 2)<br>modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 6)<br>modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, 7)<br>
modparam(&quot;acc&quot;, &quot;report_cancels&quot;,     0)<br>modparam(&quot;acc&quot;, &quot;report_ack&quot;,         0)<br>modparam(&quot;acc&quot;, &quot;early_media&quot;,        0)<br>modparam(&quot;acc&quot;, &quot;log_level&quot;,          0)<br>
modparam(&quot;acc&quot;, &quot;log_flag&quot;,           1)<br>modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;,    0)<br>modparam(&quot;acc&quot;, &quot;log_extra&quot;, &quot;src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd&quot;)<br>
modparam(&quot;acc&quot;, &quot;db_extra&quot;, &quot;src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd&quot;)<br><br><br><br><br><br><br># ----------------- setting module-specific parameters ---------------<br>#######Carrier Route<br>
modparam(&quot;carrierroute&quot;, &quot;db_url&quot;, &quot;mysql://username:passwd@DB_IP/opensips&quot;)<br>modparam(&quot;carrierroute&quot;, &quot;config_source&quot;, &quot;db&quot;)<br><br><br><br><br># ------- Group Module<br>
modparam(&quot;group&quot;, &quot;db_url&quot;, &quot;mysql://username:passwd@DB_IP/opensips&quot;)<br><br><br><br># ---- alias params<br><br>#modparam(&quot;alias_db&quot;, &quot;db_url&quot;, &quot;mysql://user:passwd@localhost/openser&quot;)<br>
modparam(&quot;alias_db&quot;, &quot;db_url&quot;, &quot;mysql://username:passwd@DB_IP/opensips&quot;)<br>modparam(&quot;alias_db&quot;, &quot;use_domain&quot;, 0)<br><br><br># ----- mi_fifo params -----<br>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br>
<br><br># ----- rr params -----<br># add value to ;lr param to cope with most of the UAs<br>modparam(&quot;rr&quot;, &quot;enable_full_lr&quot;,1)<br># do not append from tag to the RR (no need for this script)<br>modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 0)<br>
<br><br># ----- rr params -----<br>modparam(&quot;registrar&quot;, &quot;method_filtering&quot;, 1)<br>modparam(&quot;registrar&quot;, &quot;default_expires&quot;, 1800)<br><br>/* uncomment the next line to disable parallel forking via location */<br>
/* uncomment the next line not to allow more than 10 contacts per AOR */<br>modparam(&quot;registrar&quot;, &quot;max_contacts&quot;, 10)<br><br><br># ----- uri_db params -----<br>/* by default we disable the DB support in the module as we do not need it<br>
   in this configuration */<br>modparam(&quot;uri_db&quot;, &quot;use_uri_table&quot;, 0)<br>modparam(&quot;uri_db&quot;, &quot;db_url&quot;, &quot;mysql://username:passwd@DB_IP/opensips&quot;)<br><br><br><br><br># ----- usrloc params -----<br>
modparam(&quot;usrloc&quot;, &quot;timer_interval&quot;, 10)<br>modparam(&quot;usrloc&quot;, &quot;db_mode&quot;, 2)<br>modparam(&quot;usrloc&quot;, &quot;db_url&quot;,&quot;mysql://username:passwd@DB_IP/opensips&quot;)<br>
<br><br><br><br># ----- auth_db params -----<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;use_domain&quot;, 0)<br>
modparam(&quot;auth_db&quot;, &quot;db_url&quot;,&quot;mysql://username:passwd@DB_IP/opensips&quot;)<br><br><br><br>modparam(&quot;usrloc&quot;, &quot;db_url&quot;,&quot;mysql://username:passwd@DB_IP/opensips&quot;)<br><br>
<br><br>####### AVPOPS Section<br>modparam(&quot;avpops&quot;,&quot;avp_url&quot;,&quot;mysql://username:passwd@DB_IP/opensips&quot;)<br>modparam(&quot;avpops&quot;,&quot;avp_table&quot;,&quot;usr_preferences&quot;)<br><br>
<br><br><br>modparam(&quot;usrloc&quot;, &quot;nat_bflag&quot;, 6)<br><br><br>modparam(&quot;nathelper&quot;, &quot;rtpproxy_sock&quot;, &quot;udp:<a href="http://127.0.0.1:7890">127.0.0.1:7890</a>&quot;)<br>modparam(&quot;nathelper&quot;, &quot;natping_interval&quot;, 30)<br>
modparam(&quot;nathelper&quot;, &quot;ping_nated_only&quot;, 1)<br>modparam(&quot;nathelper&quot;, &quot;sipping_bflag&quot;, 7)<br>modparam(&quot;nathelper&quot;, &quot;sipping_from&quot;, &quot;sip:pinger@OpenSIPS_IP&quot;)<br>
<br><br><br><br>modparam(&quot;registrar&quot;, &quot;received_avp&quot;, &quot;$avp(i:42)&quot;)<br>modparam(&quot;nathelper&quot;, &quot;received_avp&quot;, &quot;$avp(i:42)&quot;)<br><br><br><br><br># -------------------------  request routing logic --------------#<br>
####### Routing Logic ########<br><br><br>route<br>{<br>        if(!mf_process_maxfwd_header(&quot;10&quot;)){<br>                sl_send_reply(&quot;486&quot;, &quot;To Many Hops&quot;);<br>                return;<br>        }<br>
<br>        if(msg:len &gt;= max_len){<br>                sl_send_reply(&quot;513&quot;, &quot;Message To Big&quot;);<br>                return;<br>        }<br><br>        # NAT detection<br>        route(3);<br><br><br>
        if(!is_method(&quot;REGISTER&quot;)){<br>                record_route();<br>        }<br><br><br>if (is_method(&quot;INVITE&quot;)) {<br>                setflag(4); # do accounting<br>        }<br><br><br>        <br>
<br>if (is_method(&quot;OPTIONS&quot;) &amp;&amp; uri==myself &amp;&amp; $rU==NULL ) {<br>        sl_send_reply(&quot;200&quot;,&quot;OK&quot;);<br>        exit;<br>  }<br><br>if( uri == myself )<br>{<br><br>  if(is_method(&quot;REGISTER&quot;)){<br>
<br><br><br><br><br>                         if (is_user_in(&quot;From&quot;, &quot;blocked&quot;)) {<br>                          sl_send_reply(&quot;403&quot;, &quot;Unauthorized, account is disabled&quot;);<br>                          exit();<br>
                          }<br><br><br><br><br>                        if(!www_authorize(&quot;<a href="http://domain.net">domain.net</a>&quot;, &quot;subscriber&quot;)){<br>                                www_challenge(&quot;<a href="http://domain.net">domain.net</a>&quot;, &quot;1&quot;);<br>
                                return;<br>                        }<br><br>                          if (isflagset(5))<br>                          {<br>                          <br>                          setbflag(6);<br>
                          # if you want OPTIONS natpings uncomment next<br>                          # setbflag(7);<br>                          };<br><br>                         save(&quot;location&quot;);<br><br><br><br>
                }<br><br>}<br><br><br>                alias_db_lookup(&quot;dbaliases&quot;);<br><br><br>                <br><br><br><br><br><br>             if($rU =~ &quot;^00.*&quot;)<br>                {<br><br><br>if(!cr_route(&quot;default&quot;, &quot;0&quot;, &quot;$rU&quot;, &quot;$rU&quot;, &quot;call_id&quot;)){<br>
       sl_send_reply(&quot;403&quot;, &quot;Not allowed&quot;);<br>     } else {<br>         # In cas of failure, re-route the request<br>          t_on_failure(&quot;1&quot;);<br> t_on_reply(&quot;1&quot;);<br>force_rtp_proxy();<br>
t_relay();<br>  }<br><br><br><br><br>                }<br><br><br><br>                if(does_uri_exist()){<br>                        # local uri does exist, is probably a user.<br>                        xlog(&quot;L_INFO&quot;,&quot;User Exists&quot;);<br>
<br>                        # lookup location<br>                        if(lookup(&quot;location&quot;)){<br>                        xlog(&quot;L_INFO&quot;,&quot;User Online&quot;);<br>                        route(1);<br>
                        return;<br><br>                        }<br>                        else<br>                        {<br><br>if(src_ip!=OS2_IP)<br>                             {<br>                              #Diverting to Server 2<br>
xlog(&quot;L_INFO&quot;,&quot;REDIRECCTING TO SERVER 2&quot;);<br>                              rewritehost(&quot;OS2_IP&quot;);<br>                              route(1);<br>                             }<br>                             else<br>
                             {<br>                             sl_send_reply(&quot;404&quot;, &quot;OK&quot;);<br>                             exit;<br><br>                             }<br><br>                        }<br>
        }#end of URI Found IF<br>        else<br>        {<br><br>        if(!is_method(&quot;REGISTER&quot;)){<br><br><br><br>        return;<br>        }<br><br>        }<br>}<br><br><br><br><br>route[1] {<br><br><br><br>
<br>        if (is_method(&quot;INVITE&quot;)) {<br>                t_on_branch(&quot;2&quot;);<br>                t_on_reply(&quot;2&quot;);<br>                t_on_failure(&quot;1&quot;);<br>        }<br><br><br>         if (subst_uri(&#39;/(sip:.*);nat=yes/\1/&#39;)){<br>
            setbflag(6);<br>         };<br><br>if (method==&quot;BYE&quot; || method==&quot;CANCEL&quot;) {<br>route(4);<br>};<br><br><br><br><br><br>         if(isflagset(5)||isbflagset(6)) {<br>         route(4);<br>         }<br>
<br>        if (!t_relay()) {<br>                sl_reply_error();<br>        };<br>        exit;<br>}<br><br><br><br><br>  <br><br><br><br>route[3]{<br>         force_rport();<br>         if (nat_uac_test(&quot;19&quot;)) {<br>
             if (method==&quot;REGISTER&quot;) {<br>              fix_nated_register();<br>              } else {<br>             fix_nated_contact();<br>             };<br>         setflag(5);<br>         };<br>}<br><br>
<br><br>route[4] {<br><br><br>         if (is_method(&quot;BYE&quot;)) {<br>             unforce_rtp_proxy();<br>          } else if (is_method(&quot;INVITE&quot;)){<br>          force_rtp_proxy();<br>          t_on_failure(&quot;2&quot;);<br>
          };<br><br>           if (isflagset(5))<br>           search_append(&#39;Contact:.*sip:[^&gt;[:cntrl:]]*&#39;, &#39;;nat=yes&#39;);<br>           t_on_reply(&quot;1&quot;);<br>           }<br><br><br><br>        branch_route[2] {<br>
        xlog(&quot;new branch at $ru\n&quot;);<br>}<br><br><br>onreply_route[2] {<br>        xlog(&quot;incoming reply\n&quot;);<br>}<br><br><br>failure_route[1] {<br>        if (t_was_cancelled()) {<br>                exit;<br>
        }<br><br><br>}<br><br>failure_route[2] {<br>   if (isbflagset(6) || isflagset(5)) {<br>   unforce_rtp_proxy();<br>   }<br>}<br><br><br><br>onreply_route[1] {<br>  if (t_check_status(&quot;2[0-9][0-9]&quot;)) {<br>
        force_rtp_proxy();<br>  }<br>exit;<br>}<br><br><br>I need advice please<br><br>Regards<br><br><div class="gmail_quote">On Fri, Feb 27, 2009 at 3:04 PM, michel freiha <span dir="ltr">&lt;<a href="mailto:michofr@gmail.com">michofr@gmail.com</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;"><div dir="ltr">Thanks Bogdan...I&#39;ll check this and get back to you<br><br>Regards<div><div>
</div><div class="h5"><br><br><div class="gmail_quote">On Fri, Feb 27, 2009 at 1:34 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@voice-system.ro" target="_blank">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 michel,<br>
<br>
Should do something like:<div><br>
<br>
if(!cr_route(&quot;default&quot;, &quot;0&quot;, &quot;$rU&quot;, &quot;$rU&quot;, &quot;call_id&quot;)){<br>
     sl_send_reply(&quot;403&quot;, &quot;Not allowed&quot;);<br>
   } else {<br>
       # In cas of failure, re-route the request<br>
        t_on_failure(&quot;1&quot;);<br></div>
        t_on_reply(&quot;1&quot;);<div><br>
        force_rtp_proxy();<br>
        t_relay();<br>
}<br>
<br>
<br></div>
onreply_route[1] {<br>
   if (t_check_status(&quot;2[0-9][0-9]&quot;)) {<br>
         force_rtp_proxy();<br>
   }<br>
}<br>
<br>
See : <a href="http://www.opensips.org/index.php?n=Resources.DocsCoreRoutes#toc4" target="_blank">http://www.opensips.org/index.php?n=Resources.DocsCoreRoutes#toc4</a><div><br>
<br>
Regards,<br>
Bogdan<br>
<br>
michel freiha 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>
Dear Bogdan,<br>
<br>
Do you mean doing something like that?<br>
<br>
if(!cr_route(&quot;default&quot;, &quot;0&quot;, &quot;$rU&quot;, &quot;$rU&quot;, &quot;call_id&quot;)){<br>
       sl_send_reply(&quot;403&quot;, &quot;Not allowed&quot;);<br>
     } else {<br>
         # In cas of failure, re-route the request<br>
          t_on_failure(&quot;1&quot;);<br>
<br>
force_rtp_proxy();<br>
          t_relay();<br>
route(2) ;<br>
}<br>
<br>
<br>
Please let me know how can I force it on route2 for the 200OK reply<br>
<br>
Thanks Bogdan<br>
<br>
<br></div><div>
On Fri, Feb 27, 2009 at 11:54 AM, Bogdan-Andrei Iancu &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>
    Hi Michel,<br>
<br>
    You have to call twice force_rtp_proxy() in order to complete the<br>
    RTP session (and have RTP flowing). First for the INVITE (as you<br>
    already do) and second for the 200 OK reply.<br>
<br>
    So install a onreply_route and if the reply is 200 OK, call again<br>
    force_rtp_proxy.<br>
<br>
    Regards,<br>
    Bogdan<br>
<br>
    michel freiha wrote:<br>
<br>
        Dear All,<br>
<br>
        I need to make all my rtp traffic through OpenSips to pass<br>
        through rtp proxy...I have the following route:<br>
<br>
<br>
        if(!cr_route(&quot;default&quot;, &quot;0&quot;, &quot;$rU&quot;, &quot;$rU&quot;, &quot;call_id&quot;)){<br>
              sl_send_reply(&quot;403&quot;, &quot;Not allowed&quot;);<br>
            } else {<br>
                # In cas of failure, re-route the request<br>
                 t_on_failure(&quot;1&quot;);<br>
        force_rtp_proxy();<br>
                 t_relay();<br>
          }<br>
        The call is working fine but with no audio...How can i fix<br>
        this issue in order to have 2 way audio through rtpproxy?<br>
<br>
        Regards<br>
        ------------------------------------------------------------------------<br>
<br>
        _______________________________________________<br>
        Users mailing list<br></div>
        <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> &lt;mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>&gt;<div><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>
</div></blockquote>
<br>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>