[OpenSIPS-Users] uac_raplace_to twice in the branch

Adelson O. Junior jroliv at gmail.com
Fri Apr 16 22:11:49 CEST 2010


Hi list.

We are implementing a solution using opensips which I have to replace
the To header in a "Pre_routing" scenario and, depending of the
routing, I have to replace the To header again, "Post routing"
scenario. (a kind of I remove the prefix to execute some statement,
like dbalias, and then add the same or another prefix).
The big problem is that We built the scenario thinking to use
uac_replace_to twice (in Pre and Post routing scenario), but, when
it's really called twice it generates inconsistence in the To header,
according to the function documentation.
I would like to know if you guys have some idea how I can implement
this scenario, if uac_replace_to can not be used twice.


Thanks in advice.



Pre routing code:
if ( $avp(s:pre_to_id) != null ) {
                dp_translate("$avp(s:pre_to_id)", "$tU/$var(pre_to_user)");

uac_replace_to("$var(pre_to_user)","sip:$var(pre_to_user)@$td") ;
                xlog("L_INFO", "PreRouting to TO:  $rm gw:[$si:$sp]
ruri:[$ru] from:[$fu] to:[$tu] sourceip:[$si] callid:[$ci]\n");
}

...

Post routing code:
if ($avp(s:post_to_id) != null) {
                dp_translate("$avp(s:post_to_id)", "$tU/$var(post_to_user)");
                uac_replace_to("$var(post_to_user)",
"sip:$var(post_to_user)@$td") ;
                xlog("L_INFO", "PostRouting to TO:  $rm gw:[$si:$sp]
ruri:[$ru] from:[$fu] to:[$tu] sourceip:[$si] callid:[$ci]\n");
}


--
Adelson



More information about the Users mailing list