Re: [OpenSIPS-Users] uac_replace_from i'm doing something wrong..

2017-02-23 Thread Răzvan Crainea

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: \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:
\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
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] uac_replace_from i'm doing something wrong..

2017-02-23 Thread Michele Pinassi
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:
\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

-- 
Michele Pinassi
Responsabile Telefonia di Ateneo
Servizio Reti, Sistemi e Sicurezza Informatica - Università degli Studi di Siena
tel: 0577.(23)5000 - central...@unisi.it

Per trovare una soluzione rapida ai tuoi problemi tecnici consulta le FAQ di 
Ateneo, http://www.faq.unisi.it 




signature.asc
Description: OpenPGP digital signature
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users