Hello,

On Wed, Mar 10, 2010 at 7:57 PM, Uriel Rozenbaum <uriel.rozenbaum@gmail.com> wrote:
Daniel,

I got the idea, but maybe I used a lame example. I'll need the same method to activate or deactivate some custom features like prepending some prefix and stuff.

Maybe I'll just set some variable and ask for that. Do you agree?

if activation/deactivation is needed at runtime, then custom global parameters is clearly the way to go. You can update via sercmd cli or siremis web interface the value at runtime.

Cheers,
Daniel


Uriel


On Wed, Mar 10, 2010 at 3:35 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,

On Wed, Mar 10, 2010 at 7:05 PM, Uriel Rozenbaum <uriel.rozenbaum@gmail.com> wrote:
Thanks guys, I'm using 1.5.3

So I can use

define(`SHOULD_AUTH', 1)
...
if(SHOULD_AUTH)
{
     route(5); #Auth
}

within my cfg file?

you cannot have that for now. It is for controlling which parts of config is loaded, like:

#!define AUTH

#ifdef AUTH
   route[AUTH);
#!endif

The default kamailio config in 3.0 use it to provide auth, nat, presence, etc. See it online at:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=etc/kamailio.cfg;hb=kamailio_3.0

You can achieve similar functionality as you described above with custom cfg global parameters:

http://www.kamailio.org/dokuwiki/doku.php/features:new-in-3.0.x#custom_cfg_file_parameters

auth.enabled = 1
...
if($sel(cfg_get.auth.enabled))
{
     route(5); #Auth
}

The extra benefit is that you can change the value at runtime without restart.

Cheers,
Daniel



On Wed, Mar 10, 2010 at 1:48 PM, Henning Westerholt <henning.westerholt@1und1.de> wrote:
On Wednesday 10 March 2010, Uriel Rozenbaum wrote:
> The question's simple, is there any pre-processor command to DEFINE
> constants?

Hi Uriel,

in kamailio 3.0 there is also the #define directive, which works more or less
like the one in other languages.

http://by-miconda.blogspot.com/2009/12/best-of-new-in-kamailio-300-2-
define.html


Cheers,

Henning


_______________________________________________
Kamailio (OpenSER) - Users mailing list
Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users



--
Daniel-Constantin Mierla
 http://www.asipto.com




--
Daniel-Constantin Mierla
 http://www.asipto.com