[SR-Users] Changing $fU or $fn in branch_route

Jurijs Ivolga jurijs.ivolga at gmail.com
Thu Oct 17 20:59:52 CEST 2019


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>
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191017/e220f33f/attachment.html>


More information about the sr-users mailing list