diff --git a/acinclude.m4 b/acinclude.m4 index 9190dcdc9e..cb690dfa04 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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]) diff --git a/build/config/ax_check_java.m4 b/build/config/ax_check_java.m4 new file mode 100644 index 0000000000..efee0782ab --- /dev/null +++ b/build/config/ax_check_java.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 ]] + ), + 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 ]] + ), + 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) +]) + + diff --git a/build/modules.conf.in b/build/modules.conf.in index 22fa0cc1ea..7520cb1221 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -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 diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml index 71059d3537..6a5d67759d 100644 --- a/conf/freeswitch.xml +++ b/conf/freeswitch.xml @@ -117,6 +117,7 @@ + diff --git a/conf/java.conf.xml b/conf/java.conf.xml new file mode 100644 index 0000000000..985b90d889 --- /dev/null +++ b/conf/java.conf.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/conf/modules.conf.xml b/conf/modules.conf.xml index 70ec2b4c18..b0e3fd2389 100644 --- a/conf/modules.conf.xml +++ b/conf/modules.conf.xml @@ -63,6 +63,7 @@ + diff --git a/configure.in b/configure.in index f4a06069ba..bc11de5758 100644 --- a/configure.in +++ b/configure.in @@ -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]) diff --git a/src/mod/languages/mod_java/Makefile.in b/src/mod/languages/mod_java/Makefile.in new file mode 100644 index 0000000000..9bf063df8b --- /dev/null +++ b/src/mod/languages/mod_java/Makefile.in @@ -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 + diff --git a/src/mod/languages/mod_java/freeswitch_java.cpp b/src/mod/languages/mod_java/freeswitch_java.cpp new file mode 100644 index 0000000000..cff737b120 --- /dev/null +++ b/src/mod/languages/mod_java/freeswitch_java.cpp @@ -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, "", "()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; +} + diff --git a/src/mod/languages/mod_java/freeswitch_java.h b/src/mod/languages/mod_java/freeswitch_java.h new file mode 100644 index 0000000000..62c3c7365e --- /dev/null +++ b/src/mod/languages/mod_java/freeswitch_java.h @@ -0,0 +1,26 @@ +#ifndef FREESWITCH_JAVA_H +#define FREESWITCH_JAVA_H + +#include +#include + +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 + diff --git a/src/mod/languages/mod_java/mod_java.c b/src/mod/languages/mod_java/mod_java.c new file mode 100644 index 0000000000..028170559b --- /dev/null +++ b/src/mod/languages/mod_java/mod_java.c @@ -0,0 +1,300 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2007, Damjan Jovanovic + * + * 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 + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Damjan Jovanovic + * + * + * mod_java.c -- Java Module + * + */ + +#include +#include + + +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; +} + + diff --git a/src/mod/languages/mod_java/mod_java.i b/src/mod/languages/mod_java/mod_java.i new file mode 100644 index 0000000000..bca6c0b17b --- /dev/null +++ b/src/mod/languages/mod_java/mod_java.i @@ -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 + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/DTMFCallback.java b/src/mod/languages/mod_java/src/org/freeswitch/DTMFCallback.java new file mode 100644 index 0000000000..cba00c203d --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/DTMFCallback.java @@ -0,0 +1,7 @@ +package org.freeswitch; + +public interface DTMFCallback +{ + String onDTMF(Object input, int inputType, String args); +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/Event.java b/src/mod/languages/mod_java/src/org/freeswitch/Event.java new file mode 100644 index 0000000000..849490be70 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/Event.java @@ -0,0 +1,30 @@ +package org.freeswitch; + +import java.util.*; + +public class Event +{ + private String m_body; + private TreeMap m_headers = new TreeMap(); + + 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 getHeaders() + { + return m_headers; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/FreeswitchScript.java b/src/mod/languages/mod_java/src/org/freeswitch/FreeswitchScript.java new file mode 100644 index 0000000000..4f0b8cc560 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/FreeswitchScript.java @@ -0,0 +1,7 @@ +package org.freeswitch; + +public interface FreeswitchScript +{ + void run(String uuid, String args); +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/HangupHook.java b/src/mod/languages/mod_java/src/org/freeswitch/HangupHook.java new file mode 100644 index 0000000000..5a3a0a53c7 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/HangupHook.java @@ -0,0 +1,8 @@ +package org.freeswitch; + +public interface HangupHook +{ + /** Called on hangup, usually in a different thread. */ + public void onHangup(); +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/Launcher.java b/src/mod/languages/mod_java/src/org/freeswitch/Launcher.java new file mode 100644 index 0000000000..5bdc2937c4 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/Launcher.java @@ -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); + } +} diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java new file mode 100644 index 0000000000..6a15476c92 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java @@ -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); + } + +} diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/JavaSession.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/JavaSession.java new file mode 100644 index 0000000000..89914bfc41 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/JavaSession.java @@ -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); + } + +} diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_JavaVM.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_JavaVM.java new file mode 100644 index 0000000000..031062beb8 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_JavaVM.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_state_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_state_t.java new file mode 100644 index 0000000000..379dc7d156 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_state_t.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_t.java new file mode 100644 index 0000000000..bffc3cada4 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_channel_t.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_core_session_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_core_session_t.java new file mode 100644 index 0000000000..c20e357e00 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_core_session_t.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_args_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_args_t.java new file mode 100644 index 0000000000..0413e997fe --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_args_t.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_type_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_type_t.java new file mode 100644 index 0000000000..e6e9d8fdeb --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_input_type_t.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_status_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_status_t.java new file mode 100644 index 0000000000..82c9f52e7b --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_status_t.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_void.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_void.java new file mode 100644 index 0000000000..179b210c22 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_void.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java new file mode 100644 index 0000000000..33e4c8a5ab --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitch.java @@ -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); + } + +} diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java new file mode 100644 index 0000000000..942b4dc428 --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -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); +} diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/input_callback_state_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/input_callback_state_t.java new file mode 100644 index 0000000000..e19dddfb8d --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/input_callback_state_t.java @@ -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); + } + +} diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/session_flag_t.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/session_flag_t.java new file mode 100644 index 0000000000..480375727d --- /dev/null +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/session_flag_t.java @@ -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; + } +} + diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp new file mode 100644 index 0000000000..13fd5d14b4 --- /dev/null +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -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 SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& 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& 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 +#include +#include + + +/* 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 +