[Freeswitch-svn] [commit] r9296 - in freeswitch/trunk/src/mod/languages: mod_lua mod_perl mod_python

Freeswitch SVN brian at freeswitch.org
Thu Aug 14 13:20:34 EDT 2008


Author: brian
Date: Thu Aug 14 13:20:34 2008
New Revision: 9296

Modified:
   freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
   freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.h
   freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
   freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
   freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
   freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
   freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp

Log:
add unsetInputCallback method

Modified: freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	Thu Aug 14 13:20:34 2008
@@ -158,6 +158,16 @@
 	}
 }
 
+void Session::unsetInputCallback(void)
+{
+	sanity_check_noreturn;
+	switch_safe_free(cb_function);
+	switch_safe_free(cb_arg);
+	args.input_callback = NULL;
+	switch_channel_set_private(channel, "CoreSession", NULL);
+	ap = NULL;
+}
+
 void Session::setInputCallback(char *cbfunc, char *funcargs)
 {
 

Modified: freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.h	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.h	Thu Aug 14 13:20:34 2008
@@ -29,6 +29,7 @@
 	virtual void check_hangup_hook();
 
 	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+	void unsetInputCallback(void);
 	void setInputCallback(char *cbfunc, char *funcargs = NULL);
 	void setHangupHook(char *func, char *arg = NULL);
 	bool ready();

Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp	Thu Aug 14 13:20:34 2008
@@ -7157,6 +7157,30 @@
 }
 
 
+static int _wrap_Session_unsetInputCallback(lua_State* L) {
+  int SWIG_arg = -1;
+  LUA::Session *arg1 = (LUA::Session *) 0 ;
+  
+  SWIG_check_num_args("unsetInputCallback",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("unsetInputCallback",1,"LUA::Session *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+    SWIG_fail_ptr("Session_unsetInputCallback",1,SWIGTYPE_p_LUA__Session);
+  }
+  
+  (arg1)->unsetInputCallback();
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
 static int _wrap_Session_setInputCallback__SWIG_0(lua_State* L) {
   int SWIG_arg = -1;
   LUA::Session *arg1 = (LUA::Session *) 0 ;
@@ -7720,6 +7744,7 @@
     {"end_allow_threads", _wrap_Session_end_allow_threads}, 
     {"check_hangup_hook", _wrap_Session_check_hangup_hook}, 
     {"run_dtmf_callback", _wrap_Session_run_dtmf_callback}, 
+    {"unsetInputCallback", _wrap_Session_unsetInputCallback}, 
     {"setInputCallback", _wrap_Session_setInputCallback}, 
     {"setHangupHook", _wrap_Session_setHangupHook}, 
     {"ready", _wrap_Session_ready}, 

Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm	Thu Aug 14 13:20:34 2008
@@ -481,6 +481,7 @@
 *run_dtmf_callback = *freeswitchc::Session_run_dtmf_callback;
 *setME = *freeswitchc::Session_setME;
 *setInputCallback = *freeswitchc::Session_setInputCallback;
+*unsetInputCallback = *freeswitchc::Session_unsetInputCallback;
 *setHangupHook = *freeswitchc::Session_setHangupHook;
 *ready = *freeswitchc::Session_ready;
 *swig_suuid_get = *freeswitchc::Session_suuid_get;

Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	Thu Aug 14 13:20:34 2008
@@ -166,6 +166,17 @@
 	}
 }
 
+void Session::unsetInputCallback(void)
+{
+	sanity_check_noreturn;
+	switch_safe_free(cb_function);
+	switch_safe_free(cb_arg);
+	switch_channel_set_private(channel, "CoreSession", NULL);
+	args.input_callback = NULL;
+	ap = NULL;
+	
+}
+
 void Session::setInputCallback(char *cbfunc, char *funcargs)
 {
 

Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h	Thu Aug 14 13:20:34 2008
@@ -39,6 +39,7 @@
 	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
 	void setME(SV *p);
 	void setInputCallback(char *cbfunc = "on_input", char *funcargs = NULL);
+	void unsetInputCallback(void);
 	void setHangupHook(char *func, char *arg=NULL);
 	bool ready();
 	char *suuid;

Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp	Thu Aug 14 13:20:34 2008
@@ -9738,6 +9738,33 @@
 }
 
 
+XS(_wrap_Session_unsetInputCallback) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_unsetInputCallback(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_unsetInputCallback" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    (arg1)->unsetInputCallback();
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_Session_setHangupHook__SWIG_0) {
   {
     PERL::Session *arg1 = (PERL::Session *) 0 ;
@@ -10602,6 +10629,7 @@
 {"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
 {"freeswitchc::Session_setME", _wrap_Session_setME},
 {"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
+{"freeswitchc::Session_unsetInputCallback", _wrap_Session_unsetInputCallback},
 {"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
 {"freeswitchc::Session_ready", _wrap_Session_ready},
 {"freeswitchc::Session_suuid_set", _wrap_Session_suuid_set},

Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py	Thu Aug 14 13:20:34 2008
@@ -323,6 +323,7 @@
     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

Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp	Thu Aug 14 13:20:34 2008
@@ -216,6 +216,24 @@
 
 }
 
+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)
 {
 

Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h	Thu Aug 14 13:20:34 2008
@@ -30,6 +30,7 @@
 
 	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();
 	

Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp	Thu Aug 14 13:20:34 2008
@@ -9153,6 +9153,27 @@
 }
 
 
+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 @@
 	 { (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},



More information about the Freeswitch-svn mailing list