[Freeswitch-users] ESL C# Accessviolation

Ferenc Sárközy sarkozyf at gmail.com
Thu May 29 18:39:34 MSD 2014


Hi,
My C# app uses ESL to interact with FS. It plays wav files via bgapi and
receives and processes the events of the playbacks.  The listening thread
is started like  ManagedESLTest program:

ThreadPool.QueueUserWorkItem(new WaitCallback(getFsEventsInboundMode));

this thread ends up in a while loop where the events are received:

                while (eslConnection.Connected() == ESL_SUCCESS &&
!stopConnection)
                {
                    eslEvent = eslConnection.RecvEventTimed(50);
                    if (eslEvent != null)
                    {
                        onFreeswitcEvent(eslEvent );
                    }
                }
onFreeSwitchEvent calls ends up in an other thread.

bgapi commands is sent via the same eslConnection, I assume that the
occasional Accessviolation at RecvEventTimed is caused by sending bgapi
commands via the same eslConnection from an other thread. Could that be the
cause?

Other related questions:
Is it safe to pass eslEvent to an other thread, or it should be serialized?
If so is there a best practice to serialize?

Is there some kind of event buffer in eslConnection, or the RecvEvent
misses all the events which "arrived" before the call?

Thank you in advance:
Ferenc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140529/4ec6e230/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list