<div dir="ltr">Hi Bogdan. <div>Thanks you for the answer.</div><div>I don't want mislead you.</div><div>I resolve my problem.</div><div>I use <span style="font-family:monospace;font-size:10.4px">uac_replace_from() </span><span style="font-family:monospace;font-size:10.4px">uac_replace_to() fo rewrite to and from headers.</span></div><div><div><font face="monospace"><span style="font-size:10.4px"><br></span></font></div><div><font face="monospace"><span style="font-size:10.4px">i</span></font><span style="font-size:10.4px;font-family:monospace">f(is_method("INVITE"))  {</span></div><div><font face="monospace"><span style="font-size:10.4px">     if (check_address("1","$si","$sp","any","$avp(ctx)")){</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  force_send_socket(udp:<a href="http://10.240.250.121:9918">10.240.250.121:9918</a>);</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  create_dialog();</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  topology_hiding();</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  setflag(CALL_SW);</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  do_accounting("log", "cdr|failed");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  $dlg_val(callee) = $rU;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  $dlg_val(calling) =$fU;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  $dlg_val(callcount) = $var(size);</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  xlog("L_INFO","+++++Incoming call from $fU $sp $proto \n");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  $acc_extra(src_ip) = $si;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  $acc_leg(caller) = $fU;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  $acc_leg(callee) = $rU;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  if(!lb_start_or_next("1","st","s")){</span></font></div><div><font face="monospace"><span style="font-size:10.4px">          switch($rc){</span></font></div><div><font face="monospace"><span style="font-size:10.4px">          case -1:</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              xlog("L_INFO","error  500 General dispatch error\n");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              send_reply("503", "No resource avaiable");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              acc_log_request("503 General dispatch error");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">           break;</span></font></div><div><font face="monospace"><span style="font-size:10.4px"><br></span></font></div><div><font face="monospace"><span style="font-size:10.4px">   case -2:</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              xlog("L_INFO", "503 No free resources on nodes\n");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              send_reply("503", "No resource avaible");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              acc_log_request("503 No free resource on nodes");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">       break;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">   case -3:</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              xlog("L_INFO","606 No nodes avaible\n");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              send_reply("503", "No resource avaible");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              acc_log_request("606 No nodes avaible");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">           break;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">          }</span></font></div><div><font face="monospace"><span style="font-size:10.4px">    } else {</span></font></div><div><font face="monospace"><span style="font-size:10.4px">   xlog("L_INFO","Dispatch request to softswitch $du\n");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              $avp(node) = $du;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              $acc_extra(dst_node) = $du;</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              $ru = "sip:" + $rU + "@" + $dd + ":"+$rp +";transport=udp";</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              uac_replace_from("",'sip:$<a href="mailto:fU@10.240.250.121">fU@10.240.250.121</a>');</span></font></div><div><font face="monospace"><span style="font-size:10.4px">              uac_replace_to("sip:$tU@10.240.250.121:$rp");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">       t_on_failure("fail_softswitch");</span></font></div><div><font face="monospace"><span style="font-size:10.4px">       route(relay);</span></font></div><div><font face="monospace"><span style="font-size:10.4px">  }</span></font></div></div><div><span style="font-family:monospace;font-size:10.4px"> But </span><font face="monospace"><span style="font-size:10.4px">I doubt that it correct way.</span></font></div><div><font face="monospace"><span style="font-size:10.4px">Also i want to avp_db_query fo get ip from db.</span></font></div><div><font face="monospace"><span style="font-size:10.4px">Can i use variables in force_send_socket() function ?</span></font></div><div><span style="font-family:monospace;font-size:10.4px">Regards</span><font face="monospace"><span style="font-size:10.4px"><br></span></font></div><div><font face="monospace"><span style="font-size:10.4px">Kirill Galinurov</span></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-11-16 15:36 GMT+03:00 Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <tt>Hi,<br>
      <br>
      First, note that "2" is written "two", not "to" - just to be sure
      people do understand your explanations :).<br>
      <br>
      Now, you say you still see the Client IP in the Call-ID and in the
      FROM headers ?? If that is the case:<br>
      <br>
      1) to change the call-id, see the "C" option in the
      topology_hiding() call<br>
      <br>
      2) The FROM hdr is outside the topology-hiding scope, but if you
      want to change it see the uac_replace_from() function from the the
      uac module.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="m_-8174155212666708392moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="m_-8174155212666708392moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a>
</pre><div><div class="h5">
    <div class="m_-8174155212666708392moz-cite-prefix">On 11/14/2017 05:49 PM, Kirill
      Galinurov wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">Hi. All we try topology hiding module.
        <div>We have opensips 2.3/2 like sbc with to interfaces.</div>
        <div>And ip addresses are X.X.X.X and y.y.y.y.</div>
        <div>We have to softswitch with ip addreses z.z.z.1 and z.z.z.2</div>
        <div>Also we loadbalancing calls between softswitch .</div>
        <div>My config</div>
        <div><span style="font-family:monospace"><span style="color:rgb(0,0,0)">if(is_method("INVITE"))  {
            </span><br>
                       create_dialog();
            <br>
                       topology_hiding();
            <br>
                       if
            (check_address("1","$si","$sp"<wbr>,"any","$avp(ctx)")){
            <br>
                           force_send_<wbr>socket(udp:<a href="http://10.240.250.121:5126" target="_blank">10.240.250.121:5126</a><wbr>);
            <br>
                           setflag(CALL_<wbr>SW);
            <br>
                           do_accounting("<wbr>log", "cdr|failed");
            <br>
                           $dlg_val(<wbr>callee) = $rU;
            <br>
                           $dlg_val(<wbr>calling) =$fU;
            <br>
                           $dlg_val(<wbr>callcount) = $var(size);
            <br>
                           xlog("L_INFO","<wbr>+++++Incoming call from $fU
            $sp $proto \n");
            <br>
                           $acc_extra(src_<wbr>ip) = $si;
            <br>
                           $acc_leg(<wbr>caller) = $fU;
            <br>
                           $acc_leg(<wbr>callee) = $rU;
            <br>
                           if(!lb_start_<wbr>or_next("1","st","s")){
            <br>
                               switch($rc)<wbr>{
            <br>
                                   case -1:
            <br>
                                       <wbr>xlog("L_INFO","error  500 General
            dispatch error\n");
            <br>
                                       <wbr>send_reply("503", "No resource
            avaiable");
            <br>
                                       <wbr>acc_log_request("503 General
            dispatch error");
            <br>
                                       <wbr>break;
            <br>
            <br>
                                   case -2:
            <br>
                                       <wbr>xlog("L_INFO", "503 No free
            resources on nodes\n");
            <br>
                                       <wbr>send_reply("503", "No resource
            avaible");
            <br>
                                       <wbr>acc_log_request("503 No free
            resource on nodes");
            <br>
                                       <wbr>break;
            <br>
                                   case -3:
            <br>
                                       <wbr>xlog("L_INFO","606 No nodes
            avaible\n");
            <br>
                                       <wbr>send_reply("503", "No resource
            avaible");
            <br>
                                       <wbr>acc_log_request("606 No nodes
            avaible");
            <br>
                                       <wbr>break;
            <br>
                               }        <br>
                             } else {
            <br>
                                   xlog("<wbr>L_INFO","Dispatch request to
            softswitch $du\n");
            <br>
                                   $avp(<wbr>node) = $du;
            <br>
                                   $acc_<wbr>extra(dst_node) = $du;
            <br>
                                   t_on_<wbr>failure("fail_softswitch");
            <br>
                                   route(<wbr>relay);
            <br>
                           }
            <br>
                       }
            <br>
                   else
            <br>
                       if
            (check_address("2","$Ri","$Rp"<wbr>,"any","$avp(ctx)")){
            <br>
                           setflag(CALL_<wbr>FROM_SW);
            <br>
                           do_accounting("<wbr>log", "cdr|failed");
            <br>
                           $dlg_val(<wbr>callee) = $rU;
            <br>
                           $dlg_val(<wbr>calling) = $fU;
            <br>
                           $dlg_val(<wbr>callcount) = $var(size);
            <br>
                           xlog("L_INFO","<wbr>+++++Outgouing call from $fU
            $sp $proto \n");
            <br>
                           $acc_extra(src_<wbr>ip) = $si;
            <br>
                           $acc_leg(<wbr>caller) = $fU;
            <br>
                           $acc_leg(<wbr>callee) = $rU;
            <br>
                           if(!lb_start_<wbr>or_next("$avp(ctx)","st","s"))<wbr>{
            <br>
                               switch($rc)<wbr>{
            <br>
                                   case -1:
            <br>
                                       <wbr>xlog("L_INFO","error  500 General
            dispatch error\n");
            <br>
                                       <wbr>send_reply("503", "No resource
            avaiable");
            <br>
                                       <wbr>acc_log_request("503 General
            dispatch error");
            <br>
                                       <wbr>break;
            <br>
            <br>
                                   case -2:
            <br>
                                       <wbr>xlog("L_INFO", "503 No free
            resources on operator\n");
            <br>
                                       <wbr>send_reply("503", "No resource
            avaible");
            <br>
                                       <wbr>acc_log_request("503 No free
            resource on operator");
            <br>
                                       <wbr>break;
            <br>
                                   case -3:
            <br>
                                       <wbr>xlog("L_INFO","606 No resources
            avaible\n");
            <br>
                                       <wbr>send_reply("503", "No resource
            avaible");
            <br>
                                       <wbr>acc_log_request("606 No nodes
            avaible");
            <br>
                                       <wbr>break;
            <br>
                               }        <br>
                             } else {
            <br>
                                   xlog("<wbr>L_INFO","Dispatch request to
            operator sbc $du\n");
            <br>
                                   $avp(<wbr>node) = $du;
            <br>
                                   $acc_<wbr>extra(dst_node) = $du;
            <br>
                                   t_on_<wbr>failure("fail_operator");
            <br>
                                   route(<wbr>relay);
            <br>
                           }
            <br>
                       }
            <br>
                   else
            <br>
                        sl_send_reply("<wbr>403", "Forbidden posible wrong
            port");
            <br>
            <br>
                   }
            <br>
            }<br>
            In invite on softswitch i see</span></div>
        <div>
          <div><font face="monospace">NVITE <a class="m_-8174155212666708392moz-txt-link-freetext">sip:12345@XX.XX.XX.XX:5126</a>
              SIP/2.0</font></div>
          <div><font face="monospace">Via: SIP/2.0/UDP
              YY.YY.YY.YY:5126;branch=<wbr>z9hG4bKe4d9.14b51d57.0</font></div>
          <div><font face="monospace">Max-Forwards: 69</font></div>
          <div><font face="monospace">From: "Anonymous" <<a href="mailto:sip%3A12345@CC.CC.CC.CC" target="_blank">sip:12345@CC.CC.CC.CC</a>>;tag=<wbr>as59cc9e35</font></div>
          <div><font face="monospace">To:
              <a class="m_-8174155212666708392moz-txt-link-rfc2396E"><sip:12345@xx.xx.xx.xx:5126></a></font></div>
          <div><font face="monospace">Contact:
              <a class="m_-8174155212666708392moz-txt-link-rfc2396E"><sip:10.240.250.121:5126;did=<wbr>e7e.87a97756></a></font></div>
          <div><font face="monospace">Call-ID: <a href="mailto:0068dba856ae05e8406504ab71fc9900@CC.CC.CC.CC.CC" target="_blank">0068dba856ae05e8406504ab71fc99<wbr>00@CC.CC.CC.CC.CC</a></font></div>
          <div><font face="monospace">CSeq: 102 INVITE</font></div>
        </div>
        <div><br>
        </div>
        <div>Where CC is client ip. I thithk it must be opensips ip
          adress <span style="font-family:monospace"><a href="http://10.240.250.121:5126" target="_blank">10.240.250.121:5126</a></span></div>
        <div><span style="font-family:monospace">What is wrong?</span></div>
      </div>
      <br>
      <fieldset class="m_-8174155212666708392mimeAttachmentHeader"></fieldset>
      <br>
      </div></div><pre>______________________________<wbr>_________________
Users mailing list
<a class="m_-8174155212666708392moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_-8174155212666708392moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div>