[Freeswitch-svn] [commit] r8998 - in freeswitch/trunk: . build src src/include src/mod/languages/mod_java src/mod/languages/mod_java/src/org/freeswitch/swig src/mod/languages/mod_lua src/mod/languages/mod_perl src/mod/languages/mod_python

Freeswitch SVN anthm at freeswitch.org
Fri Jul 11 15:42:53 EDT 2008


Author: anthm
Date: Fri Jul 11 15:42:52 2008
New Revision: 8998

Added:
   freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/DTMF.java
   freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_uint32_t.java
   freeswitch/trunk/src/mod/languages/mod_python/hack.diff
   freeswitch/trunk/src/mod/languages/mod_python/mod_python_extra.c
   freeswitch/trunk/src/mod/languages/mod_python/mod_python_extra.h
Removed:
   freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c
   freeswitch/trunk/src/mod/languages/mod_python/switch_swig_wrap.c.bkp
Modified:
   freeswitch/trunk/Makefile.am
   freeswitch/trunk/build/swigall.sh
   freeswitch/trunk/src/include/switch_cpp.h
   freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
   freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
   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/mod_perl_wrap.cpp
   freeswitch/trunk/src/mod/languages/mod_python/Makefile.in
   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.c
   freeswitch/trunk/src/mod/languages/mod_python/mod_python.i
   freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
   freeswitch/trunk/src/switch_cpp.cpp

Log:
snake charming

Modified: freeswitch/trunk/Makefile.am
==============================================================================
--- freeswitch/trunk/Makefile.am	(original)
+++ freeswitch/trunk/Makefile.am	Fri Jul 11 15:42:52 2008
@@ -331,7 +331,7 @@
 	cd libs/openzap && autoconf
 	cd libs/openzap && ./configure
 
-update-clean: clean modwipe uninstall libs/openzap/Makefile
+update-clean: clean modwipe uninstall libs/openzap/Makefile python-reconf
 	cd libs/sofia-sip && $(MAKE) clean
 	cd libs/openzap && $(MAKE) clean
 	cd libs/portaudio && $(MAKE) clean
@@ -347,6 +347,10 @@
 	cd libs/sofia-sip && $(MAKE) -j
 	$(MAKE) -j modules
 
+python-reconf:
+	rm -f src/mod/languages/mod_python/Makefile
+	./config.status
+
 pa-reconf:
 	cd libs/portaudio && $(MAKE) clean
 	cd libs/portaudio && sh ./configure.gnu

Modified: freeswitch/trunk/build/swigall.sh
==============================================================================
--- freeswitch/trunk/build/swigall.sh	(original)
+++ freeswitch/trunk/build/swigall.sh	Fri Jul 11 15:42:52 2008
@@ -9,7 +9,8 @@
 cd ../../../..
 
 cd src/mod/languages/mod_python
-make reswig
+make swigclean
+make mod_python_wrap.cpp
 cd ../../../..
 
 cd src/mod/languages/mod_java

Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h	(original)
+++ freeswitch/trunk/src/include/switch_cpp.h	Fri Jul 11 15:42:52 2008
@@ -101,6 +101,14 @@
 		 S_RDLOCK = (1 << 2)
 	 } session_flag_t;
 
+     class DTMF {
+	 public:
+		 char digit;
+		 uint32_t duration;
+		 SWITCH_DECLARE_CONSTRUCTOR DTMF(char idigit, uint32_t iduration = SWITCH_DEFAULT_DTMF_DURATION);
+		 virtual SWITCH_DECLARE_CONSTRUCTOR ~DTMF();
+     };
+
 	 class Stream {
 	   protected:
 		 switch_stream_handle_t mystream;
@@ -172,7 +180,7 @@
 		 SWITCH_DECLARE_CONSTRUCTOR CoreSession();
 		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid);
 		 SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session);
-		 SWITCH_DECLARE_CONSTRUCTOR ~ CoreSession();
+		 virtual SWITCH_DECLARE_CONSTRUCTOR ~ CoreSession();
 		 switch_core_session_t *session;
 		 switch_channel_t *channel;
 		 unsigned int flags;

Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/DTMF.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/DTMF.java	Fri Jul 11 15:42:52 2008
@@ -0,0 +1,60 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.swig;
+
+public class DTMF {
+  private long swigCPtr;
+  protected boolean swigCMemOwn;
+
+  protected DTMF(long cPtr, boolean cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = cPtr;
+  }
+
+  protected static long getCPtr(DTMF obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+
+  protected void finalize() {
+    delete();
+  }
+
+  public synchronized void delete() {
+    if(swigCPtr != 0 && swigCMemOwn) {
+      swigCMemOwn = false;
+      freeswitchJNI.delete_DTMF(swigCPtr);
+    }
+    swigCPtr = 0;
+  }
+
+  public void setDigit(char value) {
+    freeswitchJNI.DTMF_digit_set(swigCPtr, this, value);
+  }
+
+  public char getDigit() {
+    return freeswitchJNI.DTMF_digit_get(swigCPtr, this);
+  }
+
+  public void setDuration(SWIGTYPE_p_uint32_t value) {
+    freeswitchJNI.DTMF_duration_set(swigCPtr, this, SWIGTYPE_p_uint32_t.getCPtr(value));
+  }
+
+  public SWIGTYPE_p_uint32_t getDuration() {
+    return new SWIGTYPE_p_uint32_t(freeswitchJNI.DTMF_duration_get(swigCPtr, this), true);
+  }
+
+  public DTMF(char idigit, SWIGTYPE_p_uint32_t iduration) {
+    this(freeswitchJNI.new_DTMF__SWIG_0(idigit, SWIGTYPE_p_uint32_t.getCPtr(iduration)), true);
+  }
+
+  public DTMF(char idigit) {
+    this(freeswitchJNI.new_DTMF__SWIG_1(idigit), true);
+  }
+
+}

Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_uint32_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_uint32_t.java	Fri Jul 11 15:42:52 2008
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.swig;
+
+public class SWIGTYPE_p_uint32_t {
+  private long swigCPtr;
+
+  protected SWIGTYPE_p_uint32_t(long cPtr, boolean futureUse) {
+    swigCPtr = cPtr;
+  }
+
+  protected SWIGTYPE_p_uint32_t() {
+    swigCPtr = 0;
+  }
+
+  protected static long getCPtr(SWIGTYPE_p_uint32_t obj) {
+    return (obj == null) ? 0 : obj.swigCPtr;
+  }
+}
+

Modified: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java	(original)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java	Fri Jul 11 15:42:52 2008
@@ -32,6 +32,13 @@
   public final static native int S_HUP_get();
   public final static native int S_FREE_get();
   public final static native int S_RDLOCK_get();
+  public final static native void DTMF_digit_set(long jarg1, DTMF jarg1_, char jarg2);
+  public final static native char DTMF_digit_get(long jarg1, DTMF jarg1_);
+  public final static native void DTMF_duration_set(long jarg1, DTMF jarg1_, long jarg2);
+  public final static native long DTMF_duration_get(long jarg1, DTMF jarg1_);
+  public final static native long new_DTMF__SWIG_0(char jarg1, long jarg2);
+  public final static native long new_DTMF__SWIG_1(char jarg1);
+  public final static native void delete_DTMF(long jarg1);
   public final static native long new_Stream__SWIG_0();
   public final static native long new_Stream__SWIG_1(long jarg1);
   public final static native void delete_Stream(long jarg1);

Modified: freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp	Fri Jul 11 15:42:52 2008
@@ -643,6 +643,117 @@
 }
 
 
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1digit_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jchar jarg2) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  char arg2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  arg2 = (char)jarg2; 
+  if (arg1) (arg1)->digit = arg2;
+  
+}
+
+
+SWIGEXPORT jchar JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1digit_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jchar jresult = 0 ;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  result = (char) ((arg1)->digit);
+  jresult = (jchar)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1duration_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t arg2 ;
+  uint32_t *argp2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  argp2 = *(uint32_t **)&jarg2; 
+  if (!argp2) {
+    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null uint32_t");
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->duration = arg2;
+  
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_DTMF_1duration_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+  jlong jresult = 0 ;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t result;
+  
+  (void)jenv;
+  (void)jcls;
+  (void)jarg1_;
+  arg1 = *(DTMF **)&jarg1; 
+  result =  ((arg1)->duration);
+  *(uint32_t **)&jresult = new uint32_t((uint32_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1DTMF_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jchar jarg1, jlong jarg2) {
+  jlong jresult = 0 ;
+  char arg1 ;
+  uint32_t arg2 ;
+  DTMF *result = 0 ;
+  uint32_t *argp2 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (char)jarg1; 
+  argp2 = *(uint32_t **)&jarg2; 
+  if (!argp2) {
+    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null uint32_t");
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = (DTMF *)new DTMF(arg1,arg2);
+  *(DTMF **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1DTMF_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jchar jarg1) {
+  jlong jresult = 0 ;
+  char arg1 ;
+  DTMF *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = (char)jarg1; 
+  result = (DTMF *)new DTMF(arg1);
+  *(DTMF **)&jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1DTMF(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = *(DTMF **)&jarg1; 
+  delete arg1;
+  
+}
+
+
 SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1Stream_1_1SWIG_10(JNIEnv *jenv, jclass jcls) {
   jlong jresult = 0 ;
   Stream *result = 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	Fri Jul 11 15:42:52 2008
@@ -1486,29 +1486,31 @@
 
 #define SWIGTYPE_p_API swig_types[0]
 #define SWIGTYPE_p_CoreSession swig_types[1]
-#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_EventConsumer swig_types[3]
-#define SWIGTYPE_p_IVRMenu swig_types[4]
-#define SWIGTYPE_p_LUA__Session swig_types[5]
-#define SWIGTYPE_p_Stream swig_types[6]
-#define SWIGTYPE_p_input_callback_state swig_types[7]
-#define SWIGTYPE_p_lua_State swig_types[8]
-#define SWIGTYPE_p_session_flag_t swig_types[9]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[10]
-#define SWIGTYPE_p_switch_channel_t swig_types[11]
-#define SWIGTYPE_p_switch_core_session_t swig_types[12]
-#define SWIGTYPE_p_switch_event_node_t swig_types[13]
-#define SWIGTYPE_p_switch_event_t swig_types[14]
-#define SWIGTYPE_p_switch_event_types_t swig_types[15]
-#define SWIGTYPE_p_switch_input_args_t swig_types[16]
-#define SWIGTYPE_p_switch_input_type_t swig_types[17]
-#define SWIGTYPE_p_switch_priority_t swig_types[18]
-#define SWIGTYPE_p_switch_queue_t swig_types[19]
-#define SWIGTYPE_p_switch_status_t swig_types[20]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[21]
-#define SWIGTYPE_p_void swig_types[22]
-static swig_type_info *swig_types[24];
-static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
+#define SWIGTYPE_p_DTMF swig_types[2]
+#define SWIGTYPE_p_Event swig_types[3]
+#define SWIGTYPE_p_EventConsumer swig_types[4]
+#define SWIGTYPE_p_IVRMenu swig_types[5]
+#define SWIGTYPE_p_LUA__Session swig_types[6]
+#define SWIGTYPE_p_Stream swig_types[7]
+#define SWIGTYPE_p_input_callback_state swig_types[8]
+#define SWIGTYPE_p_lua_State swig_types[9]
+#define SWIGTYPE_p_session_flag_t swig_types[10]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[11]
+#define SWIGTYPE_p_switch_channel_t swig_types[12]
+#define SWIGTYPE_p_switch_core_session_t swig_types[13]
+#define SWIGTYPE_p_switch_event_node_t swig_types[14]
+#define SWIGTYPE_p_switch_event_t swig_types[15]
+#define SWIGTYPE_p_switch_event_types_t swig_types[16]
+#define SWIGTYPE_p_switch_input_args_t swig_types[17]
+#define SWIGTYPE_p_switch_input_type_t swig_types[18]
+#define SWIGTYPE_p_switch_priority_t swig_types[19]
+#define SWIGTYPE_p_switch_queue_t swig_types[20]
+#define SWIGTYPE_p_switch_status_t swig_types[21]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[22]
+#define SWIGTYPE_p_uint32_t swig_types[23]
+#define SWIGTYPE_p_void swig_types[24]
+static swig_type_info *swig_types[26];
+static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2143,6 +2145,254 @@
 static const char *swig_input_callback_state_t_base_names[] = {0};
 static swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names };
 
+static int _wrap_DTMF_digit_set(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char arg2 ;
+  
+  SWIG_check_num_args("digit",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("digit",2,"char");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_digit_set",1,SWIGTYPE_p_DTMF);
+  }
+  
+  arg2 = (lua_tostring(L, 2))[0];
+  if (arg1) (arg1)->digit = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_DTMF_digit_get(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char result;
+  
+  SWIG_check_num_args("digit",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_digit_get",1,SWIGTYPE_p_DTMF);
+  }
+  
+  result = (char) ((arg1)->digit);
+  SWIG_arg=0;
+  lua_pushfstring(L,"%c",result); SWIG_arg++;
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_DTMF_duration_set(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t arg2 ;
+  uint32_t *argp2 ;
+  
+  SWIG_check_num_args("duration",2,2)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("duration",2,"uint32_t");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_duration_set",1,SWIGTYPE_p_DTMF);
+  }
+  
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){
+    SWIG_fail_ptr("DTMF_duration_set",2,SWIGTYPE_p_uint32_t);
+  }
+  arg2 = *argp2;
+  
+  if (arg1) (arg1)->duration = arg2;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_DTMF_duration_get(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t result;
+  
+  SWIG_check_num_args("duration",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){
+    SWIG_fail_ptr("DTMF_duration_get",1,SWIGTYPE_p_DTMF);
+  }
+  
+  result =  ((arg1)->duration);
+  SWIG_arg=0;
+  {
+    uint32_t * resultptr = new uint32_t((uint32_t &) result);
+    SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_uint32_t,1); SWIG_arg++;
+  }
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_DTMF__SWIG_0(lua_State* L) {
+  int SWIG_arg = -1;
+  char arg1 ;
+  uint32_t arg2 ;
+  DTMF *result = 0 ;
+  uint32_t *argp2 ;
+  
+  SWIG_check_num_args("DTMF",2,2)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("DTMF",1,"char");
+  if(!lua_isuserdata(L,2)) SWIG_fail_arg("DTMF",2,"uint32_t");
+  arg1 = (lua_tostring(L, 1))[0];
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){
+    SWIG_fail_ptr("new_DTMF",2,SWIGTYPE_p_uint32_t);
+  }
+  arg2 = *argp2;
+  
+  result = (DTMF *)new DTMF(arg1,arg2);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_DTMF,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_DTMF__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  char arg1 ;
+  DTMF *result = 0 ;
+  
+  SWIG_check_num_args("DTMF",1,1)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("DTMF",1,"char");
+  arg1 = (lua_tostring(L, 1))[0];
+  result = (DTMF *)new DTMF(arg1);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_DTMF,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_DTMF(lua_State* L) {
+  int argc;
+  int argv[3]={
+    1,2,3
+  };
+  
+  argc = lua_gettop(L);
+  if (argc == 1) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]) && (lua_strlen(L,argv[0])==1);
+    }
+    if (_v) {
+      return _wrap_new_DTMF__SWIG_1(L);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]) && (lua_strlen(L,argv[0])==1);
+    }
+    if (_v) {
+      {
+        void *ptr;
+        if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_uint32_t, 0)) {
+          _v = 0;
+        } else {
+          _v = 1;
+        }
+      }
+      if (_v) {
+        return _wrap_new_DTMF__SWIG_0(L);
+      }
+    }
+  }
+  
+  lua_pushstring(L,"No matching function for overloaded 'new_DTMF'");
+  lua_error(L);return 0;
+}
+
+
+static int _wrap_delete_DTMF(lua_State* L) {
+  int SWIG_arg = -1;
+  DTMF *arg1 = (DTMF *) 0 ;
+  
+  SWIG_check_num_args("DTMF",1,1)
+  if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("DTMF",1,"DTMF *");
+  
+  if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,SWIG_POINTER_DISOWN))){
+    SWIG_fail_ptr("delete_DTMF",1,SWIGTYPE_p_DTMF);
+  }
+  
+  delete arg1;
+  
+  SWIG_arg=0;
+  
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static void swig_delete_DTMF(void *obj) {
+DTMF *arg1 = (DTMF *) obj;
+delete arg1;
+}
+static swig_lua_method swig_DTMF_methods[] = {
+    {0,0}
+};
+static swig_lua_attribute swig_DTMF_attributes[] = {
+    { "digit", _wrap_DTMF_digit_get, _wrap_DTMF_digit_set},
+    { "duration", _wrap_DTMF_duration_get, _wrap_DTMF_duration_set},
+    {0,0,0}
+};
+static swig_lua_class *swig_DTMF_bases[] = {0};
+static const char *swig_DTMF_base_names[] = {0};
+static swig_lua_class _wrap_class_DTMF = { "DTMF", &SWIGTYPE_p_DTMF,_wrap_new_DTMF, swig_delete_DTMF, swig_DTMF_methods, swig_DTMF_attributes, swig_DTMF_bases, swig_DTMF_base_names };
+
 static int _wrap_new_Stream__SWIG_0(lua_State* L) {
   int SWIG_arg = -1;
   Stream *result = 0 ;
@@ -7029,6 +7279,7 @@
 }
 static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0};
 static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0};
+static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)&_wrap_class_DTMF, 0};
 static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)&_wrap_class_Event, 0};
 static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)&_wrap_class_EventConsumer, 0};
 static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0};
@@ -7049,11 +7300,13 @@
 static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
   &_swigt__p_API,
   &_swigt__p_CoreSession,
+  &_swigt__p_DTMF,
   &_swigt__p_Event,
   &_swigt__p_EventConsumer,
   &_swigt__p_IVRMenu,
@@ -7074,11 +7327,13 @@
   &_swigt__p_switch_queue_t,
   &_swigt__p_switch_status_t,
   &_swigt__p_switch_stream_handle_t,
+  &_swigt__p_uint32_t,
   &_swigt__p_void,
 };
 
 static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_DTMF[] = {  {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_EventConsumer[] = {  {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
@@ -7099,11 +7354,13 @@
 static swig_cast_info _swigc__p_switch_queue_t[] = {  {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = {  {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_API,
   _swigc__p_CoreSession,
+  _swigc__p_DTMF,
   _swigc__p_Event,
   _swigc__p_EventConsumer,
   _swigc__p_IVRMenu,
@@ -7124,6 +7381,7 @@
   _swigc__p_switch_queue_t,
   _swigc__p_switch_status_t,
   _swigc__p_switch_stream_handle_t,
+  _swigc__p_uint32_t,
   _swigc__p_void,
 };
 

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	Fri Jul 11 15:42:52 2008
@@ -179,6 +179,47 @@
 }
 
 
+############# Class : freeswitch::DTMF ##############
+
+package freeswitch::DTMF;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( freeswitch );
+%OWNER = ();
+%ITERATORS = ();
+*swig_digit_get = *freeswitchc::DTMF_digit_get;
+*swig_digit_set = *freeswitchc::DTMF_digit_set;
+*swig_duration_get = *freeswitchc::DTMF_duration_get;
+*swig_duration_set = *freeswitchc::DTMF_duration_set;
+sub new {
+    my $pkg = shift;
+    my $self = freeswitchc::new_DTMF(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        freeswitchc::delete_DTMF($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
 ############# Class : freeswitch::Stream ##############
 
 package freeswitch::Stream;

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	Fri Jul 11 15:42:52 2008
@@ -1448,30 +1448,32 @@
 
 #define SWIGTYPE_p_API swig_types[0]
 #define SWIGTYPE_p_CoreSession swig_types[1]
-#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_EventConsumer swig_types[3]
-#define SWIGTYPE_p_IVRMenu swig_types[4]
-#define SWIGTYPE_p_PERL__Session swig_types[5]
-#define SWIGTYPE_p_PerlInterpreter swig_types[6]
-#define SWIGTYPE_p_Stream swig_types[7]
-#define SWIGTYPE_p_char swig_types[8]
-#define SWIGTYPE_p_input_callback_state swig_types[9]
-#define SWIGTYPE_p_session_flag_t swig_types[10]
-#define SWIGTYPE_p_switch_channel_state_t swig_types[11]
-#define SWIGTYPE_p_switch_channel_t swig_types[12]
-#define SWIGTYPE_p_switch_core_session_t swig_types[13]
-#define SWIGTYPE_p_switch_event_node_t swig_types[14]
-#define SWIGTYPE_p_switch_event_t swig_types[15]
-#define SWIGTYPE_p_switch_event_types_t swig_types[16]
-#define SWIGTYPE_p_switch_input_args_t swig_types[17]
-#define SWIGTYPE_p_switch_input_type_t swig_types[18]
-#define SWIGTYPE_p_switch_priority_t swig_types[19]
-#define SWIGTYPE_p_switch_queue_t swig_types[20]
-#define SWIGTYPE_p_switch_status_t swig_types[21]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[22]
-#define SWIGTYPE_p_void swig_types[23]
-static swig_type_info *swig_types[25];
-static swig_module_info swig_module = {swig_types, 24, 0, 0, 0, 0};
+#define SWIGTYPE_p_DTMF swig_types[2]
+#define SWIGTYPE_p_Event swig_types[3]
+#define SWIGTYPE_p_EventConsumer swig_types[4]
+#define SWIGTYPE_p_IVRMenu swig_types[5]
+#define SWIGTYPE_p_PERL__Session swig_types[6]
+#define SWIGTYPE_p_PerlInterpreter swig_types[7]
+#define SWIGTYPE_p_Stream swig_types[8]
+#define SWIGTYPE_p_char swig_types[9]
+#define SWIGTYPE_p_input_callback_state swig_types[10]
+#define SWIGTYPE_p_session_flag_t swig_types[11]
+#define SWIGTYPE_p_switch_channel_state_t swig_types[12]
+#define SWIGTYPE_p_switch_channel_t swig_types[13]
+#define SWIGTYPE_p_switch_core_session_t swig_types[14]
+#define SWIGTYPE_p_switch_event_node_t swig_types[15]
+#define SWIGTYPE_p_switch_event_t swig_types[16]
+#define SWIGTYPE_p_switch_event_types_t swig_types[17]
+#define SWIGTYPE_p_switch_input_args_t swig_types[18]
+#define SWIGTYPE_p_switch_input_type_t swig_types[19]
+#define SWIGTYPE_p_switch_priority_t swig_types[20]
+#define SWIGTYPE_p_switch_queue_t swig_types[21]
+#define SWIGTYPE_p_switch_status_t swig_types[22]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[23]
+#define SWIGTYPE_p_uint32_t swig_types[24]
+#define SWIGTYPE_p_void swig_types[25]
+static swig_type_info *swig_types[27];
+static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1726,6 +1728,56 @@
 }
 
 
+SWIGINTERN int
+SWIG_AsCharArray(SV * obj, char *val, size_t size)
+{ 
+  char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
+  int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
+  if (SWIG_IsOK(res)) {
+    if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize;
+    if (csize <= size) {
+      if (val) {
+	if (csize) memcpy(val, cptr, csize*sizeof(char));
+	if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char));
+      }
+      if (alloc == SWIG_NEWOBJ) {
+	delete[] cptr;
+	res = SWIG_DelNewMask(res);
+      }      
+      return res;
+    }
+    if (alloc == SWIG_NEWOBJ) delete[] cptr;
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_char SWIG_PERL_DECL_ARGS_2(SV * obj, char *val)
+{    
+  int res = SWIG_AsCharArray(obj, val, 1);
+  if (!SWIG_IsOK(res)) {
+    long v;
+    res = SWIG_AddCast(SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v));
+    if (SWIG_IsOK(res)) {
+      if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
+	if (val) *val = static_cast< char >(v);
+      } else {
+	res = SWIG_OverflowError;
+      }
+    }
+  }
+  return res;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_char  SWIG_PERL_DECL_ARGS_1(char c) 
+{ 
+  return SWIG_FromCharPtrAndSize(&c,1);
+}
+
+
 SWIGINTERNINLINE SV *
 SWIG_From_bool  SWIG_PERL_DECL_ARGS_1(bool value)
 {    
@@ -2664,6 +2716,313 @@
 }
 
 
+XS(_wrap_DTMF_digit_set) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    char arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: DTMF_digit_set(self,digit);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_set" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    ecode2 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DTMF_digit_set" "', argument " "2"" of type '" "char""'");
+    } 
+    arg2 = static_cast< char >(val2);
+    if (arg1) (arg1)->digit = arg2;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DTMF_digit_get) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    char result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: DTMF_digit_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_get" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    result = (char) ((arg1)->digit);
+    ST(argvi) = SWIG_From_char  SWIG_PERL_CALL_ARGS_1(static_cast< char >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DTMF_duration_set) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    uint32_t arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: DTMF_duration_set(self,duration);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_set" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_uint32_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< uint32_t * >(argp2));
+      }
+    }
+    if (arg1) (arg1)->duration = arg2;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DTMF_duration_get) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    uint32_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: DTMF_duration_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_get" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    result =  ((arg1)->duration);
+    ST(argvi) = SWIG_NewPointerObj((new uint32_t(static_cast< const uint32_t& >(result))), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_DTMF__SWIG_0) {
+  {
+    char arg1 ;
+    uint32_t arg2 ;
+    DTMF *result = 0 ;
+    char val1 ;
+    int ecode1 = 0 ;
+    void *argp2 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_DTMF(idigit,iduration);");
+    }
+    ecode1 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+    } 
+    arg1 = static_cast< char >(val1);
+    {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_uint32_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< uint32_t * >(argp2));
+      }
+    }
+    result = (DTMF *)new DTMF(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_DTMF__SWIG_1) {
+  {
+    char arg1 ;
+    DTMF *result = 0 ;
+    char val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_DTMF(idigit);");
+    }
+    ecode1 = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+    } 
+    arg1 = static_cast< char >(val1);
+    result = (DTMF *)new DTMF(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_DTMF) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        {
+          int res = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        {
+          int res = SWIG_AsVal_char SWIG_PERL_CALL_ARGS_2(ST(0), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_uint32_t, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_DTMF__SWIG_1); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_DTMF__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'new_DTMF'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_delete_DTMF) {
+  {
+    DTMF *arg1 = (DTMF *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_DTMF(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_DTMF, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DTMF" "', argument " "1"" of type '" "DTMF *""'"); 
+    }
+    arg1 = reinterpret_cast< DTMF * >(argp1);
+    delete arg1;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_new_Stream__SWIG_0) {
   {
     Stream *result = 0 ;
@@ -9174,6 +9533,7 @@
 }
 static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)"freeswitch::API", 0};
 static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)"freeswitch::CoreSession", 0};
+static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)"freeswitch::DTMF", 0};
 static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)"freeswitch::Event", 0};
 static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)"freeswitch::EventConsumer", 0};
 static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)"freeswitch::IVRMenu", 0};
@@ -9195,11 +9555,13 @@
 static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
   &_swigt__p_API,
   &_swigt__p_CoreSession,
+  &_swigt__p_DTMF,
   &_swigt__p_Event,
   &_swigt__p_EventConsumer,
   &_swigt__p_IVRMenu,
@@ -9221,11 +9583,13 @@
   &_swigt__p_switch_queue_t,
   &_swigt__p_switch_status_t,
   &_swigt__p_switch_stream_handle_t,
+  &_swigt__p_uint32_t,
   &_swigt__p_void,
 };
 
 static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_PERL__Session, _p_PERL__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_DTMF[] = {  {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_EventConsumer[] = {  {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
@@ -9247,11 +9611,13 @@
 static swig_cast_info _swigc__p_switch_queue_t[] = {  {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = {  {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_API,
   _swigc__p_CoreSession,
+  _swigc__p_DTMF,
   _swigc__p_Event,
   _swigc__p_EventConsumer,
   _swigc__p_IVRMenu,
@@ -9273,6 +9639,7 @@
   _swigc__p_switch_queue_t,
   _swigc__p_switch_status_t,
   _swigc__p_switch_stream_handle_t,
+  _swigc__p_uint32_t,
   _swigc__p_void,
 };
 
@@ -9309,6 +9676,12 @@
 {"freeswitchc::input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get},
 {"freeswitchc::new_input_callback_state_t", _wrap_new_input_callback_state_t},
 {"freeswitchc::delete_input_callback_state_t", _wrap_delete_input_callback_state_t},
+{"freeswitchc::DTMF_digit_set", _wrap_DTMF_digit_set},
+{"freeswitchc::DTMF_digit_get", _wrap_DTMF_digit_get},
+{"freeswitchc::DTMF_duration_set", _wrap_DTMF_duration_set},
+{"freeswitchc::DTMF_duration_get", _wrap_DTMF_duration_get},
+{"freeswitchc::new_DTMF", _wrap_new_DTMF},
+{"freeswitchc::delete_DTMF", _wrap_delete_DTMF},
 {"freeswitchc::new_Stream", _wrap_new_Stream},
 {"freeswitchc::delete_Stream", _wrap_delete_Stream},
 {"freeswitchc::Stream_write", _wrap_Stream_write},
@@ -9734,6 +10107,7 @@
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
+  SWIG_TypeClientData(SWIGTYPE_p_DTMF, (void*) "freeswitch::DTMF");
   SWIG_TypeClientData(SWIGTYPE_p_Stream, (void*) "freeswitch::Stream");
   SWIG_TypeClientData(SWIGTYPE_p_Event, (void*) "freeswitch::Event");
   SWIG_TypeClientData(SWIGTYPE_p_EventConsumer, (void*) "freeswitch::EventConsumer");

Modified: freeswitch/trunk/src/mod/languages/mod_python/Makefile.in
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/Makefile.in	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/Makefile.in	Fri Jul 11 15:42:52 2008
@@ -11,19 +11,20 @@
 LINK=$(CXXLINK)
 
 PYMOD=freeswitch
-PYTHON_SITE_DIR=@PYTHON_SITE_DIR@
+PYTHON_SITE_DIR=/usr/lib/python2.4/site-packages
 
 SWIGCFILE=../../../switch_swig.c
 SWIGIFILE=../../../switch_swig.i
 
-reswig: 
-	swig -python -shadow -c++ -I../../../../src/include -o mod_python_wrap.cpp mod_python.i
+reswig: swigclean mod_python_wrap.cpp
 
-switch_swig_wrap.o: switch_swig_wrap.c Makefile
-	$(CC)  -w $(CFLAGS) -c $< -o $@
+swigclean: clean
+	rm -f mod_python_wrap.* freeswitch.py
 
-switch_swig.o: $(SWIGCFILE) Makefile
-	$(CC)  -w $(CFLAGS) -c $< -o $@
+mod_python_wrap.cpp: mod_python_extra.c
+	swig -python -c++ -I../../../../src/include -oh mod_python_wrap.h -o mod_python_wrap.cpp mod_python.i
+	echo "#include \"mod_python_extra.c\"" >> mod_python_wrap.cpp
+	patch -s -p0 -i hack.diff
 
 local_install:
 	mkdir -m755 -p $(DESTDIR)$(PYTHON_SITE_DIR)

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	Fri Jul 11 15:42:52 2008
@@ -114,6 +114,27 @@
 S_HUP = _freeswitch.S_HUP
 S_FREE = _freeswitch.S_FREE
 S_RDLOCK = _freeswitch.S_RDLOCK
+class DTMF(_object):
+    __swig_setmethods__ = {}
+    __setattr__ = lambda self, name, value: _swig_setattr(self, DTMF, name, value)
+    __swig_getmethods__ = {}
+    __getattr__ = lambda self, name: _swig_getattr(self, DTMF, name)
+    __repr__ = _swig_repr
+    __swig_setmethods__["digit"] = _freeswitch.DTMF_digit_set
+    __swig_getmethods__["digit"] = _freeswitch.DTMF_digit_get
+    if _newclass:digit = _swig_property(_freeswitch.DTMF_digit_get, _freeswitch.DTMF_digit_set)
+    __swig_setmethods__["duration"] = _freeswitch.DTMF_duration_set
+    __swig_getmethods__["duration"] = _freeswitch.DTMF_duration_get
+    if _newclass:duration = _swig_property(_freeswitch.DTMF_duration_get, _freeswitch.DTMF_duration_set)
+    def __init__(self, *args): 
+        this = _freeswitch.new_DTMF(*args)
+        try: self.this.append(this)
+        except: self.this = this
+    __swig_destroy__ = _freeswitch.delete_DTMF
+    __del__ = lambda self : None;
+DTMF_swigregister = _freeswitch.DTMF_swigregister
+DTMF_swigregister(DTMF)
+
 class Stream(_object):
     __swig_setmethods__ = {}
     __setattr__ = lambda self, name, value: _swig_setattr(self, Stream, name, value)
@@ -274,31 +295,43 @@
 bridge = _freeswitch.bridge
 hanguphook = _freeswitch.hanguphook
 dtmf_callback = _freeswitch.dtmf_callback
-S_SWAPPED_IN = _freeswitch.S_SWAPPED_IN
-S_SWAPPED_OUT = _freeswitch.S_SWAPPED_OUT
-class PySession(CoreSession):
+class Session(CoreSession):
     __swig_setmethods__ = {}
     for _s in [CoreSession]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
-    __setattr__ = lambda self, name, value: _swig_setattr(self, PySession, name, value)
+    __setattr__ = lambda self, name, value: _swig_setattr(self, Session, name, value)
     __swig_getmethods__ = {}
     for _s in [CoreSession]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
-    __getattr__ = lambda self, name: _swig_getattr(self, PySession, name)
+    __getattr__ = lambda self, name: _swig_getattr(self, Session, name)
     __repr__ = _swig_repr
     def __init__(self, *args): 
-        this = _freeswitch.new_PySession(*args)
+        this = _freeswitch.new_Session(*args)
         try: self.this.append(this)
         except: self.this = this
-    __swig_destroy__ = _freeswitch.delete_PySession
+    __swig_destroy__ = _freeswitch.delete_Session
     __del__ = lambda self : None;
-    def setDTMFCallback(*args): return _freeswitch.PySession_setDTMFCallback(*args)
-    def setHangupHook(*args): return _freeswitch.PySession_setHangupHook(*args)
-    def check_hangup_hook(*args): return _freeswitch.PySession_check_hangup_hook(*args)
-    def hangup(*args): return _freeswitch.PySession_hangup(*args)
-    def begin_allow_threads(*args): return _freeswitch.PySession_begin_allow_threads(*args)
-    def end_allow_threads(*args): return _freeswitch.PySession_end_allow_threads(*args)
-    def run_dtmf_callback(*args): return _freeswitch.PySession_run_dtmf_callback(*args)
-PySession_swigregister = _freeswitch.PySession_swigregister
-PySession_swigregister(PySession)
+    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 run_dtmf_callback(*args): return _freeswitch.Session_run_dtmf_callback(*args)
+    def setInputCallback(*args): return _freeswitch.Session_setInputCallback(*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
+    __swig_getmethods__["cb_function"] = _freeswitch.Session_cb_function_get
+    if _newclass:cb_function = _swig_property(_freeswitch.Session_cb_function_get, _freeswitch.Session_cb_function_set)
+    __swig_setmethods__["cb_arg"] = _freeswitch.Session_cb_arg_set
+    __swig_getmethods__["cb_arg"] = _freeswitch.Session_cb_arg_get
+    if _newclass:cb_arg = _swig_property(_freeswitch.Session_cb_arg_get, _freeswitch.Session_cb_arg_set)
+    __swig_setmethods__["hangup_func"] = _freeswitch.Session_hangup_func_set
+    __swig_getmethods__["hangup_func"] = _freeswitch.Session_hangup_func_get
+    if _newclass:hangup_func = _swig_property(_freeswitch.Session_hangup_func_get, _freeswitch.Session_hangup_func_set)
+    __swig_setmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_set
+    __swig_getmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_get
+    if _newclass:hangup_func_arg = _swig_property(_freeswitch.Session_hangup_func_arg_get, _freeswitch.Session_hangup_func_arg_set)
+    def setPython(*args): return _freeswitch.Session_setPython(*args)
+    def setSelf(*args): return _freeswitch.Session_setSelf(*args)
+Session_swigregister = _freeswitch.Session_swigregister
+Session_swigregister(Session)
 
 
 

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	Fri Jul 11 15:42:52 2008
@@ -1,320 +1,301 @@
+
+#include <switch.h>
 #include "freeswitch_python.h"
+using namespace PYTHON;
 
-#define py_sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
-#define py_init_vars() do { caller_profile.source = "mod_python"; swapstate = S_SWAPPED_IN; } while(0)
+#define py_init_vars() cb_function = cb_arg = hangup_func = hangup_func_arg = NULL; hh = mark = 0; TS = NULL
 
-PySession::PySession():CoreSession()
+Session::Session():CoreSession()
 {
 	py_init_vars();
 }
 
-PySession::PySession(char *uuid):CoreSession(uuid)
+Session::Session(char *uuid):CoreSession(uuid)
 {
 	py_init_vars();
 }
 
-PySession::PySession(switch_core_session_t *new_session):CoreSession(new_session)
+Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
 {
 	py_init_vars();
 }
+static switch_status_t python_hanguphook(switch_core_session_t *session_hungup);
 
-
-void PySession::setDTMFCallback(PyObject * pyfunc, char *funcargs)
+Session::~Session()
 {
-	py_sanity_check();
+	
+	if (hangup_func) {
+		if (session) {
+			switch_core_event_hook_remove_state_change(session, python_hanguphook);
+		}
+		Py_XDECREF(hangup_func);
+		hangup_func = NULL;
+	}
+	
+	if (hangup_func_arg) {
+		Py_XDECREF(hangup_func_arg);
+		hangup_func_arg = NULL;
+	}
 
-	if (!PyCallable_Check(pyfunc)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF function is not a python function.\n");
-		return;
+	if (cb_function) {
+		Py_XDECREF(cb_function);
+		cb_function = NULL;
 	}
-	Py_XINCREF(pyfunc);
-	CoreSession::setDTMFCallback((void *) pyfunc, funcargs);
 
+	if (cb_arg) {
+		Py_XDECREF(cb_arg);
+		cb_arg = NULL;
+	}
 
+	if (Self) {
+		Py_XDECREF(Self);
+	}
 }
 
-void PySession::setHangupHook(PyObject * pyfunc)
+bool Session::begin_allow_threads()
 {
 
-	if (!PyCallable_Check(pyfunc)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
-		return;
+	do_hangup_hook();
+
+	if (!TS) {
+		TS = PyEval_SaveThread();
+		return true;
 	}
-	// without this Py_XINCREF, there will be segfaults.  basically the python
-	// interpreter will not know that it should not GC this object.
-	// callback example: http://docs.python.org/ext/callingPython.html
-	Py_XINCREF(pyfunc);
-	CoreSession::setHangupHook((void *) pyfunc);
 
+	return false;
 }
 
-
-void PySession::check_hangup_hook()
+bool Session::end_allow_threads()
 {
-#if 0
-	PyObject *func;
-	PyObject *result;
-	char *resultStr;
-	bool did_swap_in = false;
-#endif
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-					  "check_hangup_hook has been DISABLED, please do not use hangup hooks in python code until further notice!\n");
 
-	if (!session) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
-		return;
+	if (!TS) {
+		return false;
 	}
 
-	return;
-
-	/*! NEEDS TO BE FIXED:
+	PyEval_RestoreThread(TS);
+	TS = NULL;
 
-	   // The did_swap_in boolean was added to fix the following problem:
-	   // Design flaw - we swap in threadstate based on the assumption that thread state 
-	   // is currently _swapped out_ when this hangup hook is called.  However, nothing known to 
-	   // guarantee that, and  if thread state is already swapped in when this is invoked, 
-	   // bad things will happen.
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook end_allow_threads\n");
-	   did_swap_in = end_allow_threads();
+	do_hangup_hook();
 
-	   if (on_hangup == NULL) {
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "on_hangup is null\n");
-	   return;
-	   }
-
-	   func = (PyObject *) on_hangup;
-
-	   // TODO: to match js implementation, should pass the _python_ PySession 
-	   // object instance wrapping this C++ PySession instance. but how do we do that?
-	   // for now, pass the uuid since its better than nothing
-	   PyObject* func_arg = Py_BuildValue("(s)", uuid);
-
-	   result = PyEval_CallObject(func, func_arg);
-	   Py_XDECREF(func_arg);
-
-	   if (result) {
-	   resultStr = (char *) PyString_AsString(result);
-	   // currently just ignore the result
-	   }
-	   else {
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to call python hangup callback\n");
-	   PyErr_Print();
-	   PyErr_Clear();
-	   }
+	return true;
+}
 
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook begin_allow_threads\n");
-	   if (did_swap_in) {
-	   begin_allow_threads();
-	   }
+void Session::setPython(PyObject *state)
+{
+	Py = state;
+}
 
-	   Py_XDECREF(result);
-	 */
+void Session::setSelf(PyObject *state)
+{
+	Self = state;
 }
 
-switch_status_t PySession::run_dtmf_callback(void *input, switch_input_type_t itype)
+PyObject *Session::getPython()
 {
+	return Py;
+}
 
-	PyObject *func, *arglist;
-	PyObject *pyresult;
-	PyObject *headerdict;
 
-	char *resultStr;
-	char *funcargs;
-	bool did_swap_in = false;
+bool Session::ready()
+{
+	bool r;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback\n");
+	sanity_check(false);
+	r = switch_channel_ready(channel) != 0;
+	do_hangup_hook();
 
+	return r;
+}
 
-	if (!cb_state.function) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
-		return SWITCH_STATUS_FALSE;
+void Session::check_hangup_hook()
+{
+	if (hangup_func && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) {
+		hh++;
 	}
+}
 
-	func = (PyObject *) cb_state.function;
-	if (!func) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
-		return SWITCH_STATUS_FALSE;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state->function is NOT null\n");
-	}
-	if (!PyCallable_Check(func)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
-		return SWITCH_STATUS_FALSE;
-	}
+void Session::do_hangup_hook()
+{
+	PyObject *result, *arglist;
+	const char *what = hook_state == CS_HANGUP ? "hangup" : "transfer";
 
-	funcargs = (char *) cb_state.funcargs;
+	if (hh && !mark) {
+		mark++;
 
-	if (itype == SWITCH_INPUT_TYPE_DTMF) {
+		if (hangup_func) {
+			
+			if (!PyCallable_Check(hangup_func)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
+				return;
+			}
 
-		arglist = Py_BuildValue("(sis)", input, itype, funcargs);
-	} else if (itype == SWITCH_INPUT_TYPE_EVENT) {
-		// DUNNO if this is correct in the case we have an event
-		// will be of type switch_event_t *event;
-		// http://www.freeswitch.org/docs/structswitch__event.html
-		switch_event_t *event = (switch_event_t *) input;
-		arglist = Py_BuildValue("({s:s}is)", "body", event->body, itype, funcargs);
-
-		// build a dictionary with all the headers
-
-		switch_event_header_t *hp;
-		headerdict = PyDict_New();
-		for (hp = event->headers; hp; hp = hp->next) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding event header to result");
-
-			// TODO: create PyObject pointers for name and value
-			// and explicitly decref them.  all ref counting stuff is 
-			// a mess and needs to be tested and looked at closer.
-			PyDict_SetItem(headerdict, Py_BuildValue("s", hp->name), Py_BuildValue("s", hp->value));
+			if (!Self) {
+				mod_python_conjure_session(NULL, session, NULL);
+			}
+			
+			if (hangup_func_arg) {
+				arglist = Py_BuildValue("(OsO)", Self, what, hangup_func_arg);
+			} else {
+				arglist = Py_BuildValue("(Os)", Self, what);
+			}
 
+			if (!(result = PyEval_CallObject(hangup_func, arglist))) {
+				PyErr_Print();
+			}
+			
+			Py_XDECREF(arglist);
+			Py_XDECREF(hangup_func_arg);
 		}
-
-		// add it to the main event dictionary (first arg in list)
-		// under key 'headers'
-		PyObject *dict = PyTuple_GetItem(arglist, 0);
-		PyDict_SetItemString(dict, "headers", headerdict);
-
-		Py_XDECREF(headerdict);
-
-
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown input type: %d\n", itype);
-		return SWITCH_STATUS_FALSE;
 	}
 
+}
 
-	if (!arglist) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
-		return SWITCH_STATUS_FALSE;
+static switch_status_t python_hanguphook(switch_core_session_t *session_hungup)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
+	CoreSession *coresession = NULL;
+	switch_channel_state_t state = switch_channel_get_state(channel);
+
+	if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
+		if (coresession->hook_state != state) {
+			coresession->hook_state = state;
+			coresession->check_hangup_hook();
+		}
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback end_allow_threads\n");
-	did_swap_in = end_allow_threads();
+	return SWITCH_STATUS_SUCCESS;
+}
 
-	pyresult = PyEval_CallObject(func, arglist);
 
+void Session::setHangupHook(PyObject *pyfunc, PyObject *arg)
+{
 
-	Py_XDECREF(arglist);		// Trash arglist
+	if (!PyCallable_Check(pyfunc)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
+		return;
+	}
 
-	if (pyresult && pyresult != Py_None) {
-		resultStr = (char *) PyString_AsString(pyresult);
-		switch_status_t cbresult = process_callback_result(resultStr);
-		return cbresult;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Python callback\n returned None");
-		PyErr_Print();
-		PyErr_Clear();
+	if (hangup_func) {
+		if (session) {
+			switch_core_event_hook_remove_state_change(session, python_hanguphook);
+		}
+		Py_XDECREF(hangup_func);
+		hangup_func = NULL;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback begin_allow_threads\n");
-	if (did_swap_in) {
-		begin_allow_threads();
+	if (hangup_func_arg) {
+		Py_XDECREF(hangup_func_arg);
+		hangup_func_arg = NULL;
 	}
+	
+	hangup_func = pyfunc;
+	hangup_func_arg = arg;
 
-	Py_XDECREF(pyresult);
+	Py_XINCREF(hangup_func);
 
-	return SWITCH_STATUS_SUCCESS;
+	if (hangup_func_arg) {
+		Py_XINCREF(hangup_func_arg);
+	}
+
+	switch_channel_set_private(channel, "CoreSession", this);
+	hook_state = switch_channel_get_state(channel);
+	switch_core_event_hook_add_state_change(session, python_hanguphook);
 
 }
 
-bool PySession::begin_allow_threads(void)
+void Session::setInputCallback(PyObject *cbfunc, PyObject *funcargs)
 {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
 
-	if (!session) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
-		return false;
+	if (!PyCallable_Check(cbfunc)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
+		return;
 	}
-	// swap out threadstate and store in instance variable 
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
-	// so lets assume the thread state was swapped in when the python script was started,
-	// therefore swapin_tstate will be NULL (because there is nothing to swap in, since its 
-	// _already_ swapped in.)
-	if (swapin_tstate == NULL) {
-		// currently swapped in
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-out!\n");
-		swapin_tstate = PyEval_SaveThread();
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
-		// give future swapper-inners something to actually swap in
-		switch_channel_set_private(channel, "SwapInThreadState", (void *) swapin_tstate);
-		cb_state.threadState = threadState;	// TODO: get rid of this
-		args.buf = &cb_state;
-		ap = &args;
-		return true;
 
-	} else {
-		// currently swapped out
-		return false;
+	if (cb_function) {
+		Py_XDECREF(cb_function);
+		cb_function = NULL;
 	}
 
-}
-
-bool PySession::end_allow_threads(void)
-{
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
-	// swap in threadstate from instance variable saved earlier
-	if (!session) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
-		return false;
+	if (cb_arg) {
+		Py_XDECREF(cb_arg);
+		cb_arg = NULL;
 	}
 
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
-	if (swapin_tstate == NULL) {
-		// currently swapped in
-		return false;
-	} else {
-		// currently swapped out
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-in!\n");
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
-		PyEval_RestoreThread(swapin_tstate);
-		// dont give any swapper-inners the opportunity to do a double swap
-		switch_channel_set_private(channel, "SwapInThreadState", NULL);
-		return true;
+	cb_function = cbfunc;
+	cb_arg = funcargs;
+	args.buf = this;
+    switch_channel_set_private(channel, "CoreSession", this);
+
+	Py_XINCREF(cb_function);
+
+	if (cb_arg) {
+		Py_XINCREF(cb_arg);
 	}
 
+    args.input_callback = dtmf_callback;
+    ap = &args;
 
 }
 
-void PySession::hangup(char *cause)
+switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
 {
 
+	PyObject *pyresult, *arglist, *io = NULL;
+	int ts = 0;
+	char *str = NULL, *what = "";
 
-	// since we INCREF'd this function pointer earlier (so the py gc didnt reclaim it)
-	// we have to DECREF it, or else the PySession dtor will never get called and
-	// a zombie channel will be left over using up resources
+	if (TS) {
+		ts++;
+		end_allow_threads();
+	}
 
-	if (cb_state.function != NULL) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "xdecref on cb_state_function\n");
-		PyObject *func = (PyObject *) cb_state.function;
-		Py_XDECREF(func);
+	if (!PyCallable_Check(cb_function)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
+		return SWITCH_STATUS_FALSE;
+	}
+	
+	if (itype == SWITCH_INPUT_TYPE_DTMF) {
+		switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+		io = mod_python_conjure_DTMF(dtmf->digit, dtmf->duration);
+		what = "dtmf";
+	} else if (itype == SWITCH_INPUT_TYPE_EVENT){
+		what = "event";
+		io = mod_python_conjure_event(NULL, (switch_event_t *) input, NULL);
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state.function is null\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unsupported type!\n");
+		return SWITCH_STATUS_FALSE;
 	}
 
+	if (!Self) {
+		mod_python_conjure_session(NULL, session, NULL);
+	}
+	
+	if (cb_arg) {
+		arglist = Py_BuildValue("(OsOO)", Self, what, io, cb_arg);
+	} else {
+		arglist = Py_BuildValue("(OsO)", Self, what, io);
+	}
 
-	CoreSession::hangup(cause);
-
-}
-
+	if ((pyresult = PyEval_CallObject(cb_function, arglist))) {
+		str = (char *) PyString_AsString(pyresult);
+	} else {
+		PyErr_Print();
+	}
 
-PySession::~PySession()
-{
-	// Should we do any cleanup here?
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession started\n");
+	Py_XDECREF(arglist);
+	Py_XDECREF(io);
 
-	if (on_hangup) {
-		PyObject *func = (PyObject *) on_hangup;
-		Py_XDECREF(func);
+	if (cb_arg) {
+		Py_XDECREF(cb_arg);
 	}
 
-
-	if (cb_state.function != NULL) {
-		PyObject *func = (PyObject *) cb_state.function;
-		Py_XDECREF(func);
+	if (ts) {
+		begin_allow_threads();
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession finished\n");
+	if (str) {
+		return process_callback_result(str);
+	}
 
+	return SWITCH_STATUS_FALSE;
 }

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	Fri Jul 11 15:42:52 2008
@@ -1,61 +1,45 @@
 #ifndef FREESWITCH_PYTHON_H
 #define FREESWITCH_PYTHON_H
 
-#include <Python.h>
-
-#ifdef __cplusplus
 extern "C" {
-#endif
-#ifdef DOH
+#include <Python.h>
+#include "mod_python_extra.h"
 }
-#endif
 
 #include <switch_cpp.h>
 
-
-
-typedef enum {
-	S_SWAPPED_IN = (1 << 0),
-	S_SWAPPED_OUT = (1 << 1)
-} swap_state_t;
-
-void console_log(char *level_str, char *msg);
-void console_clean_log(char *msg);
-
-class PySession : public CoreSession {
+namespace PYTHON {
+class Session : public CoreSession {
  private:
-    void *threadState;
-    int swapstate;
+	virtual void do_hangup_hook();
+	PyObject *getPython();
+	PyObject *Py;
+	PyObject *Self;
+	int hh;
+	int mark;
+	PyThreadState *TS;
  public:
-    PySession();
-    PySession(char *uuid);
-    PySession(switch_core_session_t *session);
-    ~PySession();        
-    void setDTMFCallback(PyObject *pyfunc, char *funcargs);
-    void setHangupHook(PyObject *pyfunc);
-    void check_hangup_hook();
-    void hangup(char *cause);
-    bool begin_allow_threads();
-    bool end_allow_threads();
-
-	/**
-	 * Run DTMF callback
-	 * 
-     * A static method in CoreSession is the first thing called
-	 * upon receving a dtmf/event callback from fs engine, and then
-	 * it gets the PySession instance and calls this method with
-	 * dtmf/event object.
-	 *
-	 * @param input - a dtmf char buffer, or an event 'object' (not sure..)
-	 * @param itype - a SWITCH_INPUT_TYPE_DTMF or a SWITCH_INPUT_TYPE_EVENT
-     */
-    switch_status_t run_dtmf_callback(void *input, 
-									  switch_input_type_t itype);
+    Session();
+    Session(char *uuid);
+    Session(switch_core_session_t *session);
+    virtual ~Session();        
+	
+	virtual bool begin_allow_threads();
+	virtual bool end_allow_threads();
+	virtual void check_hangup_hook();
+
+	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+	void setInputCallback(PyObject *cbfunc, PyObject *funcargs = NULL);
+	void setHangupHook(PyObject *pyfunc, PyObject *arg = NULL);
+	bool ready();
+	
+	PyObject *cb_function;
+	PyObject *cb_arg;
+	PyObject *hangup_func;
+	PyObject *hangup_func_arg;
 
+	void setPython(PyObject *state);
+	void setSelf(PyObject *state);
 };
-
-
-#ifdef __cplusplus
 }
 #endif
-#endif

Added: freeswitch/trunk/src/mod/languages/mod_python/hack.diff
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_python/hack.diff	Fri Jul 11 15:42:52 2008
@@ -0,0 +1,53 @@
+--- 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 @@
+ }
+ 
+ 
+-SWIGINTERN PyObject *_wrap_new_Session__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
++SWIGINTERN PyObject *_wrap_new_Session__SWIG_0(PyObject *self, PyObject *args) {
+   PyObject *resultobj = 0;
+   PYTHON::Session *result = 0 ;
+   
+   if (!PyArg_ParseTuple(args,(char *)":new_Session")) SWIG_fail;
+   result = (PYTHON::Session *)new PYTHON::Session();
+-  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);
+   return resultobj;
+ fail:
+   return NULL;
+ }
+ 
+ 
+-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 ;
+   PYTHON::Session *result = 0 ;
+@@ -8179,7 +8179,7 @@
+   }
+   arg1 = reinterpret_cast< char * >(buf1);
+   result = (PYTHON::Session *)new PYTHON::Session(arg1);
+-  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:
+@@ -8188,7 +8188,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;
+   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+   PYTHON::Session *result = 0 ;
+@@ -8203,7 +8203,7 @@
+   }
+   arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+   result = (PYTHON::Session *)new PYTHON::Session(arg1);
+-  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);
+   return resultobj;
+ fail:
+   return NULL;

Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python.c	Fri Jul 11 15:42:52 2008
@@ -42,7 +42,7 @@
 #endif
 
 #include <switch.h>
-
+#include "mod_python_extra.h"
 
 PyThreadState *mainThreadState = NULL;
 
@@ -62,7 +62,7 @@
 	int argc;
 	int lead = 0;
 	char *script = NULL;
-	PyObject *module = NULL;
+	PyObject *module = NULL, *sp = NULL;
 	PyObject *function = NULL;
 	PyObject *arg = NULL;
 	PyObject *result = NULL;
@@ -139,6 +139,10 @@
 		PyTuple_SetItem(arg, 0, nada);
 	}
 
+	if (session) {
+		sp = mod_python_conjure_session(module, session, "session");
+	}
+
 	// invoke the handler 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n");
 	result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
@@ -150,21 +154,26 @@
 		PyErr_Print();
 		PyErr_Clear();
 	}
-
-	goto done_swap_out;
-
+	
   done:
 	switch_safe_free(dupargs);
 
+	if (sp) {
+		Py_XDECREF(sp);
+	}
+	
   done_swap_out:
+
+
 	// decrement ref counts 
 	Py_XDECREF(module);
 	Py_XDECREF(function);
 	Py_XDECREF(arg);
 	Py_XDECREF(result);
-
+	
 	// swap out thread state
 	if (session) {
+			//switch_core_session_rwunlock(session);
 		// record the fact that thread state is swapped in
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
@@ -189,7 +198,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No session: Threadstate mod_python.c swap-out! \n");
 		PyEval_ReleaseThread(tstate);
 	}
-
+	
 	switch_safe_free(dupargs);
 
 

Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python.i
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python.i	(original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python.i	Fri Jul 11 15:42:52 2008
@@ -26,5 +26,3 @@
 %include switch_swigable_cpp.h
 %include freeswitch_python.h
 
-
-

Added: freeswitch/trunk/src/mod/languages/mod_python/mod_python_extra.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_extra.c	Fri Jul 11 15:42:52 2008
@@ -0,0 +1,65 @@
+SWITCH_BEGIN_EXTERN_C 
+
+PyObject *mod_python_conjure_event(PyObject *module, switch_event_t *event, const char *name)
+{
+	PyObject *obj;
+	Event *result = new Event(event, 0);
+
+	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN );
+	if (module && name) {
+		PyDict_SetItem(PyModule_GetDict(module), Py_BuildValue("s", name), obj);
+		Py_DECREF(obj);
+	}
+
+	return obj;
+}
+
+
+PyObject *mod_python_conjure_stream(PyObject *module, switch_stream_handle_t *stream, const char *name)
+{
+	PyObject *obj;
+	Stream *result = new Stream(stream);
+
+	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_OWN );
+
+	if (module && name) {
+		PyDict_SetItem(PyModule_GetDict(module), Py_BuildValue("s", name), obj);
+		Py_DECREF(obj);
+	}
+
+	return obj;
+}
+
+PyObject *mod_python_conjure_session(PyObject *module, switch_core_session_t *session, const char *name)
+{
+	PyObject *obj;
+	
+	PYTHON::Session *result = new PYTHON::Session(session);
+	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_OWN);
+	
+	result->setPython(module);
+	result->setSelf(obj);
+
+	if (module && name) {
+		PyDict_SetItem(PyModule_GetDict(module), Py_BuildValue("s", name), obj);
+		Py_DECREF(obj);
+	}
+	
+	return obj;
+	
+}
+
+PyObject *mod_python_conjure_DTMF(char digit, int32_t duration)
+{
+	PyObject *obj;
+	
+	DTMF *result = new DTMF(digit, duration);
+	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_OWN);
+	
+	return obj;
+	
+}
+
+
+
+SWITCH_END_EXTERN_C

Added: freeswitch/trunk/src/mod/languages/mod_python/mod_python_extra.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_extra.h	Fri Jul 11 15:42:52 2008
@@ -0,0 +1,11 @@
+#ifndef MOD_PYTHON_EXTRA
+#define MOD_PYTHON_EXTRA
+SWITCH_BEGIN_EXTERN_C
+
+PyObject *mod_python_conjure_event(PyObject *module, switch_event_t *event, const char *name);
+PyObject *mod_python_conjure_stream(PyObject *module, switch_stream_handle_t *stream, const char *name);
+PyObject *mod_python_conjure_session(PyObject *module, switch_core_session_t *session, const char *name);
+PyObject *mod_python_conjure_DTMF(char digit, int32_t duration);
+
+SWITCH_END_EXTERN_C
+#endif

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	Fri Jul 11 15:42:52 2008
@@ -2497,15 +2497,15 @@
 
 #define SWIGTYPE_p_API swig_types[0]
 #define SWIGTYPE_p_CoreSession swig_types[1]
-#define SWIGTYPE_p_Event swig_types[2]
-#define SWIGTYPE_p_EventConsumer swig_types[3]
-#define SWIGTYPE_p_IVRMenu swig_types[4]
-#define SWIGTYPE_p_PySession swig_types[5]
-#define SWIGTYPE_p_Stream swig_types[6]
-#define SWIGTYPE_p_char swig_types[7]
-#define SWIGTYPE_p_input_callback_state swig_types[8]
-#define SWIGTYPE_p_session_flag_t swig_types[9]
-#define SWIGTYPE_p_swap_state_t swig_types[10]
+#define SWIGTYPE_p_DTMF swig_types[2]
+#define SWIGTYPE_p_Event swig_types[3]
+#define SWIGTYPE_p_EventConsumer swig_types[4]
+#define SWIGTYPE_p_IVRMenu swig_types[5]
+#define SWIGTYPE_p_PYTHON__Session swig_types[6]
+#define SWIGTYPE_p_Stream swig_types[7]
+#define SWIGTYPE_p_char swig_types[8]
+#define SWIGTYPE_p_input_callback_state swig_types[9]
+#define SWIGTYPE_p_session_flag_t swig_types[10]
 #define SWIGTYPE_p_switch_channel_state_t swig_types[11]
 #define SWIGTYPE_p_switch_channel_t swig_types[12]
 #define SWIGTYPE_p_switch_core_session_t swig_types[13]
@@ -2518,9 +2518,10 @@
 #define SWIGTYPE_p_switch_queue_t swig_types[20]
 #define SWIGTYPE_p_switch_status_t swig_types[21]
 #define SWIGTYPE_p_switch_stream_handle_t swig_types[22]
-#define SWIGTYPE_p_void swig_types[23]
-static swig_type_info *swig_types[25];
-static swig_module_info swig_module = {swig_types, 24, 0, 0, 0, 0};
+#define SWIGTYPE_p_uint32_t swig_types[23]
+#define SWIGTYPE_p_void swig_types[24]
+static swig_type_info *swig_types[26];
+static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2863,6 +2864,56 @@
 }
 
 
+SWIGINTERN int
+SWIG_AsCharArray(PyObject * obj, char *val, size_t size)
+{ 
+  char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
+  int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
+  if (SWIG_IsOK(res)) {
+    if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize;
+    if (csize <= size) {
+      if (val) {
+	if (csize) memcpy(val, cptr, csize*sizeof(char));
+	if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char));
+      }
+      if (alloc == SWIG_NEWOBJ) {
+	delete[] cptr;
+	res = SWIG_DelNewMask(res);
+      }      
+      return res;
+    }
+    if (alloc == SWIG_NEWOBJ) delete[] cptr;
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_char (PyObject * obj, char *val)
+{    
+  int res = SWIG_AsCharArray(obj, val, 1);
+  if (!SWIG_IsOK(res)) {
+    long v;
+    res = SWIG_AddCast(SWIG_AsVal_long (obj, &v));
+    if (SWIG_IsOK(res)) {
+      if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
+	if (val) *val = static_cast< char >(v);
+      } else {
+	res = SWIG_OverflowError;
+      }
+    }
+  }
+  return res;
+}
+
+
+SWIGINTERNINLINE PyObject *
+SWIG_From_char  (char c) 
+{ 
+  return SWIG_FromCharPtrAndSize(&c,1);
+}
+
+
 SWIGINTERNINLINE PyObject*
   SWIG_From_bool  (bool value)
 {
@@ -3675,6 +3726,254 @@
   return SWIG_Py_Void();
 }
 
+SWIGINTERN PyObject *_wrap_DTMF_digit_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  char val2 ;
+  int ecode2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:DTMF_digit_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_set" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  ecode2 = SWIG_AsVal_char(obj1, &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DTMF_digit_set" "', argument " "2"" of type '" "char""'");
+  } 
+  arg2 = static_cast< char >(val2);
+  if (arg1) (arg1)->digit = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DTMF_digit_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DTMF_digit_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_digit_get" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  result = (char) ((arg1)->digit);
+  resultobj = SWIG_From_char(static_cast< char >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DTMF_duration_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:DTMF_duration_set",&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_set" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  {
+    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t,  0  | 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'"); 
+    }  
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DTMF_duration_set" "', argument " "2"" of type '" "uint32_t""'");
+    } else {
+      uint32_t * temp = reinterpret_cast< uint32_t * >(argp2);
+      arg2 = *temp;
+      if (SWIG_IsNewObj(res2)) delete temp;
+    }
+  }
+  if (arg1) (arg1)->duration = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_DTMF_duration_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:DTMF_duration_get",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DTMF_duration_get" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  result =  ((arg1)->duration);
+  resultobj = SWIG_NewPointerObj((new uint32_t(static_cast< const uint32_t& >(result))), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_DTMF__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char arg1 ;
+  uint32_t arg2 ;
+  DTMF *result = 0 ;
+  char val1 ;
+  int ecode1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:new_DTMF",&obj0,&obj1)) SWIG_fail;
+  ecode1 = SWIG_AsVal_char(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+  } 
+  arg1 = static_cast< char >(val1);
+  {
+    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t,  0  | 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'"); 
+    }  
+    if (!argp2) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DTMF" "', argument " "2"" of type '" "uint32_t""'");
+    } else {
+      uint32_t * temp = reinterpret_cast< uint32_t * >(argp2);
+      arg2 = *temp;
+      if (SWIG_IsNewObj(res2)) delete temp;
+    }
+  }
+  result = (DTMF *)new DTMF(arg1,arg2);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_DTMF__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char arg1 ;
+  DTMF *result = 0 ;
+  char val1 ;
+  int ecode1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:new_DTMF",&obj0)) SWIG_fail;
+  ecode1 = SWIG_AsVal_char(obj0, &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_DTMF" "', argument " "1"" of type '" "char""'");
+  } 
+  arg1 = static_cast< char >(val1);
+  result = (DTMF *)new DTMF(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_NEW |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_DTMF(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[3];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 1) {
+    int _v;
+    {
+      int res = SWIG_AsVal_char(argv[0], NULL);
+      _v = SWIG_CheckState(res);
+    }
+    if (_v) {
+      return _wrap_new_DTMF__SWIG_1(self, args);
+    }
+  }
+  if (argc == 2) {
+    int _v;
+    {
+      int res = SWIG_AsVal_char(argv[0], NULL);
+      _v = SWIG_CheckState(res);
+    }
+    if (_v) {
+      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_uint32_t, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_DTMF__SWIG_0(self, args);
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_DTMF'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    DTMF(char,uint32_t)\n"
+    "    DTMF(char)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_delete_DTMF(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  DTMF *arg1 = (DTMF *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_DTMF",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DTMF, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DTMF" "', argument " "1"" of type '" "DTMF *""'"); 
+  }
+  arg1 = reinterpret_cast< DTMF * >(argp1);
+  delete arg1;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *DTMF_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *obj;
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
+  SWIG_TypeNewClientData(SWIGTYPE_p_DTMF, SWIG_NewClientData(obj));
+  return SWIG_Py_Void();
+}
+
 SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   Stream *result = 0 ;
@@ -8151,36 +8450,36 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_0(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *result = 0 ;
+  PYTHON::Session *result = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)":new_PySession")) SWIG_fail;
-  result = (PySession *)new PySession();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW |  0 );
+  if (!PyArg_ParseTuple(args,(char *)":new_Session")) SWIG_fail;
+  result = (PYTHON::Session *)new PYTHON::Session();
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_PySession__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 ;
-  PySession *result = 0 ;
+  PYTHON::Session *result = 0 ;
   int res1 ;
   char *buf1 = 0 ;
   int alloc1 = 0 ;
   PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:new_PySession",&obj0)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"O:new_Session",&obj0)) SWIG_fail;
   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1"" of type '" "char *""'");
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
   }
   arg1 = reinterpret_cast< char * >(buf1);
-  result = (PySession *)new PySession(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW |  0 );
+  result = (PYTHON::Session *)new PYTHON::Session(arg1);
+  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:
@@ -8189,29 +8488,29 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_Session__SWIG_2(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  PySession *result = 0 ;
+  PYTHON::Session *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:new_PySession",&obj0)) SWIG_fail;
+  if (!PyArg_ParseTuple(args,(char *)"O:new_Session",&obj0)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
   }
   arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
-  result = (PySession *)new PySession(arg1);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW |  0 );
+  result = (PYTHON::Session *)new PYTHON::Session(arg1);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_NEW |  0 ); result->setPython(self);
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_new_PySession(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_Session(PyObject *self, PyObject *args) {
   int argc;
   PyObject *argv[2];
   int ii;
@@ -8222,7 +8521,7 @@
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 0) {
-    return _wrap_new_PySession__SWIG_0(self, args);
+    return _wrap_new_Session__SWIG_0(self, args);
   }
   if (argc == 1) {
     int _v;
@@ -8230,7 +8529,7 @@
     int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_PySession__SWIG_2(self, args);
+      return _wrap_new_Session__SWIG_2(self, args);
     }
   }
   if (argc == 1) {
@@ -8238,33 +8537,33 @@
     int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
     _v = SWIG_CheckState(res);
     if (_v) {
-      return _wrap_new_PySession__SWIG_1(self, args);
+      return _wrap_new_Session__SWIG_1(self, args);
     }
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n"
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Session'.\n"
     "  Possible C/C++ prototypes are:\n"
-    "    PySession()\n"
-    "    PySession(char *)\n"
-    "    PySession(switch_core_session_t *)\n");
+    "    PYTHON::Session()\n"
+    "    PYTHON::Session(char *)\n"
+    "    PYTHON::Session(switch_core_session_t *)\n");
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_delete_PySession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_delete_Session(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:delete_PySession",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, SWIG_POINTER_DISOWN |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:delete_Session",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySession" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
   delete arg1;
   
   resultobj = SWIG_Py_Void();
@@ -8274,79 +8573,63 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_PySession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Session_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  PyObject *arg2 = (PyObject *) 0 ;
-  char *arg3 = (char *) 0 ;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  int res3 ;
-  char *buf3 = 0 ;
-  int alloc3 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:PySession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_begin_allow_threads",&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 '" "PySession_setDTMFCallback" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_begin_allow_threads" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  arg2 = obj1;
-  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
-  }
-  arg3 = reinterpret_cast< char * >(buf3);
-  (arg1)->setDTMFCallback(arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (bool)(arg1)->begin_allow_threads();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
-  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_PySession_setHangupHook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Session_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  PyObject *arg2 = (PyObject *) 0 ;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  bool result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:PySession_setHangupHook",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_end_allow_threads",&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 '" "PySession_setHangupHook" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  arg2 = obj1;
-  (arg1)->setHangupHook(arg2);
-  resultobj = SWIG_Py_Void();
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (bool)(arg1)->end_allow_threads();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_PySession_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Session_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:PySession_check_hangup_hook",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_check_hangup_hook",&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 '" "PySession_check_hangup_hook" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
   (arg1)->check_hangup_hook();
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -8355,133 +8638,510 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_PySession_hangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Session_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  char *arg2 = (char *) 0 ;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  switch_status_t result;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
+  void *argp3 ;
+  int res3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OO:PySession_hangup",&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OOO:Session_run_dtmf_callback",&obj0,&obj1,&obj2)) 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 '" "PySession_hangup" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_hangup" "', argument " "2"" of type '" "char *""'");
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
   }
-  arg2 = reinterpret_cast< char * >(buf2);
-  (arg1)->hangup(arg2);
-  resultobj = SWIG_Py_Void();
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  {
+    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
+    }  
+    if (!argp3) {
+      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
+    } else {
+      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
+      arg3 = *temp;
+      if (SWIG_IsNewObj(res3)) delete temp;
+    }
+  }
+  result = (arg1)->run_dtmf_callback(arg2,arg3);
+  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
-  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_PySession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Session_setInputCallback__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  bool result;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  PyObject *arg3 = (PyObject *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:PySession_begin_allow_threads",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OOO:Session_setInputCallback",&obj0,&obj1,&obj2)) 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 '" "PySession_begin_allow_threads" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  result = (bool)(arg1)->begin_allow_threads();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  arg3 = obj2;
+  (arg1)->setInputCallback(arg2,arg3);
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_PySession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Session_setInputCallback__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  bool result;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"O:PySession_end_allow_threads",&obj0)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setInputCallback",&obj0,&obj1)) 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 '" "PySession_end_allow_threads" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  result = (bool)(arg1)->end_allow_threads();
-  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setInputCallback(arg2);
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *_wrap_PySession_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  PySession *arg1 = (PySession *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  switch_status_t result;
+SWIGINTERN PyObject *_wrap_Session_setInputCallback(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        return _wrap_Session_setInputCallback__SWIG_1(self, args);
+      }
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        _v = (argv[2] != 0);
+        if (_v) {
+          return _wrap_Session_setInputCallback__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Session_setInputCallback'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    setInputCallback(PYTHON::Session *,PyObject *,PyObject *)\n"
+    "    setInputCallback(PYTHON::Session *,PyObject *)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_setHangupHook__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  PyObject *arg3 = (PyObject *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
-  int res2 ;
-  void *argp3 ;
-  int res3 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   
-  if (!PyArg_ParseTuple(args,(char *)"OOO:PySession_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 |  0 );
+  if (!PyArg_ParseTuple(args,(char *)"OOO:Session_setHangupHook",&obj0,&obj1,&obj2)) 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 '" "PySession_run_dtmf_callback" "', argument " "1"" of type '" "PySession *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  arg1 = reinterpret_cast< PySession * >(argp1);
-  res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'"); 
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  arg3 = obj2;
+  (arg1)->setHangupHook(arg2,arg3);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_setHangupHook__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setHangupHook",&obj0,&obj1)) 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_setHangupHook" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
   }
-  {
-    res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t,  0  | 0);
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'"); 
-    }  
-    if (!argp3) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
-    } else {
-      switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
-      arg3 = *temp;
-      if (SWIG_IsNewObj(res3)) delete temp;
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setHangupHook(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_setHangupHook(PyObject *self, PyObject *args) {
+  int argc;
+  PyObject *argv[4];
+  int ii;
+  
+  if (!PyTuple_Check(args)) SWIG_fail;
+  argc = (int)PyObject_Length(args);
+  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+    argv[ii] = PyTuple_GET_ITEM(args,ii);
+  }
+  if (argc == 2) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        return _wrap_Session_setHangupHook__SWIG_1(self, args);
+      }
     }
   }
-  result = (arg1)->run_dtmf_callback(arg2,arg3);
-  resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN |  0 );
+  if (argc == 3) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_PYTHON__Session, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      _v = (argv[1] != 0);
+      if (_v) {
+        _v = (argv[2] != 0);
+        if (_v) {
+          return _wrap_Session_setHangupHook__SWIG_0(self, args);
+        }
+      }
+    }
+  }
+  
+fail:
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Session_setHangupHook'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    setHangupHook(PYTHON::Session *,PyObject *,PyObject *)\n"
+    "    setHangupHook(PYTHON::Session *,PyObject *)\n");
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_ready",&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_ready" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (bool)(arg1)->ready();
+  resultobj = SWIG_From_bool(static_cast< bool >(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_cb_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_cb_function_set",&obj0,&obj1)) 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_cb_function_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->cb_function = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_cb_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_cb_function_get",&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_cb_function_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->cb_function);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_cb_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_cb_arg_set",&obj0,&obj1)) 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_cb_arg_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->cb_arg = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_cb_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_cb_arg_get",&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_cb_arg_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->cb_arg);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_hangup_func_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_hangup_func_set",&obj0,&obj1)) 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_hangup_func_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->hangup_func = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_hangup_func_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_hangup_func_get",&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_hangup_func_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->hangup_func);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_hangup_func_arg_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_hangup_func_arg_set",&obj0,&obj1)) 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_hangup_func_arg_set" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  if (arg1) (arg1)->hangup_func_arg = arg2;
+  
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_hangup_func_arg_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:Session_hangup_func_arg_get",&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_hangup_func_arg_get" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  result = (PyObject *) ((arg1)->hangup_func_arg);
+  resultobj = result;
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_setPython(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setPython",&obj0,&obj1)) 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_setPython" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setPython(arg2);
+  resultobj = SWIG_Py_Void();
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_Session_setSelf(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  PYTHON::Session *arg1 = (PYTHON::Session *) 0 ;
+  PyObject *arg2 = (PyObject *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OO:Session_setSelf",&obj0,&obj1)) 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_setSelf" "', argument " "1"" of type '" "PYTHON::Session *""'"); 
+  }
+  arg1 = reinterpret_cast< PYTHON::Session * >(argp1);
+  arg2 = obj1;
+  (arg1)->setSelf(arg2);
+  resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
   return NULL;
 }
 
 
-SWIGINTERN PyObject *PySession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *Session_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
   if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
+  SWIG_TypeNewClientData(SWIGTYPE_p_PYTHON__Session, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
@@ -8509,6 +9169,13 @@
 	 { (char *)"new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
 	 { (char *)"delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
 	 { (char *)"input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
+	 { (char *)"DTMF_digit_set", _wrap_DTMF_digit_set, METH_VARARGS, NULL},
+	 { (char *)"DTMF_digit_get", _wrap_DTMF_digit_get, METH_VARARGS, NULL},
+	 { (char *)"DTMF_duration_set", _wrap_DTMF_duration_set, METH_VARARGS, NULL},
+	 { (char *)"DTMF_duration_get", _wrap_DTMF_duration_get, METH_VARARGS, NULL},
+	 { (char *)"new_DTMF", _wrap_new_DTMF, METH_VARARGS, NULL},
+	 { (char *)"delete_DTMF", _wrap_delete_DTMF, METH_VARARGS, NULL},
+	 { (char *)"DTMF_swigregister", DTMF_swigregister, METH_VARARGS, NULL},
 	 { (char *)"new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
 	 { (char *)"delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
 	 { (char *)"Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
@@ -8608,36 +9275,46 @@
 	 { (char *)"bridge", _wrap_bridge, METH_VARARGS, NULL},
 	 { (char *)"hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
 	 { (char *)"dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
-	 { (char *)"new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
-	 { (char *)"delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
-	 { (char *)"PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
-	 { (char *)"PySession_setHangupHook", _wrap_PySession_setHangupHook, METH_VARARGS, NULL},
-	 { (char *)"PySession_check_hangup_hook", _wrap_PySession_check_hangup_hook, METH_VARARGS, NULL},
-	 { (char *)"PySession_hangup", _wrap_PySession_hangup, METH_VARARGS, NULL},
-	 { (char *)"PySession_begin_allow_threads", _wrap_PySession_begin_allow_threads, METH_VARARGS, NULL},
-	 { (char *)"PySession_end_allow_threads", _wrap_PySession_end_allow_threads, METH_VARARGS, NULL},
-	 { (char *)"PySession_run_dtmf_callback", _wrap_PySession_run_dtmf_callback, METH_VARARGS, NULL},
-	 { (char *)"PySession_swigregister", PySession_swigregister, METH_VARARGS, NULL},
+	 { (char *)"new_Session", _wrap_new_Session, METH_VARARGS, NULL},
+	 { (char *)"delete_Session", _wrap_delete_Session, METH_VARARGS, NULL},
+	 { (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_run_dtmf_callback", _wrap_Session_run_dtmf_callback, METH_VARARGS, NULL},
+	 { (char *)"Session_setInputCallback", _wrap_Session_setInputCallback, 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},
+	 { (char *)"Session_cb_function_get", _wrap_Session_cb_function_get, METH_VARARGS, NULL},
+	 { (char *)"Session_cb_arg_set", _wrap_Session_cb_arg_set, METH_VARARGS, NULL},
+	 { (char *)"Session_cb_arg_get", _wrap_Session_cb_arg_get, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_set", _wrap_Session_hangup_func_set, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_get", _wrap_Session_hangup_func_get, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set, METH_VARARGS, NULL},
+	 { (char *)"Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get, METH_VARARGS, NULL},
+	 { (char *)"Session_setPython", _wrap_Session_setPython, METH_VARARGS, NULL},
+	 { (char *)"Session_setSelf", _wrap_Session_setSelf, METH_VARARGS, NULL},
+	 { (char *)"Session_swigregister", Session_swigregister, METH_VARARGS, NULL},
 	 { NULL, NULL, 0, NULL }
 };
 
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
-static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
-    return (void *)((CoreSession *)  ((PySession *) x));
+static void *_p_PYTHON__SessionTo_p_CoreSession(void *x, int *newmemory) {
+    return (void *)((CoreSession *)  ((PYTHON::Session *) x));
 }
 static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_PySession = {"_p_PySession", "PySession *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_PYTHON__Session = {"_p_PYTHON__Session", "PYTHON::Session *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_swap_state_t = {"_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
@@ -8650,20 +9327,21 @@
 static swig_type_info _swigt__p_switch_queue_t = {"_p_switch_queue_t", "switch_queue_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
   &_swigt__p_API,
   &_swigt__p_CoreSession,
+  &_swigt__p_DTMF,
   &_swigt__p_Event,
   &_swigt__p_EventConsumer,
   &_swigt__p_IVRMenu,
-  &_swigt__p_PySession,
+  &_swigt__p_PYTHON__Session,
   &_swigt__p_Stream,
   &_swigt__p_char,
   &_swigt__p_input_callback_state,
   &_swigt__p_session_flag_t,
-  &_swigt__p_swap_state_t,
   &_swigt__p_switch_channel_state_t,
   &_swigt__p_switch_channel_t,
   &_swigt__p_switch_core_session_t,
@@ -8676,20 +9354,21 @@
   &_swigt__p_switch_queue_t,
   &_swigt__p_switch_status_t,
   &_swigt__p_switch_stream_handle_t,
+  &_swigt__p_uint32_t,
   &_swigt__p_void,
 };
 
 static swig_cast_info _swigc__p_API[] = {  {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CoreSession[] = {  {&_swigt__p_CoreSession, 0, 0, 0},  {&_swigt__p_PYTHON__Session, _p_PYTHON__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_DTMF[] = {  {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_Event[] = {  {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_EventConsumer[] = {  {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IVRMenu[] = {  {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PySession[] = {  {&_swigt__p_PySession, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_PYTHON__Session[] = {  {&_swigt__p_PYTHON__Session, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_Stream[] = {  {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_input_callback_state[] = {  {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_session_flag_t[] = {  {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_swap_state_t[] = {  {&_swigt__p_swap_state_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_channel_state_t[] = {  {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_channel_t[] = {  {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_core_session_t[] = {  {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
@@ -8702,20 +9381,21 @@
 static swig_cast_info _swigc__p_switch_queue_t[] = {  {&_swigt__p_switch_queue_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_status_t[] = {  {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_switch_stream_handle_t[] = {  {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_uint32_t[] = {  {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_API,
   _swigc__p_CoreSession,
+  _swigc__p_DTMF,
   _swigc__p_Event,
   _swigc__p_EventConsumer,
   _swigc__p_IVRMenu,
-  _swigc__p_PySession,
+  _swigc__p_PYTHON__Session,
   _swigc__p_Stream,
   _swigc__p_char,
   _swigc__p_input_callback_state,
   _swigc__p_session_flag_t,
-  _swigc__p_swap_state_t,
   _swigc__p_switch_channel_state_t,
   _swigc__p_switch_channel_t,
   _swigc__p_switch_core_session_t,
@@ -8728,6 +9408,7 @@
   _swigc__p_switch_queue_t,
   _swigc__p_switch_status_t,
   _swigc__p_switch_stream_handle_t,
+  _swigc__p_uint32_t,
   _swigc__p_void,
 };
 
@@ -9261,7 +9942,6 @@
   SWIG_Python_SetConstant(d, "S_HUP",SWIG_From_int(static_cast< int >(S_HUP)));
   SWIG_Python_SetConstant(d, "S_FREE",SWIG_From_int(static_cast< int >(S_FREE)));
   SWIG_Python_SetConstant(d, "S_RDLOCK",SWIG_From_int(static_cast< int >(S_RDLOCK)));
-  SWIG_Python_SetConstant(d, "S_SWAPPED_IN",SWIG_From_int(static_cast< int >(S_SWAPPED_IN)));
-  SWIG_Python_SetConstant(d, "S_SWAPPED_OUT",SWIG_From_int(static_cast< int >(S_SWAPPED_OUT)));
 }
 
+#include "mod_python_extra.c"

Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp	(original)
+++ freeswitch/trunk/src/switch_cpp.cpp	Fri Jul 11 15:42:52 2008
@@ -367,6 +367,24 @@
 	return (char *) "invalid";
 }
 
+
+SWITCH_DECLARE_CONSTRUCTOR DTMF::DTMF(char idigit, uint32_t iduration)
+{
+	digit = idigit;
+
+	if (iduration == 0) {
+		iduration == SWITCH_DEFAULT_DTMF_DURATION;
+	}
+
+	duration = iduration;
+}
+
+SWITCH_DECLARE_CONSTRUCTOR DTMF::~DTMF()
+{
+	
+}
+
+
 SWITCH_DECLARE_CONSTRUCTOR Stream::Stream()
 {
 	SWITCH_STANDARD_STREAM(mystream);
@@ -457,8 +475,6 @@
 		}
 		switch_core_session_rwunlock(session);
 	}
-
-	
 }
 
 SWITCH_DECLARE(char *) CoreSession::getXMLCDR()
@@ -602,11 +618,6 @@
 	this_check(-1);
 	sanity_check(-1);
 
-	// create and store an empty filehandle in callback args 
-	// to workaround a bug in the presumptuous process_callback_result()
-    switch_file_handle_t fh = { 0 };
-	store_file_handle(&fh);
-
 	if (!tts_name) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No TTS engine specified\n");
 		return SWITCH_STATUS_FALSE;
@@ -793,13 +804,12 @@
         }
 	}
 
-
-	store_file_handle(&local_fh);
-
     begin_allow_threads();
     status = switch_ivr_play_file(session, fhp, file, ap);
     end_allow_threads();
 
+	fhp = NULL;
+	
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 
 }
@@ -895,18 +905,22 @@
 
 SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int max_len, int silence_threshold, int silence_secs) 
 {
-	switch_file_handle_t fh = { 0 };
 	switch_status_t status;
 
 	this_check(-1);
 	sanity_check(-1);
 
-	fh.thresh = silence_threshold;
-	fh.silence_hits = silence_secs;
-	store_file_handle(&fh);
+	memset(&local_fh, 0, sizeof(local_fh));
+	fhp = &local_fh;
+	local_fh.thresh = silence_threshold;
+	local_fh.silence_hits = silence_secs;
+
 	begin_allow_threads();
-	status = switch_ivr_record_file(session, &fh, file_name, &args, max_len);
+	status = switch_ivr_record_file(session, &local_fh, file_name, &args, max_len);
 	end_allow_threads();
+
+	fhp = NULL;
+
     return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
 
 }
@@ -1012,22 +1026,6 @@
     switch_core_event_hook_add_state_change(session, hanguphook);
 }
 
-/** \brief Store a file handle in the callback args
- * 
- * In a few of the methods like playFile and streamfile,
- * an empty switch_file_handle_t is created and passed
- * to core, and stored in callback args so that the callback
- * handler can retrieve it for pausing, ff, rewinding file ptr. 
- * 
- * \param fh - a switch_file_handle_t
- */
-void CoreSession::store_file_handle(switch_file_handle_t *fh) {
-    cb_state.extra = fh;  // set a file handle so callback handler can pause
-    args.buf = &cb_state;     
-    ap = &args;
-}
-
-
 /* ---- methods not bound to CoreSession instance ---- */
 
 SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg)
@@ -1137,13 +1135,6 @@
 
 	if (fhp) {
 		fh = fhp;
-	} else {
-		if (!cb_state.extra) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because cb_state.extra is null\n");
-			return SWITCH_STATUS_FALSE;	
-		}
-		
-		fh = (switch_file_handle_t *) cb_state.extra;    
 	}
 
 



More information about the Freeswitch-svn mailing list