initial import of mod_java from Damjan Jovanovic
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5755 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
2066263064
commit
e69fe7e336
|
@ -5,5 +5,6 @@ m4_include([build/config/ax_check_compiler_flags.m4])
|
|||
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])
|
||||
|
|
|
@ -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)
|
||||
])
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ formats/mod_native_file
|
|||
formats/mod_sndfile
|
||||
#formats/mod_shout
|
||||
#formats/mod_local_stream
|
||||
#languages/mod_java
|
||||
#languages/mod_perl
|
||||
#languages/mod_python
|
||||
#languages/mod_spidermonkey
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
<!-- Languages -->
|
||||
<!--#include "spidermonkey.conf.xml"-->
|
||||
<!-- none for mod_perl -->
|
||||
<!--#include "java.conf.xml"-->
|
||||
|
||||
<!-- ASR /TTS -->
|
||||
<!-- none for mod_cepstral -->
|
||||
|
|
|
@ -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>
|
|
@ -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"/> -->
|
||||
|
|
|
@ -337,6 +337,7 @@ AC_ARG_ENABLE(core-libedit-support,
|
|||
|
||||
#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 @@ AC_CONFIG_FILES([Makefile
|
|||
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])
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package org.freeswitch;
|
||||
|
||||
public interface DTMFCallback
|
||||
{
|
||||
String onDTMF(Object input, int inputType, String args);
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package org.freeswitch;
|
||||
|
||||
public interface FreeswitchScript
|
||||
{
|
||||
void run(String uuid, String args);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package org.freeswitch;
|
||||
|
||||
public interface HangupHook
|
||||
{
|
||||
/** Called on hangup, usually in a different thread. */
|
||||
public void onHangup();
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue