Hi guys,
The question's simple, is there any pre-processor command to DEFINE constants?
Thanks! Uriel
2010/3/10 Uriel Rozenbaum uriel.rozenbaum@gmail.com:
Hi guys,
The question's simple, is there any pre-processor command to DEFINE constants?
Until Kamailio 1.5 you can use m4 (look in the wiki to get some usage example). Beginning with Kamailio 3.0 there are 'conf' variables (like constants that can be changed in runtime via MI command).
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
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?
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.htmlhttp://by-miconda.blogspot.com/2009/12/best-of-new-in-kamailio-300-2-%0Adefine.html
Cheers,
Henning
Hello,
On Wed, Mar 10, 2010 at 7:05 PM, Uriel Rozenbaum uriel.rozenbaum@gmail.comwrote:
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/kamai...
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_f...
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.htmlhttp://by-miconda.blogspot.com/2009/12/best-of-new-in-kamailio-300-2-%0Adefine.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,
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@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/kamai...
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_f...
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.htmlhttp://by-miconda.blogspot.com/2009/12/best-of-new-in-kamailio-300-2-%0Adefine.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
Hello,
On Wed, Mar 10, 2010 at 7:57 PM, Uriel Rozenbaum uriel.rozenbaum@gmail.comwrote:
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/kamai...
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_f...
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.htmlhttp://by-miconda.blogspot.com/2009/12/best-of-new-in-kamailio-300-2-%0Adefine.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