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