[OpenSIPS-Users] topology_hiding

Kirill Galinurov k.galinurov at gmail.com
Fri Nov 17 03:26:42 EST 2017


Hi Bogdan.
Thanks you for the answer.
I don't want mislead you.
I resolve my problem.
I use uac_replace_from() uac_replace_to() fo rewrite to and from headers.

if(is_method("INVITE"))  {
     if (check_address("1","$si","$sp","any","$avp(ctx)")){
  force_send_socket(udp:10.240.250.121:9918);
  create_dialog();
  topology_hiding();
  setflag(CALL_SW);
  do_accounting("log", "cdr|failed");
  $dlg_val(callee) = $rU;
  $dlg_val(calling) =$fU;
  $dlg_val(callcount) = $var(size);
  xlog("L_INFO","+++++Incoming call from $fU $sp $proto \n");
  $acc_extra(src_ip) = $si;
  $acc_leg(caller) = $fU;
  $acc_leg(callee) = $rU;
  if(!lb_start_or_next("1","st","s")){
          switch($rc){
          case -1:
              xlog("L_INFO","error  500 General dispatch error\n");
              send_reply("503", "No resource avaiable");
              acc_log_request("503 General dispatch error");
           break;

   case -2:
              xlog("L_INFO", "503 No free resources on nodes\n");
              send_reply("503", "No resource avaible");
              acc_log_request("503 No free resource on nodes");
       break;
   case -3:
              xlog("L_INFO","606 No nodes avaible\n");
              send_reply("503", "No resource avaible");
              acc_log_request("606 No nodes avaible");
           break;
          }
    } else {
   xlog("L_INFO","Dispatch request to softswitch $du\n");
              $avp(node) = $du;
              $acc_extra(dst_node) = $du;
              $ru = "sip:" + $rU + "@" + $dd + ":"+$rp +";transport=udp";
              uac_replace_from("",'sip:$fU at 10.240.250.121');
              uac_replace_to("sip:$tU at 10.240.250.121:$rp");
       t_on_failure("fail_softswitch");
       route(relay);
  }
 But I doubt that it correct way.
Also i want to avp_db_query fo get ip from db.
Can i use variables in force_send_socket() function ?
Regards
Kirill Galinurov

2017-11-16 15:36 GMT+03:00 Bogdan-Andrei Iancu <bogdan at opensips.org>:

> Hi,
>
> First, note that "2" is written "two", not "to" - just to be sure people
> do understand your explanations :).
>
> Now, you say you still see the Client IP in the Call-ID and in the FROM
> headers ?? If that is the case:
>
> 1) to change the call-id, see the "C" option in the topology_hiding() call
>
> 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.
>
> Regards,
>
> Bogdan-Andrei Iancu
>   OpenSIPS Founder and Developer
>   http://www.opensips-solutions.com
>
> On 11/14/2017 05:49 PM, Kirill Galinurov wrote:
>
> Hi. All we try topology hiding module.
> We have opensips 2.3/2 like sbc with to interfaces.
> And ip addresses are X.X.X.X and y.y.y.y.
> We have to softswitch with ip addreses z.z.z.1 and z.z.z.2
> Also we loadbalancing calls between softswitch .
> My config
> if(is_method("INVITE"))  {
>            create_dialog();
>            topology_hiding();
>            if (check_address("1","$si","$sp","any","$avp(ctx)")){
>                force_send_socket(udp:10.240.250.121:5126);
>                setflag(CALL_SW);
>                do_accounting("log", "cdr|failed");
>                $dlg_val(callee) = $rU;
>                $dlg_val(calling) =$fU;
>                $dlg_val(callcount) = $var(size);
>                xlog("L_INFO","+++++Incoming call from $fU $sp $proto
> \n");
>                $acc_extra(src_ip) = $si;
>                $acc_leg(caller) = $fU;
>                $acc_leg(callee) = $rU;
>                if(!lb_start_or_next("1","st","s")){
>                    switch($rc){
>                        case -1:
>                            xlog("L_INFO","error  500 General dispatch
> error\n");
>                            send_reply("503", "No resource avaiable");
>                            acc_log_request("503 General dispatch error");
>                            break;
>
>                        case -2:
>                            xlog("L_INFO", "503 No free resources on
> nodes\n");
>                            send_reply("503", "No resource avaible");
>                            acc_log_request("503 No free resource on
> nodes");
>                            break;
>                        case -3:
>                            xlog("L_INFO","606 No nodes avaible\n");
>                            send_reply("503", "No resource avaible");
>                            acc_log_request("606 No nodes avaible");
>                            break;
>                    }
>                  } else {
>                        xlog("L_INFO","Dispatch request to softswitch
> $du\n");
>                        $avp(node) = $du;
>                        $acc_extra(dst_node) = $du;
>                        t_on_failure("fail_softswitch");
>                        route(relay);
>                }
>            }
>        else
>            if (check_address("2","$Ri","$Rp","any","$avp(ctx)")){
>                setflag(CALL_FROM_SW);
>                do_accounting("log", "cdr|failed");
>                $dlg_val(callee) = $rU;
>                $dlg_val(calling) = $fU;
>                $dlg_val(callcount) = $var(size);
>                xlog("L_INFO","+++++Outgouing call from $fU $sp $proto
> \n");
>                $acc_extra(src_ip) = $si;
>                $acc_leg(caller) = $fU;
>                $acc_leg(callee) = $rU;
>                if(!lb_start_or_next("$avp(ctx)","st","s")){
>                    switch($rc){
>                        case -1:
>                            xlog("L_INFO","error  500 General dispatch
> error\n");
>                            send_reply("503", "No resource avaiable");
>                            acc_log_request("503 General dispatch error");
>                            break;
>
>                        case -2:
>                            xlog("L_INFO", "503 No free resources on
> operator\n");
>                            send_reply("503", "No resource avaible");
>                            acc_log_request("503 No free resource on
> operator");
>                            break;
>                        case -3:
>                            xlog("L_INFO","606 No resources avaible\n");
>                            send_reply("503", "No resource avaible");
>                            acc_log_request("606 No nodes avaible");
>                            break;
>                    }
>                  } else {
>                        xlog("L_INFO","Dispatch request to operator sbc
> $du\n");
>                        $avp(node) = $du;
>                        $acc_extra(dst_node) = $du;
>                        t_on_failure("fail_operator");
>                        route(relay);
>                }
>            }
>        else
>             sl_send_reply("403", "Forbidden posible wrong port");
>
>        }
> }
> In invite on softswitch i see
> NVITE sip:12345 at XX.XX.XX.XX:5126 SIP/2.0
> Via: SIP/2.0/UDP YY.YY.YY.YY:5126;branch=z9hG4bKe4d9.14b51d57.0
> Max-Forwards: 69
> From: "Anonymous" <sip:12345 at CC.CC.CC.CC>;tag=as59cc9e35
> To: <sip:12345 at xx.xx.xx.xx:5126>
> Contact: <sip:10.240.250.121:5126;did=e7e.87a97756>
> Call-ID: 0068dba856ae05e8406504ab71fc9900 at CC.CC.CC.CC.CC
> CSeq: 102 INVITE
>
> Where CC is client ip. I thithk it must be opensips ip adress
> 10.240.250.121:5126
> What is wrong?
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20171117/3df55fc2/attachment-0001.html>


More information about the Users mailing list