add unsetInputCallback method

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9296 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West
2008-08-14 17:20:34 +00:00
parent 6efa5bdf0d
commit 23c0d9ebbf
11 changed files with 119 additions and 0 deletions
@@ -323,6 +323,7 @@ class Session(CoreSession):
def check_hangup_hook(*args): return _freeswitch.Session_check_hangup_hook(*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)
def setHangupHook(*args): return _freeswitch.Session_setHangupHook(*args)
def ready(*args): return _freeswitch.Session_ready(*args)
__swig_setmethods__["cb_function"] = _freeswitch.Session_cb_function_set
@@ -216,6 +216,24 @@ void Session::setHangupHook(PyObject *pyfunc, PyObject *arg)
}
void Session::unsetInputCallback(void)
{
if (cb_function) {
Py_XDECREF(cb_function);
cb_function = NULL;
}
if (cb_arg) {
Py_XDECREF(cb_arg);
cb_arg = NULL;
}
switch_channel_set_private(channel, "CoreSession", NULL);
args.input_callback = NULL;
ap = NULL;
}
void Session::setInputCallback(PyObject *cbfunc, PyObject *funcargs)
{
@@ -30,6 +30,7 @@ class Session : public CoreSession {
virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
void setInputCallback(PyObject *cbfunc, PyObject *funcargs = NULL);
void unsetInputCallback(void);
void setHangupHook(PyObject *pyfunc, PyObject *arg = NULL);
bool ready();
@@ -9153,6 +9153,27 @@ fail:
}
SWIGINTERN PyObject *_wrap_Session_unsetInputCallback(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_unsetInputCallback",&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_unsetInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'");
}
arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
(arg1)->unsetInputCallback();
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_Session_setHangupHook__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
@@ -9659,6 +9680,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"Session_check_hangup_hook", _wrap_Session_check_hangup_hook, 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},
{ (char *)"Session_setHangupHook", _wrap_Session_setHangupHook, METH_VARARGS, NULL},
{ (char *)"Session_ready", _wrap_Session_ready, METH_VARARGS, NULL},
{ (char *)"Session_cb_function_set", _wrap_Session_cb_function_set, METH_VARARGS, NULL},