[Freeswitch-dev] Share data between modules

João Mesquita jmesquita at freeswitch.org
Thu Oct 18 22:06:26 MSD 2012


I understand it now. Should we make a disclaimer about that on the wiki or
even on the configuration file of the mod? I am working on documenting most
of the modules of their corresponding conf files and I really believe this
piece of information deserves a very visible space.

Regards,
João Mesquita



On Thu, Oct 18, 2012 at 12:43 PM, Anthony Minessale <
anthony.minessale at gmail.com> wrote:

> I mean loading it into FS at all puts you at risk of crashing.
>
> ZMQ pretends to be a socket but really is a complicated series of threads
> all using sockets to talk to each other.  You only see one, its designed
> expecting the main thread of your app to be the star of the app.  The way
> its used in FS loading it into a mod puts it at risk because if any thread
> in FS calls fork for any reason, all of the zmq threads also fork and cause
> segs.
>
> Doing it on the other side of ESL is safer since you are not loading the
> lib into the process.
>
>
> On Thu, Oct 18, 2012 at 12:28 PM, João Mesquita <jmesquita at freeswitch.org>wrote:
>
>> Tony,
>>
>> If I understood you correctly, using ZMQ more extensively other than an
>> event consumer will never work right but the mod as it is with the proper
>> thread safety implementation would work just fine correct?
>>
>> What I find very debatable is that the beauty of ZMQ is implementing your
>> own protocol for service based brokers and such fancy things other than
>> just broadcasting messages like it is doing right now and since the
>> protocol implementation is something very dependent on the application
>> itself, a standard mod is questionable. The way I do it is have my own
>> daemon that uses ESL to consume events and do ZMQ on the other end. Much
>> like a proxy.
>>
>> Anyhow, just wanted to add to the discussion.
>>
>> Sent from my iPhone
>>
>> On Oct 18, 2012, at 1:14 PM, Anthony CTO <anthony.minessale at gmail.com>
>> wrote:
>>
>> ZMQ and FS are never going to work well....
>>
>> There are many problems such as, any call to fork in FS like when it
>> execs the system commands or tries to email a VM results in segs.
>>
>> ZMQ has a firm belief in no mutexes and sockets for threads to do
>> interprocess communication.  I don't have anything against that but it does
>> not match the FS philosophy at all.
>>
>> All that aside,
>>
>> mod_event_zmq sends only events  if you want to send data from a module
>> via that, just create and fire an event.
>>
>>
>> On Thu, Oct 18, 2012 at 9:07 AM, João Mesquita <jmesquita at freeswitch.org>wrote:
>>
>>> I guess a solution would be to re queue the events again and pop on the
>>> thread that owns the ZMQ context. Shouldn't be too hard although there
>>> would be locking problems on the queue.
>>>
>>> Regards,
>>> JM
>>>
>>> Sent from my iPhone
>>>
>>> On Oct 17, 2012, at 8:52 AM, Peter Olsson <
>>> peter.olsson at visionutveckling.se> wrote:
>>>
>>>  I believe the threading model in zmq is different, that it really
>>> doesn’t work well together with FreeSWITCH’s threading model.****
>>>
>>> ** **
>>>
>>> If I’ve understood this correctly, for instance when you send a message
>>> using zmq, the library takes for granted that this is always done from the
>>> same thread. However, inside FS it means it might be sent from different
>>> threads, since the event system inside FS has multiple threads to pop the
>>> queued events.****
>>>
>>> ** **
>>>
>>> Tony, probably has a more correct description – I’ve never even used zmq
>>> myself :)****
>>>
>>> ** **
>>>
>>> /Peter****
>>>
>>> ** **
>>>
>>> *Från:* freeswitch-dev-bounces at lists.freeswitch.org [
>>> mailto:freeswitch-dev-bounces at lists.freeswitch.org<freeswitch-dev-bounces at lists.freeswitch.org>]
>>> *För *Juan Antonio Ibañez Santorum
>>> *Skickat:* den 17 oktober 2012 13:37
>>> *Till:* freeswitch-dev at lists.freeswitch.org
>>> *Ämne:* Re: [Freeswitch-dev] Share data between modules****
>>>
>>> ** **
>>>
>>> Any idea to improve it? ****
>>>
>>> 2012/10/16 Anthony Minessale <anthony.minessale at gmail.com>****
>>>
>>> You should do that by firing events from your module so they are
>>> delivered via mode_event_zmq.****
>>>
>>> Beware zmq is unstable in FS because its a threaded app and zmq is a
>>> different threading model.****
>>>
>>> ** **
>>>
>>> On Tue, Oct 16, 2012 at 3:44 PM, Juan Antonio Ibañez Santorum <
>>> juanito1982 at gmail.com> wrote:****
>>>
>>> The idea is to get some internal data from an own module to be served
>>> via mod_event_zmq.****
>>>
>>> ** **
>>>
>>> Regards****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> 2012/10/16 Anthony Minessale <anthony.minessale at gmail.com>****
>>>
>>> Can you provide context on which 2 modules you want to do this with?****
>>>
>>> Its not a good design to allow loadable modules to require symbols from
>>> each other.****
>>>
>>> ** **
>>>
>>> On Tue, Oct 16, 2012 at 12:48 PM, Juan Antonio Ibañez Santorum <
>>> juanito1982 at gmail.com> wrote:****
>>>
>>> Do you refer to mod_hash? How can I call its API functions from another
>>> module? Is it possible to save C data structures, not only stirng values?
>>> ****
>>>
>>> ** **
>>>
>>> Regards****
>>>
>>> ** **
>>>
>>> 2012/10/16 Mitch Capper <mitch.capper at gmail.com>****
>>>
>>> Check out the hash api it can do exactly what you want, suggest
>>> prefixing all your entries to keep it clean and avoid conflicts.
>>>
>>> ~Mitch****
>>>
>>>
>>> On Tue, Oct 16, 2012 at 8:45 AM, Juan Antonio Ibañez Santorum
>>> <juanito1982 at gmail.com> wrote:
>>> > Hello,
>>> >
>>> >    Is there any way to share data (as a hash) between modules? I can
>>> see
>>> > switch_core_set_variable() function but I think it cannot be used for
>>> that
>>> > purpose.
>>> >
>>> > Regards
>>> >****
>>>
>>> >
>>> _________________________________________________________________________
>>> > Professional FreeSWITCH Consulting Services:
>>> > consulting at freeswitch.org
>>> > http://www.freeswitchsolutions.com
>>> >
>>> > 
>>> > 
>>> >
>>> > Official FreeSWITCH Sites
>>> > http://www.freeswitch.org
>>> > http://wiki.freeswitch.org
>>> > http://www.cluecon.com
>>> >
>>> > FreeSWITCH-dev mailing list
>>> > FreeSWITCH-dev at lists.freeswitch.org
>>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> > http://www.freeswitch.org
>>> >
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org****
>>>
>>> ** **
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at 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/
>>> Twitter: http://twitter.com/FreeSWITCH_wire
>>>
>>> AIM: anthm
>>> MSN:anthony_minessale at hotmail.com
>>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>>> IRC: irc.freenode.net #freeswitch
>>>
>>> FreeSWITCH Developer Conference
>>> sip:888 at conference.freeswitch.org
>>> googletalk:conf+888 at conference.freeswitch.org
>>> pstn:+19193869900****
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org****
>>>
>>> ** **
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at 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/
>>> Twitter: http://twitter.com/FreeSWITCH_wire
>>>
>>> AIM: anthm
>>> MSN:anthony_minessale at hotmail.com
>>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>>> IRC: irc.freenode.net #freeswitch
>>>
>>> FreeSWITCH Developer Conference
>>> sip:888 at conference.freeswitch.org
>>> googletalk:conf+888 at conference.freeswitch.org
>>> pstn:+19193869900****
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org****
>>>
>>>
>>> !DSPAM:507e958b32763975712591! ****
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at 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/
>> Twitter: http://twitter.com/FreeSWITCH_wire
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:+19193869900
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at 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/
> Twitter: http://twitter.com/FreeSWITCH_wire
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> googletalk:conf+888 at conference.freeswitch.org
> pstn:+19193869900
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20121018/cba30bbb/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list