[OpenSIPS-Users] Changing FROM header several times
Magnus Burman
magnus.burman at adamo.es
Tue Jun 22 18:28:54 CEST 2010
To get outgoing caller id to work I have to change my FROM header to a
trunk-specific format. While this is ugly, it works, unless I try to do it
more then once. Using gateway lists in drouting this scenario can happen as
the routing script is run for each gateway on failure.
Is there another way for me to do this? Either by only using
uac_replace_from once, or by alternating the FROM header in another way?
With the below script I end up with duplicates:
From: "123456789""34123456789" <sip:123456789 at 4.4.4.4sip:34123456789 at 4.4.4.4
>;tag=as0ab5e31d.
if(do_routing()) {
route(111);
exit;
}
#...
route[111] {
# Do gateway-specific processing
switch($rd) {
case "1.1.1.1":
route(callid1);
break;
case "2.2.2.2":
route(callid2);
break;
case "3.3.3.3":
route(callid3);
break;
default:
route(callid1);
}
t_on_failure("1");
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[callid1] {
if(avp_db_query("select call_id from subscriber_extras where username =
'$fU'", "$avp(s:cid)")) {
uac_replace_from("34$avp(s:cid)", "sip:34$avp(s:cid)@$td");
}
}
route[callid2] {
if(avp_db_query("select call_id from subscriber_extras where username =
'$fU'", "$avp(s:cid)")) {
uac_replace_from("+34$avp(s:cid)", "sip:+34$avp(s:cid)@$td");
}
}
route[callid3] {
if(avp_db_query("select call_id from subscriber_extras where username =
'$fU'", "$avp(s:cid)")) {
uac_replace_from("$avp(s:cid)", "sip:$avp(s:cid)@$td");
}
}
failure_route[1] {
if(use_next_gw()) {
t_on_failure("1");
route(111);
exit;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100622/173785ec/attachment.htm
More information about the Users
mailing list