fix the hangup hook extra arg code

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8363 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-05-12 15:38:51 +00:00
parent 996cfa54bd
commit 5b63c744bb
1 changed files with 5 additions and 3 deletions

View File

@ -83,6 +83,7 @@ void Session::do_hangup_hook()
{ {
if (hh && !mark) { if (hh && !mark) {
const char *err = NULL; const char *err = NULL;
int arg_count = 1;
mark++; mark++;
if (!getLUA()) { if (!getLUA()) {
@ -94,10 +95,11 @@ void Session::do_hangup_hook()
lua_pushstring(L, hook_state == CS_HANGUP ? "hangup" : "transfer"); lua_pushstring(L, hook_state == CS_HANGUP ? "hangup" : "transfer");
if (hangup_func_arg) { 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); err = lua_tostring(L, -1);
if (!switch_strlen_zero(err)) { if (!switch_strlen_zero(err)) {