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

Sirish Masur Mohan Sirish.MasurMohan at oa.com.au
Mon Dec 17 02:31:09 MSK 2012


Hello All,

I am a newbie to FreeSWITCH, please excuse if this question has already been answered.

My requirement is as follows:

*         When an incoming call is received, it needs to be bridged to one of the 4 available destination lines

*         Minimal management of these lines is required: need to keep track of when each line was used, so that, when a new incoming call is received, I can use the oldest used available line to bridge the call to

In order to achieve this, I have:

*         Defined a few global variables in vars.xml, which would keep track of each line's status (available/busy) and last used timestamp

*         Implemented a Lua script which 'chooses' the line based on global variables status and timestamp (using "global_getvar") and update the status of the line to be used (using "global_setvar")

*         Bridge to the line returned by the script

*         Execute another Lua script on hang-up, which updates the global variables

I am now wondering if I would run into issues in cases where I receive concurrent calls (I am using a Sangoma E1 card, and will receive multiple concurrent calls soon)? Would I need to be applying some kind of explicit mutex protection in these scripts for the global variables?

Thanks in advance!

With regards,
Sirish

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20121217/fe964ecd/attachment-0001.html 


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