[asterisk-dev] Application/Function configuration parsing

Nir Simionovich nir.simionovich at gmail.com
Sun Oct 26 03:13:21 CDT 2008


Hi Russell,

  Thanks for the info and the pointer to the presentation - I'll take a 
look at it and see if I get the hang of
it.

  Here's a silly question, why not include the configuration parsing 
handling techniques to the app_skel.c
file, so that people starting off have a clear example. app_skel.c is a 
wonderful example, and it took me
about 20 minutes to read, another 10 minutes to understand how the 
application flags and options are
parsed and continue on from there. I'm confident that for someone 
experienced, it will take no more than
a few minutes to create a skel.conf file, showing a skeleton 
configuration file, and have it parsed in the
application - I'm confident it will help many like myself to get up and 
running faster.

Cheers,
  Nir S



Russell Bryant wrote:
> 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.
>
>
>
>
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>   




More information about the asterisk-dev mailing list