]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
even more lang stuff
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Jul 2008 21:06:14 +0000 (21:06 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Jul 2008 21:06:14 +0000 (21:06 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9063 d0543943-73ff-0310-b7d9-9358b9ac24b2

16 files changed:
src/include/switch_cpp.h
src/mod/languages/mod_lua/Makefile
src/mod/languages/mod_lua/freeswitch_lua.cpp
src/mod/languages/mod_lua/freeswitch_lua.h
src/mod/languages/mod_lua/hack.diff
src/mod/languages/mod_lua/mod_lua_wrap.cpp
src/mod/languages/mod_perl/Makefile
src/mod/languages/mod_perl/freeswitch_perl.cpp
src/mod/languages/mod_perl/freeswitch_perl.h
src/mod/languages/mod_perl/hack.diff
src/mod/languages/mod_perl/mod_perl_wrap.cpp
src/mod/languages/mod_python/freeswitch_python.cpp
src/mod/languages/mod_python/freeswitch_python.h
src/mod/languages/mod_python/hack.diff
src/mod/languages/mod_python/mod_python_wrap.cpp
src/switch_cpp.cpp

index 5e7d8b81941ca7fda78b887a0e928110b8b4c623..ed2aa2f72cdda5965280cf2909c2cfd3afaa8dce 100644 (file)
@@ -199,7 +199,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
 
           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;
index 5e481099f7b6ce76f2831a28de809de55894a1b7..b086108b6d25a29638173ac8ad65d5b24b97d0e5 100644 (file)
@@ -13,6 +13,8 @@ local_depend: $(LOCAL_OBJS)
 $(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
 
index b85a874ecaa5054030725813b2e2aee31907227a..e33e1eaecf854fc4ba710c46d0ad0cf836d026b0 100644 (file)
@@ -9,7 +9,7 @@ Session::Session():CoreSession()
        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;
index c61194e4d3c44637d650b2a566649bfc53685cf8..0b9b6dbbcd6c3ee9b611ea1aaa83d83df355fa39 100644 (file)
@@ -20,7 +20,7 @@ class Session : public CoreSession {
        int mark;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
        
index 8bf3b107fa463a4b6b7911ebd9d0ed8f83bd1283..afd37b086dd9a36da76ab6dccd992cf601a6dc8f 100644 (file)
@@ -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;
index 8f9e2823567851bfe6102e0b28372a6486bf26fe..b8430e5db81dea7c65f54f3de04b1c2a146e2f55 100644 (file)
@@ -6743,6 +6743,34 @@ fail:
 
 
 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 ;
@@ -6763,7 +6791,7 @@ fail:
 }
 
 
-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 @@ fail:
 
 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 @@ static int _wrap_new_Session(lua_State* L) {
       }
     }
     if (_v) {
-      return _wrap_new_Session__SWIG_2(L);
+      return _wrap_new_Session__SWIG_3(L);
     }
   }
   if (argc == 1) {
@@ -6818,7 +6846,26 @@ static int _wrap_new_Session(lua_State* L) {
       _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);
+      }
     }
   }
   
index 75542e2baeb08e4dec568b7bc9feb9b76f322084..145951576f8c65b88af94dcaae19b05f429ebbe6 100644 (file)
@@ -20,7 +20,8 @@ mod_perl_wrap.cpp:
        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)
index 373a0b387381117759e0b5b0a182a9ce831a3ddb..795aa2bec2c6ac69cd0c6bbc129ddb8ae2fb6ce7 100644 (file)
@@ -13,7 +13,7 @@ Session::Session():CoreSession()
        init_me();
 }
 
-Session::Session(char *uuid):CoreSession(uuid)
+Session::Session(char *uuid, CoreSession *a_leg):CoreSession(uuid, a_leg)
 {
        init_me();
        if (session && allocated) {
index deef2ecf6fa3045423eba3ec4c5b76f5de8615b8..ccbec939aca551cb65bcbf74658a131c64f7973b 100644 (file)
@@ -28,7 +28,7 @@ class Session : public CoreSession {
        SV *me;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *uuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     ~Session();        
        
index e3f7bb1dc46abe41e95b8a067ffc0b8151ef6c27..91aa2ddf8364ffbf77816ec5810c08647bca072d 100644 (file)
@@ -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 ;
      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);
index 72a73c6507ee737638635ae784e9aedceb318752..0cecf37103db5117a10cb53c5f55282e9910aba0 100644 (file)
@@ -8872,6 +8872,55 @@ XS(_wrap_new_Session__SWIG_0) {
 
 
 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 ;
@@ -8911,7 +8960,7 @@ XS(_wrap_new_Session__SWIG_1) {
 }
 
 
-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 @@ XS(_wrap_new_Session) {
     }
   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;
     }
   }
index 6b9685eeea4679e8030724b2090c35f5ebe7721d..df2eb4bfbc2d6f8054699cd4d248bf046eed8c94 100644 (file)
@@ -10,7 +10,7 @@ Session::Session():CoreSession()
        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 @@ bool Session::begin_allow_threads()
 
        if (!TS) {
                TS = PyEval_SaveThread();
+               if (channel) {
+                       switch_channel_set_private(channel, "SwapInThreadState", TS);
+               }
                return true;
        }
 
@@ -75,6 +78,10 @@ bool Session::end_allow_threads()
        PyEval_RestoreThread(TS);
        TS = NULL;
 
+       if (channel) {
+               switch_channel_set_private(channel, "SwapInThreadState", NULL);
+       }
+
        do_hangup_hook();
 
        return true;
index cb5563e9639206eaac1408206be4bcf251bfaa95..8d61407de6c00e67fece998302e99ec9fac85fd6 100644 (file)
@@ -20,7 +20,7 @@ class Session : public CoreSession {
        PyThreadState *TS;
  public:
     Session();
-    Session(char *uuid);
+    Session(char *nuuid, CoreSession *a_leg = NULL);
     Session(switch_core_session_t *session);
     virtual ~Session();        
        
index 777f34e43553a9e9aa1bd13c9313210ce2414659..712171035ca974d413fd3df80b4afb0b512930af 100644 (file)
@@ -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 @@
  }
  
  
  
 -SWIGINTERN PyObject *_wrap_new_Session__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
 +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);
    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);
index f8555dcc307bf8c5288fba02c513f570d0a0ea54..9b58a3b66a9cbad0a013c55af3247740e9601723 100644 (file)
@@ -8635,6 +8635,40 @@ fail:
 
 
 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 ;
@@ -8659,7 +8693,7 @@ fail:
 }
 
 
-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 @@ fail:
 
 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 @@ SWIGINTERN PyObject *_wrap_new_Session(PyObject *self, PyObject *args) {
     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 @@ SWIGINTERN PyObject *_wrap_new_Session(PyObject *self, PyObject *args) {
     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 @@ fail:
   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;
index b9694c155e5fe7821a3a3c62225b57aaa37f16a6..3a0a4e31d028b7235cd30f13afee8a724faff7e9 100644 (file)
@@ -425,7 +425,7 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession()
        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 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid)
                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 @@ SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b)
                                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();
                }
        }