[SR-Users] Changing $fU or $fn in branch_route
Daniel-Constantin Mierla
miconda at gmail.com
Thu Oct 17 21:22:09 CEST 2019
Hello,
assigning to $fn, $fu or $fU is offered as a convenience way to update
parts of From header, but the changes are not applied immediately, like
the other operations done over the SIP headers -- see more details in
the FAQ:
-
https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers_or
In your case, try to do those changes only in branch_route.
Cheers,
Daniel
On 17.10.19 20:59, Jurijs Ivolga wrote:
> Hi,
>
> Just to add one more point that $fU & $fn I'm checking not in script
> but in SIP packet. So using sngrep i see in SIP packet from header
> where $fU and $fn are "1234567+123456".
>
> Jurijs
>
>
> On Thu, Oct 17, 2019 at 1:06 PM Jurijs Ivolga <jurijs.ivolga at gmail.com
> <mailto:jurijs.ivolga at gmail.com>> wrote:
>
> Hi!
>
> I have small problem. When I assign $fU or $fn in request-route
> and then one more time I make new assignment in
> branch_route. Instead of rewriting it is just concatenate needed
> value at the end. lets assume $avp(cli)=1234567 and
> $avp(cliplus)=+1234567. So if in request_route I
> do $fU=$avp(cli); and then in branch_route $fU=$avp(cliplus);. $fU
> becomes one string: "1234567+1234567". Is it a bug or I missing
> something?
>
> Here is config snippet:
>
> request_route {
> ...
> route(MY);
> ...
> }
>
> route[MY] {
>
> ...
> $avp(cli) = "1234567"
> $avp(cliplus) = "+"+$avp(cli);
> $fU=$avp(cli); # here $fU=1234567
> $fn=$avp(cli); # here $fn=1234567
> route(LCR_ROUTE);
> exit;
> }
>
> route[LCR_ROUTE]
> {
> if(!is_method("INVITE"))
> return;
> if (!load_gws("1",$rU,$avp(cli))) {
> send_reply("503", "Error loading gateways");
> exit;
> }
>
> $var(i)=0;
> while($(avp(lcr_gw_uri)[$var(i)])!= $null){
> xlog("L_INFO", "loaded
> gw_uri_avp[$var(i)]=$(avp(lcr_gw_uri)[$var(i)]) \n");
> $var(i) = $var(i)+1;
> }
>
> if (!next_gw()) {
> send_reply("503", "No available gateways");
> exit;
> }
>
> xlog("L_INFO", "request-uri $ru \n");
> xlog("L_INFO", "$avp(lcr_gw_uri), $avp(lcr_id)\n");
>
> xlog("L_INFO", "flag $avp(lcr_flag) \n");
>
> t_set_fr(0, 4000);
> t_on_failure("RTF_LCR_ROUTE");
> t_on_branch("BRANCH_CUST");
> route(RELAY);
> exit;
> }
>
> branch_route[BRANCH_CUST] {
> if ( $avp(lcr_flag) == 4) {
> $fU=$avp(cliplus); #here $fU=1234567+1234567
> $fn=$avp(cliplus); #here $fn=1234567+1234567
> }
> }
>
> Jurijs
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training, Oct 21-23, 2019, Berlin, Germany -- https://asipto.com/u/kat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191017/f7954e29/attachment.html>
More information about the sr-users
mailing list