[Freeswitch-svn] [commit] r9022 - freeswitch/trunk/src/mod/languages/mod_perl

Freeswitch SVN anthm at freeswitch.org
Mon Jul 14 16:37:37 EDT 2008


Author: anthm
Date: Mon Jul 14 16:37:36 2008
New Revision: 9022

Modified:
   freeswitch/trunk/src/mod/languages/mod_perl/Makefile
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch.pm
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h
   freeswitch/trunk/src/mod/languages/mod_perl/hack.diff
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp

Log:
fixup mod_perl

Modified: freeswitch/trunk/src/mod/languages/mod_perl/Makefile
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/Makefile	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/Makefile	Mon Jul 14 16:37:36 2008
@@ -10,13 +10,15 @@
 include $(BASE)/build/modmake.rules
 
 
+reswig:	swigclean mod_perl_wrap.cpp
+
 swigclean: clean
 	rm -f mod_perl_wrap.* freeswitch.so freeswitch.pm
 
 mod_perl_wrap.cpp:
 	swig -static -shadow -perl5 -c++ -DMULTIPLICITY -I../../../../src/include -o mod_perl_wrap.cpp freeswitch.i
 	echo "#include \"mod_perl_extra.c\"" >> mod_perl_wrap.cpp
-	#	patch -s -p0 -i hack.diff
+	patch -s -p0 -i hack.diff
 
 
 

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	Mon Jul 14 16:37:36 2008
@@ -391,6 +391,12 @@
 *swig_cb_state_set = *freeswitchc::CoreSession_cb_state_set;
 *swig_hook_state_get = *freeswitchc::CoreSession_hook_state_get;
 *swig_hook_state_set = *freeswitchc::CoreSession_hook_state_set;
+*swig_uuid_get = *freeswitchc::CoreSession_uuid_get;
+*swig_uuid_set = *freeswitchc::CoreSession_uuid_set;
+*swig_tts_name_get = *freeswitchc::CoreSession_tts_name_get;
+*swig_tts_name_set = *freeswitchc::CoreSession_tts_name_set;
+*swig_voice_name_get = *freeswitchc::CoreSession_voice_name_get;
+*swig_voice_name_set = *freeswitchc::CoreSession_voice_name_set;
 *answer = *freeswitchc::CoreSession_answer;
 *preAnswer = *freeswitchc::CoreSession_preAnswer;
 *hangup = *freeswitchc::CoreSession_hangup;
@@ -473,9 +479,12 @@
 *end_allow_threads = *freeswitchc::Session_end_allow_threads;
 *check_hangup_hook = *freeswitchc::Session_check_hangup_hook;
 *run_dtmf_callback = *freeswitchc::Session_run_dtmf_callback;
+*setME = *freeswitchc::Session_setME;
 *setInputCallback = *freeswitchc::Session_setInputCallback;
 *setHangupHook = *freeswitchc::Session_setHangupHook;
 *ready = *freeswitchc::Session_ready;
+*swig_suuid_get = *freeswitchc::Session_suuid_get;
+*swig_suuid_set = *freeswitchc::Session_suuid_set;
 *swig_cb_function_get = *freeswitchc::Session_cb_function_get;
 *swig_cb_function_set = *freeswitchc::Session_cb_function_set;
 *swig_cb_arg_get = *freeswitchc::Session_cb_arg_get;

Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	Mon Jul 14 16:37:36 2008
@@ -16,11 +16,26 @@
 Session::Session(char *uuid):CoreSession(uuid)
 {
 	init_me();
+	suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
+	for (char *p = suuid; p && *p; p++) {
+		if (*p == '-') {
+			*p = '_';
+		}
+		if (*p == '\n') {
+			*p = '\0';
+		}
+	}
 }
 
 Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
 {
 	init_me();
+	suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
+	for (char *p = suuid; p && *p; p++) {
+		if (*p == '-') {
+			*p = '_';
+		}
+	}
 }
 static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
 Session::~Session()
@@ -54,6 +69,11 @@
 	my_perl = pi;
 }
 
+void Session::setME(SV *p)
+{
+	me = p;
+}
+
 PerlInterpreter *Session::getPERL()
 {
 	if (!my_perl) {
@@ -92,13 +112,13 @@
 		}
 
 		if (hangup_func_arg) {
-			code = switch_mprintf("%s(%s,%s)", hangup_func_str, hook_state == CS_HANGUP ? "hangup" : "transfer", hangup_func_arg);
-		} else {
-			code = switch_mprintf("%s(%s)", hangup_func_str, hook_state == CS_HANGUP ? "hangup" : "transfer");
-		}
+            code = switch_mprintf("%s($%s,\"%s\",%s)", hangup_func_str, suuid, hook_state == CS_HANGUP ? "hangup" : "transfer", hangup_func_arg);
+        } else {
+            code = switch_mprintf("%s($%s,\"%s\")", hangup_func_str, suuid, hook_state == CS_HANGUP ? "hangup" : "transfer");
+        }
 
-		Perl_eval_pv(my_perl, code, TRUE);
-		free(code);
+        Perl_eval_pv(my_perl, code, TRUE);
+        free(code);
 	}
 }
 
@@ -189,7 +209,7 @@
 			sv_setpv(this_sv, str);
 			hv_store(hash, "duration", 8, this_sv, 0);
 
-			code = switch_mprintf("$__RV = %s('dtmf', \\%%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
+			code = switch_mprintf("$__RV = %s($%s, 'dtmf', \\%%__dtmf, %s);", cb_function, suuid, switch_str_nil(cb_arg));
 			Perl_eval_pv(my_perl, code, FALSE);
 			free(code);
 
@@ -204,7 +224,7 @@
 
 			mod_perl_conjure_event(my_perl, event, "__Input_Event__");
 
-			code = switch_mprintf("$__RV = %s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
+			code = switch_mprintf("$__RV = %s($%s, 'event', $__Input_Event__, %s);", cb_function, suuid, switch_str_nil(cb_arg));
 			Perl_eval_pv(my_perl, code, TRUE);
 			free(code);
 

Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.h	Mon Jul 14 16:37:36 2008
@@ -25,6 +25,7 @@
 	PerlInterpreter *my_perl;
 	int hh;
 	int mark;
+	SV *me;
  public:
     Session();
     Session(char *uuid);
@@ -36,10 +37,11 @@
 	virtual void check_hangup_hook();
 
 	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
-	void setInputCallback(char *cbfunc, char *funcargs);
+	void setME(SV *p);
+	void setInputCallback(char *cbfunc = "on_input", char *funcargs = NULL);
 	void setHangupHook(char *func, char *arg=NULL);
 	bool ready();
-	
+	char *suuid;
 	char *cb_function;
 	char *cb_arg;
 	char *hangup_func_str;

Modified: freeswitch/trunk/src/mod/languages/mod_perl/hack.diff
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/hack.diff	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/hack.diff	Mon Jul 14 16:37:36 2008
@@ -1,29 +1,69 @@
---- mod_perl_wrap2.cpp	2008-05-11 20:28:24.000000000 -0400
-+++ mod_perl_wrap.cpp	2008-05-11 20:26:06.000000000 -0400
-@@ -6754,7 +6754,7 @@
+--- mod_perl_wrap.cpp	2008-07-14 15:52:35.000000000 -0400
++++ old.cpp	2008-07-14 15:52:01.000000000 -0400
+@@ -8852,13 +8852,17 @@
+   {
+     PERL::Session *result = 0 ;
+     int argvi = 0;
++    SV *foo;
+     dXSARGS;
+-    
++
      if ((items < 0) || (items > 0)) {
        SWIG_croak("Usage: new_Session();");
      }
--    result = (PERL::Session *)new PERL::Session(); result->setPERL(my_perl);
-+    result = (PERL::Session *)new PERL::Session();
-     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+-    result = (PERL::Session *)new PERL::Session();
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
++    result = (PERL::Session *)new PERL::Session(); 
++	foo = get_sv("foo", TRUE);
++	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	result->setME(foo);	
++	ST(argvi) = foo; argvi++ ;
      XSRETURN(argvi);
    fail:
-@@ -6781,7 +6781,7 @@
+     SWIG_croak_null();
+@@ -8874,6 +8878,7 @@
+     char *buf1 = 0 ;
+     int alloc1 = 0 ;
+     int argvi = 0;
++	SV *foo;
+     dXSARGS;
+     
+     if ((items < 1) || (items > 1)) {
+@@ -8884,9 +8889,13 @@
        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
      }
      arg1 = reinterpret_cast< char * >(buf1);
--    result = (PERL::Session *)new PERL::Session(arg1); result->setPERL(my_perl);
-+    result = (PERL::Session *)new PERL::Session(arg1);
-     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+-    result = (PERL::Session *)new PERL::Session(arg1);
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
++    result = (PERL::Session *)new PERL::Session(arg1); result->setPERL(my_perl);
++	foo = get_sv(result->suuid, TRUE);
++	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	result->setME(foo);	
++	ST(argvi) = foo; argvi++ ;
      if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
++
      XSRETURN(argvi);
-@@ -6809,7 +6809,7 @@
-       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'"); 
+   fail:
+     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+@@ -8902,6 +8911,7 @@
+     void *argp1 = 0 ;
+     int res1 = 0 ;
+     int argvi = 0;
++    SV *foo;
+     dXSARGS;
+     
+     if ((items < 1) || (items > 1)) {
+@@ -8913,8 +8923,11 @@
      }
      arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
--    result = (PERL::Session *)new PERL::Session(arg1); result->setPERL(my_perl);
-+    result = (PERL::Session *)new PERL::Session(arg1);
-     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-     
+     result = (PERL::Session *)new PERL::Session(arg1);
+-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+-    
++	foo = get_sv(result->suuid, TRUE);
++	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
++	result->setME(foo);	
++	ST(argvi) = foo; argvi++ ;
++	
      XSRETURN(argvi);
+   fail:
+     

Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c	Mon Jul 14 16:37:36 2008
@@ -139,8 +139,11 @@
 	return error;
 }
 
+#define HACK_CLEAN_CODE "foreach my $kl(keys %main::) {undef($$kl) if (defined($$kl) && ($kl =~ /^\\w+[\\w\\d_]+$/))}"
+
 static void destroy_perl(PerlInterpreter ** to_destroy)
 {
+	Perl_safe_eval(*to_destroy, HACK_CLEAN_CODE);
 	perl_destruct(*to_destroy);
 	perl_free(*to_destroy);
 	*to_destroy = NULL;
@@ -189,14 +192,20 @@
 }
 #endif
 
+
+
+
+
+
+
+
 static void perl_function(switch_core_session_t *session, char *data)
 {
 	char *uuid = switch_core_session_get_uuid(session);
 	PerlInterpreter *my_perl = clone_perl();
-	char code[1024];
+	char code[1024] = "";
 
 	perl_parse(my_perl, xs_init, 3, embedding, NULL);
-	Perl_safe_eval(my_perl, code);
 
 	switch_snprintf(code, sizeof(code),
 					"use lib '%s/perl';\n"
@@ -204,8 +213,6 @@
 					"$SWITCH_ENV{UUID} = \"%s\";\n" "$session = new freeswitch::Session(\"%s\")", SWITCH_GLOBAL_dirs.base_dir, uuid, uuid);
 
 	perl_parse_and_execute(my_perl, data, code);
-	Perl_safe_eval(my_perl, "undef $session;");
-	Perl_safe_eval(my_perl, "undef (*);");
 	destroy_perl(&my_perl);
 }
 
@@ -264,12 +271,6 @@
 		perl_parse_and_execute(my_perl, cmd, NULL);
 	}
 
-	if (uuid) {
-		switch_snprintf(code, sizeof(code), "undef $session;", uuid);
-		Perl_safe_eval(my_perl, code);
-	}
-
-	Perl_safe_eval(my_perl, "undef(*);");
 	destroy_perl(&my_perl);
 
 	switch_safe_free(cmd);
@@ -277,7 +278,7 @@
 	if (po->d) {
 		free(po);
 	}
-
+	
 	return NULL;
 }
 

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	Mon Jul 14 16:37:36 2008
@@ -5381,6 +5381,222 @@
 }
 
 
+XS(_wrap_CoreSession_uuid_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_uuid_set(self,uuid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_uuid_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->uuid) delete[] arg1->uuid;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->uuid = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->uuid = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_uuid_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_uuid_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_uuid_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *) ((arg1)->uuid);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_tts_name_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_tts_name_set(self,tts_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_tts_name_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->tts_name) delete[] arg1->tts_name;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->tts_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->tts_name = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_tts_name_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_tts_name_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_tts_name_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *) ((arg1)->tts_name);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_voice_name_set) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoreSession_voice_name_set(self,voice_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_set" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_voice_name_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->voice_name) delete[] arg1->voice_name;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->voice_name = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->voice_name = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoreSession_voice_name_get) {
+  {
+    CoreSession *arg1 = (CoreSession *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CoreSession_voice_name_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_voice_name_get" "', argument " "1"" of type '" "CoreSession *""'"); 
+    }
+    arg1 = reinterpret_cast< CoreSession * >(argp1);
+    result = (char *) ((arg1)->voice_name);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_CoreSession_answer) {
   {
     CoreSession *arg1 = (CoreSession *) 0 ;
@@ -8636,13 +8852,17 @@
   {
     PERL::Session *result = 0 ;
     int argvi = 0;
+    SV *foo;
     dXSARGS;
-    
+
     if ((items < 0) || (items > 0)) {
       SWIG_croak("Usage: new_Session();");
     }
-    result = (PERL::Session *)new PERL::Session();
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    result = (PERL::Session *)new PERL::Session(); 
+	foo = get_sv("foo", TRUE);
+	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+	result->setME(foo);	
+	ST(argvi) = foo; argvi++ ;
     XSRETURN(argvi);
   fail:
     SWIG_croak_null();
@@ -8658,6 +8878,7 @@
     char *buf1 = 0 ;
     int alloc1 = 0 ;
     int argvi = 0;
+	SV *foo;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
@@ -8668,9 +8889,13 @@
       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
     }
     arg1 = reinterpret_cast< char * >(buf1);
-    result = (PERL::Session *)new PERL::Session(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    result = (PERL::Session *)new PERL::Session(arg1); result->setPERL(my_perl);
+	foo = get_sv(result->suuid, TRUE);
+	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+	result->setME(foo);	
+	ST(argvi) = foo; argvi++ ;
     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+
     XSRETURN(argvi);
   fail:
     if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -8686,6 +8911,7 @@
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
+    SV *foo;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
@@ -8697,8 +8923,11 @@
     }
     arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
     result = (PERL::Session *)new PERL::Session(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    
+	foo = get_sv(result->suuid, TRUE);
+	SWIG_MakePtr(foo, SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+	result->setME(foo);	
+	ST(argvi) = foo; argvi++ ;
+	
     XSRETURN(argvi);
   fail:
     
@@ -8939,7 +9168,38 @@
 }
 
 
-XS(_wrap_Session_setInputCallback) {
+XS(_wrap_Session_setME) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    SV *arg2 = (SV *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_setME(self,p);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setME" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    arg2 = ST(1);
+    (arg1)->setME(arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Session_setInputCallback__SWIG_0) {
   {
     PERL::Session *arg1 = (PERL::Session *) 0 ;
     char *arg2 = (char *) 0 ;
@@ -8988,6 +9248,180 @@
 }
 
 
+XS(_wrap_Session_setInputCallback__SWIG_1) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_setInputCallback(self,cbfunc);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    (arg1)->setInputCallback(arg2);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Session_setInputCallback__SWIG_2) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_setInputCallback(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    (arg1)->setInputCallback();
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Session_setInputCallback) {
+  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;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _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;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 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:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setInputCallback__SWIG_2); return;
+    case 2:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setInputCallback__SWIG_1); return;
+    case 3:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setInputCallback__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Session_setInputCallback'");
+  XSRETURN(0);
+}
+
+
 XS(_wrap_Session_setHangupHook__SWIG_0) {
   {
     PERL::Session *arg1 = (PERL::Session *) 0 ;
@@ -9189,6 +9623,78 @@
 }
 
 
+XS(_wrap_Session_suuid_set) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Session_suuid_set(self,suuid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_suuid_set" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_suuid_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (arg1->suuid) delete[] arg1->suuid;
+    if (arg2) {
+      size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+      arg1->suuid = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+    } else {
+      arg1->suuid = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Session_suuid_get) {
+  {
+    PERL::Session *arg1 = (PERL::Session *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Session_suuid_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_suuid_get" "', argument " "1"" of type '" "PERL::Session *""'"); 
+    }
+    arg1 = reinterpret_cast< PERL::Session * >(argp1);
+    result = (char *) ((arg1)->suuid);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_Session_cb_function_set) {
   {
     PERL::Session *arg1 = (PERL::Session *) 0 ;
@@ -9720,6 +10226,12 @@
 {"freeswitchc::CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get},
 {"freeswitchc::CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set},
 {"freeswitchc::CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get},
+{"freeswitchc::CoreSession_uuid_set", _wrap_CoreSession_uuid_set},
+{"freeswitchc::CoreSession_uuid_get", _wrap_CoreSession_uuid_get},
+{"freeswitchc::CoreSession_tts_name_set", _wrap_CoreSession_tts_name_set},
+{"freeswitchc::CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get},
+{"freeswitchc::CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set},
+{"freeswitchc::CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get},
 {"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer},
 {"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer},
 {"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup},
@@ -9772,9 +10284,12 @@
 {"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
 {"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
 {"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
+{"freeswitchc::Session_setME", _wrap_Session_setME},
 {"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
 {"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
 {"freeswitchc::Session_ready", _wrap_Session_ready},
+{"freeswitchc::Session_suuid_set", _wrap_Session_suuid_set},
+{"freeswitchc::Session_suuid_get", _wrap_Session_suuid_get},
 {"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
 {"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
 {"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},



More information about the Freeswitch-svn mailing list