[Freeswitch-users] Newbie question: Executing Lua scripts for incoming calls, how concurrency is to be handled?

Michael Collins msc at freeswitch.org
Thu Dec 20 19:42:16 MSK 2012


Sirish,

Since you'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.

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 "hash"
API to store information in the local database. Also, check out the
"hash_dump" API as it is a useful way to quickly see what all is stored
there.

For an example of how to add, remove, and read information from the local
database using the "hash" API please see conf/dialplan/default.xml. Search
for "hash" and you'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.

-MC

On Tue, Dec 18, 2012 at 7:39 PM, Sirish Masur Mohan <
Sirish.MasurMohan at oa.com.au> wrote:

> Hi Michael,****
>
> ** **
>
> >> How are you physically connecting from FreeSWITCH to the PBX?****
>
> ** **
>
> I connect this via E1 link – I have a Sangoma card installed on the
> FreeSWITCH machine.****
>
> ** **
>
> With regards,****
>
> Sirish****
>
> ** **
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Michael
> Collins
> *Sent:* Wednesday, 19 December 2012 1:31 PM
> *To:* FreeSWITCH Users Help
> *Subject:* Re: [Freeswitch-users] Newbie question: Executing Lua scripts
> for incoming calls, how concurrency is to be handled?****
>
> ** **
>
> To trigger SIP registrations you'd need the PBX to have a SIP client. I'm
> assuming this is possible, but maybe that's a false assumption. How are you
> physically connecting from FreeSWITCH to the PBX?
>
> -MC****
>
> On Tue, Dec 18, 2012 at 2:36 PM, Sirish Masur Mohan <
> Sirish.MasurMohan at oa.com.au> wrote:****
>
> Hey Guys,****
>
>  ****
>
> 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? ****
>
>  ****
>
> 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?****
>
>  ****
>
> With regards,****
>
> Sirish****
>
>  ****
>
> *From:* Sirish Masur Mohan
> *Sent:* Tuesday, 18 December 2012 1:02 PM
> *To:* FreeSWITCH Users Help
> *Subject:* RE: [Freeswitch-users] Newbie question: Executing Lua scripts
> for incoming calls, how concurrency is to be handled?****
>
>  ****
>
> Hi Michael,****
>
>  ****
>
> Thanks for the reply. ****
>
>  ****
>
> >> You would need a SIP registration from the PBX to FreeSWITCH for each
> of the modem extensions****
>
> 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.. ****
>
>  ****
>
> >> What application are you building?****
>
> 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!****
>
>  ****
>
> With regards,****
>
> Sirish****
>
>  ****
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [
> mailto:freeswitch-users-bounces at lists.freeswitch.org<freeswitch-users-bounces at lists.freeswitch.org>]
> *On Behalf Of *Michael Collins
> *Sent:* Tuesday, 18 December 2012 6:23 AM
> *To:* FreeSWITCH Users Help
> *Subject:* Re: [Freeswitch-users] Newbie question: Executing Lua scripts
> for incoming calls, how concurrency is to be handled?****
>
>  ****
>
> You don't have to have actual human agents for mod_fifo. You could define
> a user for each modem and then manually "log in" those "agents" on the
> command line using the fifo_member API command. Something like this:
>
> fifo_member add fifo_name {fifo_member_wait=nowait}user/1234
>
> 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.
>
> Having modems go through a VoIP system sounds a bit scary. What
> application are you building?
> -MC****
>
> On Sun, Dec 16, 2012 at 5:41 PM, Sirish Masur Mohan <
> Sirish.MasurMohan at oa.com.au> wrote:****
>
> Hi William,
>
> Thanks for the reply.
>
> My setup is as follows:
> Client(Caller)->dialup modem->PBX->FreeSWITCH->PBX-> 4 dialup
> modems->Server(Receiver)
>
> 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?
>
> Thanks!
>
> With regards,
> Sirish****
>
>
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of William King
> Sent: Monday, 17 December 2012 10:47 AM
> To: freeswitch-users at lists.freeswitch.org
> Subject: Re: [Freeswitch-users] Newbie question: Executing Lua scripts for
> incoming calls, how concurrency is to be handled?
>
> Sounds like you want to take a look into mod_fifo.
>
> William King
> Senior Engineer
> Quentus Technologies, INC
> 1037 NE 65th St Suite 273
> Seattle, WA 98115
> Main:   (877) 211-9337
> Office: (206) 388-4772
> Cell:   (253) 686-5518
> william.king at quentustech.com****
>
> _________________________________________________________________________
> 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-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org****
>
>
>
>
> --
> Michael S Collins
> Twitter: @mercutioviz
> http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.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-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org****
>
>
>
>
> --
> Michael S Collins
> Twitter: @mercutioviz
> http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.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-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>


-- 
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20121220/18869b35/attachment-0001.html 


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