On Friday 04 April 2014 23:23:49 Kelvin Chua wrote:
I am curious on your method daniel, what do you mean
by
"store the changes in avps and commit the changes" ?
Any modifications I want to make to from are set in
$avp(uacfromdisplay) and/or $avp(uacfromuri), eg for an anonymous outbound
call:
else if($rU=~"^131[0-9]+$")
{
strip(3);
append_hf("Privacy: id\r\n");
$avp(uacreplacefromdisplay)=1;
$avp(uacfromdisplay)="anonymous";
$avp(uacreplacefromuri)=1;
$avp(uacfromuri)="sip:anonymous@anonymous.invalid:"+$rp;
}
and in route [RELAY] they are actually commited:
if($avp(uacreplacefromdisplay) && $avp(uacreplacefromuri))
{
uac_replace_from("$avp(uacfromdisplay)","$avp(uacfromuri)");
$avp(uacreplacefromdisplay[*])=$null;
$avp(uacreplacefromuri[*])=$null;
}
else
{
if($avp(uacreplacefromdisplay))
{
uac_replace_from("$avp(uacfromdisplay)","");
$avp(uacreplacefromdisplay[*])=$null;
}
if($avp(uacreplacefromuri))
{
uac_replace_from("$avp(uacfromuri)");
$avp(uacreplacefromuri[*])=$null;
}
}
This way you can make multiple "changes" during call routing logic and be sure
there is only 1 call to the uac_replace_from/to functions.
--
POCOS B.V. - Croy 9c - 5653 LC Eindhoven
Telefoon: 040 293 8661 - Fax: 040 293 8658
http://www.pocos.nl/ -
http://www.sipo.nl/
K.v.K. Eindhoven 17097024