Sirish,<br><br>Since you&#39;re using an E1 to connect to the PBX then really all you need to do is keep track of the last time each port was hung up and whether or not a given port is currently in use. I would use api_on_answer to launch a simple script to set a flag to say that a particular port is in use and then use the api_hangup_hook to launch another script when the call ends.<br>
<br>The channel variables page on the wiki has some examples of how to use these. I recommend that you write simple Lua scripts that use the &quot;hash&quot; API to store information in the local database. Also, check out the &quot;hash_dump&quot; API as it is a useful way to quickly see what all is stored there.<br>
<br>For an example of how to add, remove, and read information from the local database using the &quot;hash&quot; API please see conf/dialplan/default.xml. Search for &quot;hash&quot; and you&#39;ll see all sorts of examples of how the example dialplan uses the local database to store useful information that allows us to implement features like call return, call intercept, etc.<br>
<br>-MC<br><br><div class="gmail_quote">On Tue, Dec 18, 2012 at 7:39 PM, Sirish Masur Mohan <span dir="ltr">&lt;<a href="mailto:Sirish.MasurMohan@oa.com.au" target="_blank">Sirish.MasurMohan@oa.com.au</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-AU"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi Michael,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&gt;&gt;</span> How are you physically connecting from FreeSWITCH to the PBX?<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I connect this via E1 link – I have a Sangoma card installed on the FreeSWITCH machine.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">With regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Sirish<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Michael Collins<br>
<b>Sent:</b> Wednesday, 19 December 2012 1:31 PM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] Newbie question: Executing Lua scripts for incoming calls, how concurrency is to be handled?<u></u><u></u></span></p>
</div><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="margin-bottom:12.0pt">To trigger SIP registrations you&#39;d need the PBX to have a SIP client. I&#39;m assuming this is possible, but maybe that&#39;s a false assumption. How are you physically connecting from FreeSWITCH to the PBX?<br>
<br>-MC<u></u><u></u></p><div><p class="MsoNormal">On Tue, Dec 18, 2012 at 2:36 PM, Sirish Masur Mohan &lt;<a href="mailto:Sirish.MasurMohan@oa.com.au" target="_blank">Sirish.MasurMohan@oa.com.au</a>&gt; wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hey Guys,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Would really appreciate if you could help me out here – isn’t there a way to handle concurrent calls in the dial plan, especially when Lua scripts, accessing global variables, are executed on receiving calls? </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Is mod_fifo the closest I could get to handle concurrency (as Michael has explained)? If yes, how do I trigger SIP registrations, especially working with a PBX which I don’t have full control of?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">With regards,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Sirish</span><u></u><u></u></p></div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p>
<div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US"> Sirish Masur Mohan <br>
<b>Sent:</b> Tuesday, 18 December 2012 1:02 PM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> RE: [Freeswitch-users] Newbie question: Executing Lua scripts for incoming calls, how concurrency is to be handled?</span><u></u><u></u></p>
</div></div><div><div><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi Michael,</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks for the reply. </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&gt;&gt;</span> You would need a SIP registration from the PBX to FreeSWITCH for each of the modem extensions<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I am seen SIP clients such as X-Lite sending out the SIP registrations, but could you please clarify as to how this can be achieved in the PBX? The final production environment would be out in the customer’s PBX, which I may not have complete control of.. </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">&gt;&gt;</span> What application are you building?<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I may not be able to provide the details because of the NDA with customer, but what I am trying to achieve is, to replace an existing IVR with FreeSWITCH in an old existing setup of the customer – that’s the reason why we continue working with dialup modems!</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">With regards,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Sirish</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">mailto:freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Michael Collins<br>
<b>Sent:</b> Tuesday, 18 December 2012 6:23 AM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] Newbie question: Executing Lua scripts for incoming calls, how concurrency is to be handled?</span><u></u><u></u></p>
</div><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal" style="margin-bottom:12.0pt">You don&#39;t have to have actual human agents for mod_fifo. You could define a user for each modem and then manually &quot;log in&quot; those &quot;agents&quot; on the command line using the fifo_member API command. Something like this:<br>
<br>fifo_member add fifo_name {fifo_member_wait=nowait}user/1234<br><br>Where 1234 is the user id of one of the modems. You would need a SIP registration from the PBX to FreeSWITCH for each of the modem extensions. <br><br>
Having modems go through a VoIP system sounds a bit scary. What application are you building?<br>-MC<u></u><u></u></p><div><p class="MsoNormal">On Sun, Dec 16, 2012 at 5:41 PM, Sirish Masur Mohan &lt;<a href="mailto:Sirish.MasurMohan@oa.com.au" target="_blank">Sirish.MasurMohan@oa.com.au</a>&gt; wrote:<u></u><u></u></p>
<p class="MsoNormal">Hi William,<br><br>Thanks for the reply.<br><br>My setup is as follows:<br>Client(Caller)-&gt;dialup modem-&gt;PBX-&gt;FreeSWITCH-&gt;PBX-&gt; 4 dialup modems-&gt;Server(Receiver)<br><br>I basically need FreeSWITCH to bridge the incoming call to the best external destination (out of the 4 available), so that the modem training, connection etc can take place smoothly, before exchange of data. I am not sure if mod_fifo would help me in this scenario, as, I would require an agent to dial in and read the fifo. Could you please clarify?<br>
<br>Thanks!<br><br>With regards,<br>Sirish<u></u><u></u></p><div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>-----Original Message-----<br>From: <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] On Behalf Of William King<br>
Sent: Monday, 17 December 2012 10:47 AM<br>To: <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>Subject: Re: [Freeswitch-users] Newbie question: Executing Lua scripts for incoming calls, how concurrency is to be handled?<br>
<br>Sounds like you want to take a look into mod_fifo.<br><br>William King<br>Senior Engineer<br>Quentus Technologies, INC<br>1037 NE 65th St Suite 273<br>Seattle, WA 98115<br>Main:   <a href="tel:%28877%29%20211-9337" target="_blank">(877) 211-9337</a><br>
Office: <a href="tel:%28206%29%20388-4772" target="_blank">(206) 388-4772</a><br>Cell:   <a href="tel:%28253%29%20686-5518" target="_blank">(253) 686-5518</a><br><a href="mailto:william.king@quentustech.com" target="_blank">william.king@quentustech.com</a><u></u><u></u></p>
</div><div><div><p class="MsoNormal">_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br><a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>Official FreeSWITCH Sites<br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br><a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br><a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>FreeSWITCH-users mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><u></u><u></u></p>
</div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org" target="_blank">http://www.FreeSWITCH.org</a><br>
<a href="http://www.ClueCon.com" target="_blank">http://www.ClueCon.com</a><br><a href="http://www.OSTAG.org" target="_blank">http://www.OSTAG.org</a><u></u><u></u></p></div></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<br>_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br><a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>Official FreeSWITCH Sites<br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br><a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br><a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>FreeSWITCH-users mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p>
</div><span class="HOEnZb"><font color="#888888"><p class="MsoNormal" style="margin-bottom:12.0pt"><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org" target="_blank">http://www.FreeSWITCH.org</a><br>
<a href="http://www.ClueCon.com" target="_blank">http://www.ClueCon.com</a><br><a href="http://www.OSTAG.org" target="_blank">http://www.OSTAG.org</a><br><br><u></u><u></u></p></font></span></div></div><br>_________________________________________________________________________<br>

Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org" target="_blank">http://www.FreeSWITCH.org</a><br><a href="http://www.ClueCon.com" target="_blank">http://www.ClueCon.com</a><br>
<a href="http://www.OSTAG.org" target="_blank">http://www.OSTAG.org</a><br><br><br>