[asterisk-dev] [asterisk-app-dev] How do third party moduledevelopersexposetheir resources via asterisk ARI?

David M. Lee dlee at digium.com
Fri Oct 18 10:20:15 CDT 2013


On Oct 18, 2013, at 9:27 AM, Paul Albrecht <palbrecht at glccom.com> wrote:

>> As far as registering a resource with ARI, the main function is ast_ari_add_handler()[2]. That call, and the code to build the stasis_rest_handlers tree that gets passed into it, resides in the generated res/res_ari_{resource}.c file.
>> 
> 
> Suppose this will work, but why not implement resources the usual way asterisk does this sort of thing? That is, create an object via a registration interface and then call the methods on the object when they're needed. For resources, it would be something like register the uri and callbacks for the rest methods and then invoke the methods via the object when then accessed.

That's exactly what we have. But the C code to do so is tedious, repetitive, and error prone.

We made design decisions to provide (and some extent, enforce) API documentation for ARI. Generating C code from the API declarations was fairly simple, and helps to enforce consistency between the API declarations and the implementation.

-- 
David M. Lee
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com  & www.asterisk.org




More information about the asterisk-dev mailing list