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

Freeswitch SVN anthm at freeswitch.org
Wed Jul 16 17:06:14 EDT 2008


Author: anthm
Date: Wed Jul 16 17:06:14 2008
New Revision: 9063

Modified:
   freeswitch/trunk/src/include/switch_cpp.h
   freeswitch/trunk/src/mod/languages/mod_lua/Makefile
   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/hack.diff
   freeswitch/trunk/src/mod/languages/mod_lua/mod_lua_wrap.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/Makefile
   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/hack.diff
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp
   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/hack.diff
   freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
   freeswitch/trunk/src/switch_cpp.cpp

Log:
even more lang stuff

Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h	(original)
+++ freeswitch/trunk/src/include/switch_cpp.h	Wed Jul 16 17:06:14 2008
@@ -199,7 +199,7 @@
 
 	   public:
 		 SWITCH_DECLARE_CONSTRUCTOR CoreSession();
-		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid);
+		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *nuuid, CoreSession *a_leg = NULL);
 		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session);
 		 virtual SWITCH_DECLARE_CONSTRUCTOR ~ CoreSession();
 		 switch_core_session_t *session;

Modified: freeswitch/trunk/src/mod/languages/mod_lua/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/Makefile	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/Makefile	Wed Jul 16 17:06:14 2008
@@ -13,6 +13,8 @@
 $(LIBLUA_A):
 	cd lua && $(MAKE) CC="$(CC)" CFLAGS="$(ALL_CFLAGS) -DLUA_USE_LINUX -w" liblua.a
 
+reswig: swigclean mod_lua_wrap.cpp
+
 luaclean:
 	cd lua && $(MAKE) clean
 

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	Wed Jul 16 17:06:14 2008
@@ -9,7 +9,7 @@
 	hh = mark = 0;
 }
 
-Session::Session(char *uuid):CoreSession(uuid)
+Session::Session(char *nuuid, CoreSession *a_leg):CoreSession(nuuid, a_leg)
 {
 	cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
 	hh = mark = 0;

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	Wed Jul 16 17:06:14 2008
@@ -20,7 +20,7 @@
 	int mark;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
 	

Modified: freeswitch/trunk/src/mod/languages/mod_lua/hack.diff
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/hack.diff	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/hack.diff	Wed Jul 16 17:06:14 2008
@@ -1,6 +1,6 @@
---- mod_lua_wrap.cpp	2008-05-11 20:03:58.000000000 -0400
-+++ mod_lua_wrap2.cpp	2008-05-11 20:05:08.000000000 -0400
-@@ -5158,7 +5158,7 @@
+--- mod_lua_wrap.cpp	2008-07-16 16:58:58.000000000 -0400
++++ old.cpp	2008-07-16 16:58:42.000000000 -0400
+@@ -6731,7 +6731,7 @@
    SWIG_check_num_args("LUA::Session",0,0)
    result = (LUA::Session *)new LUA::Session();
    SWIG_arg=0;
@@ -9,7 +9,16 @@
    return SWIG_arg;
    
    if(0) SWIG_fail;
-@@ -5179,7 +5179,7 @@
+@@ -6759,7 +6759,7 @@
+   
+   result = (LUA::Session *)new LUA::Session(arg1,arg2);
+   SWIG_arg=0;
+-  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; 
++  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
+   return SWIG_arg;
+   
+   if(0) SWIG_fail;
+@@ -6780,7 +6780,7 @@
    arg1 = (char *)lua_tostring(L, 1);
    result = (LUA::Session *)new LUA::Session(arg1);
    SWIG_arg=0;
@@ -18,7 +27,7 @@
    return SWIG_arg;
    
    if(0) SWIG_fail;
-@@ -5204,7 +5204,7 @@
+@@ -6805,7 +6805,7 @@
    
    result = (LUA::Session *)new LUA::Session(arg1);
    SWIG_arg=0;

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	Wed Jul 16 17:06:14 2008
@@ -6745,6 +6745,34 @@
 static int _wrap_new_Session__SWIG_1(lua_State* L) {
   int SWIG_arg = -1;
   char *arg1 = (char *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  LUA::Session *result = 0 ;
+  
+  SWIG_check_num_args("LUA::Session",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *");
+  if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("LUA::Session",2,"CoreSession *");
+  arg1 = (char *)lua_tostring(L, 1);
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
+    SWIG_fail_ptr("new_Session",2,SWIGTYPE_p_CoreSession);
+  }
+  
+  result = (LUA::Session *)new LUA::Session(arg1,arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_Session__SWIG_2(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
   LUA::Session *result = 0 ;
   
   SWIG_check_num_args("LUA::Session",1,1)
@@ -6763,7 +6791,7 @@
 }
 
 
-static int _wrap_new_Session__SWIG_2(lua_State* L) {
+static int _wrap_new_Session__SWIG_3(lua_State* L) {
   int SWIG_arg = -1;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   LUA::Session *result = 0 ;
@@ -6790,8 +6818,8 @@
 
 static int _wrap_new_Session(lua_State* L) {
   int argc;
-  int argv[2]={
-    1,2
+  int argv[3]={
+    1,2,3
   };
   
   argc = lua_gettop(L);
@@ -6809,7 +6837,7 @@
       }
     }
     if (_v) {
-      return _wrap_new_Session__SWIG_2(L);
+      return _wrap_new_Session__SWIG_3(L);
     }
   }
   if (argc == 1) {
@@ -6818,7 +6846,26 @@
       _v = lua_isstring(L,argv[0]);
     }
     if (_v) {
-      return _wrap_new_Session__SWIG_1(L);
+      return _wrap_new_Session__SWIG_2(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      {
+        void *ptr;
+        if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+          _v = 0;
+        } else {
+          _v = 1;
+        }
+      }
+      if (_v) {
+        return _wrap_new_Session__SWIG_1(L);
+      }
     }
   }
   

Modified: freeswitch/trunk/src/mod/languages/mod_perl/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/Makefile	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/Makefile	Wed Jul 16 17:06:14 2008
@@ -20,7 +20,8 @@
 	echo "#include \"mod_perl_extra.c\"" >> mod_perl_wrap.cpp
 	patch -s -p0 -i hack.diff
 
-
+orig: mod_perl_wrap.cpp
+	patch -R -s -p0 -i hack.diff
 
 freeswitch.$(DYNAMIC_LIB_EXTEN): $(LOCAL_OBJS) $(LOCAL_LIBADD)
 	$(LINK) $(SOLINK) -o freeswitch.$(DYNAMIC_LIB_EXTEN)  $(LOCAL_OBJS) $(LOCAL_LIBADD) $(LDFLAGS)

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	Wed Jul 16 17:06:14 2008
@@ -13,7 +13,7 @@
 	init_me();
 }
 
-Session::Session(char *uuid):CoreSession(uuid)
+Session::Session(char *uuid, CoreSession *a_leg):CoreSession(uuid, a_leg)
 {
 	init_me();
 	if (session && allocated) {

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	Wed Jul 16 17:06:14 2008
@@ -28,7 +28,7 @@
 	SV *me;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
 	

Modified: freeswitch/trunk/src/mod/languages/mod_perl/hack.diff
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/hack.diff	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/hack.diff	Wed Jul 16 17:06:14 2008
@@ -1,5 +1,5 @@
---- mod_perl_wrap.cpp	2008-07-16 13:38:11.000000000 -0500
-+++ old.cpp	2008-07-16 13:37:44.000000000 -0500
+--- mod_perl_wrap.cpp	2008-07-16 16:55:53.000000000 -0400
++++ old.cpp	2008-07-16 16:55:38.000000000 -0400
 @@ -8852,13 +8852,18 @@
    {
      PERL::Session *result = 0 ;
@@ -22,7 +22,33 @@
      XSRETURN(argvi);
    fail:
      SWIG_croak_null();
-@@ -8874,6 +8879,7 @@
+@@ -8877,6 +8882,7 @@
+     void *argp2 = 0 ;
+     int res2 = 0 ;
+     int argvi = 0;
++	SV *foo;
+     dXSARGS;
+     
+     if ((items < 2) || (items > 2)) {
+@@ -8893,7 +8899,16 @@
+     }
+     arg2 = reinterpret_cast< CoreSession * >(argp2);
+     result = (PERL::Session *)new PERL::Session(arg1,arg2);
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
++	if (result->allocated) {
++		result->setPERL(my_perl);
++		foo = get_sv(result->suuid, TRUE);
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++		result->setME(foo);	
++	} else {
++		foo = sv_newmortal();
++		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	}
++	ST(argvi) = foo; argvi++ ;
+     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+     
+     XSRETURN(argvi);
+@@ -8913,6 +8928,7 @@
      char *buf1 = 0 ;
      int alloc1 = 0 ;
      int argvi = 0;
@@ -30,7 +56,7 @@
      dXSARGS;
      
      if ((items < 1) || (items > 1)) {
-@@ -8884,9 +8890,19 @@
+@@ -8923,9 +8939,19 @@
        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
      }
      arg1 = reinterpret_cast< char * >(buf1);
@@ -52,7 +78,7 @@
      XSRETURN(argvi);
    fail:
      if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
-@@ -8902,6 +8918,7 @@
+@@ -8941,6 +8967,7 @@
      void *argp1 = 0 ;
      int res1 = 0 ;
      int argvi = 0;
@@ -60,7 +86,7 @@
      dXSARGS;
      
      if ((items < 1) || (items > 1)) {
-@@ -8913,8 +8930,18 @@
+@@ -8952,8 +8979,18 @@
      }
      arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
      result = (PERL::Session *)new PERL::Session(arg1);

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	Wed Jul 16 17:06:14 2008
@@ -8874,6 +8874,55 @@
 XS(_wrap_new_Session__SWIG_1) {
   {
     char *arg1 = (char *) 0 ;
+    CoreSession *arg2 = (CoreSession *) 0 ;
+    PERL::Session *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+	SV *foo;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_Session(uuid,a_leg);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Session" "', argument " "2"" of type '" "CoreSession *""'"); 
+    }
+    arg2 = reinterpret_cast< CoreSession * >(argp2);
+    result = (PERL::Session *)new PERL::Session(arg1,arg2);
+	if (result->allocated) {
+		result->setPERL(my_perl);
+		foo = get_sv(result->suuid, TRUE);
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+		result->setME(foo);	
+	} else {
+		foo = sv_newmortal();
+		SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+	}
+	ST(argvi) = foo; argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_Session__SWIG_2) {
+  {
+    char *arg1 = (char *) 0 ;
     PERL::Session *result = 0 ;
     int res1 ;
     char *buf1 = 0 ;
@@ -8911,7 +8960,7 @@
 }
 
 
-XS(_wrap_new_Session__SWIG_2) {
+XS(_wrap_new_Session__SWIG_3) {
   {
     switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
     PERL::Session *result = 0 ;
@@ -9005,13 +9054,44 @@
     }
   check_3:
     
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 4;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_4:
+    
   dispatch:
     switch(_index) {
     case 1:
       ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_0); return;
     case 2:
-      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_2); return;
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_3); return;
     case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_2); return;
+    case 4:
       ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_1); return;
     }
   }

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	Wed Jul 16 17:06:14 2008
@@ -10,7 +10,7 @@
 	py_init_vars();
 }
 
-Session::Session(char *uuid):CoreSession(uuid)
+Session::Session(char *nuuid, CoreSession *a_leg):CoreSession(nuuid, a_leg)
 {
 	py_init_vars();
 }
@@ -59,6 +59,9 @@
 
 	if (!TS) {
 		TS = PyEval_SaveThread();
+		if (channel) {
+			switch_channel_set_private(channel, "SwapInThreadState", TS);
+		}
 		return true;
 	}
 
@@ -75,6 +78,10 @@
 	PyEval_RestoreThread(TS);
 	TS = NULL;
 
+	if (channel) {
+		switch_channel_set_private(channel, "SwapInThreadState", NULL);
+	}
+
 	do_hangup_hook();
 
 	return true;

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	Wed Jul 16 17:06:14 2008
@@ -20,7 +20,7 @@
 	PyThreadState *TS;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *nuuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     virtual ~Session();        
 	

Modified: freeswitch/trunk/src/mod/languages/mod_python/hack.diff
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/hack.diff	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/hack.diff	Wed Jul 16 17:06:14 2008
@@ -1,6 +1,6 @@
---- mod_python_wrap.cpp	2008-07-10 13:14:21.000000000 -0500
-+++ old.cpp	2008-07-10 13:13:57.000000000 -0500
-@@ -8150,20 +8150,20 @@
+--- mod_python_wrap.cpp	2008-07-16 17:05:18.000000000 -0400
++++ old.cpp	2008-07-16 17:05:07.000000000 -0400
+@@ -8621,20 +8621,20 @@
  }
  
  
@@ -23,8 +23,26 @@
 +SWIGINTERN PyObject *_wrap_new_Session__SWIG_1(PyObject *self, PyObject *args) {
    PyObject *resultobj = 0;
    char *arg1 = (char *) 0 ;
+   CoreSession *arg2 = (CoreSession *) 0 ;
+@@ -8659,7 +8659,7 @@
+   }
+   arg2 = reinterpret_cast< CoreSession * >(argp2);
+   result = (PYTHON::Session *)new PYTHON::Session(arg1,arg2);
+-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 );
++  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
+   if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+   return resultobj;
+ fail:
+@@ -8668,7 +8668,7 @@
+ }
+ 
+ 
+-SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
++SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) {
+   PyObject *resultobj = 0;
+   char *arg1 = (char *) 0 ;
    PYTHON::Session *result = 0 ;
-@@ -8179,7 +8179,7 @@
+@@ -8684,7 +8684,7 @@
    }
    arg1 = reinterpret_cast< char * >(buf1);
    result = (PYTHON::Session *)new PYTHON::Session(arg1);
@@ -33,16 +51,16 @@
    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
    return resultobj;
  fail:
-@@ -8188,7 +8188,7 @@
+@@ -8693,7 +8693,7 @@
  }
  
  
--SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-+SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) {
+-SWIGINTERN PyObject *_wrap_new_Session__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
++SWIGINTERN PyObject *_wrap_new_Session__SWIG_3(PyObject *self, PyObject *args) {
    PyObject *resultobj = 0;
    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
    PYTHON::Session *result = 0 ;
-@@ -8203,7 +8203,7 @@
+@@ -8708,7 +8708,7 @@
    }
    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
    result = (PYTHON::Session *)new PYTHON::Session(arg1);

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	Wed Jul 16 17:06:14 2008
@@ -8637,6 +8637,40 @@
 SWIGINTERN PyObject *_wrap_new_Session__SWIG_1(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   char *arg1 = (char *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  PYTHON::Session *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:new_Session",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Session" "', argument " "2"" of type '" "CoreSession *""'"); 
+  }
+  arg2 = reinterpret_cast< CoreSession * >(argp2);
+  result = (PYTHON::Session *)new PYTHON::Session(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
   PYTHON::Session *result = 0 ;
   int res1 ;
   char *buf1 = 0 ;
@@ -8659,7 +8693,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_3(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
   PYTHON::Session *result = 0 ;
@@ -8683,12 +8717,12 @@
 
 SWIGINTERN PyObject *_wrap_new_Session(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[2];
+  PyObject *argv[3];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
   argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
@@ -8700,7 +8734,7 @@
     int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_Session__SWIG_2(self, args);
+      return _wrap_new_Session__SWIG_3(self, args);
     }
   }
   if (argc == 1) {
@@ -8708,7 +8742,20 @@
     int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_Session__SWIG_1(self, args);
+      return _wrap_new_Session__SWIG_2(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      void *vptr = 0;
+      int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_Session__SWIG_1(self, args);
+      }
     }
   }
   
@@ -8716,6 +8763,7 @@
   SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Session'.\n"
     "  Possible C/C++ prototypes are:\n"
     "    PYTHON::Session()\n"
+    "    PYTHON::Session(char *,CoreSession *)\n"
     "    PYTHON::Session(char *)\n"
     "    PYTHON::Session(switch_core_session_t *)\n");
   return NULL;

Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp	(original)
+++ freeswitch/trunk/src/switch_cpp.cpp	Wed Jul 16 17:06:14 2008
@@ -425,7 +425,7 @@
 	init_vars();
 }
 
-SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid)
+SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid, CoreSession *a_leg)
 {
 	init_vars();
 
@@ -435,7 +435,7 @@
 		allocated = 1;
     } else {
 		switch_call_cause_t cause;
-		if (switch_ivr_originate(NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, SOF_NONE) == SWITCH_STATUS_SUCCESS) {
+		if (switch_ivr_originate(a_leg ? a_leg->session : NULL, &session, &cause, nuuid, 60, NULL, NULL, NULL, NULL, SOF_NONE) == SWITCH_STATUS_SUCCESS) {
 			channel = switch_core_session_get_channel(session);
 			allocated = 1;
 			switch_set_flag(this, S_HUP);
@@ -1081,8 +1081,8 @@
 				dtmf_func = args.input_callback;   // get the call back function
 				err = NULL;
 				switch_ivr_multi_threaded_bridge(session_a.session, session_b.session, dtmf_func, args.buf, args.buf);
-				session_a.end_allow_threads();
 			}
+			session_a.end_allow_threads();
 		}
 	}
 



More information about the Freeswitch-svn mailing list