Feature request for OpenSIPS 1.9: support for macro definitions

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Feature request for OpenSIPS 1.9: support for macro definitions

Michael Renzmann
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Feature request for OpenSIPS 1.9: support for macro definitions

Bogdan-Andrei Iancu-2
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
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Feature request for OpenSIPS 1.9: support for macro definitions

Ali Pey
I second this as well. Named flags would make debugging and scripting quite simpler.

Regards,
Ali



On Thu, Nov 8, 2012 at 11:23 AM, Bogdan-Andrei Iancu <[hidden email]> wrote:
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Feature request for OpenSIPS 1.9: support for macro definitions

Bogdan-Andrei Iancu-2
Hi Ali,

Added on the list http://www.opensips.org/Main/Ver190#toc9 with a quite high priority ;).

Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 11/08/2012 07:06 PM, Ali Pey wrote:
I second this as well. Named flags would make debugging and scripting quite simpler.

Regards,
Ali



On Thu, Nov 8, 2012 at 11:23 AM, Bogdan-Andrei Iancu <[hidden email]> wrote:
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________ Users mailing list [hidden email] http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Feature request for OpenSIPS 1.9: support for macro definitions

Ali Pey
Thank you Bogdan...


On Thu, Nov 8, 2012 at 12:14 PM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Hi Ali,

Added on the list http://www.opensips.org/Main/Ver190#toc9 with a quite high priority ;).

Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 11/08/2012 07:06 PM, Ali Pey wrote:
I second this as well. Named flags would make debugging and scripting quite simpler.

Regards,
Ali



On Thu, Nov 8, 2012 at 11:23 AM, Bogdan-Andrei Iancu <[hidden email]> wrote:
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________ Users mailing list [hidden email] http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users