[asterisk-dev] Application/Function configuration parsing
Russell Bryant
russell at digium.com
Sat Oct 25 21:05:40 CDT 2008
On Oct 25, 2008, at 5:29 PM, Nir Simionovich wrote:
> I've been trying to read how Asterisk applications or functions
> relate
> to specific configuration files,
> however, I was unable to figure out a single methodology to do so. I
> may
> be missing something here,
> but as I'm trying to write an application that relies on a
> configuration
> file, this point kinda got me stuck.
>
> My general application description is available at
> http://www.simionovich.com/?page_id=94, and I
> would highly appreciate it is you could please point me to some
> example
> that may help me out in a
> simple and clear way. I've tried chan_sip.c to figure out how the
> configuration section works, but as
> I said, I got stuck (My C is a little rusty, I have to admit).
The functions for configuration handling are declared in include/
asterisk/config.h. The three that are most commonly used are.
ast_config_load()
- Load a configuration file
ast_category_browse()
- Traverse configuration categories (The stuff in square brackets)
ast_variable_browse()
- Traverse key/value pairs within a certain configuration category
There are a lot of examples, and they're all a little bit different.
If you search around for ast_config_load(), you will find all of the
places that configuration is handled.
Here is an older set of slides on the config API that might help as
well:
http://svncommunity.digium.com/svn/russell/presentations/astricon07/developer-day/Astricon_config_API.odp
--
Russell Bryant
Senior Software Engineer
Open Source Team Lead
Digium, Inc.
More information about the asterisk-dev
mailing list