diff options
author | Timo Teräs <timo.teras@iki.fi> | 2011-12-09 12:03:09 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2011-12-09 12:03:45 +0200 |
commit | e82a605b244e836e1d050ea4168a00e30d8906c9 (patch) | |
tree | 131f95cc8a315e1b69155ca8505cc181f99df93a /testing/asterisk/ASTERISK-18976.patch | |
parent | 5da95ade3824aa45275b3457899ba8056b7c198f (diff) | |
download | aports-e82a605b244e836e1d050ea4168a00e30d8906c9.tar.bz2 aports-e82a605b244e836e1d050ea4168a00e30d8906c9.tar.xz |
testing/asterisk: add some bug fixes and patches
Diffstat (limited to 'testing/asterisk/ASTERISK-18976.patch')
-rw-r--r-- | testing/asterisk/ASTERISK-18976.patch | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/testing/asterisk/ASTERISK-18976.patch b/testing/asterisk/ASTERISK-18976.patch new file mode 100644 index 0000000000..36c613ff4f --- /dev/null +++ b/testing/asterisk/ASTERISK-18976.patch @@ -0,0 +1,142 @@ +--- a/pbx/pbx_lua.c.orig 2011-12-08 08:28:31.000000000 +0200 ++++ b/pbx/pbx_lua.c 2011-12-08 08:54:22.000000000 +0200 +@@ -94,7 +94,6 @@ + static void lua_create_application_metatable(lua_State *L); + static void lua_create_autoservice_functions(lua_State *L); + static void lua_create_hangup_function(lua_State *L); +-static void lua_detect_goto(lua_State *L); + static void lua_concat_args(lua_State *L, int start, int nargs); + + static void lua_state_destroy(void *data); +@@ -213,19 +212,10 @@ + chan = lua_touserdata(L, -1); + lua_pop(L, 1); + ++ context = ast_strdupa(chan->context); ++ exten = ast_strdupa(chan->exten); ++ priority = chan->priority; + +- lua_getfield(L, LUA_REGISTRYINDEX, "context"); +- context = ast_strdupa(lua_tostring(L, -1)); +- lua_pop(L, 1); +- +- lua_getfield(L, LUA_REGISTRYINDEX, "exten"); +- exten = ast_strdupa(lua_tostring(L, -1)); +- lua_pop(L, 1); +- +- lua_getfield(L, LUA_REGISTRYINDEX, "priority"); +- priority = lua_tointeger(L, -1); +- lua_pop(L, 1); +- + lua_concat_args(L, 2, nargs); + data = lua_tostring(L, -1); + +@@ -256,75 +246,51 @@ + return lua_error(L); + } + +- lua_detect_goto(L); +- +- return 0; +-} +- +-/*! +- * \brief Detect if a Goto or other dialplan jump has been executed and return +- * control to the pbx engine. +- */ +-static void lua_detect_goto(lua_State *L) +-{ +- struct ast_channel *chan; +- +- lua_getfield(L, LUA_REGISTRYINDEX, "channel"); +- chan = lua_touserdata(L, -1); +- lua_pop(L, 1); +- +- /* check context */ +- lua_getfield(L, LUA_REGISTRYINDEX, "context"); +- lua_pushstring(L, chan->context); +- if (!lua_equal(L, -1, -2)) { ++ if (strcmp(context, chan->context)) { ++ lua_pushstring(L, context); ++ lua_pushstring(L, chan->context); + lua_pushliteral(L, "context"); +- goto e_goto_detected; +- } +- lua_pop(L, 2); +- +- /* check exten */ +- lua_getfield(L, LUA_REGISTRYINDEX, "exten"); +- lua_pushstring(L, chan->exten); +- if (!lua_equal(L, -1, -2)) { ++ } else if (strcmp(exten, chan->exten)) { ++ lua_pushstring(L, exten); ++ lua_pushstring(L, chan->exten); + lua_pushliteral(L, "exten"); +- goto e_goto_detected; +- } +- lua_pop(L, 2); +- +- /* check priority */ +- lua_getfield(L, LUA_REGISTRYINDEX, "priority"); +- lua_pushinteger(L, chan->priority); +- if (!lua_equal(L, -1, -2)) { ++ } else if (priority != chan->priority) { ++ lua_pushinteger(L, priority); ++ lua_pushinteger(L, chan->priority); + lua_pushliteral(L, "priority"); +- goto e_goto_detected; ++ } else { ++ /* no goto - restore the original position back ++ * to lua state, in case this was a recursive dialplan ++ * call (a dialplan application re-entering dialplan) */ ++ lua_update_registry(L, context, exten, priority); ++ return 0; + } +- lua_pop(L, 2); +- return; +- +-e_goto_detected: +- /* format our debug message */ +- lua_insert(L, -3); + +- lua_pushliteral(L, " changed from "); ++ /* goto detected - construct error message */ + lua_insert(L, -3); +- +- lua_pushliteral(L, " to "); +- lua_insert(L, -2); +- +- lua_concat(L, 5); +- +- ast_debug(2, "Goto detected: %s\n", lua_tostring(L, -1)); +- lua_pop(L, 1); +- +- /* let the lua engine know it needs to return control to the pbx */ +- lua_pushinteger(L, LUA_GOTO_DETECTED); ++ ++ lua_pushliteral(L, " changed from "); ++ lua_insert(L, -3); ++ ++ lua_pushliteral(L, " to "); ++ lua_insert(L, -2); ++ ++ lua_concat(L, 5); ++ ++ ast_debug(2, "Goto detected: %s\n", lua_tostring(L, -1)); ++ lua_pop(L, 1); ++ ++ /* let the lua engine know it needs to return control to the pbx */ ++ lua_pushinteger(L, LUA_GOTO_DETECTED); + lua_error(L); ++ ++ return 0; + } + + /*! + * \brief [lua_CFunction] Used to get the value of a variable or dialplan + * function (for access from lua, don't call directly) +- * ++ * + * The value of the variable or function is returned. This function is the + * 'get()' function in the following example as would be seen in + * extensions.lua. |