[OpenSIPS-Users] Feature request for OpenSIPS 1.9: support for macro definitions
Bogdan-Andrei Iancu
bogdan at opensips.org
Thu Nov 8 17:23:30 CET 2012
Hi Michael,
You can already use names for the route, not only numerical IDs (without
the need of defining).
For flags, you can use only numbers, indeed - usually I use M4 as text
preprocessor to do different complex ops over the script (like defines,
ifdefs, etc).
But maybe a built in support for names of flags will not be a big issue,
especially it is not a big deal.
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 11/08/2012 01:22 PM, Michael Renzmann wrote:
> Hi all.
>
> I'm relatively new to OpenSIPS and still am at the very beginning of
> learning how to tame this wonderful beast ;-).
>
> One thing that I, personally, find pretty uncomfortable is that in various
> places in the opensips.cfg one needs to use plain numbers to define or
> modify the behaviour. That easily results in constructs like:
>
> === cut ===
> route {
> ...
> route(42);
> ...
> }
>
> route[42] {
> ...
> setflag(8);
> ...
> }
> === cut ===
>
> Obviously, it is possible to memorize the meaning of the different numbers
> depending on the context they are used in - this is what people do now
> when they work with OpenSIPS. But I guess things may become pretty painful
> when you have a complex configuration and need to urgently debug an issue
> in it which just has brought down a heavily loaded, productively used
> OpenSIPS instance...
>
> Using comments certainly helps to relieve the problem a bit, but they can
> not solve it. However, things would become much easier if one could use
> "speaking names" instead of plain numbers:
>
> === cut ===
> define(ROUTE_NAT_DETECTION, 42);
> define(FLAG_NAT_DETECTED, 8);
>
> route {
> ...
> route(ROUTE_NAT_DETECTION);
> ...
> }
>
> route[ROUTE_NAT_DETECTION] {
> ...
> setflag(FLAG_NAT_DETECTED);
> ...
> }
> === cut ===
>
> Yes, I am aware that this could also be achieved by using an external
> macro preprocessor such as M4. But that would add another dependency - one
> which could be avoided if OpenSIPS had built-in support for simple macro
> definitions like those shown in the example above.
>
> Bye, Mike
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
More information about the Users
mailing list