The general jist of your overview seems sound.

To answer your question:

Typically you would have the protocol specific side create some sort of table of all the calls with something to tie it to the freeswitch channel.  To be threadsafe you can keep the channels uuid string in a table and whenever you need to do something to that channel you can find it with session = switch_core_session_locate(uuid)
This will only give you the session if it can acquire a read lock giving you suitable level of guarentee that the channel will not be destroyed until you release it with switch_core_session_rwunlock(session);

for the other way around you can store some info to get back to the master protocol by way of the
private structure found in the channel with either a direct pointer to your master entity or some similar
token based lookup to find the correct entity.



On Wed, Nov 19, 2008 at 8:58 AM, Giovanni Maruzzelli <gmaruzz@celliax.org> wrote:
First things first: when I'll understand, I'll write the wiki page on
endpoints inner working and development.

I'm now beginning to rewrite the skypiax implementation, and I would
like to do it in the most "accepted" way.

skypiax (and celliax in the future) will have multiple interfaces (eg:
multiple concurrent skype clients managed by the module).

So, you can think at it as similar to mod_openzap as a general structure.

At module loading, I will parse the config file, and create a
"globals" struct that will contains the global values that can be
inherited by all interfaces and an array of pointers to interface
structs.

For each Skype interface that I find defined in the config file, I
will alloc and populate one interface struct pointed by one array
member.

If not overridden in the interface definition in the config file, the
interface struct members will inherit the values from the globals.

For each Skype interface, I will have a thread, started on module
loading, that monitors that interface for signaling (incoming call,
offline, buddies, etc).

When an incoming call arrives, the signaling thread creates the
session, get the interface name, create a private tech_pvt that is
just a series of pointers to the members of the interface structure
that is located by the name, put the channel in the CS_INIT state,
start the thread on it, and forget.

When there is an outboubd call, channel_outgoing_channel() find the
interface name from outbound_profile->destination_num, create a
private tech_pvt that is just a series of pointers to the members of
the interface structure located by the name, put the channel in the
CS_INIT state and forget.

Is the above correct?

How to send messages/events/etc (state changes, whatever) from the
signaling thread to an active interface (eg. remote hangup)?
How an active interface receives  messages/events/etc (state changes,
whatever) from the core FS (eg local hangup request)?

Thank you to all that will answer, and please forgive the naiveness of
this first posting.

Ciao for now,

Giovanni



--

Sincerely,

Giovanni Maruzzelli

=========================================
Contact person : Mr Giovanni Maruzzelli
Company : celliax
Website: www.celliax.org
Address : via Pierlombardo 9, 20135 Milano
Country/Territory : Italy
Business Email: gmaruzz at celliax dot org
Phone : 39-347-2665618
Fax : 39-02-87390039

_______________________________________________
Freeswitch-dev mailing list
Freeswitch-dev@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400