[Freeswitch-users] implementing missed call without a race

Neil Patel neilp at cs.stanford.edu
Thu Jan 3 16:46:40 MSK 2013


Hi All,

I recently implemented "missed call" functionality into my lua app: an
inbound call comes in, I check the DB if it should be a "missed call". If
so, the call is terminated and the caller is called back through an
outbound call. This is useful in places like India where people are charged
for outbound calls only.

Thanks to help from folks on FS IRC, I implemented like so:

   1. script1.lua takes the inbound call
   2. If missed call is to be made, invoke script2.lua (passing script1's
   uuid) through a bgapi call, and let script1.lua terminate
   3. in script2.lua, uuid_kill the session from script1.lua, and make an
   outbound call to the original caller

Two questions:

   1. Are there any problems with this implementation from correctness and
   performance standpoints?
   2. I am using this app over a TDM (PRI) connection. During very heavy
   load, there is a race condition: after killing the original session but
   before initiating the new outbound call in script2, the available channel
   could be grabbed. Is there any way to fix or mitigate this race?

Thanks,
Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130103/cea075d2/attachment.html 


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