[asterisk-dev] chan_cellphone - Asterisk architecture question / discussion

Tzafrir Cohen tzafrir.cohen at xorcom.com
Wed Feb 7 17:55:21 MST 2007


On Wed, Feb 07, 2007 at 06:08:42PM -0600, Russell Bryant wrote:
> 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

This is how chan_modem works. But then you have the pain of manually
setting chan_modem to be in the globals section. Anyway, are those
indeed independent channels? If I want to list all of my phones, should
I get a separate list for Nokias and for Sonys?

-- 
               Tzafrir Cohen       
icq#16849755                    jabber:tzafrir at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir


More information about the asterisk-dev mailing list