[asterisk-dev] Processing .conf files

Nir Simionovich nir.simionovich at gmail.com
Sun Nov 19 11:18:12 CST 2017


Hi All,

  Ok, this email may be totally pointless to some, but I'm having some
conceptual difficulties with the methodology of processing .conf files.

  Allow me to explain my current issues in ramping up on this one. As part
of the
beanstalk work I've done, I would like to create either an app_beanstalk or
func_beanstalk or to be better, a res_beanstalk.

  In my mind, I see a configuration file works something like the following:

;
; Beanstalk job queue resourcing application
;

[general]
ttr = 60            ; an integer number of seconds to allow a worker to run
a job
delay = 0           ; an integer number of seconds to wait before marking a
job as ready.
                    ; A job will be set as "delayed" in this period of time


[tube1]
enabled = no
;host = 127.0.0.1    ; Specify the remote IP address of the Beanstalkd
server
;port = 11300        ; Specify the remote PORT of the the Beanstalkd server
;tube = asterisk-cdr ; Specify the default job queue to use
;priority = 99       ; Specify the default job priority for the queue. The
lower the number,
                     ; the higher the priority.


[tube2]
enabled = no
;host = 127.0.0.1    ; Specify the remote IP address of the Beanstalkd
server
;port = 11300        ; Specify the remote PORT of the the Beanstalkd server
;tube = asterisk-cdr ; Specify the default job queue to
;priority = 99       ; Specify the default job priority for the queue. The
lower the number,
                     ; the higher the priority.

  Now, I've trying to figure out how the configuration parser works with
"free form" data. I've tried looking
into app_voicemail.c, as that uses a fairly similar concept, however, that
didn't provide much help.

  From what I gathered, there are two main functions that I need to
understand how they work:
ast_category_browse and ast_variable_browse. Now, the basic methodology of
the various Asterisk
config files is fairly static, namely, a configuration for a singular
function - very much like cdr_beanstalkd.conf.
However, for my new tool to work, I need to be able to create dynamically
allocated "tube contexts". I couldn't find
any specific sample that would describe this kind of methodology of
operation in a coherent manner.

  Another option I was thinking of doing is going with the following route:

;
; Beanstalk job queue resourcing application
;

[general]
ttr = 60            ; an integer number of seconds to allow a worker to run
a job
delay = 0           ; an integer number of seconds to wait before marking a
job as ready.
                    ; A job will be set as "delayed" in this period of time

tube => tube1,beanstalk://127.0.0.1:11300/asterisk-tube1,99
tube => tube2,beanstalk://127.0.0.1:11300/asterisk-tube2,99

  In general, this seems like a simpler configuration parsing mechanism,
but, it doesn't really comply with
how the rest of the Asterisk configuration is built, and thus, seems fairly
alien to the configuration construct.

  Any assistance would be appreciated.

P.S.
  Already looked into app_skel, didn't really provide me the information I
was looking for.




-- 

Kind Regards,

  Nir Simionovich

  GreenfieldTech

  (schedule) http://nirsimionovich.appointy.com/

  (w) http://www.greenfieldtech.net

  (p) +972-73-2557799        (MSN): nirs at greenfieldtech.net

  (m) +972-54-6982826      (GTALK): nir.simionovich at gmail.com

  (f) +972-73-2557202      (SKYPE): greenfieldtech.nir


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

               Zero Your Inbox <https://mailstrom.co/referral/ARZJE> | Cloud
Servers <https://www.digitalocean.com/?refcode=97eeea09917a>

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

*Disclaimer:*

This e-mail is intended solely for the person to whom it is addressed and
may contain confidential or legally privileged information. Access to this
e-mail by anyone else is unauthorized. If an addressing or transmission
error has misdirected this e-mail, please notify the author by replying to
this e-mail and destroy this e-mail and any attachments.
E-mail may be susceptible to data corruption, interception, unauthorized
amendment, viruses and delays or the consequences thereof. If you are not
the intended recipient, be advised that you have received this email in
error and that any use, dissemination, forwarding, printing or copying of
this email is strictly prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20171119/d984b501/attachment-0001.html>


More information about the asterisk-dev mailing list