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
2009/8/25 Daniel-Constantin Mierla miconda@gmail.com:
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
Really useful !!!
Just a question, how about the logs? The current logs display the line error and so, what would occur if there is a syntax error in an included file?
On 25.08.2009 20:21 Uhr, Iñaki Baz Castillo wrote:
2009/8/25 Daniel-Constantin Mierla miconda@gmail.com:
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
Really useful !!!
good.
Just a question, how about the logs? The current logs display the line error and so, what would occur if there is a syntax error in an included file?
yes, line is printed in kamailio 1.5.x, I am working to get line and file printed in SR for fixup and runtime errors - right now only log of syntax errors does this.
Cheers, Daniel
Great!
...added to wiki .... http://sip-router.org/wiki/cookbooks/core-cookbook/devel#include
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
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.
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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On Wed, Aug 26, 2009 at 9:47 AM, Daniel-Constantin Mierlamiconda@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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
On 26.08.2009 11:44 Uhr, Jan Janak wrote:
On Wed, Aug 26, 2009 at 9:47 AM, Daniel-Constantin Mierlamiconda@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.
yes, enclosing in quotes would be recommended. Shall we force all the time the double quotes?
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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
On Wed, Aug 26, 2009 at 10:55 AM, Daniel-Constantin Mierlamiconda@gmail.com wrote:
On 26.08.2009 11:44 Uhr, Jan Janak wrote:
On Wed, Aug 26, 2009 at 9:47 AM, Daniel-Constantin Mierlamiconda@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.
yes, enclosing in quotes would be recommended. Shall we force all the time the double quotes?
Yes, please. That way it would be obvious that what the include directive expects is a string and not an expression to be evaluated.
thanks, Jan.
26 aug 2009 kl. 11.03 skrev Jan Janak:
On Wed, Aug 26, 2009 at 10:55 AM, Daniel-Constantin Mierlamiconda@gmail.com wrote:
On 26.08.2009 11:44 Uhr, Jan Janak wrote:
On Wed, Aug 26, 2009 at 9:47 AM, Daniel-Constantin Mierlamiconda@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.
yes, enclosing in quotes would be recommended. Shall we force all the time the double quotes?
Yes, please. That way it would be obvious that what the include directive expects is a string and not an expression to be evaluated.
And just to be very clear in the documentation - "Note that you can't use any type of avp's in this statement as it is processed at startup, not at runtime."
/O
2009/8/26 Olle E. Johansson oej@edvina.net:
And just to be very clear in the documentation - "Note that you can't use any type of avp's in this statement as it is processed at startup, not at runtime."
Sorry, is that true? I understood that the included file text is justinserted in the main config file being parse, no more, so the included file could also contain AVP's and everything. Am I wrong?
On 26.08.2009 12:09 Uhr, Iñaki Baz Castillo wrote:
2009/8/26 Olle E. Johansson oej@edvina.net:
And just to be very clear in the documentation - "Note that you can't use any type of avp's in this statement as it is processed at startup, not at runtime."
Sorry, is that true? I understood that the included file text is justinserted in the main config file being parse,
Yes, kind of. One cfg tree is built from the content of all files.
no more, so the included file could also contain AVP's and everything.
Yes, can contain anything that is valid in at the position of include directive.
Am I wrong?
Probably Olle meant that you cannot do: $avp(x) = "my_file"; include $avp(x)
Cheers, Daniel
2009/8/26 Daniel-Constantin Mierla miconda@gmail.com:
Am I wrong?
Probably Olle meant that you cannot do: $avp(x) = "my_file"; include $avp(x)
ahhh ok
On 26.08.2009 12:03 Uhr, Jan Janak wrote:
On Wed, Aug 26, 2009 at 10:55 AM, Daniel-Constantin Mierlamiconda@gmail.com wrote:
On 26.08.2009 11:44 Uhr, Jan Janak wrote:
On Wed, Aug 26, 2009 at 9:47 AM, Daniel-Constantin Mierlamiconda@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.
yes, enclosing in quotes would be recommended. Shall we force all the time the double quotes?
Yes, please. That way it would be obvious that what the include directive expects is a string and not an expression to be evaluated.
done. Just that it cannot be a string like elsewhere in the config for now. Expanding grammar to support hex, octet representation of chars, whitespace, etc. is a bit more complex to implement in order to cope with comments on the same line after the include. But I have it in mind for future.
Cheers, Daniel
Hello,
note: following most of opinions expressed on devel list regarding the directive name (to be more suggestive about what it does), "include" has been replaced with "include_file". See: http://sip-router.org/wiki/cookbooks/core-cookbook/devel#include_file
Cheers, Daniel
On 25.08.2009 20:15 Uhr, 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