[Kamailio-Users] DEFINE question
Uriel Rozenbaum
uriel.rozenbaum at gmail.com
Wed Mar 10 19:57:40 CET 2010
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?
Uriel
On Wed, Mar 10, 2010 at 3:35 PM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:
> 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/17b5998e/attachment.htm>
More information about the Users
mailing list