From 5b63c744bbacfe92d9fb7a4071292edad8c18b93 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 12 May 2008 15:38:51 +0000 Subject: [PATCH] fix the hangup hook extra arg code git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8363 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_lua/freeswitch_lua.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index dce29f8096..9f51db0ea7 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -83,6 +83,7 @@ void Session::do_hangup_hook() { if (hh && !mark) { const char *err = NULL; + int arg_count = 1; mark++; if (!getLUA()) { @@ -94,10 +95,11 @@ void Session::do_hangup_hook() lua_pushstring(L, hook_state == CS_HANGUP ? "hangup" : "transfer"); if (hangup_func_arg) { - lua_pushstring(L, hangup_func_arg); + lua_getfield(L, LUA_GLOBALSINDEX, (char *)hangup_func_arg); + arg_count++; } - - lua_call(L, 1, 1); + + lua_call(L, arg_count, 1); err = lua_tostring(L, -1); if (!switch_strlen_zero(err)) {