[sr-dev] New branch oej/routeblocks

Olle E. Johansson oej at edvina.net
Fri Jan 25 19:08:14 CET 2013


Hi!

THe branch I just published contains some functions made a day after code freeze. With this you can check if a named route exists, and call it if it exists.

This works well with non-mandatory include files. You can now have building blocks and just dump a NAT-manage file in an include directory. If that's included and that route block is defined, then execute it.

Small changes that I added to the cfgutils module if that's ok with all the authors of that module.

Please test and if everything seems ok, I'll merge after 4.0.0 release.

Have a great weekend!

Cheers,
/O

Documentation:
==============

4.17. check_route_exists(route)

   Check if a route block exists

   Parameters:

   "name" of a route block in the config file, like "route[FROGJUMP]"

   This function can be used from any route. You can only check for
   route[] blocks, not reply, event or other routes.

   Example 1.21. check_route_exists() usage
...
if(check_route_exists("FROGJUMP") {
        $var(jumping_frogs) = 1;
};
...

4.18. route_if_exists(route)

   Execute a routing block only if it is defined. If it's not defined,
   silently move to the next action in the configuration script.

   Parameters:

   "name" of a route block in the config file, like "route[FROGJUMP]"

   This function can be used from any route. You can only execute it for
   route[] blocks, not reply, event or other routes.

   Example 1.22. route_if_exists() usage
...
route_if_exists("PRESENCE_SANTA_CLAUS");
...





More information about the sr-dev mailing list