Pbx_lua error handling with xpcall in asterisk dialplan

Hi. I am trying to handler errors in pbx_lua with xpcall.
i’ve made a wrapper for functions. like this:

local function defaultErrorHandler(msg)
    app.noop(msg)
    app.noop(debug.traceback())
end

local function callDialplanFunctionProtected(dpFunction)
    return function(context, extension)
        local status, err = xpcall(dpFunction, defaultErrorHandler, context, extension)
        if status == false then
            app.noop("something went wrong")
        end
    end
end

But some applications trigger this function(even if there is no any error). For example app[“goto”] always returns code 5 and triggers xpcall. How to prevent this?

--  [string "extensions.lua"]:15: in function <[string "extensions.lua"]:13> 
    --  [C]: in function 'goto'
    --  [string "extensions.lua"]:152: in function <[string "extensions.lua"]:125>
    --  [C]: in function 'xpcall'
    --  [string "extensions.lua"]:53: in function <[string "extensions.lua"]:52>")

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.