<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Can't you just have a different connection managed by the other thread? &nbsp;Does that work?<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 25, 2014, at 2:57 PM, Swapnil Ayachit &lt;<a href="mailto:s.Ayachit@cataleya.com" class="">s.Ayachit@cataleya.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">

<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" class="">

<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;" class="">
<div class="">
<div class="">Hello friends,</div>
<div class=""><br class="">
</div>
<div class="">I am new to Freeswitch. I like freeswitch architecture and its flexibility.</div>
<div class=""><span style="font-family: Helvetica, sans-serif; font-size: 9pt;" class=""><br class="">
</span></div>
<div class=""><b class="">I have couple of questions:</b></div>
<div class="">Is the ESL connection objection thread safe?</div>
<div class=""><span style="font-family: Helvetica, sans-serif; font-size: 9pt;" class="">Can we post ESL events to a queue and handle it by a different thread and if this new thread can write back on the ESL connection</span></div>
<div class=""><span style="font-family: Helvetica, sans-serif; font-size: 12px;" class=""><br class="">
</span></div>
<div class=""><b class="">Problem</b>:</div>
<div class="">I &nbsp;am facing a problem with &nbsp;a python program using outbound ESL interface which plays announcement, collect digits and bridges a call. First call always works but 2nd call &nbsp;doesn’t work after playback command from app. eslLogLeve(7) and fs_cli doesn’t
 show any errors.&nbsp;</div>
<div class=""><b class="">App:</b></div>
<div class="">We have a server thread which accepts incoming connection from FS, answers call and waits for other events. If it receives CHANNEL_ANSWER or DTMF event then it post event along with connection object to python queue.&nbsp;<span style="font-style: italic;" class="">&nbsp;</span>&nbsp;</div>
<div class="">We have another thread which processes events from queue. It plays announcement for CHANNEL_ANSWER event and it stores digits for DTMF events. If digit lenth becomes 4 then it bridges call to a gateway.</div>
<div class=""><br class="">
</div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">
<span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">FreeSWITCH Version 1.2.24+git~20140513T183205Z~9af707ed20~64bit (git 9af707e 2014-05-13 18:32:05Z 64bit) on RedHat 6.4.</span><o:p class=""></o:p></div>
<div class=""><br class="">
</div>
<div class="">Con is outbound ESL connection object</div>
<div class="">Python:</div>
<div style="font-family: Calibri; font-size: 12px;" class=""><span style="font-size: 12px;" class=""><font face="Consolas" class="">&nbsp; &nbsp;while con.connected():</font></span></div>
<div style="font-family: Calibri; font-size: 12px;" class=""><span style="font-size: 12px;" class=""><font face="Consolas" class="">&nbsp; &nbsp; &nbsp; fs_event = con.recvEvent()</font></span></div>
<div style="font-family: Calibri; font-size: 12px;" class=""><span style="font-size: 12px;" class=""><font face="Consolas" class="">&nbsp; &nbsp; &nbsp; if name == "DTMF”:</font></span></div>
<div style="font-family: Calibri; font-size: 12px;" class=""><span style="font-size: 12px;" class=""><font face="Consolas" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;eventQueue.put(conn, fs_event)</font></span></div>
<div style="font-family: Calibri; font-size: 12px;" class="">
<div class=""><div style="font-family: 'Times New Roman', serif; font-size: 12pt; margin: 0cm 0cm 0.0001pt;" class="">
<code style="font-family: 'Courier New';" class=""><span style="font-size: 10pt; color: rgb(51, 51, 51);" class=""><br class="">
</span></code></div><div style="margin: 0cm 0cm 0.0001pt;" class=""><span style="font-size: 12px;" class=""><font face="Consolas" class=""><code class=""><span style="color: rgb(51, 51, 51);" class="">server&nbsp;=</span></code><span style="color: rgb(51, 51, 51);" class="">&nbsp;</span><code class=""><span style="color: rgb(51, 51, 51);" class="">SocketServer.ThreadingTCPServer(('',&nbsp;8040),
 ESLRequestHandler)</span></code><span style="color: rgb(51, 51, 51);" class=""><o:p class=""></o:p></span></font></span></div><div style="font-family: 'Times New Roman', serif; font-size: 12pt; margin: 0cm 0cm 0.0001pt;" class="">
<code style="font-family: 'Courier New';" class=""><span style="font-size: 10pt; color: rgb(51, 51, 51);" class=""><br class="">
</span></code></div>
</div>
<div class=""></div>
</div>
<div class="">If I don’t put event in python queue and process it within while con.connected() loop then program always works but I would like to process event in other thread.&nbsp;</div>
<div class="">recvEventTimed(100) &nbsp;or creating new inbound connection to execute FS commands couldn’t help.</div>
<div class=""><br class="">
</div>
<div style="font-family: Calibri; font-size: 12px;" class=""><div style="margin: 0cm 0cm 0.0001pt;" class="">Appreciate any help.</div><div style="margin: 0cm 0cm 0.0001pt;" class=""><br class="">
</div><div style="margin: 0cm 0cm 0.0001pt;" class="">Regards,</div><div style="margin: 0cm 0cm 0.0001pt;" class="">Swapnil</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>

_________________________________________________________________________<br class="">Professional FreeSWITCH Consulting Services: <br class=""><a href="mailto:consulting@freeswitch.org" class="">consulting@freeswitch.org</a><br class="">http://www.freeswitchsolutions.com<br class=""><br class="">Official FreeSWITCH Sites<br class="">http://www.freeswitch.org<br class="">http://confluence.freeswitch.org<br class="">http://www.cluecon.com<br class=""><br class="">FreeSWITCH-users mailing list<br class="">FreeSWITCH-users@lists.freeswitch.org<br class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br class="">UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br class="">http://www.freeswitch.org</div></blockquote></div><br class=""></div></body></html>