[Kamailio-Users] Problem with LCR

Antonio Reale ant.reale at gmail.com
Fri Apr 24 10:25:48 CEST 2009


Hi Juha,

2009/4/23 Juha Heinanen <jh at tutpro.com>:

> i read 1.4 code and saw that request uri user is saved to ruri_user_avp
> only if next_gw() is called from request route.  so if you call it from
> failure_route, it will not be saved, which could explain the above
> error.

I call next_gw the first time in request route and then in the failure route.
In the scenario with call forwarding the route for PSTN termination is
called from failure route but next_gw that gives the error is in the
request route.
It seems that the problem is that the ruri_user_avp is no longer
defined (initially assigned with modparam("lcr", "ruri_user_avp",
"$avp(i:500)")), not the null value of the ruri_user_avp (because
before calling nexg_gw it is null also in the working scenario).

REQUEST ROUTE
----------------------------------------------------
route[15]
{
if(uri =~ "^sip:[0-9]+@")
                {
                        # only route numeric users to PSTN
                        xlog("L_INFO", "gw_uri_avp before load_gws:
'$avp(i:709)'\n");
                        xlog("L_INFO", "ruri_user_avp before load_gws:
'$avp(i:500)'\n");
                        if(!load_gws())
                        {

                                xlog("L_ERR", "Error loading PSTN
gateways - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("503", "PSTN Termination
Currently Unavailable");
                                exit;
                        }
                        xlog("L_INFO", "gw_uri_avp before next_gw:
'$avp(i:709)'\n");
                        xlog("L_INFO", "ruri_user_avp before next_gw:
'$avp(i:500)'\n");
                        if(!next_gw())
                        {
                                xlog("L_ERR", "No PSTN gateways
available - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("503", "PSTN Termination
Currently Unavailable");
                                exit;
                        }
                        xlog("L_INFO", "gw_uri_avp after next_gw:
'$avp(i:709)'\n");
                        xlog("L_INFO", "ruri_user_avp after next_gw:
'$avp(i:500)'\n");

                        t_on_failure("1");
                        route(11);
                }
}

FAILURE ROUTE 1
----------------------------
failure_route[1]
{
        xlog("L_INFO", "Failure route for PSTN entered - M=$rm
RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        route(20);
        if(!next_gw())
        {

                xlog("L_ERR", "Failed to select next PSTN gateway -
M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                exit;
        }

        t_on_failure("1");
        route(11);
}


FAILURE ROUTE 2
----------------------------------------
if($avp(s:cfb) != NULL)
        {
                avp_delete("$avp(s:acc_caller_user)/g");
                avp_delete("$avp(s:acc_caller_domain)/g");
                avp_delete("$avp(s:acc_state)/g");
                avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)");
                avp_copy("$avp(s:acc_callee_domain)",
"$avp(s:acc_caller_domain)");
                $avp(s:acc_state) = "cfb";
                avp_pushto("$ru", "$avp(s:cfb)");
                setflag(29);
                append_branch();

                t_on_branch("1");
                xlog("L_INFO", "CFB detected - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
                route(13);           ### Route that find callee then
go to route 15 for PSTN
        }


The script is based on sipwise generated script and modified to work
with 1.4. I didn't add further lcr functions. If you want I can send
the entire script.

[CUT]
>
> -- juha
>

Thank you very much.
Regards,
Antonio




More information about the sr-users mailing list