[Kamailio-Users] [sr-dev] [SR-Users] support for 'include' in cfg file

Jan Janak jan at ryngle.com
Wed Aug 26 10:44:48 CEST 2009


On Wed, Aug 26, 2009 at 9:47 AM, Daniel-Constantin
Mierla<miconda at gmail.com> wrote:
>
>
> On 26.08.2009 1:51 Uhr, Klaus Darilion wrote:
>>
>> Great!
>>
>> ...added to wiki ....
>> http://sip-router.org/wiki/cookbooks/core-cookbook/devel#include
>
> thanks, I was wondering if this really belongs to parameters section, since
> it can be used in route blocks as well. Maybe a new section is better -- not
> sure how to name it now.

Maybe we should have a section about general config file syntax, such
as comments, identifiers, reserved keywords, included files. This
directive would then fit in nicely.

By the way, wouldn't it make more sense to require that the filename
is enclosed between a pair of quotes? Unix filenames may contain
pretty much anything except '/' and that could result in all kinds of
strange errors when not quoted. Also it would be consistend with
loadmodule and loadpath.

  Jan.

>
> Cheers,
> Daniel
>
>
>>
>> klaus
>>
>> Daniel-Constantin Mierla wrote:
>>>
>>> Hello,
>>>
>>> just committed to GIT support for 'include' in config file. Hopefully
>>> this helps in nicer structuring and maintenance of your configs.
>>>
>>> The syntax is simple:
>>>
>>> include path_to_file
>>>
>>> The path_to_file can be relative or absolute. If it is not absolute path,
>>> first attempt is to locate it relative to current directory, and if fails,
>>> relative to directory of the file that includes it. There is no restriction
>>> where include can be used or what can contain - any part of config file is
>>> ok. There is a limit of maximum 10 includes in depth, otherwise you can use
>>> as many includes as you want. Reporting of the cfg file syntax errors prints
>>> now the file name for easier troubleshooting.
>>> Example:
>>>
>>> route {
>>>    ...
>>>    include /sr/checks.cfg
>>>    ...
>>> }
>>>
>>> --- /sr/checks.cfg ---
>>>
>>>   if (!mf_process_maxfwd_header("10")) {
>>>       sl_send_reply("483","Too Many Hops");
>>>       exit;
>>>   }
>>>
>>> ---
>>>
>>> Testing and feedback is much appreciated.
>>>
>>> Cheers,
>>> Daniel
>>>
>>
>>
>> _______________________________________________
>> sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>
> --
> Daniel-Constantin Mierla
> * http://www.asipto.com/
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>




More information about the sr-users mailing list