提交 749c2177 authored 作者: Anthony Minessale's avatar Anthony Minessale

tweak lua hangup hook (part 2)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12714 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 ed327e6f
...@@ -24,6 +24,10 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup); ...@@ -24,6 +24,10 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup);
Session::~Session() Session::~Session()
{ {
if (channel) {
switch_channel_set_private(channel, "CoreSession", NULL);
}
if (hangup_func_str) { if (hangup_func_str) {
if (session) { if (session) {
switch_core_event_hook_remove_state_change(session, lua_hanguphook); switch_core_event_hook_remove_state_change(session, lua_hanguphook);
...@@ -141,6 +145,10 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup) ...@@ -141,6 +145,10 @@ static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"); coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession");
} }
if (!(coresession && coresession->hook_state)) {
return SWITCH_STATUS_FALSE;
}
if (coresession && coresession->allocated && (state == CS_HANGUP || state == CS_ROUTING) && coresession->hook_state != state) { if (coresession && coresession->allocated && (state == CS_HANGUP || state == CS_ROUTING) && coresession->hook_state != state) {
coresession->hook_state = state; coresession->hook_state = state;
coresession->check_hangup_hook(); coresession->check_hangup_hook();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论