mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-17 01:31:55 +00:00
fix hanguphook order of operations vs destroy method issue in c++ code
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12730 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -324,6 +324,7 @@ class Session(CoreSession):
|
||||
def begin_allow_threads(*args): return _freeswitch.Session_begin_allow_threads(*args)
|
||||
def end_allow_threads(*args): return _freeswitch.Session_end_allow_threads(*args)
|
||||
def check_hangup_hook(*args): return _freeswitch.Session_check_hangup_hook(*args)
|
||||
def destroy(*args): return _freeswitch.Session_destroy(*args)
|
||||
def run_dtmf_callback(*args): return _freeswitch.Session_run_dtmf_callback(*args)
|
||||
def setInputCallback(*args): return _freeswitch.Session_setInputCallback(*args)
|
||||
def unsetInputCallback(*args): return _freeswitch.Session_unsetInputCallback(*args)
|
||||
|
||||
@@ -21,16 +21,25 @@ Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
|
||||
}
|
||||
static switch_status_t python_hanguphook(switch_core_session_t *session_hungup);
|
||||
|
||||
Session::~Session()
|
||||
void Session::destroy(void)
|
||||
{
|
||||
|
||||
if (hangup_func) {
|
||||
if (session) {
|
||||
switch_core_event_hook_remove_state_change(session, python_hanguphook);
|
||||
}
|
||||
Py_DECREF(hangup_func);
|
||||
hangup_func = NULL;
|
||||
if (!allocated) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (session) {
|
||||
if (!channel) {
|
||||
channel = switch_core_session_get_channel(session);
|
||||
}
|
||||
switch_channel_set_private(channel, "CoreSession", NULL);
|
||||
switch_core_event_hook_remove_state_change(session, python_hanguphook);
|
||||
}
|
||||
|
||||
if (hangup_func) {
|
||||
Py_DECREF(hangup_func);
|
||||
hangup_func = NULL;
|
||||
}
|
||||
|
||||
if (hangup_func_arg) {
|
||||
Py_DECREF(hangup_func_arg);
|
||||
@@ -49,7 +58,14 @@ Session::~Session()
|
||||
|
||||
if (Self) {
|
||||
Py_DECREF(Self);
|
||||
}
|
||||
}
|
||||
|
||||
CoreSession::destroy();
|
||||
}
|
||||
|
||||
Session::~Session()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
bool Session::begin_allow_threads()
|
||||
|
||||
@@ -27,6 +27,7 @@ class Session : public CoreSession {
|
||||
virtual bool begin_allow_threads();
|
||||
virtual bool end_allow_threads();
|
||||
virtual void check_hangup_hook();
|
||||
virtual void destroy(void);
|
||||
|
||||
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
|
||||
void setInputCallback(PyObject *cbfunc, PyObject *funcargs = NULL);
|
||||
|
||||
@@ -9442,6 +9442,27 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_Session_destroy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
|
||||
void *argp1 = 0 ;
|
||||
int res1 = 0 ;
|
||||
PyObject * obj0 = 0 ;
|
||||
|
||||
if (!PyArg_ParseTuple(args,(char *)"O:Session_destroy",&obj0)) SWIG_fail;
|
||||
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, 0 | 0 );
|
||||
if (!SWIG_IsOK(res1)) {
|
||||
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_destroy" "', argument " "1"" of type '" "PYTHON::Session *""'");
|
||||
}
|
||||
arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
|
||||
(arg1)->destroy();
|
||||
resultobj = SWIG_Py_Void();
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SWIGINTERN PyObject *_wrap_Session_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
|
||||
PyObject *resultobj = 0;
|
||||
PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
|
||||
@@ -10114,6 +10135,7 @@ static PyMethodDef SwigMethods[] = {
|
||||
{ (char *)"Session_begin_allow_threads", _wrap_Session_begin_allow_threads, METH_VARARGS, NULL},
|
||||
{ (char *)"Session_end_allow_threads", _wrap_Session_end_allow_threads, METH_VARARGS, NULL},
|
||||
{ (char *)"Session_check_hangup_hook", _wrap_Session_check_hangup_hook, METH_VARARGS, NULL},
|
||||
{ (char *)"Session_destroy", _wrap_Session_destroy, METH_VARARGS, NULL},
|
||||
{ (char *)"Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback, METH_VARARGS, NULL},
|
||||
{ (char *)"Session_setInputCallback", _wrap_Session_setInputCallback, METH_VARARGS, NULL},
|
||||
{ (char *)"Session_unsetInputCallback", _wrap_Session_unsetInputCallback, METH_VARARGS, NULL},
|
||||
|
||||
Reference in New Issue
Block a user