[Freeswitch-users] Limit application usage in Lua

Florent Krieg flokrrr at gmail.com
Thu Mar 12 21:42:50 MSK 2015


Hi all,

I wanted to implement call rate limits using this Lua instruction:
session:execute("limit", "hash " .. billedcaller .. " caps 10/1
!REQUESTED_CHAN_UNAVAIL")

It is actually working, but the rest of the Lua dialplan is still
processed, which is a problem in my case.

I made a dirty but quick workaround, looking like this:
rate_var = session:getVariable("limit_rate_" .. billedcaller .. "_caps")
if not rate_var then
    logz("[Calls limit] CAPS limit reached for " .. billedcaller .. ",
aborting the dialplan.")
    return
end

How can it be done properly?
Is there a way to be able to get the result of the 'limit' app call?
Or shall I check the status of the a-leg just after to decide to process
the rest of the dialplan or not?

I know that this issue doesn't occur in a 'pure' XML dialplan, but I'm
trying to find a solution for my Lua-only dialplan.

Thanks in advance if you have any idea.
I'm willing to try any possible solution you would think about!

Florent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150312/c63f867d/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list