Hack patch to avoid hanguphook calling check_hangup_hook purely virtually
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8789 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
66948098d8
commit
e5233533b3
|
@ -38,47 +38,81 @@
|
||||||
#include <mono/metadata/threads.h>
|
#include <mono/metadata/threads.h>
|
||||||
#include <mono/metadata/metadata.h>
|
#include <mono/metadata/metadata.h>
|
||||||
#include "freeswitch_mono.h"
|
#include "freeswitch_mono.h"
|
||||||
|
|
||||||
MonoSession::MonoSession():CoreSession()
|
MonoSession::MonoSession():CoreSession()
|
||||||
{
|
{
|
||||||
}
MonoSession::MonoSession(char *uuid):CoreSession(uuid)
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MonoSession::MonoSession(char *uuid):CoreSession(uuid)
|
||||||
{
|
{
|
||||||
}
MonoSession::MonoSession(switch_core_session_t *session):CoreSession(session)
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MonoSession::MonoSession(switch_core_session_t *session):CoreSession(session)
|
||||||
{
|
{
|
||||||
}
MonoSession::~MonoSession()
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MonoSession::~MonoSession()
|
||||||
{
|
{
|
||||||
mono_thread_attach(globals.domain);
|
mono_thread_attach(globals.domain);
|
||||||
if (dtmfDelegateHandle)
|
|
||||||
|
if (dtmfDelegateHandle) {
|
||||||
mono_gchandle_free(dtmfDelegateHandle);
|
mono_gchandle_free(dtmfDelegateHandle);
|
||||||
if (hangupDelegateHandle)
|
}
|
||||||
|
|
||||||
|
if (hangupDelegateHandle) {
|
||||||
mono_gchandle_free(hangupDelegateHandle);
|
mono_gchandle_free(hangupDelegateHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do auto-hangup ourselves because CoreSession can't call check_hangup_hook
|
||||||
|
// after MonoSession destruction (cause at point it's pure virtual)
|
||||||
|
if (session) {
|
||||||
|
channel = switch_core_session_get_channel(session);
|
||||||
|
if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
|
||||||
|
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||||
|
setAutoHangup(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool MonoSession::begin_allow_threads()
|
bool MonoSession::begin_allow_threads()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool MonoSession::end_allow_threads()
|
bool MonoSession::end_allow_threads()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MonoSession::check_hangup_hook()
|
void MonoSession::check_hangup_hook()
|
||||||
{
|
{
|
||||||
mono_thread_attach(globals.domain);
|
mono_thread_attach(globals.domain);
|
||||||
if (!hangupDelegateHandle) {
|
if (!hangupDelegateHandle) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MonoObject * hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
|
MonoObject * hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
|
||||||
if (!hangupDelegate) {
|
if (!hangupDelegate) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MonoObject * ex = NULL;
|
MonoObject * ex = NULL;
|
||||||
mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
|
mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
|
||||||
if (ex) {
|
if (ex) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype)
|
switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype)
|
||||||
{
|
{
|
||||||
mono_thread_attach(globals.domain);
|
mono_thread_attach(globals.domain);
|
||||||
|
@ -90,6 +124,7 @@
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *args[2];
|
void *args[2];
|
||||||
args[0] = &input;
|
args[0] = &input;
|
||||||
args[1] = &itype;
|
args[1] = &itype;
|
||||||
|
@ -99,6 +134,7 @@
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *resPtr = mono_string_to_utf8((MonoString *) res);
|
char *resPtr = mono_string_to_utf8((MonoString *) res);
|
||||||
switch_status_t status = process_callback_result(resPtr);
|
switch_status_t status = process_callback_result(resPtr);
|
||||||
g_free(resPtr);
|
g_free(resPtr);
|
||||||
|
|
Loading…
Reference in New Issue