]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Restore LUA dialplan ACTIONS functionality
authorPeter Wu <peter@lekensteyn.nl>
Sun, 30 Aug 2015 20:30:32 +0000 (22:30 +0200)
committerMichael Jerris <mike@jerris.com>
Wed, 9 Sep 2015 19:00:10 +0000 (14:00 -0500)
Since using SWIG 2.0 to generate the code, two new items have been
pushed on the stack. Use relative stack indices to avoid breakage.

FS-8099 #resolve

src/mod/languages/mod_lua/mod_lua.cpp

index bb835b09e015fb7b56fdf38123b994d7a5bfb8d0..433b6e3e8f380464bdcddce68014ae1e767efe0f 100644 (file)
@@ -591,7 +591,7 @@ SWITCH_STANDARD_DIALPLAN(lua_dialplan_hunt)
 
        /* expecting ACTIONS = { {"app1", "app_data1"}, { "app2" }, "app3" } -- each of three is valid */
        lua_getglobal(L, "ACTIONS");
-       if (!lua_istable(L, 1)) {
+       if (!lua_istable(L, -1)) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
                        "Global variable ACTIONS may only be a table\n");
                goto done;
@@ -599,7 +599,7 @@ SWITCH_STANDARD_DIALPLAN(lua_dialplan_hunt)
 
        lua_pushnil(L); /* STACK = tab | nil */
 
-       while (lua_next(L, 1) != 0) { /* STACK = tab | k1 .. kn | vn */
+       while (lua_next(L, -2) != 0) { /* STACK = tab | k1 .. kn | vn */
                char *application = NULL, *app_data = NULL;
 
                if (lua_isstring(L, -1)) {