[asterisk-dev] chan_cellphone - Asterisk architecture question
/ discussion
Russell Bryant
russell at digium.com
Wed Feb 7 17:08:42 MST 2007
David Bowerman wrote:
> My question is, if I were to go down this track, how would you want
> the abstraction module to be built in terms of the Asterisk
> architecture?. Its not an app, and not a chan, so a res maybe ?
>
> Asterisk <-> chan_cellphone <-> res_nokia | res_sony | res_xxx <->
> bluetooth <->hardware
>
> Any thoughts?
I would suggest doing something simpler than that.
chan_cellphone.c --- The core channel driver
chan_cellphone_nokia.c --- The implementation of the nokia specific piece
chan_cellphone_sony.c -- sony specific piece ...
Then, we can build chan_cellphone.so to comprise chan_cellphone.o as
well as chan_cellphone_*.o.
Then, for each phone specific component, you would need a way to
"register" it into the chan_cellphone core. You could do the same thing
that Asterisk modules do when they get loaded. We use constructors to
run the load_module() function so that the module doesn't have to care
whether it was getting dynamically loaded, or if it was just embedded
into the Asterisk executable. So, you can use a constructor in each
sub-file that will register that phone specific implementation.
For more information on the constructor attribute, see the following
documentation on function attributes in general, as well as the
constructor attribute specifically:
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Function-Attributes.html#Function-Attributes
--
Russell Bryant
Software Engineer
Digium, Inc.
More information about the asterisk-dev
mailing list