[OpenSIPS-Users] Changing FROM header several times
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Wed Jun 23 23:24:38 CEST 2010
Hi Magnus,
actually you want to change the FROM hdr once per each branch - so use
the branch route for applying the per-branch changes (call
uac_replace_from from branch_route).
Regards,
Bogdan
Magnus Burman wrote:
> 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
> <mailto: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;
> }
> }
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
--
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
20 - 24 September 2010, Frankfurt, Germany
www.voice-system.ro
More information about the Users
mailing list