freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
September 2007
- 7 participants
- 84 discussions
Author: anthm
Date: Tue Sep 25 11:49:19 2007
New Revision: 5758
Modified:
freeswitch/trunk/src/switch_buffer.c
Log:
tweak
Modified: freeswitch/trunk/src/switch_buffer.c
==============================================================================
--- freeswitch/trunk/src/switch_buffer.c (original)
+++ freeswitch/trunk/src/switch_buffer.c Tue Sep 25 11:49:19 2007
@@ -157,7 +157,7 @@
{
switch_size_t len;
if ((len = switch_buffer_read(buffer, data, datalen)) == 0) {
- if (buffer->loops >= 0) {
+ if (buffer->loops > 0) {
buffer->loops--;
}
if (buffer->loops == 0) {
1
0
Author: silik0n
Date: Tue Sep 25 10:52:34 2007
New Revision: 5757
Modified:
freeswitch/trunk/docs/AUTHORS
Log:
Fix my contact infos
Modified: freeswitch/trunk/docs/AUTHORS
==============================================================================
--- freeswitch/trunk/docs/AUTHORS (original)
+++ freeswitch/trunk/docs/AUTHORS Tue Sep 25 10:52:34 2007
@@ -27,7 +27,7 @@
Stefan Knoblich - Various patches and support. Thanks.
Justin Unger - <justinunger at gmail dot com> Lots of help with patches and SIP testing. Thanks!
Paul D. Tinsley - Various patches and support. <pdt at jackhammer.org>
- Ken Rice of Asteria Solutions Group, INC <ken AT asteriasgi.com> - xmlcdr, sofia improvements, load testing.
+ Ken Rice - <krice AT suspicious.org> - xmlcdr, sofia improvements, load testing.
Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks.
Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups.
Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements.
1
0
Author: mikej
Date: Tue Sep 25 10:12:29 2007
New Revision: 5756
Modified:
freeswitch/trunk/docs/AUTHORS
Log:
AUTHORS file update
Modified: freeswitch/trunk/docs/AUTHORS
==============================================================================
--- freeswitch/trunk/docs/AUTHORS (original)
+++ freeswitch/trunk/docs/AUTHORS Tue Sep 25 10:12:29 2007
@@ -33,6 +33,7 @@
Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements.
Matt Klein <mklein(a)nmedia.net>
Jonas Gauffin <jonas at gauffin dot org> - Bugfixes and additions in mod_spidermonkey_odbc
+ Damjan Jovanovic <moctodliamgtavojtodnajmad backwards> - mod_java
A big THANK YOU goes to:
1
0
25 Sep '07
Author: mikej
Date: Tue Sep 25 09:21:17 2007
New Revision: 5755
Added:
freeswitch/trunk/build/config/ax_check_java.m4
freeswitch/trunk/conf/java.conf.xml
freeswitch/trunk/src/mod/languages/mod_java/Makefile.in
freeswitch/trunk/src/mod/languages/mod_java/freeswitch_java.cpp
freeswitch/trunk/src/mod/languages/mod_java/freeswitch_java.h
freeswitch/trunk/src/mod/languages/mod_java/mod_java.c
freeswitch/trunk/src/mod/languages/mod_java/mod_java.i
freeswitch/trunk/src/mod/languages/mod_java/src/
freeswitch/trunk/src/mod/languages/mod_java/src/org/
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/DTMFCallback.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/Event.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/FreeswitchScript.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/HangupHook.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/Launcher.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/JavaSession.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_JavaVM.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_state_t.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_t.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_core_session_t.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_args_t.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_type_t.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_status_t.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_void.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/input_callback_state_t.java
freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/session_flag_t.java
freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
Modified:
freeswitch/trunk/acinclude.m4
freeswitch/trunk/build/modules.conf.in
freeswitch/trunk/conf/freeswitch.xml
freeswitch/trunk/conf/modules.conf.xml
freeswitch/trunk/configure.in
Log:
initial import of mod_java from Damjan Jovanovic
Modified: freeswitch/trunk/acinclude.m4
==============================================================================
--- freeswitch/trunk/acinclude.m4 (original)
+++ freeswitch/trunk/acinclude.m4 Tue Sep 25 09:21:17 2007
@@ -5,5 +5,6 @@
m4_include([build/config/ac_gcc_archflag.m4])
m4_include([build/config/ac_gcc_x86_cpuid.m4])
m4_include([build/config/ax_lib_mysql.m4])
+m4_include([build/config/ax_check_java.m4])
m4_include([libs/apr/build/apr_common.m4])
m4_include([build/config/libcurl.m4])
Added: freeswitch/trunk/build/config/ax_check_java.m4
==============================================================================
--- (empty file)
+++ freeswitch/trunk/build/config/ax_check_java.m4 Tue Sep 25 09:21:17 2007
@@ -0,0 +1,153 @@
+
+dnl Usage:
+dnl AX_CHECK_JAVA
+dnl Test for java, and defines
+dnl - JAVA_CFLAGS (compiler flags)
+dnl - LIB_JAVA (linker flags, stripping and path)
+dnl prerequisites:
+
+AC_DEFUN([AX_CHECK_JAVA],
+[
+AC_ARG_WITH([java],
+ AC_HELP_STRING([ --with-java=PFX], [prefix where 'java' is installed.]),
+ [with_java_prefix=$withval],
+ [with_java_prefix=${JAVA_INSTALL_PATH:-/usr/java/j2sdk1.4.1_01}])
+have_java='no'
+LIB_JAVA=''
+JAVA_FLAGS=''
+JAVA_HOME=''
+if test "x$with_java" != 'xno'
+then
+ AC_MSG_CHECKING([for JAVA installation at ${with_java}])
+ AC_MSG_RESULT()
+
+dnl these two lines should let u find most java installations
+ java_dirs="/usr /usr/local /usr/lib/j2sdk1.4-sun /usr/lib/jvm/java /System/Library/Frameworks/JavaVM.framework/Versions/Current /opt /mingw"
+ java_inc_dirs="include include/libgcj Headers"
+
+ if test "x$with_java" != 'x'
+ then
+ if test -d "$with_java"
+ then
+ JAVA_HOME="$with_java"
+ for j in $java_inc_dirs
+ do
+ echo "configure: __oline__: checking $JAVA_HOME/$j" >&AC_FD_CC
+ if test -r "$JAVA_HOME/$j/jni.h"; then
+ echo "taking that" >&AC_FD_CC
+ java_inc_dir="$j"
+ break 2
+ fi
+ done
+ else
+ AC_MSG_WARN([Sorry, $with_java does not exist, checking usual places])
+ with_java=''
+ fi
+ fi
+
+dnl now find the java dirs
+
+ if test "x$JAVA_HOME" = 'x'
+ then
+ for i in $java_dirs;
+ do
+ for j in $java_inc_dirs
+ do
+ echo "configure: __oline__: checking $i/$j" >&AC_FD_CC
+ if test -r "$i/$j/jni.h"; then
+ echo "taking that" >&AC_FD_CC
+ JAVA_HOME="$i"
+ java_inc_dir="$j"
+ break
+ fi
+ done
+ done
+ if test "x$JAVA_HOME" != 'x'
+ then
+ AC_MSG_NOTICE([java home set to $JAVA_HOME])
+ else
+ AC_MSG_NOTICE([cannot find the java directory, assuming it is specified in CFLAGS])
+ fi
+ fi
+
+
+
+ failed=0;
+ passed=0;
+ JAVA_OLD_CPPFLAGS=$CPPFLAGS
+ case "${host_os}" in
+ linux*)
+ java_extra_inc=linux
+ ;;
+ darwin*)
+ java_extra_inc=darwin
+ ;;
+ *mingw32*)
+ java_extra_inc=win32
+ ;;
+ *cygwin*)
+ java_extra_inc=win32
+ ;;
+ esac
+dnl Check if extra inc is required
+ CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/$java_inc_dir"
+ AC_LANG_SAVE
+ AC_LANG_C
+ AC_COMPILE_IFELSE(
+ AC_LANG_SOURCE(
+ [[#include <jni.h>]]
+ ),
+ passed=`expr $passed + 1`,failed=`expr $failed + 1`
+ )
+ AC_LANG_RESTORE
+ CPPFLAGS="$JAVA_OLD_CPPFLAGS"
+ JAVA_FLAGS="-I$JAVA_HOME/$java_inc_dir -DHasJava"
+
+ if test $failed -gt 0
+ then
+ echo "configure: __oline__: checking if extra_inc required" >&AC_FD_CC
+ failed=0;
+ CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/$java_inc_dir -I$JAVA_HOME/$java_inc_dir/$java_extra_inc"
+ AC_LANG_SAVE
+ AC_LANG_C
+ AC_COMPILE_IFELSE(
+ AC_LANG_SOURCE(
+ [[#include <jni.h>]]
+ ),
+ passed=`expr $passed + 1`,failed=`expr $failed + 1`
+ )
+ AC_LANG_RESTORE
+ CPPFLAGS="$JAVA_OLD_CPPFLAGS"
+ JAVA_FLAGS="-I$JAVA_HOME/$java_inc_dir -I$JAVA_HOME/$java_inc_dir/$java_extra_inc -DHasJava"
+ fi
+ AC_MSG_CHECKING(if JAVA package is complete)
+ if test $passed -gt 0
+ then
+ if test $failed -gt 0
+ then
+ AC_MSG_RESULT(no -- some components failed test)
+ have_java='no (failed tests)'
+ JAVA_FLAGS=
+ else
+ if test "x$JAVA_HOME" = 'x'
+ then
+ JAVA_FLAGS=
+ else
+ LIB_JAVA="-L$JAVA_HOME/lib"
+ fi
+ AC_DEFINE(HasJava,1,Define if you have Java)
+ AC_MSG_RESULT(yes)
+ have_java='yes'
+ fi
+ else
+ JAVA_FLAGS=
+ AC_MSG_RESULT(no)
+ fi
+fi
+AM_CONDITIONAL(HasJava, test "x$have_java" = 'xyes')
+AC_SUBST(LIB_JAVA)
+AC_SUBST(JAVA_FLAGS)
+AC_SUBST(JAVA_HOME)
+])
+
+
Modified: freeswitch/trunk/build/modules.conf.in
==============================================================================
--- freeswitch/trunk/build/modules.conf.in (original)
+++ freeswitch/trunk/build/modules.conf.in Tue Sep 25 09:21:17 2007
@@ -41,6 +41,7 @@
formats/mod_sndfile
#formats/mod_shout
#formats/mod_local_stream
+#languages/mod_java
#languages/mod_perl
#languages/mod_python
#languages/mod_spidermonkey
Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml (original)
+++ freeswitch/trunk/conf/freeswitch.xml Tue Sep 25 09:21:17 2007
@@ -117,6 +117,7 @@
<!-- Languages -->
<!--#include "spidermonkey.conf.xml"-->
<!-- none for mod_perl -->
+ <!--#include "java.conf.xml"-->
<!-- ASR /TTS -->
<!-- none for mod_cepstral -->
Added: freeswitch/trunk/conf/java.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/java.conf.xml Tue Sep 25 09:21:17 2007
@@ -0,0 +1,11 @@
+<configuration name="java.conf" description="Java Plug-Ins">
+ <!-- Path to the Java 1.6 virtual machine to use -->
+ <javavm path="/usr/java/jdk1.6.0/jre/lib/i386/client/libjvm.so"/>
+ <!-- Options to pass to Java -->
+ <options>
+ <!-- Your class path (make sure freeswitch.jar is on it) -->
+ <option value="-Djava.class.path=/usr/local/freeswitch/scripts/freeswitch.jar"/>
+ <!-- Enable remote debugging -->
+ <option value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8000"/>
+ </options>
+</configuration>
Modified: freeswitch/trunk/conf/modules.conf.xml
==============================================================================
--- freeswitch/trunk/conf/modules.conf.xml (original)
+++ freeswitch/trunk/conf/modules.conf.xml Tue Sep 25 09:21:17 2007
@@ -63,6 +63,7 @@
<!-- <load module="mod_spidermonkey"/> -->
<!-- <load module="mod_perl"/> -->
<!-- <load module="mod_python"/> -->
+ <!-- <load module="mod_java"/> -->
<!-- ASR /TTS -->
<!-- <load module="mod_cepstral"/> -->
Modified: freeswitch/trunk/configure.in
==============================================================================
--- freeswitch/trunk/configure.in (original)
+++ freeswitch/trunk/configure.in Tue Sep 25 09:21:17 2007
@@ -337,6 +337,7 @@
#AX_LIB_MYSQL([MINIMUM-VERSION])
AX_LIB_MYSQL
+AX_CHECK_JAVA
AM_CONDITIONAL([ADD_ODBC],[test "x$enable_core_odbc_support" != "xno"])
AM_CONDITIONAL([ADD_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
@@ -348,6 +349,7 @@
src/mod/event_handlers/mod_cdr/Makefile
src/mod/endpoints/mod_sofia/Makefile
src/mod/event_handlers/mod_radius_cdr/Makefile
+ src/mod/languages/mod_java/Makefile
src/include/switch_am_config.h
build/getlib.sh
build/modmake.rules])
Added: freeswitch/trunk/src/mod/languages/mod_java/Makefile.in
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/Makefile.in Tue Sep 25 09:21:17 2007
@@ -0,0 +1,31 @@
+# define these targets in your makefile if you wish
+# local_all local_depend local_clean depend_install local_install local_distclean local_extraclean:
+
+# and define these variables to impact your build
+
+JAVA_FLAGS=@JAVA_FLAGS@
+JAVA_HOME=@JAVA_HOME@
+# Without -fno-strict-aliasing, g++ generates invalid code for Java_org_freeswitch_freeswitchJNI_SWIGJavaSessionUpcast, which segfaults
+LOCAL_CFLAGS=$(JAVA_FLAGS) -fno-strict-aliasing
+LOCAL_OBJS=freeswitch_java.o switch_swig_wrap.o
+CLASSES=src/org/freeswitch/Launcher.java \
+ src/org/freeswitch/HangupHook.java \
+ src/org/freeswitch/DTMFCallback.java \
+ src/org/freeswitch/FreeswitchScript.java \
+ src/org/freeswitch/Event.java \
+ src/org/freeswitch/swig/*
+include ../../../../build/modmake.rules
+
+
+local_depend:
+ mkdir -p classes
+ $(JAVA_HOME)/bin/javac -sourcepath src -d classes $(CLASSES)
+ $(JAVA_HOME)/bin/jar cf freeswitch.jar -C classes org
+
+reswig:
+ rm -f switch_swig_wrap.cpp
+ swig -java -c++ -I../../../include -package org.freeswitch.swig -outdir src/org/freeswitch/swig -o switch_swig_wrap.cpp mod_java.i
+
+local_install:
+ cp freeswitch.jar $(PREFIX)/scripts
+
Added: freeswitch/trunk/src/mod/languages/mod_java/freeswitch_java.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/freeswitch_java.cpp Tue Sep 25 09:21:17 2007
@@ -0,0 +1,330 @@
+#include "freeswitch_java.h"
+
+JavaSession::JavaSession() : CoreSession()
+{
+}
+
+JavaSession::JavaSession(char *uuid) : CoreSession(uuid)
+{
+}
+
+JavaSession::JavaSession(switch_core_session_t *session) : CoreSession(session)
+{
+}
+
+JavaSession::~JavaSession()
+{
+ JNIEnv *env;
+ jint res;
+
+ res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
+ if (res == JNI_OK)
+ {
+ if (cb_state.function)
+ {
+ env->DeleteGlobalRef((jobject)cb_state.function);
+ cb_state.function = NULL;
+ if (cb_state.funcargs)
+ {
+ env->DeleteGlobalRef((jobject)cb_state.funcargs);
+ cb_state.funcargs = NULL;
+ }
+ }
+ if (on_hangup)
+ env->DeleteGlobalRef((jobject)on_hangup);
+ }
+ else
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error getting JNIEnv, memory leaked!\n");
+}
+
+bool JavaSession::begin_allow_threads()
+{
+ // Java uses kernel-threads
+ return true;
+}
+
+bool JavaSession::end_allow_threads()
+{
+ // Java uses kernel-threads
+ return true;
+}
+
+void JavaSession::setDTMFCallback(jobject dtmfCallback, char *funcargs)
+{
+ JNIEnv *env;
+ jobject globalDTMFCallback = NULL;
+ jstring args = NULL;
+ jobject globalArgs = NULL;
+ jint res;
+
+ res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
+ if (res != JNI_OK)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error getting JNIEnv!\n");
+ return;
+ }
+
+ globalDTMFCallback = env->NewGlobalRef(dtmfCallback);
+ if (globalDTMFCallback == NULL)
+ goto fail;
+
+ args = env->NewStringUTF(funcargs);
+ if (args == NULL)
+ goto fail;
+ globalArgs = env->NewGlobalRef(args);
+ env->DeleteLocalRef(args);
+ if (globalArgs == NULL)
+ goto fail;
+
+ // Free previous callback
+ if (cb_state.function != NULL)
+ {
+ env->DeleteGlobalRef((jobject)cb_state.function);
+ cb_state.function = NULL;
+ if (cb_state.funcargs != NULL)
+ {
+ env->DeleteGlobalRef((jobject)cb_state.funcargs);
+ cb_state.funcargs = NULL;
+ }
+ }
+
+ CoreSession::setDTMFCallback(globalDTMFCallback, (char*) globalArgs);
+ return;
+
+fail:
+ if (globalDTMFCallback)
+ env->DeleteGlobalRef(globalDTMFCallback);
+ if (globalArgs)
+ env->DeleteGlobalRef(globalArgs);
+}
+
+void JavaSession::setHangupHook(jobject hangupHook)
+{
+ JNIEnv *env;
+ jobject globalHangupHook;
+ jint res;
+
+ res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
+ if (res != JNI_OK)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error getting JNIEnv!\n");
+ return;
+ }
+
+ globalHangupHook = env->NewGlobalRef(hangupHook);
+ if (globalHangupHook == NULL)
+ return;
+
+ // Free previous hook
+ if (on_hangup != NULL)
+ {
+ env->DeleteGlobalRef((jobject)on_hangup);
+ on_hangup = NULL;
+ }
+
+ CoreSession::setHangupHook(globalHangupHook);
+}
+
+void JavaSession::check_hangup_hook()
+{
+ JNIEnv *env;
+ jint res;
+ bool needDetach = false;
+
+ if (!session)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
+ return;
+ }
+
+ if (on_hangup == NULL)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "on_hangup is null\n");
+ return;
+ }
+
+ res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
+ if (res == JNI_EDETACHED)
+ {
+ res = javaVM->AttachCurrentThread((void**)&env, NULL);
+ if (res == JNI_OK)
+ needDetach = true;
+ }
+ if (res == JNI_OK)
+ {
+ jclass klass = env->GetObjectClass((jobject)on_hangup);
+ if (klass != NULL)
+ {
+ jmethodID onHangup = env->GetMethodID(klass, "onHangup", "()V");
+ if (onHangup != NULL)
+ env->CallVoidMethod((jobject)on_hangup, onHangup);
+
+ env->DeleteLocalRef(klass);
+ }
+ if (needDetach)
+ javaVM->DetachCurrentThread();
+ }
+ else
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+ "attaching thread to JVM failed, error %d\n", res);
+}
+
+switch_status_t JavaSession::run_dtmf_callback(void *input, switch_input_type_t itype)
+{
+ JNIEnv *env;
+ jclass klass = NULL;
+ jmethodID onDTMF;
+ jstring digits = NULL;
+ jint res;
+ jstring callbackResult = NULL;
+ switch_status_t status;
+
+ if (cb_state.function == NULL)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ res = javaVM->GetEnv((void**)&env, JNI_VERSION_1_6);
+ if (res != JNI_OK)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error getting JNIEnv!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ klass = env->GetObjectClass((jobject)cb_state.function);
+ if (klass == NULL)
+ return SWITCH_STATUS_FALSE;
+
+ onDTMF = env->GetMethodID(klass, "onDTMF", "(Ljava/lang/Object;ILjava/lang/String;)Ljava/lang/String;");
+ if (onDTMF == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto done;
+ }
+
+ if (itype == SWITCH_INPUT_TYPE_DTMF)
+ {
+ digits = env->NewStringUTF((char*)input);
+ if (digits == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto done;
+ }
+ callbackResult = (jstring) env->CallObjectMethod((jobject)cb_state.function, onDTMF, digits, itype, (jstring)cb_state.funcargs);
+ const char *callbackResultUTF = env->GetStringUTFChars(callbackResult, NULL);
+ if (callbackResultUTF)
+ {
+ status = process_callback_result((char*) callbackResultUTF, &cb_state, session);
+ env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
+ }
+ else
+ status = SWITCH_STATUS_FALSE;
+ }
+ else if (itype == SWITCH_INPUT_TYPE_EVENT)
+ {
+ // :-)
+ switch_event_t *switch_event = (switch_event_t*) input;
+ switch_event_header *header;
+ jclass Event = NULL;
+ jobject event = NULL;
+ jstring body = NULL;
+ jmethodID constructor, setBody, addHeader;
+ const char *callbackResultUTF;
+
+ env->FindClass("org/freeswitch/Event");
+ if (Event == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto cleanup;
+ }
+ constructor = env->GetMethodID(Event, "<init>", "()V");
+ if (constructor == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto cleanup;
+ }
+ event = env->CallStaticObjectMethod(Event, constructor);
+ if (event == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto cleanup;
+ }
+
+ setBody = env->GetMethodID(Event, "setBody", "(Ljava/lang/String;)V");
+ if (setBody == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto cleanup;
+ }
+ body = env->NewStringUTF(switch_event->body);
+ if (body == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto cleanup;
+ }
+ env->CallVoidMethod(event, setBody, body);
+ if (env->ExceptionOccurred())
+ goto cleanup;
+
+ addHeader = env->GetMethodID(Event, "addHeader", "(Ljava/lang/String;Ljava/lang/String;)V");
+ if (addHeader == NULL)
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto cleanup;
+ }
+ for (header = switch_event->headers; header; header = header->next)
+ {
+ jstring name = NULL;
+ jstring value = NULL;
+
+ name = env->NewStringUTF(header->name);
+ if (name == NULL)
+ goto endloop;
+ value = env->NewStringUTF(header->value);
+ if (value == NULL)
+ goto endloop;
+
+ env->CallVoidMethod(event, addHeader, name, value);
+
+ endloop:
+ if (name != NULL)
+ env->DeleteLocalRef(name);
+ if (value != NULL)
+ env->DeleteLocalRef(value);
+ if (env->ExceptionOccurred())
+ {
+ status = SWITCH_STATUS_FALSE;
+ goto cleanup;
+ }
+ }
+
+ callbackResult = (jstring) env->CallObjectMethod((jobject)cb_state.function, onDTMF, event, itype, (jstring)cb_state.funcargs);
+ callbackResultUTF = env->GetStringUTFChars(callbackResult, NULL);
+ if (callbackResultUTF)
+ {
+ status = process_callback_result((char*) callbackResultUTF, &cb_state, session);
+ env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
+ }
+ else
+ status = SWITCH_STATUS_FALSE;
+
+ cleanup:
+ if (Event != NULL)
+ env->DeleteLocalRef(Event);
+ if (event != NULL)
+ env->DeleteLocalRef(event);
+ if (body != NULL)
+ env->DeleteLocalRef(body);
+ }
+
+done:
+ if (klass != NULL)
+ env->DeleteLocalRef(klass);
+ if (digits != NULL)
+ env->DeleteLocalRef(digits);
+ if (callbackResult != NULL)
+ env->DeleteLocalRef(callbackResult);
+ return status;
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/freeswitch_java.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/freeswitch_java.h Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+#ifndef FREESWITCH_JAVA_H
+#define FREESWITCH_JAVA_H
+
+#include <switch_cpp.h>
+#include <jni.h>
+
+extern JavaVM *javaVM;
+
+class JavaSession : public CoreSession
+{
+ public:
+ JavaSession();
+ JavaSession(char *uuid);
+ JavaSession(switch_core_session_t *session);
+ virtual ~JavaSession();
+
+ virtual bool begin_allow_threads();
+ virtual bool end_allow_threads();
+ void setDTMFCallback(jobject dtmfCallback, char *funcargs);
+ void setHangupHook(jobject hangupHook);
+ virtual void check_hangup_hook();
+ virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+};
+
+#endif
+
Added: freeswitch/trunk/src/mod/languages/mod_java/mod_java.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/mod_java.c Tue Sep 25 09:21:17 2007
@@ -0,0 +1,300 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2007, Damjan Jovanovic <d a m j a n d o t j o v a t g m a i l d o t c o m>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Damjan Jovanovic <d a m j a n d o t j o v a t g m a i l d o t c o m>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Damjan Jovanovic <d a m j a n d o t j o v a t g m a i l d o t c o m>
+ *
+ *
+ * mod_java.c -- Java Module
+ *
+ */
+
+#include <switch.h>
+#include <jni.h>
+
+
+static switch_memory_pool_t *memoryPool = NULL;
+static switch_dso_handle_t *javaVMHandle = NULL;
+
+JavaVM *javaVM = NULL;
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_java_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_java_shutdown);
+SWITCH_MODULE_DEFINITION(mod_java, mod_java_load, mod_java_shutdown, NULL);
+
+
+static void launch_java(switch_core_session_t *session, char *data, JNIEnv *env)
+{
+ jclass Launcher = NULL;
+ jmethodID launch = NULL;
+ jstring uuid = NULL;
+ jstring args = NULL;
+
+ Launcher = (*env)->FindClass(env, "org/freeswitch/Launcher");
+ if (Launcher == NULL)
+ {
+ (*env)->ExceptionDescribe(env);
+ goto done;
+ }
+
+ launch = (*env)->GetStaticMethodID(env, Launcher, "launch", "(Ljava/lang/String;Ljava/lang/String;)V");
+ if (launch == NULL)
+ {
+ (*env)->ExceptionDescribe(env);
+ goto done;
+ }
+
+ uuid = (*env)->NewStringUTF(env, switch_core_session_get_uuid(session));
+ if (uuid == NULL)
+ {
+ (*env)->ExceptionDescribe(env);
+ goto done;
+ }
+
+ args = (*env)->NewStringUTF(env, data);
+ if (args == NULL)
+ {
+ (*env)->ExceptionDescribe(env);
+ goto done;
+ }
+
+ (*env)->CallStaticVoidMethod(env, Launcher, launch, uuid, args);
+ if ((*env)->ExceptionOccurred(env))
+ (*env)->ExceptionDescribe(env);
+
+done:
+ if (args != NULL)
+ (*env)->DeleteLocalRef(env, args);
+ if (uuid != NULL)
+ (*env)->DeleteLocalRef(env, uuid);
+ if (Launcher != NULL)
+ (*env)->DeleteLocalRef(env, Launcher);
+}
+
+static void java_function(switch_core_session_t *session, char *data)
+{
+ JNIEnv *env;
+ jint res;
+
+ if (javaVM == NULL)
+ return;
+
+ res = (*javaVM)->AttachCurrentThread(javaVM, (void*) &env, NULL);
+ if (res == JNI_OK)
+ {
+ launch_java(session, data, env);
+ (*javaVM)->DetachCurrentThread(javaVM);
+ }
+ else
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error attaching thread to Java VM!\n");
+}
+
+
+static switch_application_interface_t java_application_interface = {
+ /*.interface_name */ "java",
+ /*.application_function */ java_function,
+ NULL, NULL, NULL,
+ /* flags */ SAF_NONE,
+ /* should we support no media mode here? If so, we need to detect the mode, and either disable the media functions or indicate media if/when we need */
+ /*.next */ NULL
+};
+
+static switch_loadable_module_interface_t java_module_interface = {
+ /*.module_name */ modname,
+ /*.endpoint_interface */ NULL,
+ /*.timer_interface */ NULL,
+ /*.dialplan_interface */ NULL,
+ /*.codec_interface */ NULL,
+ /*.application_interface */ &java_application_interface,
+ /*.api_interface */ NULL,
+ /*.file_interface */ NULL,
+ /*.speech_interface */ NULL,
+ /*.directory_interface */ NULL
+};
+
+static switch_status_t load_config(JavaVMOption **javaOptions, int *optionCount)
+{
+ switch_xml_t cfg, xml;
+ switch_status_t status;
+
+ xml = switch_xml_open_cfg("java.conf", &cfg, NULL);
+ if (xml)
+ {
+ switch_xml_t javavm;
+ switch_xml_t options;
+
+ javavm = switch_xml_child(cfg, "javavm");
+ if (javavm != NULL)
+ {
+ const char *path = switch_xml_attr_soft(javavm, "path");
+ if (path != NULL)
+ {
+ status = switch_dso_load(&javaVMHandle, path, memoryPool);
+ if (status != SWITCH_STATUS_SUCCESS)
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading %s\n", path);
+ }
+ else
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM path specified in java.conf.xml\n");
+ status = SWITCH_STATUS_FALSE;
+ }
+ }
+ else
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM specified in java.conf.xml\n");
+ status = SWITCH_STATUS_FALSE;
+ goto close;
+ }
+
+ options = switch_xml_child(cfg, "options");
+ if (options != NULL)
+ {
+ switch_xml_t option;
+ int i = 0;
+ *optionCount = 0;
+ for (option = switch_xml_child(options, "option"); option; option = option->next)
+ {
+ const char *value = switch_xml_attr_soft(option, "value");
+ if (value != NULL)
+ ++*optionCount;
+ }
+ *optionCount += 1;
+ *javaOptions = switch_core_alloc(memoryPool, (switch_size_t)(*optionCount * sizeof(JavaVMOption)));
+ if (*javaOptions == NULL)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
+ status = SWITCH_STATUS_FALSE;
+ goto close;
+ }
+ for (option = switch_xml_child(options, "option"); option; option = option->next)
+ {
+ const char *value = switch_xml_attr_soft(option, "value");
+ if (value == NULL)
+ continue;
+ (*javaOptions)[i].optionString = switch_core_strdup(memoryPool, value);
+ if ((*javaOptions)[i].optionString == NULL)
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
+ status = SWITCH_STATUS_FALSE;
+ goto close;
+ }
+ ++i;
+ }
+ (*javaOptions)[i].optionString = "-Djava.library.path=" SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "mod";
+ }
+
+ close:
+ switch_xml_free(xml);
+ }
+ else
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening java.conf.xml\n");
+ status = SWITCH_STATUS_FALSE;
+ }
+ return status;
+}
+
+static switch_status_t create_java_vm(JavaVMOption *options, int optionCount)
+{
+ jint (JNICALL *pJNI_CreateJavaVM)(JavaVM**,void**,void*);
+ switch_status_t status;
+
+ status = switch_dso_sym((void*) &pJNI_CreateJavaVM, javaVMHandle, "JNI_CreateJavaVM");
+ if (status == SWITCH_STATUS_SUCCESS)
+ {
+ JNIEnv *env;
+ JavaVMInitArgs initArgs;
+ jint res;
+
+ memset(&initArgs, 0, sizeof(initArgs));
+ initArgs.version = JNI_VERSION_1_6;
+ initArgs.nOptions = optionCount;
+ initArgs.options = options;
+ initArgs.ignoreUnrecognized = JNI_TRUE;
+
+ res = pJNI_CreateJavaVM(&javaVM, (void*) &env, &initArgs);
+ if (res == JNI_OK)
+ {
+ (*javaVM)->DetachCurrentThread(javaVM);
+ status = SWITCH_STATUS_SUCCESS;
+ }
+ else
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating Java VM!\n");
+ status = SWITCH_STATUS_FALSE;
+ }
+ }
+ else
+ {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Specified Java VM doesn't have JNI_CreateJavaVM\n");
+ status = SWITCH_STATUS_FALSE;
+ }
+ return status;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_java_load)
+{
+ switch_status_t status;
+ JavaVMOption *options = NULL;
+ int optionCount = 0;
+
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = &java_module_interface;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Java Framework Loading...\n");
+
+ if (javaVM != NULL)
+ return SWITCH_STATUS_SUCCESS;
+
+ status = switch_core_new_memory_pool(&memoryPool);
+ if (status == SWITCH_STATUS_SUCCESS)
+ {
+ status = load_config(&options, &optionCount);
+ if (status == SWITCH_STATUS_SUCCESS)
+ {
+ status = create_java_vm(options, optionCount);
+ if (status == SWITCH_STATUS_SUCCESS)
+ return SWITCH_STATUS_SUCCESS;
+ switch_dso_unload(javaVMHandle);
+ }
+ switch_core_destroy_memory_pool(&memoryPool);
+ }
+ else
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating memory pool\n");
+ return status;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_java_shutdown)
+{
+ if (javaVM == NULL)
+ return SWITCH_STATUS_FALSE;
+
+ (*javaVM)->DestroyJavaVM(javaVM);
+ javaVM = NULL;
+ switch_dso_unload(javaVMHandle);
+ switch_core_destroy_memory_pool(&memoryPool);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
Added: freeswitch/trunk/src/mod/languages/mod_java/mod_java.i
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/mod_java.i Tue Sep 25 09:21:17 2007
@@ -0,0 +1,57 @@
+%module freeswitch
+
+/** insert the following includes into generated code so it compiles */
+%{
+#include "switch_cpp.h"
+#include "freeswitch_java.h"
+%}
+
+%ignore SwitchToMempool;
+
+
+
+// I thought we were using swig because it's easier than the alternatives :-)
+
+%typemap(jtype) jobject dtmfCallback "org.freeswitch.DTMFCallback"
+%typemap(jstype) jobject dtmfCallback "org.freeswitch.DTMFCallback"
+
+%typemap(jtype) jobject hangupHook "org.freeswitch.HangupHook"
+%typemap(jstype) jobject hangupHook "org.freeswitch.HangupHook"
+
+// Taken from various.i definitions for BYTE
+%typemap(jni) char *dtmf_buf "jbyteArray"
+%typemap(jtype) char *dtmf_buf "byte[]"
+%typemap(jstype) char *dtmf_buf "byte[]"
+%typemap(in) char *dtmf_buf
+{
+ $1 = (char*) JCALL2(GetByteArrayElements, jenv, $input, 0);
+ if (!$1) return 0;
+}
+%typemap(argout) char *dtmf_buf
+{
+ JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte*) $1, 0);
+}
+%typemap(javain) char *dtmf_buf "$javainput"
+%typemap(freearg) char *dtmf_buf ""
+
+%typemap(jni) char *terminator "jbyteArray"
+%typemap(jtype) char *terminator "byte[]"
+%typemap(jstype) char *terminator "byte[]"
+%typemap(in) char *terminator
+{
+ $1 = (char*) JCALL2(GetByteArrayElements, jenv, $input, 0);
+ if (!$1) return 0;
+}
+%typemap(argout) char *terminator
+{
+ JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte*) $1, 0);
+}
+%typemap(javain) char *terminator "$javainput"
+%typemap(freearg) char *terminator ""
+
+
+
+%include "enums.swg"
+%include switch_cpp.h
+%include freeswitch_java.h
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/DTMFCallback.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/DTMFCallback.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,7 @@
+package org.freeswitch;
+
+public interface DTMFCallback
+{
+ String onDTMF(Object input, int inputType, String args);
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/Event.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/Event.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,30 @@
+package org.freeswitch;
+
+import java.util.*;
+
+public class Event
+{
+ private String m_body;
+ private TreeMap<String,String> m_headers = new TreeMap<String,String>();
+
+ private void setBody(String body)
+ {
+ m_body = body;
+ }
+
+ private void addHeader(String name, String value)
+ {
+ m_headers.put(name, value);
+ }
+
+ public String getBody()
+ {
+ return m_body;
+ }
+
+ public TreeMap<String,String> getHeaders()
+ {
+ return m_headers;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/FreeswitchScript.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/FreeswitchScript.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,7 @@
+package org.freeswitch;
+
+public interface FreeswitchScript
+{
+ void run(String uuid, String args);
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/HangupHook.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/HangupHook.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,8 @@
+package org.freeswitch;
+
+public interface HangupHook
+{
+ /** Called on hangup, usually in a different thread. */
+ public void onHangup();
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/Launcher.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/Launcher.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,82 @@
+/*
+ * Launcher.java
+ *
+ * Created on 13 September 2007, 06:40
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.freeswitch;
+
+import java.io.*;
+import java.net.*;
+import java.lang.reflect.*;
+
+/**
+ *
+ * @author dacha
+ */
+public class Launcher
+{
+ static
+ {
+ // Find and load mod_java
+ String javaLibraryPaths = System.getProperty("java.library.path");
+ String pathSeparator = System.getProperty("path.separator");
+ String libraryPaths[] = javaLibraryPaths.split(pathSeparator);
+
+ String libraryName = System.mapLibraryName("mod_java");
+ int modJavaIndex = libraryName.indexOf("mod_java");
+ if (modJavaIndex >= 0)
+ libraryName = libraryName.substring(modJavaIndex);
+
+ for (String libraryPath : libraryPaths)
+ {
+ String fullLibraryPath = libraryPath + File.separatorChar + libraryName;
+ if (new File(fullLibraryPath).exists())
+ {
+ System.load(fullLibraryPath);
+ break;
+ }
+ }
+ }
+
+ public static void launch(String sessionUuid, String args) throws Exception
+ {
+ String argv[] = args.split("[ ]");
+ if (argv.length == 0)
+ {
+ System.out.println("Too few arguments to mod java");
+ System.out.println("Usage: java /path/to/file.jar fully.qualified.class arg1 arg2 arg3");
+ System.out.println("Usage: java fully.qualified.class arg1 arg2 arg3");
+ return;
+ }
+
+ Class klazz;
+ int argsOffset;
+ if (argv[0].endsWith(".jar") || argv[0].endsWith(".JAR"))
+ {
+ if (argv.length < 2)
+ throw new Exception("Too few arguments: must specify fully qualified class name when loading from JAR file");
+ URL urls[] = new URL[1];
+ urls[0] = new File(argv[0]).toURI().toURL();
+ URLClassLoader urlClassLoader = new URLClassLoader(urls);
+ klazz = Class.forName(argv[1], true, urlClassLoader);
+ argsOffset = argv[0].length() + argv[1].length() + 2;
+ }
+ else
+ {
+ klazz = Class.forName(argv[0]);
+ argsOffset = argv[0].length() + 1;
+ }
+
+ Constructor constructor = klazz.getConstructor();
+ Object object = constructor.newInstance();
+ Method run = klazz.getMethod("run", String.class, String.class);
+ String newArgs = "";
+ if (argsOffset < args.length())
+ newArgs = args.substring(argsOffset);
+ run.invoke(object, sessionUuid, newArgs);
+ }
+}
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,191 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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 CoreSession {
+ private long swigCPtr;
+ protected boolean swigCMemOwn;
+
+ protected CoreSession(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(CoreSession obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if(swigCPtr != 0 && swigCMemOwn) {
+ swigCMemOwn = false;
+ freeswitchJNI.delete_CoreSession(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+
+ public void setSession(SWIGTYPE_p_switch_core_session_t value) {
+ freeswitchJNI.CoreSession_session_set(swigCPtr, this, SWIGTYPE_p_switch_core_session_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_switch_core_session_t getSession() {
+ long cPtr = freeswitchJNI.CoreSession_session_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_switch_core_session_t(cPtr, false);
+ }
+
+ public void setChannel(SWIGTYPE_p_switch_channel_t value) {
+ freeswitchJNI.CoreSession_channel_set(swigCPtr, this, SWIGTYPE_p_switch_channel_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_switch_channel_t getChannel() {
+ long cPtr = freeswitchJNI.CoreSession_channel_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_switch_channel_t(cPtr, false);
+ }
+
+ public void setFlags(long value) {
+ freeswitchJNI.CoreSession_flags_set(swigCPtr, this, value);
+ }
+
+ public long getFlags() {
+ return freeswitchJNI.CoreSession_flags_get(swigCPtr, this);
+ }
+
+ public void setCb_state(input_callback_state_t value) {
+ freeswitchJNI.CoreSession_cb_state_set(swigCPtr, this, input_callback_state_t.getCPtr(value), value);
+ }
+
+ public input_callback_state_t getCb_state() {
+ long cPtr = freeswitchJNI.CoreSession_cb_state_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new input_callback_state_t(cPtr, false);
+ }
+
+ public void setHook_state(SWIGTYPE_p_switch_channel_state_t value) {
+ freeswitchJNI.CoreSession_hook_state_set(swigCPtr, this, SWIGTYPE_p_switch_channel_state_t.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_switch_channel_state_t getHook_state() {
+ return new SWIGTYPE_p_switch_channel_state_t(freeswitchJNI.CoreSession_hook_state_get(swigCPtr, this), true);
+ }
+
+ public int answer() {
+ return freeswitchJNI.CoreSession_answer(swigCPtr, this);
+ }
+
+ public int preAnswer() {
+ return freeswitchJNI.CoreSession_preAnswer(swigCPtr, this);
+ }
+
+ public void hangup(String cause) {
+ freeswitchJNI.CoreSession_hangup(swigCPtr, this, cause);
+ }
+
+ public void setVariable(String var, String val) {
+ freeswitchJNI.CoreSession_setVariable(swigCPtr, this, var, val);
+ }
+
+ public String getVariable(String var) {
+ return freeswitchJNI.CoreSession_getVariable(swigCPtr, this, var);
+ }
+
+ public int recordFile(String file_name, int max_len, int silence_threshold, int silence_secs) {
+ return freeswitchJNI.CoreSession_recordFile(swigCPtr, this, file_name, max_len, silence_threshold, silence_secs);
+ }
+
+ public void setCallerData(String var, String val) {
+ freeswitchJNI.CoreSession_setCallerData(swigCPtr, this, var, val);
+ }
+
+ public int originate(CoreSession a_leg_session, String dest, int timeout) {
+ return freeswitchJNI.CoreSession_originate(swigCPtr, this, CoreSession.getCPtr(a_leg_session), a_leg_session, dest, timeout);
+ }
+
+ public void setDTMFCallback(SWIGTYPE_p_void cbfunc, String funcargs) {
+ freeswitchJNI.CoreSession_setDTMFCallback(swigCPtr, this, SWIGTYPE_p_void.getCPtr(cbfunc), funcargs);
+ }
+
+ public int speak(String text) {
+ return freeswitchJNI.CoreSession_speak(swigCPtr, this, text);
+ }
+
+ public void set_tts_parms(String tts_name, String voice_name) {
+ freeswitchJNI.CoreSession_set_tts_parms(swigCPtr, this, tts_name, voice_name);
+ }
+
+ public int collectDigits(int timeout) {
+ return freeswitchJNI.CoreSession_collectDigits(swigCPtr, this, timeout);
+ }
+
+ public int getDigits(byte[] dtmf_buf, int buflen, int maxdigits, String terminators, byte[] terminator, int timeout) {
+ return freeswitchJNI.CoreSession_getDigits(swigCPtr, this, dtmf_buf, buflen, maxdigits, terminators, terminator, timeout);
+ }
+
+ public int transfer(String extensions, String dialplan, String context) {
+ return freeswitchJNI.CoreSession_transfer(swigCPtr, this, extensions, dialplan, context);
+ }
+
+ public int playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, String terminators, String audio_files, String bad_input_audio_files, byte[] dtmf_buf, String digits_regex) {
+ return freeswitchJNI.CoreSession_playAndGetDigits(swigCPtr, this, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, dtmf_buf, digits_regex);
+ }
+
+ public int streamFile(String file, int starting_sample_count) {
+ return freeswitchJNI.CoreSession_streamFile(swigCPtr, this, file, starting_sample_count);
+ }
+
+ public int flushEvents() {
+ return freeswitchJNI.CoreSession_flushEvents(swigCPtr, this);
+ }
+
+ public int flushDigits() {
+ return freeswitchJNI.CoreSession_flushDigits(swigCPtr, this);
+ }
+
+ public int setAutoHangup(boolean val) {
+ return freeswitchJNI.CoreSession_setAutoHangup(swigCPtr, this, val);
+ }
+
+ public void setHangupHook(SWIGTYPE_p_void hangup_func) {
+ freeswitchJNI.CoreSession_setHangupHook(swigCPtr, this, SWIGTYPE_p_void.getCPtr(hangup_func));
+ }
+
+ public boolean ready() {
+ return freeswitchJNI.CoreSession_ready(swigCPtr, this);
+ }
+
+ public void execute(String app, String data) {
+ freeswitchJNI.CoreSession_execute(swigCPtr, this, app, data);
+ }
+
+ public boolean begin_allow_threads() {
+ return freeswitchJNI.CoreSession_begin_allow_threads(swigCPtr, this);
+ }
+
+ public boolean end_allow_threads() {
+ return freeswitchJNI.CoreSession_end_allow_threads(swigCPtr, this);
+ }
+
+ public String get_uuid() {
+ return freeswitchJNI.CoreSession_get_uuid(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_switch_input_args_t get_cb_args() {
+ return new SWIGTYPE_p_switch_input_args_t(freeswitchJNI.CoreSession_get_cb_args(swigCPtr, this), false);
+ }
+
+ public void check_hangup_hook() {
+ freeswitchJNI.CoreSession_check_hangup_hook(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_switch_status_t run_dtmf_callback(SWIGTYPE_p_void input, SWIGTYPE_p_switch_input_type_t itype) {
+ return new SWIGTYPE_p_switch_status_t(freeswitchJNI.CoreSession_run_dtmf_callback(swigCPtr, this, SWIGTYPE_p_void.getCPtr(input), SWIGTYPE_p_switch_input_type_t.getCPtr(itype)), true);
+ }
+
+}
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/JavaSession.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/JavaSession.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,72 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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 JavaSession extends CoreSession {
+ private long swigCPtr;
+
+ protected JavaSession(long cPtr, boolean cMemoryOwn) {
+ super(freeswitchJNI.SWIGJavaSessionUpcast(cPtr), cMemoryOwn);
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(JavaSession obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if(swigCPtr != 0 && swigCMemOwn) {
+ swigCMemOwn = false;
+ freeswitchJNI.delete_JavaSession(swigCPtr);
+ }
+ swigCPtr = 0;
+ super.delete();
+ }
+
+ public JavaSession() {
+ this(freeswitchJNI.new_JavaSession__SWIG_0(), true);
+ }
+
+ public JavaSession(String uuid) {
+ this(freeswitchJNI.new_JavaSession__SWIG_1(uuid), true);
+ }
+
+ public JavaSession(SWIGTYPE_p_switch_core_session_t session) {
+ this(freeswitchJNI.new_JavaSession__SWIG_2(SWIGTYPE_p_switch_core_session_t.getCPtr(session)), true);
+ }
+
+ public boolean begin_allow_threads() {
+ return freeswitchJNI.JavaSession_begin_allow_threads(swigCPtr, this);
+ }
+
+ public boolean end_allow_threads() {
+ return freeswitchJNI.JavaSession_end_allow_threads(swigCPtr, this);
+ }
+
+ public void setDTMFCallback(org.freeswitch.DTMFCallback dtmfCallback, String funcargs) {
+ freeswitchJNI.JavaSession_setDTMFCallback(swigCPtr, this, dtmfCallback, funcargs);
+ }
+
+ public void setHangupHook(org.freeswitch.HangupHook hangupHook) {
+ freeswitchJNI.JavaSession_setHangupHook(swigCPtr, this, hangupHook);
+ }
+
+ public void check_hangup_hook() {
+ freeswitchJNI.JavaSession_check_hangup_hook(swigCPtr, this);
+ }
+
+ public SWIGTYPE_p_switch_status_t run_dtmf_callback(SWIGTYPE_p_void input, SWIGTYPE_p_switch_input_type_t itype) {
+ return new SWIGTYPE_p_switch_status_t(freeswitchJNI.JavaSession_run_dtmf_callback(swigCPtr, this, SWIGTYPE_p_void.getCPtr(input), SWIGTYPE_p_switch_input_type_t.getCPtr(itype)), true);
+ }
+
+}
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_JavaVM.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_JavaVM.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_JavaVM {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_JavaVM(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_JavaVM() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_JavaVM obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_state_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_state_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_switch_channel_state_t {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_switch_channel_state_t(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_switch_channel_state_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_switch_channel_state_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_switch_channel_t {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_switch_channel_t(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_switch_channel_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_switch_channel_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_core_session_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_core_session_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_switch_core_session_t {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_switch_core_session_t(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_switch_core_session_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_switch_core_session_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_args_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_args_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_switch_input_args_t {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_switch_input_args_t(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_switch_input_args_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_switch_input_args_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_type_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_type_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_switch_input_type_t {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_switch_input_type_t(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_switch_input_type_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_switch_input_type_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_status_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_status_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_switch_status_t {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_switch_status_t(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_switch_status_t() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_switch_status_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_void.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_void.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,26 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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_void {
+ private long swigCPtr;
+
+ protected SWIGTYPE_p_void(long cPtr, boolean futureUse) {
+ swigCPtr = cPtr;
+ }
+
+ protected SWIGTYPE_p_void() {
+ swigCPtr = 0;
+ }
+
+ protected static long getCPtr(SWIGTYPE_p_void obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,53 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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 freeswitch {
+ public static void console_log(String level_str, String msg) {
+ freeswitchJNI.console_log(level_str, msg);
+ }
+
+ public static void console_clean_log(String msg) {
+ freeswitchJNI.console_clean_log(msg);
+ }
+
+ public static String api_execute(String cmd, String arg) {
+ return freeswitchJNI.api_execute(cmd, arg);
+ }
+
+ public static void api_reply_delete(String reply) {
+ freeswitchJNI.api_reply_delete(reply);
+ }
+
+ public static SWIGTYPE_p_switch_status_t process_callback_result(String raw_result, input_callback_state_t cb_state, SWIGTYPE_p_switch_core_session_t session) {
+ return new SWIGTYPE_p_switch_status_t(freeswitchJNI.process_callback_result(raw_result, input_callback_state_t.getCPtr(cb_state), cb_state, SWIGTYPE_p_switch_core_session_t.getCPtr(session)), true);
+ }
+
+ public static void bridge(CoreSession session_a, CoreSession session_b) {
+ freeswitchJNI.bridge(CoreSession.getCPtr(session_a), session_a, CoreSession.getCPtr(session_b), session_b);
+ }
+
+ public static SWIGTYPE_p_switch_status_t hanguphook(SWIGTYPE_p_switch_core_session_t session) {
+ return new SWIGTYPE_p_switch_status_t(freeswitchJNI.hanguphook(SWIGTYPE_p_switch_core_session_t.getCPtr(session)), true);
+ }
+
+ public static SWIGTYPE_p_switch_status_t dtmf_callback(SWIGTYPE_p_switch_core_session_t session, SWIGTYPE_p_void input, SWIGTYPE_p_switch_input_type_t itype, SWIGTYPE_p_void buf, long buflen) {
+ return new SWIGTYPE_p_switch_status_t(freeswitchJNI.dtmf_callback(SWIGTYPE_p_switch_core_session_t.getCPtr(session), SWIGTYPE_p_void.getCPtr(input), SWIGTYPE_p_switch_input_type_t.getCPtr(itype), SWIGTYPE_p_void.getCPtr(buf), buflen), true);
+ }
+
+ public static void setJavaVM(SWIGTYPE_p_JavaVM value) {
+ freeswitchJNI.javaVM_set(SWIGTYPE_p_JavaVM.getCPtr(value));
+ }
+
+ public static SWIGTYPE_p_JavaVM getJavaVM() {
+ long cPtr = freeswitchJNI.javaVM_get();
+ return (cPtr == 0) ? null : new SWIGTYPE_p_JavaVM(cPtr, false);
+ }
+
+}
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,85 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+package org.freeswitch.swig;
+
+class freeswitchJNI {
+ public final static native void console_log(String jarg1, String jarg2);
+ public final static native void console_clean_log(String jarg1);
+ public final static native String api_execute(String jarg1, String jarg2);
+ public final static native void api_reply_delete(String jarg1);
+ public final static native long process_callback_result(String jarg1, long jarg2, input_callback_state_t jarg2_, long jarg3);
+ public final static native void input_callback_state_t_function_set(long jarg1, input_callback_state_t jarg1_, long jarg2);
+ public final static native long input_callback_state_t_function_get(long jarg1, input_callback_state_t jarg1_);
+ public final static native void input_callback_state_t_threadState_set(long jarg1, input_callback_state_t jarg1_, long jarg2);
+ public final static native long input_callback_state_t_threadState_get(long jarg1, input_callback_state_t jarg1_);
+ public final static native void input_callback_state_t_extra_set(long jarg1, input_callback_state_t jarg1_, long jarg2);
+ public final static native long input_callback_state_t_extra_get(long jarg1, input_callback_state_t jarg1_);
+ public final static native void input_callback_state_t_funcargs_set(long jarg1, input_callback_state_t jarg1_, String jarg2);
+ public final static native String input_callback_state_t_funcargs_get(long jarg1, input_callback_state_t jarg1_);
+ public final static native long new_input_callback_state_t();
+ public final static native void delete_input_callback_state_t(long jarg1);
+ 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 delete_CoreSession(long jarg1);
+ public final static native void CoreSession_session_set(long jarg1, CoreSession jarg1_, long jarg2);
+ public final static native long CoreSession_session_get(long jarg1, CoreSession jarg1_);
+ public final static native void CoreSession_channel_set(long jarg1, CoreSession jarg1_, long jarg2);
+ public final static native long CoreSession_channel_get(long jarg1, CoreSession jarg1_);
+ public final static native void CoreSession_flags_set(long jarg1, CoreSession jarg1_, long jarg2);
+ public final static native long CoreSession_flags_get(long jarg1, CoreSession jarg1_);
+ public final static native void CoreSession_cb_state_set(long jarg1, CoreSession jarg1_, long jarg2, input_callback_state_t jarg2_);
+ public final static native long CoreSession_cb_state_get(long jarg1, CoreSession jarg1_);
+ public final static native void CoreSession_hook_state_set(long jarg1, CoreSession jarg1_, long jarg2);
+ public final static native long CoreSession_hook_state_get(long jarg1, CoreSession jarg1_);
+ public final static native int CoreSession_answer(long jarg1, CoreSession jarg1_);
+ public final static native int CoreSession_preAnswer(long jarg1, CoreSession jarg1_);
+ public final static native void CoreSession_hangup(long jarg1, CoreSession jarg1_, String jarg2);
+ public final static native void CoreSession_setVariable(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+ public final static native String CoreSession_getVariable(long jarg1, CoreSession jarg1_, String jarg2);
+ public final static native int CoreSession_recordFile(long jarg1, CoreSession jarg1_, String jarg2, int jarg3, int jarg4, int jarg5);
+ public final static native void CoreSession_setCallerData(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+ public final static native int CoreSession_originate(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_, String jarg3, int jarg4);
+ public final static native void CoreSession_setDTMFCallback(long jarg1, CoreSession jarg1_, long jarg2, String jarg3);
+ public final static native int CoreSession_speak(long jarg1, CoreSession jarg1_, String jarg2);
+ public final static native void CoreSession_set_tts_parms(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+ public final static native int CoreSession_collectDigits(long jarg1, CoreSession jarg1_, int jarg2);
+ public final static native int CoreSession_getDigits(long jarg1, CoreSession jarg1_, byte[] jarg2, int jarg3, int jarg4, String jarg5, byte[] jarg6, int jarg7);
+ public final static native int CoreSession_transfer(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4);
+ public final static native int CoreSession_playAndGetDigits(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, int jarg4, int jarg5, String jarg6, String jarg7, String jarg8, byte[] jarg9, String jarg10);
+ public final static native int CoreSession_streamFile(long jarg1, CoreSession jarg1_, String jarg2, int jarg3);
+ public final static native int CoreSession_flushEvents(long jarg1, CoreSession jarg1_);
+ public final static native int CoreSession_flushDigits(long jarg1, CoreSession jarg1_);
+ public final static native int CoreSession_setAutoHangup(long jarg1, CoreSession jarg1_, boolean jarg2);
+ public final static native void CoreSession_setHangupHook(long jarg1, CoreSession jarg1_, long jarg2);
+ public final static native boolean CoreSession_ready(long jarg1, CoreSession jarg1_);
+ public final static native void CoreSession_execute(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+ public final static native boolean CoreSession_begin_allow_threads(long jarg1, CoreSession jarg1_);
+ public final static native boolean CoreSession_end_allow_threads(long jarg1, CoreSession jarg1_);
+ public final static native String CoreSession_get_uuid(long jarg1, CoreSession jarg1_);
+ public final static native long CoreSession_get_cb_args(long jarg1, CoreSession jarg1_);
+ public final static native void CoreSession_check_hangup_hook(long jarg1, CoreSession jarg1_);
+ public final static native long CoreSession_run_dtmf_callback(long jarg1, CoreSession jarg1_, long jarg2, long jarg3);
+ public final static native void bridge(long jarg1, CoreSession jarg1_, long jarg2, CoreSession jarg2_);
+ public final static native long hanguphook(long jarg1);
+ public final static native long dtmf_callback(long jarg1, long jarg2, long jarg3, long jarg4, long jarg5);
+ public final static native void javaVM_set(long jarg1);
+ public final static native long javaVM_get();
+ public final static native long new_JavaSession__SWIG_0();
+ public final static native long new_JavaSession__SWIG_1(String jarg1);
+ public final static native long new_JavaSession__SWIG_2(long jarg1);
+ public final static native void delete_JavaSession(long jarg1);
+ public final static native boolean JavaSession_begin_allow_threads(long jarg1, JavaSession jarg1_);
+ public final static native boolean JavaSession_end_allow_threads(long jarg1, JavaSession jarg1_);
+ public final static native void JavaSession_setDTMFCallback(long jarg1, JavaSession jarg1_, org.freeswitch.DTMFCallback jarg2, String jarg3);
+ public final static native void JavaSession_setHangupHook(long jarg1, JavaSession jarg1_, org.freeswitch.HangupHook jarg2);
+ public final static native void JavaSession_check_hangup_hook(long jarg1, JavaSession jarg1_);
+ public final static native long JavaSession_run_dtmf_callback(long jarg1, JavaSession jarg1_, long jarg2, long jarg3);
+ public final static native long SWIGJavaSessionUpcast(long jarg1);
+}
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/input_callback_state_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/input_callback_state_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,75 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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 input_callback_state_t {
+ private long swigCPtr;
+ protected boolean swigCMemOwn;
+
+ protected input_callback_state_t(long cPtr, boolean cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = cPtr;
+ }
+
+ protected static long getCPtr(input_callback_state_t obj) {
+ return (obj == null) ? 0 : obj.swigCPtr;
+ }
+
+ protected void finalize() {
+ delete();
+ }
+
+ public synchronized void delete() {
+ if(swigCPtr != 0 && swigCMemOwn) {
+ swigCMemOwn = false;
+ freeswitchJNI.delete_input_callback_state_t(swigCPtr);
+ }
+ swigCPtr = 0;
+ }
+
+ public void setFunction(SWIGTYPE_p_void value) {
+ freeswitchJNI.input_callback_state_t_function_set(swigCPtr, this, SWIGTYPE_p_void.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_void getFunction() {
+ long cPtr = freeswitchJNI.input_callback_state_t_function_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
+ }
+
+ public void setThreadState(SWIGTYPE_p_void value) {
+ freeswitchJNI.input_callback_state_t_threadState_set(swigCPtr, this, SWIGTYPE_p_void.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_void getThreadState() {
+ long cPtr = freeswitchJNI.input_callback_state_t_threadState_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
+ }
+
+ public void setExtra(SWIGTYPE_p_void value) {
+ freeswitchJNI.input_callback_state_t_extra_set(swigCPtr, this, SWIGTYPE_p_void.getCPtr(value));
+ }
+
+ public SWIGTYPE_p_void getExtra() {
+ long cPtr = freeswitchJNI.input_callback_state_t_extra_get(swigCPtr, this);
+ return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
+ }
+
+ public void setFuncargs(String value) {
+ freeswitchJNI.input_callback_state_t_funcargs_set(swigCPtr, this, value);
+ }
+
+ public String getFuncargs() {
+ return freeswitchJNI.input_callback_state_t_funcargs_get(swigCPtr, this);
+ }
+
+ public input_callback_state_t() {
+ this(freeswitchJNI.new_input_callback_state_t(), true);
+ }
+
+}
Added: freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/session_flag_t.java
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/src/org/freeswitch/swig/session_flag_t.java Tue Sep 25 09:21:17 2007
@@ -0,0 +1,50 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * 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 enum session_flag_t {
+ S_HUP(freeswitchJNI.S_HUP_get()),
+ S_FREE(freeswitchJNI.S_FREE_get()),
+ S_RDLOCK(freeswitchJNI.S_RDLOCK_get());
+
+ public final int swigValue() {
+ return swigValue;
+ }
+
+ public static session_flag_t swigToEnum(int swigValue) {
+ session_flag_t[] swigValues = session_flag_t.class.getEnumConstants();
+ if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
+ return swigValues[swigValue];
+ for (session_flag_t swigEnum : swigValues)
+ if (swigEnum.swigValue == swigValue)
+ return swigEnum;
+ throw new IllegalArgumentException("No enum " + session_flag_t.class + " with value " + swigValue);
+ }
+
+ private session_flag_t() {
+ this.swigValue = SwigNext.next++;
+ }
+
+ private session_flag_t(int swigValue) {
+ this.swigValue = swigValue;
+ SwigNext.next = swigValue+1;
+ }
+
+ private session_flag_t(session_flag_t swigEnum) {
+ this.swigValue = swigEnum.swigValue;
+ SwigNext.next = this.swigValue+1;
+ }
+
+ private final int swigValue;
+
+ private static class SwigNext {
+ private static int next = 0;
+ }
+}
+
Added: freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/languages/mod_java/switch_swig_wrap.cpp Tue Sep 25 09:21:17 2007
@@ -0,0 +1,1529 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org)
+ * Version 1.3.31
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+#ifdef __cplusplus
+template<class T> class SwigValueWrapper {
+ T *tt;
+public:
+ SwigValueWrapper() : tt(0) { }
+ SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+ SwigValueWrapper(const T& t) : tt(new T(t)) { }
+ ~SwigValueWrapper() { delete tt; }
+ SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+ operator T&() const { return *tt; }
+ T *operator&() { return tt; }
+private:
+ SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+#endif
+
+/* -----------------------------------------------------------------------------
+ * This section contains generic SWIG labels for method/variable
+ * declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC)
+# if (__SUNPRO_CC <= 0x560)
+# define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+# else
+# define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+# define SWIGINLINE inline
+# else
+# define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+# elif defined(__ICC)
+# define SWIGUNUSED __attribute__ ((__unused__))
+# else
+# define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+# define SWIGUNUSEDPARM(p)
+# else
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# ifndef GCC_HASCLASSVISIBILITY
+# define GCC_HASCLASSVISIBILITY
+# endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# if defined(STATIC_LINKED)
+# define SWIGEXPORT
+# else
+# define SWIGEXPORT __declspec(dllexport)
+# endif
+# else
+# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+# define SWIGEXPORT __attribute__ ((visibility("default")))
+# else
+# define SWIGEXPORT
+# endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+# define SWIGSTDCALL __stdcall
+# else
+# define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+
+/* Fix for jlong on some versions of gcc on Windows */
+#if defined(__GNUC__) && !defined(__INTELC__)
+ typedef long long __int64;
+#endif
+
+/* Fix for jlong on 64-bit x86 Solaris */
+#if defined(__x86_64)
+# ifdef _LP64
+# undef _LP64
+# endif
+#endif
+
+#include <jni.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* Support for throwing Java exceptions */
+typedef enum {
+ SWIG_JavaOutOfMemoryError = 1,
+ SWIG_JavaIOException,
+ SWIG_JavaRuntimeException,
+ SWIG_JavaIndexOutOfBoundsException,
+ SWIG_JavaArithmeticException,
+ SWIG_JavaIllegalArgumentException,
+ SWIG_JavaNullPointerException,
+ SWIG_JavaDirectorPureVirtual,
+ SWIG_JavaUnknownError
+} SWIG_JavaExceptionCodes;
+
+typedef struct {
+ SWIG_JavaExceptionCodes code;
+ const char *java_exception;
+} SWIG_JavaExceptions_t;
+
+
+static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
+ jclass excep;
+ static const SWIG_JavaExceptions_t java_exceptions[] = {
+ { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
+ { SWIG_JavaIOException, "java/io/IOException" },
+ { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
+ { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
+ { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
+ { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
+ { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
+ { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
+ { SWIG_JavaUnknownError, "java/lang/UnknownError" },
+ { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } };
+ const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
+
+ while (except_ptr->code != code && except_ptr->code)
+ except_ptr++;
+
+ jenv->ExceptionClear();
+ excep = jenv->FindClass(except_ptr->java_exception);
+ if (excep)
+ jenv->ThrowNew(excep, msg);
+}
+
+
+/* Contract support */
+
+#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
+
+
+#include "switch_cpp.h"
+#include "freeswitch_java.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_console_1log(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) {
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return ;
+ }
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ console_log(arg1,arg2);
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_console_1clean_1log(JNIEnv *jenv, jclass jcls, jstring jarg1) {
+ char *arg1 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return ;
+ }
+ console_clean_log(arg1);
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_api_1execute(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2) {
+ jstring jresult = 0 ;
+ char *arg1 = (char *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return 0;
+ }
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ result = (char *)api_execute(arg1,arg2);
+ if(result) jresult = jenv->NewStringUTF((const char *)result);
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_api_1reply_1delete(JNIEnv *jenv, jclass jcls, jstring jarg1) {
+ char *arg1 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return ;
+ }
+ api_reply_delete(arg1);
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_process_1callback_1result(JNIEnv *jenv, jclass jcls, jstring jarg1, jlong jarg2, jobject jarg2_, jlong jarg3) {
+ jlong jresult = 0 ;
+ char *arg1 = (char *) 0 ;
+ input_callback_state *arg2 = (input_callback_state *) 0 ;
+ switch_core_session_t *arg3 = (switch_core_session_t *) 0 ;
+ switch_status_t result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg2_;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return 0;
+ }
+ arg2 = *(input_callback_state **)&jarg2;
+ arg3 = *(switch_core_session_t **)&jarg3;
+ result = process_callback_result(arg1,arg2,arg3);
+ *(switch_status_t **)&jresult = new switch_status_t((switch_status_t &)result);
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1function_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ void *arg2 = (void *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ if (arg1) (arg1)->function = arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1function_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ void *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ result = (void *) ((arg1)->function);
+ *(void **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1threadState_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ void *arg2 = (void *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ if (arg1) (arg1)->threadState = arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1threadState_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ void *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ result = (void *) ((arg1)->threadState);
+ *(void **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1extra_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ void *arg2 = (void *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ if (arg1) (arg1)->extra = arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1extra_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ void *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ result = (void *) ((arg1)->extra);
+ *(void **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1funcargs_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ {
+ if (arg1->funcargs) delete [] arg1->funcargs;
+ if (arg2) {
+ arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]);
+ strcpy((char *)arg1->funcargs, (const char *)arg2);
+ } else {
+ arg1->funcargs = 0;
+ }
+ }
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_input_1callback_1state_1t_1funcargs_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jstring jresult = 0 ;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+ char *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ result = (char *) ((arg1)->funcargs);
+ if(result) jresult = jenv->NewStringUTF((const char *)result);
+ return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1input_1callback_1state_1t(JNIEnv *jenv, jclass jcls) {
+ jlong jresult = 0 ;
+ input_callback_state_t *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ result = (input_callback_state_t *)new input_callback_state_t();
+ *(input_callback_state_t **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1input_1callback_1state_1t(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(input_callback_state_t **)&jarg1;
+ delete arg1;
+
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_S_1HUP_1get(JNIEnv *jenv, jclass jcls) {
+ jint jresult = 0 ;
+ session_flag_t result;
+
+ (void)jenv;
+ (void)jcls;
+ result = (session_flag_t)S_HUP;
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_S_1FREE_1get(JNIEnv *jenv, jclass jcls) {
+ jint jresult = 0 ;
+ session_flag_t result;
+
+ (void)jenv;
+ (void)jcls;
+ result = (session_flag_t)S_FREE;
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_S_1RDLOCK_1get(JNIEnv *jenv, jclass jcls) {
+ jint jresult = 0 ;
+ session_flag_t result;
+
+ (void)jenv;
+ (void)jcls;
+ result = (session_flag_t)S_RDLOCK;
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1CoreSession(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(CoreSession **)&jarg1;
+ delete arg1;
+
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1session_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = *(switch_core_session_t **)&jarg2;
+ if (arg1) (arg1)->session = arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1session_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_core_session_t *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (switch_core_session_t *) ((arg1)->session);
+ *(switch_core_session_t **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1channel_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = *(switch_channel_t **)&jarg2;
+ if (arg1) (arg1)->channel = arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1channel_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_channel_t *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (switch_channel_t *) ((arg1)->channel);
+ *(switch_channel_t **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1flags_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ unsigned int arg2 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = (unsigned int)jarg2;
+ if (arg1) (arg1)->flags = arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1flags_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ unsigned int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (unsigned int) ((arg1)->flags);
+ jresult = (jlong)result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1cb_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ input_callback_state *arg2 = (input_callback_state *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ (void)jarg2_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = *(input_callback_state **)&jarg2;
+ if (arg1) (arg1)->cb_state = *arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1cb_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ input_callback_state *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (input_callback_state *)& ((arg1)->cb_state);
+ *(input_callback_state **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1hook_1state_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_channel_state_t arg2 ;
+ switch_channel_state_t *argp2 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ argp2 = *(switch_channel_state_t **)&jarg2;
+ if (!argp2) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null switch_channel_state_t");
+ return ;
+ }
+ arg2 = *argp2;
+ if (arg1) (arg1)->hook_state = arg2;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1hook_1state_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_channel_state_t result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = ((arg1)->hook_state);
+ *(switch_channel_state_t **)&jresult = new switch_channel_state_t((switch_channel_state_t &)result);
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1answer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (int)(arg1)->answer();
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1preAnswer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (int)(arg1)->preAnswer();
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1hangup(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ (arg1)->hangup(arg2);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setVariable(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->setVariable(arg2,arg3);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getVariable(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+ jstring jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ result = (char *)(arg1)->getVariable(arg2);
+ if(result) jresult = jenv->NewStringUTF((const char *)result);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1recordFile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jint jarg5) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int arg3 = (int) 0 ;
+ int arg4 = (int) 0 ;
+ int arg5 = (int) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ arg3 = (int)jarg3;
+ arg4 = (int)jarg4;
+ arg5 = (int)jarg5;
+ result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
+ jresult = (jint)result;
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setCallerData(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->setCallerData(arg2,arg3);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1originate(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jstring jarg3, jint jarg4) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ CoreSession *arg2 = (CoreSession *) 0 ;
+ char *arg3 = (char *) 0 ;
+ int arg4 = (int) 60 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ (void)jarg2_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = *(CoreSession **)&jarg2;
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return 0;
+ }
+ arg4 = (int)jarg4;
+ result = (int)(arg1)->originate(arg2,arg3,arg4);
+ jresult = (jint)result;
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setDTMFCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jstring jarg3) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ void *arg2 = (void *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->setDTMFCallback(arg2,arg3);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1speak(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ result = (int)(arg1)->speak(arg2);
+ jresult = (jint)result;
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1set_1tts_1parms(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->set_tts_parms(arg2,arg3);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1collectDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int arg2 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = (int)jarg2;
+ result = (int)(arg1)->collectDigits(arg2);
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jbyteArray jarg2, jint jarg3, jint jarg4, jstring jarg5, jbyteArray jarg6, jint jarg7) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int arg3 ;
+ int arg4 ;
+ char *arg5 = (char *) 0 ;
+ char *arg6 = (char *) 0 ;
+ int arg7 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ {
+ arg2 = (char*) jenv->GetByteArrayElements(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ arg3 = (int)jarg3;
+ arg4 = (int)jarg4;
+ arg5 = 0;
+ if (jarg5) {
+ arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0);
+ if (!arg5) return 0;
+ }
+ {
+ arg6 = (char*) jenv->GetByteArrayElements(jarg6, 0);
+ if (!arg6) return 0;
+ }
+ arg7 = (int)jarg7;
+ result = (int)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6,arg7);
+ jresult = (jint)result;
+ {
+ jenv->ReleaseByteArrayElements(jarg2, (jbyte*) arg2, 0);
+ }
+ {
+ jenv->ReleaseByteArrayElements(jarg6, (jbyte*) arg6, 0);
+ }
+
+ if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5);
+
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1transfer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return 0;
+ }
+ arg4 = 0;
+ if (jarg4) {
+ arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+ if (!arg4) return 0;
+ }
+ result = (int)(arg1)->transfer(arg2,arg3,arg4);
+ jresult = (jint)result;
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+ if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1playAndGetDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3, jint jarg4, jint jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jbyteArray jarg9, jstring jarg10) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int arg2 ;
+ int arg3 ;
+ int arg4 ;
+ int arg5 ;
+ char *arg6 = (char *) 0 ;
+ char *arg7 = (char *) 0 ;
+ char *arg8 = (char *) 0 ;
+ char *arg9 = (char *) 0 ;
+ char *arg10 = (char *) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = (int)jarg2;
+ arg3 = (int)jarg3;
+ arg4 = (int)jarg4;
+ arg5 = (int)jarg5;
+ arg6 = 0;
+ if (jarg6) {
+ arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0);
+ if (!arg6) return 0;
+ }
+ arg7 = 0;
+ if (jarg7) {
+ arg7 = (char *)jenv->GetStringUTFChars(jarg7, 0);
+ if (!arg7) return 0;
+ }
+ arg8 = 0;
+ if (jarg8) {
+ arg8 = (char *)jenv->GetStringUTFChars(jarg8, 0);
+ if (!arg8) return 0;
+ }
+ {
+ arg9 = (char*) jenv->GetByteArrayElements(jarg9, 0);
+ if (!arg9) return 0;
+ }
+ arg10 = 0;
+ if (jarg10) {
+ arg10 = (char *)jenv->GetStringUTFChars(jarg10, 0);
+ if (!arg10) return 0;
+ }
+ result = (int)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
+ jresult = (jint)result;
+ {
+ jenv->ReleaseByteArrayElements(jarg9, (jbyte*) arg9, 0);
+ }
+ if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6);
+ if (arg7) jenv->ReleaseStringUTFChars(jarg7, (const char *)arg7);
+ if (arg8) jenv->ReleaseStringUTFChars(jarg8, (const char *)arg8);
+
+ if (arg10) jenv->ReleaseStringUTFChars(jarg10, (const char *)arg10);
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1streamFile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int arg3 = (int) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return 0;
+ }
+ arg3 = (int)jarg3;
+ result = (int)(arg1)->streamFile(arg2,arg3);
+ jresult = (jint)result;
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1flushEvents(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (int)(arg1)->flushEvents();
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1flushDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (int)(arg1)->flushDigits();
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setAutoHangup(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) {
+ jint jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ bool arg2 ;
+ int result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = jarg2 ? true : false;
+ result = (int)(arg1)->setAutoHangup(arg2);
+ jresult = (jint)result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1setHangupHook(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ void *arg2 = (void *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ (arg1)->setHangupHook(arg2);
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1ready(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jboolean jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ bool result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (bool)(arg1)->ready();
+ jresult = (jboolean)result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->execute(arg2,arg3);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1begin_1allow_1threads(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jboolean jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ bool result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (bool)(arg1)->begin_allow_threads();
+ jresult = (jboolean)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1end_1allow_1threads(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jboolean jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ bool result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (bool)(arg1)->end_allow_threads();
+ jresult = (jboolean)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1get_1uuid(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jstring jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ result = (char *)((CoreSession const *)arg1)->get_uuid();
+ if(result) jresult = jenv->NewStringUTF((const char *)result);
+ return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1get_1cb_1args(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jlong jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_input_args_t *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ {
+ switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
+ result = (switch_input_args_t *) &_result_ref;
+ }
+ *(switch_input_args_t **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1check_1hangup_1hook(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ (arg1)->check_hangup_hook();
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1run_1dtmf_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
+ jlong jresult = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ void *arg2 = (void *) 0 ;
+ switch_input_type_t arg3 ;
+ switch_status_t result;
+ switch_input_type_t *argp3 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ argp3 = *(switch_input_type_t **)&jarg3;
+ if (!argp3) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null switch_input_type_t");
+ return 0;
+ }
+ arg3 = *argp3;
+ result = (arg1)->run_dtmf_callback(arg2,arg3);
+ *(switch_status_t **)&jresult = new switch_status_t((switch_status_t &)result);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_bridge(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
+ CoreSession *arg1 = 0 ;
+ CoreSession *arg2 = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ (void)jarg2_;
+ arg1 = *(CoreSession **)&jarg1;
+ if(!arg1) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "CoreSession & reference is null");
+ return ;
+ }
+ arg2 = *(CoreSession **)&jarg2;
+ if(!arg2) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "CoreSession & reference is null");
+ return ;
+ }
+ bridge(*arg1,*arg2);
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_hanguphook(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ jlong jresult = 0 ;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_status_t result;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(switch_core_session_t **)&jarg1;
+ result = hanguphook(arg1);
+ *(switch_status_t **)&jresult = new switch_status_t((switch_status_t &)result);
+ return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_dtmf_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jlong jarg2, jlong jarg3, jlong jarg4, jlong jarg5) {
+ jlong jresult = 0 ;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ void *arg2 = (void *) 0 ;
+ switch_input_type_t arg3 ;
+ void *arg4 = (void *) 0 ;
+ unsigned int arg5 ;
+ switch_status_t result;
+ switch_input_type_t *argp3 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(switch_core_session_t **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ argp3 = *(switch_input_type_t **)&jarg3;
+ if (!argp3) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null switch_input_type_t");
+ return 0;
+ }
+ arg3 = *argp3;
+ arg4 = *(void **)&jarg4;
+ arg5 = (unsigned int)jarg5;
+ result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
+ *(switch_status_t **)&jresult = new switch_status_t((switch_status_t &)result);
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_javaVM_1set(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ JavaVM *arg1 = (JavaVM *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(JavaVM **)&jarg1;
+ javaVM = arg1;
+
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_javaVM_1get(JNIEnv *jenv, jclass jcls) {
+ jlong jresult = 0 ;
+ JavaVM *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ result = (JavaVM *)javaVM;
+ *(JavaVM **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1JavaSession_1_1SWIG_10(JNIEnv *jenv, jclass jcls) {
+ jlong jresult = 0 ;
+ JavaSession *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ result = (JavaSession *)new JavaSession();
+ *(JavaSession **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1JavaSession_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1) {
+ jlong jresult = 0 ;
+ char *arg1 = (char *) 0 ;
+ JavaSession *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = 0;
+ if (jarg1) {
+ arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+ if (!arg1) return 0;
+ }
+ result = (JavaSession *)new JavaSession(arg1);
+ *(JavaSession **)&jresult = result;
+ if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+ return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1JavaSession_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ jlong jresult = 0 ;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ JavaSession *result = 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(switch_core_session_t **)&jarg1;
+ result = (JavaSession *)new JavaSession(arg1);
+ *(JavaSession **)&jresult = result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_delete_1JavaSession(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ JavaSession *arg1 = (JavaSession *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ arg1 = *(JavaSession **)&jarg1;
+ delete arg1;
+
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_JavaSession_1begin_1allow_1threads(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jboolean jresult = 0 ;
+ JavaSession *arg1 = (JavaSession *) 0 ;
+ bool result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(JavaSession **)&jarg1;
+ result = (bool)(arg1)->begin_allow_threads();
+ jresult = (jboolean)result;
+ return jresult;
+}
+
+
+SWIGEXPORT jboolean JNICALL Java_org_freeswitch_swig_freeswitchJNI_JavaSession_1end_1allow_1threads(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ jboolean jresult = 0 ;
+ JavaSession *arg1 = (JavaSession *) 0 ;
+ bool result;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(JavaSession **)&jarg1;
+ result = (bool)(arg1)->end_allow_threads();
+ jresult = (jboolean)result;
+ return jresult;
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_JavaSession_1setDTMFCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2, jstring jarg3) {
+ JavaSession *arg1 = (JavaSession *) 0 ;
+ jobject arg2 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(JavaSession **)&jarg1;
+ arg2 = jarg2;
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->setDTMFCallback(arg2,arg3);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_JavaSession_1setHangupHook(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jobject jarg2) {
+ JavaSession *arg1 = (JavaSession *) 0 ;
+ jobject arg2 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(JavaSession **)&jarg1;
+ arg2 = jarg2;
+ (arg1)->setHangupHook(arg2);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_JavaSession_1check_1hangup_1hook(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+ JavaSession *arg1 = (JavaSession *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(JavaSession **)&jarg1;
+ (arg1)->check_hangup_hook();
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_JavaSession_1run_1dtmf_1callback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
+ jlong jresult = 0 ;
+ JavaSession *arg1 = (JavaSession *) 0 ;
+ void *arg2 = (void *) 0 ;
+ switch_input_type_t arg3 ;
+ switch_status_t result;
+ switch_input_type_t *argp3 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(JavaSession **)&jarg1;
+ arg2 = *(void **)&jarg2;
+ argp3 = *(switch_input_type_t **)&jarg3;
+ if (!argp3) {
+ SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null switch_input_type_t");
+ return 0;
+ }
+ arg3 = *argp3;
+ result = (arg1)->run_dtmf_callback(arg2,arg3);
+ *(switch_status_t **)&jresult = new switch_status_t((switch_status_t &)result);
+ return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_SWIGJavaSessionUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+ jlong baseptr = 0;
+ (void)jenv;
+ (void)jcls;
+ *(CoreSession **)&baseptr = *(JavaSession **)&jarg1;
+ return baseptr;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
1
0
[Freeswitch-svn] [commit] r5754 - freeswitch/trunk/src/mod/languages/mod_java
by Freeswitch SVN 25 Sep '07
by Freeswitch SVN 25 Sep '07
25 Sep '07
Author: mikej
Date: Tue Sep 25 07:35:11 2007
New Revision: 5754
Added:
freeswitch/trunk/src/mod/languages/mod_java/
Log:
add directory for new module.
1
0
[Freeswitch-svn] [commit] r5753 - freeswitch/trunk/src/mod/xml_int/mod_xml_cdr
by Freeswitch SVN 25 Sep '07
by Freeswitch SVN 25 Sep '07
25 Sep '07
Author: mikej
Date: Mon Sep 24 21:55:05 2007
New Revision: 5753
Modified:
freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
Log:
resolves MDXMLINT-11 and MDXMLINT-12, re-factors error handling and cleanup to eliminate possible segfaults and leaks.
Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Mon Sep 24 21:55:05 2007
@@ -59,23 +59,25 @@
static switch_status_t my_on_hangup(switch_core_session_t *session)
{
switch_xml_t cdr;
- char *xml_text;
- char *path;
+ char *xml_text = NULL;
+ char *path = NULL;
+ char *curl_xml_text = NULL;
+ char *logdir = NULL;
+ char *xml_text_escaped = NULL;
int fd = -1;
uint32_t curTry;
long httpRes;
CURL *curl_handle = NULL;
- char *curl_xml_text;
- char *logdir;
switch_channel_t *channel = switch_core_session_get_channel(session);
uint32_t i;
+ switch_status_t status = SWITCH_STATUS_FALSE;
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
/* build the XML */
if(!(xml_text = switch_mprintf("<?xml version=\"1.0\"?>\n%s",switch_xml_toxml(cdr)) )) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- return SWITCH_STATUS_FALSE;
+ goto error;
}
/* do we log to the disk no matter what? */
@@ -101,17 +103,24 @@
#endif
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
}
- free(path);
+ switch_safe_free(path);
}
}
/* try to post it to the web server */
- if(!switch_strlen_zero(globals.url)) {
+ if (!switch_strlen_zero(globals.url)) {
curl_handle = curl_easy_init();
- if(!(curl_xml_text = switch_mprintf("cdr=%s",xml_text) )) {
+
+ xml_text_escaped = curl_easy_escape(curl_handle, (const char*) xml_text, (int)strlen(xml_text));
+
+ if (switch_strlen_zero(xml_text_escaped)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto error;
+ }
+
+ if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text_escaped))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
- free(xml_text);
- return SWITCH_STATUS_FALSE;
+ goto error;
}
if (!switch_strlen_zero(globals.cred)) {
@@ -130,30 +139,25 @@
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
*/
- for(curTry=0;curTry<=globals.retries;curTry++) {
+ for (curTry=0;curTry<=globals.retries;curTry++) {
curl_easy_perform(curl_handle);
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE,&httpRes);
- if(httpRes==200) {
- curl_easy_cleanup(curl_handle);
- free(curl_xml_text);
- free(xml_text);
- return SWITCH_STATUS_SUCCESS;
+ if (httpRes==200) {
+ goto success;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server\n",httpRes);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",httpRes, globals.url);
}
/* make sure we dont sleep on the last try */
- for(i=0;i<globals.delay && (curTry != (globals.retries));i++) {
+ for (i=0;i<globals.delay && (curTry != (globals.retries));i++) {
switch_sleep(1000);
if(globals.shutdown) {
/* we are shutting down so dont try to webpost any more */
i=globals.delay;
curTry=globals.retries;
}
- }
-
+ }
}
- free(curl_xml_text);
curl_easy_cleanup(curl_handle);
/* if we are here the web post failed for some reason */
@@ -174,16 +178,27 @@
#endif
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
}
- free(path);
}
}
- free(xml_text);
- switch_xml_free(cdr);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
}
- return SWITCH_STATUS_SUCCESS;
+
+success:
+ status = SWITCH_STATUS_SUCCESS;
+
+error:
+ if (curl_handle) {
+ curl_easy_cleanup(curl_handle);
+ }
+ switch_safe_free(curl_xml_text);
+ switch_safe_free(xml_text_escaped);
+ switch_safe_free(path);
+ switch_safe_free(xml_text);
+ switch_xml_free(cdr);
+
+ return status;
}
@@ -221,9 +236,9 @@
char *val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "cred")) {
- globals.cred = val;
+ globals.cred = strdup(val);
} else if (!strcasecmp(var, "url")) {
- globals.url = val;
+ globals.url = strdup(val);
} else if (!strcasecmp(var, "delay")) {
globals.delay = (uint32_t) atoi(val);
} else if (!strcasecmp(var, "retries")) {
@@ -232,10 +247,10 @@
if (switch_strlen_zero(val)) {
globals.logDir = SWITCH_GLOBAL_dirs.log_dir;
} else {
- globals.logDir = val;
+ globals.logDir = strdup(val);
}
} else if (!strcasecmp(var, "errLogDir")) {
- globals.errLogDir = val;
+ globals.errLogDir = strdup(val);
}
}
1
0
[Freeswitch-svn] [commit] r5752 - freeswitch/trunk/src/mod/event_handlers/mod_cdr
by Freeswitch SVN 25 Sep '07
by Freeswitch SVN 25 Sep '07
25 Sep '07
Author: mikej
Date: Mon Sep 24 21:22:32 2007
New Revision: 5752
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp
Log:
fix build broken in in r5751
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/basecdr.cpp Mon Sep 24 21:22:32 2007
@@ -333,7 +333,7 @@
const void *var;
switch_memory_pool_t *sessionpool;
sessionpool = switch_core_session_get_pool(coresession);
- for (hi = switch_channel_variable_first(channel,sessionpool); hi; hi = switch_hash_next(hi))
+ for (hi = switch_channel_variable_first(channel); hi; hi = switch_hash_next(hi))
{
switch_hash_this(hi, &var, 0, &val);
std::string tempstring_first, tempstring_second;
1
0
24 Sep '07
Author: anthm
Date: Mon Sep 24 15:34:25 2007
New Revision: 5751
Modified:
freeswitch/trunk/src/include/switch_channel.h
freeswitch/trunk/src/include/switch_loadable_module.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/mod/formats/mod_native_file/mod_native_file.c
freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_loadable_module.c
Log:
fix some races and alter core (do a full rebuild)
Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h (original)
+++ freeswitch/trunk/src/include/switch_channel.h Mon Sep 24 15:34:25 2007
@@ -227,7 +227,7 @@
* pool is NULL, then an internal, non-thread-safe iterator is used.
* @remark Use switch_hash_next and switch_hash_this with this function to iterate all the channel variables
*/
-SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel);
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel);
/*!
Modified: freeswitch/trunk/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/trunk/src/include/switch_loadable_module.h (original)
+++ freeswitch/trunk/src/include/switch_loadable_module.h Mon Sep 24 15:34:25 2007
@@ -200,12 +200,11 @@
/*!
\brief Retrieve the list of loaded codecs into an array
- \param pool the memory pool to use for the hash index
\param array the array to populate
\param arraylen the max size in elements of the array
\return the number of elements added to the array
*/
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, const switch_codec_implementation_t **array, int arraylen);
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_implementation_t **array, int arraylen);
/*!
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Mon Sep 24 15:34:25 2007
@@ -2822,7 +2822,7 @@
}
if (conference == NULL) {
- for (hi = switch_hash_first(globals.conference_pool, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
conference = (conference_obj_t *) val;
Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c Mon Sep 24 15:34:25 2007
@@ -586,7 +586,7 @@
void *vval;
const void *vvar;
- if ((hi = switch_channel_variable_first(channel, switch_core_session_get_pool(session)))) {
+ if ((hi = switch_channel_variable_first(channel))) {
for (; hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
if (vvar && !strncmp(vvar, "enum_", 5)) {
Modified: freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c (original)
+++ freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c Mon Sep 24 15:34:25 2007
@@ -252,7 +252,7 @@
stream.write_function(&stream, "%s=%s&", prof_names[x], encode_buf);
}
- if ((hi = switch_channel_variable_first(channel, switch_core_session_get_pool(session)))) {
+ if ((hi = switch_channel_variable_first(channel))) {
for (; hi; hi = switch_hash_next(hi)) {
void *val;
const void *var;
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Mon Sep 24 15:34:25 2007
@@ -477,7 +477,7 @@
sql = switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to like '%%%q'", type, rpid, status, proto, from);
- for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (mdl_profile_t *) val;
@@ -572,7 +572,7 @@
sql = switch_mprintf("select *,'%q' from jabber_subscriptions", status ? status : "");
}
- for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (mdl_profile_t *) val;
@@ -642,7 +642,7 @@
sql = switch_mprintf("select * from jabber_subscriptions");
- for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (mdl_profile_t *) val;
@@ -760,7 +760,7 @@
return 0;
}
} else if (((tech_pvt->num_codecs =
- switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
+ switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
return 0;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Mon Sep 24 15:34:25 2007
@@ -230,7 +230,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
return SWITCH_STATUS_GENERR;
}
- } else if (((num_codecs = switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), codecs, SWITCH_MAX_CODECS))) <= 0) {
+ } else if (((num_codecs = switch_loadable_module_get_codecs(codecs, SWITCH_MAX_CODECS))) <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
return SWITCH_STATUS_GENERR;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Mon Sep 24 15:34:25 2007
@@ -1090,7 +1090,7 @@
stream->write_function(stream, "%25s\t%s\t %32s\t%s\n", "Name", " Type", "Data", "State");
stream->write_function(stream, "%s\n", line);
switch_mutex_lock(mod_sofia_globals.hash_mutex);
- for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &val);
profile = (sofia_profile_t *) val;
if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Sep 24 15:34:25 2007
@@ -264,7 +264,7 @@
}
} else {
tech_pvt->num_codecs =
- switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), tech_pvt->codecs,
+ switch_loadable_module_get_codecs(tech_pvt->codecs,
sizeof(tech_pvt->codecs) / sizeof(tech_pvt->codecs[0]));
}
@@ -574,7 +574,7 @@
}
SWITCH_STANDARD_STREAM(stream);
- if ((hi = switch_channel_variable_first(channel, switch_core_session_get_pool(tech_pvt->session)))) {
+ if ((hi = switch_channel_variable_first(channel))) {
for (; hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
if (vvar && vval) {
@@ -1540,14 +1540,14 @@
switch_mutex_lock(mod_sofia_globals.hash_mutex);
- for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
this_profile = (sofia_profile_t *) vval;
if (this_profile == profile) {
switch_core_hash_delete(mod_sofia_globals.profile_hash, vvar);
}
}
- for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.gateway_hash), mod_sofia_globals.gateway_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, mod_sofia_globals.gateway_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
this_gateway = (sofia_gateway_t *) vval;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Mon Sep 24 15:34:25 2007
@@ -116,7 +116,7 @@
if ((sql = switch_mprintf("select 0,'unavailable','unavailable',* from sip_subscriptions where event='presence'"))) {
switch_mutex_lock(mod_sofia_globals.hash_mutex);
- for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (sofia_profile_t *) val;
if (!(profile->pflags & PFLAG_PRESENCE)) {
@@ -294,7 +294,7 @@
assert(sql != NULL);
switch_mutex_lock(mod_sofia_globals.hash_mutex);
- for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (sofia_profile_t *) val;
if (!(profile->pflags & PFLAG_PRESENCE)) {
@@ -396,7 +396,7 @@
}
switch_mutex_lock(mod_sofia_globals.hash_mutex);
- for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (sofia_profile_t *) val;
if (!(profile->pflags & PFLAG_PRESENCE)) {
Modified: freeswitch/trunk/src/mod/formats/mod_native_file/mod_native_file.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_native_file/mod_native_file.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_native_file/mod_native_file.c Mon Sep 24 15:34:25 2007
@@ -144,7 +144,7 @@
switch_file_interface_t *file_interface;
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
- uint32_t num_codecs = switch_loadable_module_get_codecs(NULL, codecs, sizeof(codecs) / sizeof(codecs[0]));
+ uint32_t num_codecs = switch_loadable_module_get_codecs(codecs, sizeof(codecs) / sizeof(codecs[0]));
uint32_t x;
for (x = 0; x < num_codecs; x++) {
Modified: freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.c Mon Sep 24 15:34:25 2007
@@ -142,7 +142,7 @@
/* Finally, go through and initialise each plugin before returning SUCCESS */
switch_hash_index_t *p = NULL;
- for (p = switch_hash_first(mono_pool, globals.plugins); p; p = switch_hash_next(p)) {
+ for (p = switch_hash_first(NULL, globals.plugins); p; p = switch_hash_next(p)) {
mono_plugin *plugin = (mono_plugin *) switch_core_alloc(mono_pool, sizeof(*plugin));
switch_ssize_t *key_length = NULL;
const void *key = NULL;
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Mon Sep 24 15:34:25 2007
@@ -342,15 +342,17 @@
}
}
-SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_hash_index_t *) switch_channel_variable_first(switch_channel_t *channel)
{
switch_hash_index_t *hi;
assert(channel != NULL);
- if ((hi = switch_hash_first(pool, channel->variables))) {
- switch_mutex_lock(channel->profile_mutex);
+ switch_mutex_lock(channel->profile_mutex);
+ if ((hi = switch_hash_first(NULL, channel->variables))) {
channel->vi = 1;
+ } else {
+ switch_mutex_unlock(channel->profile_mutex);
}
return hi;
@@ -818,7 +820,7 @@
}
/* Index Variables */
- for (hi = switch_hash_first(switch_core_session_get_pool(channel->session), channel->variables); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, channel->variables); hi; hi = switch_hash_next(hi)) {
char buf[1024];
switch_hash_this(hi, &var, NULL, &val);
if (var && val) {
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Mon Sep 24 15:34:25 2007
@@ -81,7 +81,7 @@
uint32_t loops = 0;
switch_mutex_lock(session_manager.session_table_mutex);
- for (hi = switch_hash_first(session_manager.memory_pool, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
if (val) {
session = (switch_core_session_t *) val;
@@ -388,10 +388,6 @@
assert(session != NULL);
- if (!session->message_queue) {
- switch_queue_create(&session->message_queue, SWITCH_MESSAGE_QUEUE_LEN, session->pool);
- }
-
if (session->message_queue) {
if (switch_queue_trypush(session->message_queue, message) == SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_SUCCESS;
@@ -477,10 +473,6 @@
assert(session != NULL);
- if (!session->event_queue) {
- switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
- }
-
if (session->event_queue) {
if (switch_queue_trypush(session->event_queue, *event) == SWITCH_STATUS_SUCCESS) {
*event = NULL;
@@ -522,10 +514,6 @@
assert(session != NULL);
- if (!session->private_event_queue) {
- switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
- }
-
if (session->private_event_queue) {
(*event)->event_id = SWITCH_EVENT_PRIVATE_COMMAND;
if (switch_queue_trypush(session->private_event_queue, *event) == SWITCH_STATUS_SUCCESS) {
@@ -818,6 +806,9 @@
switch_thread_rwlock_create(&session->bug_rwlock, session->pool);
switch_thread_cond_create(&session->cond, session->pool);
switch_thread_rwlock_create(&session->rwlock, session->pool);
+ switch_queue_create(&session->message_queue, SWITCH_MESSAGE_QUEUE_LEN, session->pool);
+ switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
+ switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
snprintf(session->name, sizeof(session->name), "%"SWITCH_SIZE_T_FMT, session->id);
switch_mutex_lock(session_manager.session_table_mutex);
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Mon Sep 24 15:34:25 2007
@@ -967,7 +967,7 @@
void *vval;
const void *vvar;
- if ((hi = switch_channel_variable_first(chana, switch_core_session_get_pool(sessa)))) {
+ if ((hi = switch_channel_variable_first(chana))) {
for (; hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
if (vvar && vval && (!prefix || (var && !strncmp((char *) vvar, var, strlen(var))))) {
@@ -1330,7 +1330,7 @@
}
}
- if (((hi = switch_channel_variable_first(channel, switch_core_session_get_pool(session))))) {
+ if (((hi = switch_channel_variable_first(channel)))) {
for (; hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
if (vvar && vval) {
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Mon Sep 24 15:34:25 2007
@@ -323,7 +323,7 @@
assert(caller_channel != NULL);
/* Copy all the channel variables into the event */
- if ((hi = switch_channel_variable_first(caller_channel, switch_core_session_get_pool(session)))) {
+ if ((hi = switch_channel_variable_first(caller_channel))) {
for (; hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &vvar, NULL, &vval);
if (vvar && vval) {
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Mon Sep 24 15:34:25 2007
@@ -108,7 +108,7 @@
switch_loadable_module_t *module;
switch_mutex_lock(loadable_modules.mutex);
- for (hi = switch_hash_first(loadable_modules.pool, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
module = (switch_loadable_module_t *) val;
@@ -1078,7 +1078,7 @@
void *val;
switch_loadable_module_t *module;
- for (hi = switch_hash_first(loadable_modules.pool, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
module = (switch_loadable_module_t *) val;
do_shutdown(module);
@@ -1174,7 +1174,7 @@
return switch_core_hash_find_locked(loadable_modules.management_hash, relative_oid, loadable_modules.mutex);
}
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, const switch_codec_implementation_t **array, int arraylen)
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_implementation_t **array, int arraylen)
{
switch_hash_index_t *hi;
void *val;
@@ -1183,7 +1183,7 @@
const switch_codec_implementation_t *imp;
switch_mutex_lock(loadable_modules.mutex);
- for (hi = switch_hash_first(pool, loadable_modules.codec_hash); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_hash_first(NULL, loadable_modules.codec_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
codec_interface = (switch_codec_interface_t *) val;
/* Look for a 20ms implementation because it's the safest choice */
1
0
Author: anthm
Date: Mon Sep 24 12:56:40 2007
New Revision: 5750
Modified:
freeswitch/trunk/src/switch_channel.c
Log:
fix for FSCORE-51 (maybe 2)
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Mon Sep 24 12:56:40 2007
@@ -360,7 +360,7 @@
{
assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- switch_core_hash_insert_dup_locked(channel->private_hash, switch_core_session_strdup(channel->session, key), private_info, channel->flag_mutex);
+ switch_core_hash_insert_dup_locked(channel->private_hash, switch_core_session_strdup(channel->session, key), private_info, channel->profile_mutex);
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
}
@@ -398,15 +398,13 @@
{
assert(channel != NULL);
- if (varname) {
+ if (!switch_strlen_zero(varname)) {
switch_mutex_lock(channel->profile_mutex);
- switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
+ switch_core_hash_delete(channel->variables, varname);
if (!switch_strlen_zero(value)) {
- switch_core_hash_insert_dup_locked(channel->variables, varname,
- switch_clean_string(switch_core_session_strdup(channel->session, value)), channel->flag_mutex);
- } else {
- switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
- }
+ switch_core_hash_insert_dup(channel->variables, varname,
+ switch_clean_string(switch_core_session_strdup(channel->session, value)));
+ }
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
}
@@ -418,14 +416,12 @@
{
assert(channel != NULL);
- if (varname) {
+ if (!switch_strlen_zero(varname)) {
switch_mutex_lock(channel->profile_mutex);
- switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
+ switch_core_hash_delete(channel->variables, varname);
if (!switch_strlen_zero(value)) {
- switch_core_hash_insert_dup_locked(channel->variables, varname, value, channel->flag_mutex);
- } else {
- switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
- }
+ switch_core_hash_insert_dup(channel->variables, varname, value);
+ }
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
}
1
0
Author: anthm
Date: Mon Sep 24 12:10:12 2007
New Revision: 5749
Modified:
freeswitch/trunk/src/switch_channel.c
Log:
fix for FSCORE-51 (maybe)
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Mon Sep 24 12:10:12 2007
@@ -360,7 +360,7 @@
{
assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- switch_core_hash_insert_dup(channel->private_hash, switch_core_session_strdup(channel->session, key), private_info);
+ switch_core_hash_insert_dup_locked(channel->private_hash, switch_core_session_strdup(channel->session, key), private_info, channel->flag_mutex);
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
}
@@ -400,11 +400,12 @@
if (varname) {
switch_mutex_lock(channel->profile_mutex);
- switch_core_hash_delete(channel->variables, varname);
+ switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
if (!switch_strlen_zero(value)) {
- switch_core_hash_insert_dup(channel->variables, varname, switch_clean_string(switch_core_session_strdup(channel->session, value)));
+ switch_core_hash_insert_dup_locked(channel->variables, varname,
+ switch_clean_string(switch_core_session_strdup(channel->session, value)), channel->flag_mutex);
} else {
- switch_core_hash_delete(channel->variables, varname);
+ switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
}
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
@@ -419,11 +420,11 @@
if (varname) {
switch_mutex_lock(channel->profile_mutex);
- switch_core_hash_delete(channel->variables, varname);
+ switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
if (!switch_strlen_zero(value)) {
- switch_core_hash_insert_dup(channel->variables, varname, value);
+ switch_core_hash_insert_dup_locked(channel->variables, varname, value, channel->flag_mutex);
} else {
- switch_core_hash_delete(channel->variables, varname);
+ switch_core_hash_delete_locked(channel->variables, varname, channel->flag_mutex);
}
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
1
0