[Kamailio-Users] Passing REGISTERs up stream

Klaus Darilion klaus.mailinglists at pernau.at
Sat Nov 8 00:41:49 CET 2008


Daniel Corbe wrote:
> Is there a way to save the contact binding on the reply? 
>  save("location") throws an error that says it cannot be used in reply 
> blocks.

Yes, this is a known problem. For such usage I think a dedicated module 
(e.g. "relay_register) is needed.

regards
klaus

PS: if the registrar supports Path then you could use the Path feature.

> 
> Thanks.
> 
> -Daniel
> 
> Nov  2 02:21:27 [61791] CRITICAL:core:yyerror: parse error in config 
> file, line 417, column 10-11: Command cannot be used in the block
> 
> onreply_route[2]
> {
>         if (status =~ "2[0-9][0-9]")
>         {
>                 save("location");
>         };
> }
> 
> If I can't use the save("location") in the onreply block, then how do I 
> cache the contact binding?  
> 
> Is there a way to do it from within a module?  I might consider coding 
> something up if that is the case.  What module does the save command 
> live in?
> 
> On Fri, Oct 31, 2008 at 1:47 AM, Daniel-Constantin Mierla 
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
> 
>     Hello,
> 
> 
>     On 10/30/08 01:10, Daniel Corbe wrote:
> 
>         Guys,
> 
>         When attempting to pass REGISTER requests up stream I get the
>         following error messages on the console (below).  This also
>         brings up the question of "what is the best way to simply pass
>         REGISTER requests on to an upstream registrar?"
> 
>         Thanks for the help.
> 
>         -Daniel
> 
> 
>         REGISTER: NATed client, enabling NAT
>         Oct 29 18:03:58 [48175] ERROR:tm:t_forward_nonack: no branch for
>         forwarding
>         Oct 29 18:03:58 [48175] ERROR:tm:w_t_relay: t_forward_nonack failed
>         Oct 29 18:03:58 [48175] ERROR:tm:t_forward_nonack: no branch for
>         forwarding
>         Oct 29 18:03:58 [48175] ERROR:tm:w_t_relay: t_forward_nonack failed
>         Oct 29 18:03:59 [48175] CRITICAL:tm:t_should_relay_response:
>         pick_branch failed (lowest==-1) for code 401
> 
>         Here's the relevant parts of my ser config;
> 
>         in route[1]
> 
>         route[1]
>         {
>             ...
>                if (method == "REGISTER")
>                {
>                        route(2);
>                }
>                route(1);
>         }
> 
>         route[2]
>         {
>                # Check to see if the UAC is trying to UNREGISTER.  If
>         not test
>                # for NAT.  If NAT is present, we mark it as such before
>         we save()
>                # the location, that way flag 6 is always set for NATed UAs.
>                if (!search("^Contact:[ ]*\*") && nat_uac_test("19")) {
>                        xlog("L_NOTICE", "REGISTER: NATed client,
>         enabling NAT\n");
>                        setflag(6);
>                        fix_nated_register();
>                        force_rport();
>                };
> 
>                # We must handle replies for registrations, for caching
>         and location
>                # tracking purposes.
>                t_on_reply("1");
>                t_on_failure("1");
> 
>                # Check for digest
>                #if (radius_www_authorize(""))
>                #{
>                #       xlog("L_NOTICE", "REGISTER: No Digest, sending
>         challenge\n");
>                #       www_challenge("", "0");
>                #       exit;
>                #}
> 
>                # Digest was good if we get here
>                #save("location");
> 
>                # Relay register to porta
>                t_relay("216.151.143.69 <http://216.151.143.69>
>         <http://216.151.143.69>");
> 
>         }
> 
>         onreply_route[2]
>         {
>                if (status =~ "2[0-9][0-9]")
>                {
>                #       save("location");
>                };
>         }
> 
>     you need a line with:
> 
>     exit;
> 
>     at the end of route[2]. Also, there seem to be looping in route[1]
>     if you handle non-REGISTER.
> 
>     Cheers,
>     Daniel
> 
>     -- 
>     Daniel-Constantin Mierla
>     http://www.asipto.com
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Users mailing list
> Users at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users





More information about the Users mailing list