Hello,

On Wed, Mar 10, 2010 at 7:57 PM, Uriel Rozenbaum
<[email protected]>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 <
> [email protected]> wrote:
>
>> Hello,
>>
>> On Wed, Mar 10, 2010 at 7:05 PM, Uriel Rozenbaum <
>> [email protected]> 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 <
>>> [email protected]> 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
>>> [email protected]
>>> 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
_______________________________________________
Kamailio (OpenSER) - Users mailing list
[email protected]
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users

Reply via email to