Hi, Michele!

OpenSIPS does not support passing parameters as you've done. It is always expecting a string between quotes. So you should replace your uac_replace_from and append_hf with something like:

uac_replace_from("05771530$(fU{s.substr,1,0})", "sip:05771530$(fU{s.substr,1,0})@$Ri");
append_hf("P-Asserted-Identity: <sip:05771530$(fU{s.substr,1,0})@$Ri>\r\n");

Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 02/23/2017 11:51 AM, Michele Pinassi wrote:
Hi all,

i need to remap "from" number prior to send call to a ToIP trunk

In my route[toip] i wrote:

route[toip] {
     xlog("L_INFO","$ci - Route via TOIP from $fU to $tU (RURI: $ru)\n");

     if (is_method("INVITE")) {
     setflag(DB_FLAG);
     setflag(ACC_DO); # do accounting
     }

     if($fU=~"6[0-9]{3}$")  {
     # Change all 6xxx to 05771530xxx
uac_replace_from("05771530"+$(fU{s.substr,1,0}),"sip:05771530"+$(fU{s.substr,1,0})+"@"+$Ri);
append_hf("P-Asserted-Identity:
<sip:05771530"+$(fU{s.substr,1,0})+"@"+$Ri+">\r\n");
     }

     if(route_to_carrier("toip")) {
         t_on_failure("next_gw");
         t_relay();
         exit;
     }
}

but i got an error. Maybe i'm doing somewthing wrong with number
manipulation.

Suggestions how i can do the same thing in a more elegant manner are
welcome !

Thanks for any help, Michele



_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to