[asterisk-dev] Adding a new module to Asterisk
Joshua Colp
jcolp at digium.com
Mon Oct 16 05:15:19 CDT 2017
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
More information about the asterisk-dev
mailing list