[asterisk-dev] Adding a new module to Asterisk

Nir Simionovich nir.simionovich at gmail.com
Mon Oct 16 08:03:52 CDT 2017


ok, managed to pass that hurdle - I'm basically using a fairly old piece of
code to base my module on - namely, cdr_manager.c,
so the configuration parser in there is slightly different.

Minor question, is there a "safe" asterisk method of doing a "sprintf"?

On Mon, Oct 16, 2017 at 1:16 PM Joshua Colp <jcolp at digium.com> wrote:

> On Mon, Oct 16, 2017, at 06:45 AM, Nir Simionovich wrote:
> > Ok, that helped - looks like I'm linking correctly now.
> >
> > Different question, I remember their used to be a "safe string copy"
> > function that I'm supposed to use,
> > instead of using strcpy. Mainly, I want to parse my configuration file
> > correctly, but I can't find any
> > specific methodology for doing this in a uniform asteriskish manner.
>
> From a configuration perspective there's two APIs:
>
> If only .conf files are needed then there is the Asterisk Config Options
> API, include/asterisk/config_options.h, which is used by the skeleton
> application apps/app_skel.c for configuration parsing, storing, and
> usage.
>
> If realtime is needed then there is the Asterisk Sorcery API,
> include/asterisk/sorcery.h, which is used by PJSIP and other things -
> with the simplest being res/res_mwi_external.c
>
> It's highly recommended to use one of them instead of rolling your own
> configuration parsing. They take care of things (such as safe atomic
> reloads).
>
> The "safe string copy" you are thinking of is probably ast_copy_string.
>
> --
> Joshua Colp
> Digium, Inc. | Senior Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - US
> Check us out at: www.digium.com & www.asterisk.org
>
> --
> _____________________________________________________________________
> -- 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
>
-- 

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/20171016/5173dabb/attachment-0001.html>


More information about the asterisk-dev mailing list