<div dir="ltr"><div>Hi. Please help.<br><span id="result_box" class="" lang="en"><span class="">We have:</span></span><br><span id="result_box" class="" lang="en"><span class="">One MGW: Cisco AS5350<br></span></span></div>
<span id="result_box" class="" lang="en"><span class="">UserID=</span></span><span id="result_box" class="" lang="en"><span class="">telephone number and </span></span><span id="result_box" class="" lang="en"><span class="">registration on OpenSips </span></span><span id="result_box" class="" lang="en"><span class="">through MySQL<br>

</span></span><span id="result_box" class="" lang="en"><span class="">Call to</span> <span class="">PSTN</span> <span class="">pass through</span> <span class="">MGW</span> <span class="">with prefix</span> <span class="">9999:</span></span><br>
<span id="result_box" class="" lang="en"><span class=""><br>Now, such a scheme works:<br>
<br>
(UAC       )----&gt;sip-----&gt;Opensips 1.7---&gt;SIP---&gt;MGW Cisco<br>85.85.85.95               85.85.85.85                 85.85.85.11<br>RTP-----------------------------------------------------------&gt;MGW Cisco--------&gt;PSTN<br>
<br></span></span><span id="result_box" class="" lang="en"><span class="">Here is
        an example</span> <span class="">CFG-</span><span class="">file that</span> <span class="">works now</span><span class="">:</span> <br class="">
      <span class="">The message</span> <span class="">&quot;</span><span class="">183</span><span class="">&quot;</span> <span class="">prefix
        and</span> <span class="">visible</span> <span class="">IP</span>
      <span class="">gateway.</span> <span class="">And that
        could</span> <span class="">be a threat</span> <span class="">of fraud</span><span class="">.</span> <br class="">
      <span class="">Here:</span> <span class="">if you use the</span>
      <span class="">function</span> <span class="">topology_hiding
        ();</span> <span class="">it</span> <span class="">does
        not happen</span> <span class="">a fair exchange</span><span class="">:</span> <br class="">
      <span class=""></span></span><span id="result_box" class="" lang="en"><span class="">&quot;BYE&quot;</span> <span class="">comes</span>
      <span class="">to the message</span> <span class="">&quot;404</span><span class="">&quot;, &quot;Not here&quot;</span> <span class="">rather than
        &quot;</span><span class="">200</span> <span class="">OK&quot;</span>
      <br class="">
      <span class="">I use</span> <span class="">client_nat_test</span>
      <span class="">to</span> <span class="">cut off</span> <span class="">all requests for</span> <span class="">registration</span>
      <span class="">are NAT</span><span class=""></span></span><span id="result_box" class="" lang="en"><span class=""><span id="result_box" class="" lang="en"><span class="">, but</span>
          <span class="">it does not work</span></span>!<br>
        <br>
        
      </span></span>port=5060<br>
    listen=udp:<a href="http://85.85.85.85:5060">85.85.85.85:5060</a> #Opensips-server<br>
    route{<br>
    if (has_totag()) {<br>
        if (loose_route()) {<br>
        if (is_method(&quot;BYE&quot;)) {<br>
        setflag(1);<br>
        setflag(3);}<br>
        else if (is_method(&quot;INVITE&quot;)) {<br>
        #topology_hiding();<br>
        record_route();    }<br>
        route(1);}<br>
        else {<br>
        if ( is_method(&quot;ACK&quot;) ) {<br>
        if ( t_check_trans() ) {<br>
        t_relay();<br>
        exit;}<br>
        else {<br>
        exit;<br>
        }}<br>
        sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>
        }<br>
        exit;<br>
    }<br>
    <br>
    #initial requests<br>
    if (is_method(&quot;CANCEL&quot;)){<br>
    if (t_check_trans())<br>
    t_relay();<br>
    exit;}<br>
    <br>
    t_check_trans();<br>
    <br>
    # authenticate if from local subscriber (uncomment to enable auth)<br>
    # authenticate all initial non-REGISTER request that pretend to be<br>
    # generated by local subscriber (domain from FROM URI is local)<br>
    <br>
    if (!(method==&quot;REGISTER&quot;) &amp;&amp; from_uri==myself) #/*no
    multidomain version*/<br>
    {if (!proxy_authorize(&quot;&quot;, &quot;subscriber&quot;)) <br>
    {proxy_challenge(&quot;&quot;, &quot;0&quot;);<br>
    exit;}<br>
    if (!db_check_from()) <br>
    {sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>
    exit;}<br>
    consume_credentials();<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;))    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;)) record_route();<br>
    <br>
    # account only INVITEs    if (is_method(&quot;INVITE&quot;))<br>
    {<br>
    # if (!src_ip==&quot;85.85.85.11&quot;) #CISCO MGW IP<br>
    #{<br>
    #        topology_hiding();<br>
    #        }<br>
    setflag(1); # do accounting<br>
    }<br>
    <br>
    if (!uri==myself)    ## replace with following line if multi-domain
    support is used<br>
    {<br>
    route(1);}<br>
    <br>
    # requests for my domain<br>
    if (is_method(&quot;PUBLISH&quot;)){<br>
    sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>
    exit;}<br>
    <br>
    if (is_method(&quot;REGISTER&quot;)){<br>
    #        if(client_nat_test(&quot;3&quot;))<br>
    #        {<br>
    #            sl_send_reply(&quot;403&quot;, &quot;Not working NAT&quot;);<br>
    #            exit;<br>
    #        }<br>
    <br>
    # authenticate the REGISTER requests (uncomment to enable auth)<br>
    if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;))    {<br>
    www_challenge(&quot;&quot;, &quot;0&quot;);<br>
    exit;}<br>
    if (!db_check_to()) {<br>
    sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>
    exit;}<br>
    if (!save(&quot;location&quot;))<br>
    sl_reply_error();<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 ((src_ip==&quot;85.85.85.11&quot;) &amp;&amp; (!lookup(&quot;location&quot;)))<br>
    {<br>
    switch ($retcode) {<br>
    case -1:<br>
    case -3:<br>
    t_newtran();<br>
    t_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>
    exit;<br>
    case -2:<br>
    sl_send_reply(&quot;405&quot;, &quot;Method Not Allowed&quot;);<br>
    exit;<br>
    }}<br>
    <br>
    # when routing via usrloc, log the missed calls also<br>
    setflag(2);<br>
    <br>
    if (src_ip==&quot;85.85.85.11&quot;) {<br>
    route(1);}<br>
    route(3);<br>
    }<br>
    <br>
    route[1] {<br>
    # for INVITEs enable some additional helper routes<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>
    if (!t_relay()) {<br>
    sl_reply_error();};<br>
    exit;}<br>
    ####################################################<br>
    route[3] {<br>
    prefix(&quot;9999&quot;);<br>
    rewritehostport(&quot;<a href="http://85.85.85.11:5060">85.85.85.11:5060</a>&quot;);<br>
    if (!t_relay()) {<br>
    sl_reply_error();<br>
    };exit;<br>
    }<br>
    ####################################################<br>
    branch_route[2] { xlog(&quot;new branch at $ru\n&quot;);}<br>
    onreply_route[2] { xlog(&quot;incoming reply\n&quot;); }<br>
    <br>
    failure_route[1] {<br>
    if (t_was_cancelled()) {exit;}}<br><br><br>It&#39;s not safe, it&#39;s necessary to build a new wiring diagram:<br>
(UAC      )---&gt;sip,RTP----&gt;(Opensips---&gt;rtp,SIP------&gt;)-----&gt;MGW Cisco---&gt;PSTN<br>
85.85.85.95                    (85.85.85.85   192.168.0.2)      192.168.0.3<br>
<br>
questions:<br>
1. to hide the network topology from the users (can be used dialog module, function: topology_hiding?)<br>
2. hide RTP traffic to MGW for Opensips-server (can be used MediaProxy or rtpproxy)?<br>3. <span id="result_box" class="" lang="en"><span class="">Cut off</span> <span class="">all</span> <span class="">who</span> <span class="">are NAT!!!</span></span><br>

Please, give examples opensips.cfg-file ?<br></div>