[Freeswitch-users] Limit application usage in Lua

Michael S Collins msc at freeswitch.org
Thu Mar 12 23:28:18 MSK 2015


Some context here would be helpful. Can you pastebin your Lua script, or at least the relevant lines that demonstrate what is happening? Also, when you say that the rest of the Lua dialplan is still processed, what does that mean? 

 

-MC

 

From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Florent Krieg
Sent: Thursday, March 12, 2015 11:43 AM
To: FreeSWITCH Users Help
Subject: [Freeswitch-users] Limit application usage in Lua

 

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/e41301c4/attachment.html 


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