[Kamailio-Users] DEFINE question

Daniel-Constantin Mierla miconda at gmail.com
Wed Mar 10 19:35:45 CET 2010


Hello,

On Wed, Mar 10, 2010 at 7:05 PM, Uriel Rozenbaum
<uriel.rozenbaum at 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 at 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<http://by-miconda.blogspot.com/2009/12/best-of-new-in-kamailio-300-2-%0Adefine.html>
>>
>> Cheers,
>>
>> Henning
>>
>
>
> _______________________________________________
> Kamailio (OpenSER) - Users mailing list
> Users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/users/attachments/20100310/26a74edd/attachment.htm>


More information about the Users mailing list