[sr-dev] updates to config preprocessor

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 7 09:52:41 CEST 2011


Hello,

just to let you know about some recent additions regarding the config 
file preprocessor, hopefully they will help you keep the config cleaner 
and easy to maintain.

- you can use either #! or !! as the start marker of preprocessor 
directive (to make happy those complaining about not able to distinguish 
quickly from comments)
- subsdef was added some time ago to allow defining a token that will 
replace ID tokens as well as update inside string values. It has the 
same format as #!subst. For example:|

#!substdef "!ABC!XYZ!g"|

is pretty much same as:

#!define ABC XYZ
#!subs "/ABC/XYZ/"

- substdefs, like substdef byt the defined value will be added enclosed 
in double quotes:

|#!substdef "!ABC!XYZ!g"|

is pretty much same as:

#!define ABC "XYZ"
#!subs "/ABC/XYZ/"

- trydef - similar to define, but if the ID is defined already, ignore 
this time
- redef - similar to define, but if the ID is defined, redefine its 
value (note that define itself throws error if the ID is already defined)

Regarding the inclusion of files, a new option is available, 
'import_file'. It is similar to 'include_file', but if the file is not 
found, it does not throw error. Bot include_file and import_file can be 
started as well with #! or !!. You can still use them without #! or !!, 
whatever you like more.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20110707/af3ea8ef/attachment-0001.htm>


More information about the sr-dev mailing list