[Serusers] if routeXX fails..

Matt Schulte mschulte at netlogic.net
Fri Apr 22 01:40:20 CEST 2005


Ok, I realized I already assumed your theory :-) This is always
returning true, even though the last statement is returning false, the
route ultimately is still returning true.. This was just an effort to
consolidate code for those of our custs who send by IP (rather than
auth). Am I going about this the right way or am I barking up the wrong
tree? I just cant seem to get it to work :-(

	Matt

code:

route[6]
{

                if lookup("location") {
                        xlog("L_INFO", "LOG: Caught usrloc %mi %rm From
<%fu> To <%tu> RURI <%ru>\n");
                        route(2);
                        break;
                }
                if enum_query("blahblah")  {
                        xlog("L_INFO", "LOG: Caught ENUM %mi %rm From
<%fu> To <%tu> RURI <%ru>\n");
                        route(2);
                        break;
                }
                if (search("(f|From): .*@x.x.x.x")) {
                        if (exec_dset("/usr/local/bin/aliases.pl")) {
                                xlog("L_INFO", "LOG: Caught alias %mi
%rm From <%fu> To <%tu> RURI <%ru>\n");
                                route(2);
                                break;
                        }
                }
}

-----Original Message-----
From: Matt Schulte 
Sent: Thursday, April 21, 2005 6:03 PM
To: marian.dumitru at voice-sistem.ro
Cc: serusers at lists.iptel.org
Subject: RE: [Serusers] if routeXX fails..


I see, that makes perfect sense :-).. So I just might need to flip
around my "if" to get it to work. 

-----Original Message-----
From: Marian Dumitru [mailto:marian.dumitru at voice-sistem.ro] 
Sent: Thursday, April 21, 2005 5:10 PM
To: Matt Schulte
Cc: serusers at lists.iptel.org
Subject: Re: [Serusers] if routeXX fails..


Hi Matt,

Basically you can do that, but be very careful since the return code of 
a route is the return code of the *last* command executed inside the 
route - and break always returns true!

Best regards,
Marian

Matt Schulte wrote:
> Is it possible to do this? or is it bad practice, I'm assuming the
> "extra" route would have to return an error code to show a 
> nonpositive? I coulda swore I got this to work awhile back.
> 
> if (!route(6)) {
>          xlog("L_INFO", "NOTICE: blah <%ru> sending 404\n");
>          sl_send_reply("404", "Not Found");
>          break;
>          } else {
>          # Else route6 ran another route and break
>          break;
> }
> 

-- 
Voice System
http://www.voice-system.ro

_______________________________________________
Serusers mailing list
serusers at lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers




More information about the sr-users mailing list