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