[asterisk-dev] const char * to AST_STRING_FIELD

Szasz Tamas szasz.tamas at elastoffice.com
Tue Jan 31 03:34:14 CST 2012


Hi List,

I'm new in asterisk development, and I need to change something in our 
module, because the module was developed for asterisk 1.4.
The problem from where I can't move out:
In our old 1.4 module was a definition:
FUNCTION_STATIC(Function, funcName, synopsis, syntax, description)
                                 Function * Function::_instance = 0;
                                 struct ast_custom_function      
Function::function =
                                 {
                                         funcName,  //const char *
                                         synopsis,   //const char *
                                         syntax,   //const char *
                                         description,   //const char *
                                         FuncReadWrapper<Function>,
                                         FuncWriteWrapper<Function>
                                 };

But in the asterisk version 1.6 we must use the ast_custom_function like 
this:

struct ast_custom_function {
         const char *name;                       /*!< Name */
         AST_DECLARE_STRING_FIELDS(
                 AST_STRING_FIELD(synopsis);     /*!< Synopsis text for 
'show functions' */
                 AST_STRING_FIELD(desc);         /*!< Description (help 
text) for 'show functions &lt;name&gt;' */
                 AST_STRING_FIELD(syntax);       /*!< Syntax text for 
'core show functions' */
                 AST_STRING_FIELD(arguments);    /*!< Arguments 
description */
                 AST_STRING_FIELD(seealso);      /*!< See also */
         );
         enum ast_doc_src docsrc;                /*!< Where the 
documentation come from */
         ast_acf_read_fn_t read;         /*!< Read function, if read is 
supported */
         ast_acf_write_fn_t write;       /*!< Write function, if write 
is supported */
         struct ast_module *mod;         /*!< Module this custom 
function belongs to */
         AST_RWLIST_ENTRY(ast_custom_function) acflist;
};

Can somebody explain me, how can I change my code to the new style. I 
tried it, but neither one solution worked.
Maybe for a senior developer, it's a simple question.

Best Regards,
Tamas Szasz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120131/f4eaa636/attachment-0001.htm>


More information about the asterisk-dev mailing list