[OpenSIPS-Devel] [ opensips-Patches-3494189 ] Proper includes and imports within config file(s)

SourceForge.net noreply at sourceforge.net
Mon Mar 5 19:14:50 CET 2012


Patches item #3494189, was opened at 2012-02-25 09:38
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3494189&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: trunk
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Dynamic Packet (dpacket)
>Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: Proper includes and imports within config file(s)

Initial Comment:
This patch adds support for includes and imports within the configuration file(s). These can be nested within each other and recursive up to 10 levels, which is simply a limitation set in the code. All loading is done at config parsing startup and does not effect server performance. The two new core functions added, described in detail below. Enhancements also upgrade error functions to show config file in addition other error details on parsing error(s). 

Work derived from the great parser enhancements made by Daniel-Constantin Mierla to the sip-router project. 

Purpose of patch/enhancement ::

 This patch will make working with large configs much easier. It also hopes to achieve some modularity when working with large projects/installations by abstracting parts of the logic into individual files.

Description of new core functions ::

include_file:
 example: include_file "proxy_regs.cfg"
 details: Can be called from outside route blocks to load additional routes/blocks or from inside them to simply preform more functions. The file path can be relative or absolute. If it is not an absolute path, first attempt is to locate it relative to current directory. If that fails, second try is relative to directory of the file that includes it. Will throw an error if file is not found.

import_file:
 example: import_file "proxy_checks.cfg"
 details: Same as include_file but will not throw an error if file is not found.

----------------------------------------------------------------------

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2012-03-05 10:14

Message:
Hi ,

Thank you for the patch - nice and useful functionality. I uploaded it on
SVN.

As we need a place to document the cfg file related features, what about
starting a tutorial on the opensips config file - structure, syntax, etc ?

Regards,
Bogdan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=3494189&group_id=232389



More information about the Devel mailing list