diff --git a/.gitignore b/.gitignore index 758d33e4bac5818354688aa8812a669ef3cc8e61..9b9578f4ce617a7235485bc296c62418ea92d1c5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,14 +12,7 @@ tags TAGS.LST ID -src/org/sflphone/views/paralloidviews/ -src/org/sflphone/views/paralloid - AndroidUnusedResources1.6.2.jar - -jni/pjproject-android/build -jni/pjproject-android/pjsip/build/.pjsua2-lib-arm-unknown-linux-androideabi.depend -jni/pjproject-android/pjsip/build/.pjsua2-test-arm-unknown-linux-androideabi.depend .classpath .project .settings/org.eclipse.jdt.core.prefs diff --git a/Makefile b/Makefile index 8d086d24f0f8a430f33ad23b8b05880d28cd6a52..77e82f25dc318d1cdd472b7e4a461fe8b87adbdb 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ apkclean: rm -f $(SFLPHONE_APK) lightclean: - cd $(SRC) && rm -rf libs obj bin $(SFLPHONE_APK) + cd $(SRC) && rm -rf libs/armeabi-v7a libs/x86 libs/mips obj bin $(SFLPHONE_APK) clean: lightclean rm -rf $(SRC)/gen java-libs/*/gen java-libs/*/bin .sdk vlc-sdk/ vlc-sdk.7z diff --git a/sflphone-android/.gitignore b/sflphone-android/.gitignore index 9eac1f8508674c1913e8ba6082923e98721a3f04..6288f7f0a8b6a1d7c6176e5454625988935ad77b 100644 --- a/sflphone-android/.gitignore +++ b/sflphone-android/.gitignore @@ -3,7 +3,7 @@ /jni/obj /libs /bin -/gen +gen/ /out /.idea *.swp @@ -28,6 +28,12 @@ local.properties .settings/org.eclipse.ltk.core.refactoring.prefs SFLPhone.iml +jni/sflphone_wrapper.cpp +jni/sflphone_wrapper.h +jni/sflphoneservice_loader.c + + + ant.properties *.keystore SFLPhoneservice* diff --git a/sflphone-android/jni/Android.mk b/sflphone-android/jni/Android.mk index f6051da0438af32bd50fea10b786cabfb2770148..760ee5d34343312fb3101be0645072ab9c9acec4 100644 --- a/sflphone-android/jni/Android.mk +++ b/sflphone-android/jni/Android.mk @@ -27,142 +27,30 @@ # shall include the source code for the parts of OpenSSL used as well # as that of the covered work. - LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) -LOCAL_CODECS_PATH = $(LOCAL_PATH)/sflphone/daemon/src/audio/codecs -LOCAL_SRC_PATH = $(LOCAL_PATH)/sflphone/daemon/src +LOCAL_CODECS_PATH = $(SFLPHONE_SRC)/daemon/src/audio/codecs +LOCAL_SRC_PATH = $(SFLPHONE_SRC)/daemon/src include $(call all-subdir-makefiles) include $(CLEAR_VARS) -# FIXME VERSION="1.1.0" MY_PREFIX=/sdcard MY_DATADIR=/data/data -MY_PJPROJECT=sflphone/daemon/libs/pjproject-2.2.1 -MY_COMMONCPP=libucommon/sources -MY_CCRTP=libccrtp/sources -MY_OPENSSL=libopenssl -MY_SPEEX=libspeex/sources -MY_LIBZRTPCPP=libzrtp/sources - -# FIXME: It would be cool to call the swig script automatically -#$(shell $(LOCAL_PATH)/../make-swig.sh) LOCAL_CPPFLAGS += -frtti LOCAL_CPPFLAGS += -fexceptions -LOCAL_SRC_FILES := \ - $(LOCAL_SRC_PATH)/conference.cpp \ - $(LOCAL_SRC_PATH)/voiplink.cpp \ - $(LOCAL_SRC_PATH)/preferences.cpp \ - $(LOCAL_SRC_PATH)/managerimpl.cpp \ - $(LOCAL_SRC_PATH)/manager.cpp \ - $(LOCAL_SRC_PATH)/eventthread.cpp \ - $(LOCAL_SRC_PATH)/call.cpp \ - $(LOCAL_SRC_PATH)/account.cpp \ - $(LOCAL_SRC_PATH)/numbercleaner.cpp \ - $(LOCAL_SRC_PATH)/fileutils.cpp \ - $(LOCAL_SRC_PATH)/ip_utils.cpp \ - $(LOCAL_SRC_PATH)/threadloop.cpp \ - $(LOCAL_SRC_PATH)/audio/audioloop.cpp \ - $(LOCAL_SRC_PATH)/audio/ringbuffer.cpp \ - $(LOCAL_SRC_PATH)/audio/mainbuffer.cpp \ - $(LOCAL_SRC_PATH)/audio/audiorecord.cpp \ - $(LOCAL_SRC_PATH)/audio/audiobuffer.cpp \ - $(LOCAL_SRC_PATH)/audio/audiorecorder.cpp \ - $(LOCAL_SRC_PATH)/audio/recordable.cpp \ - $(LOCAL_SRC_PATH)/audio/audiolayer.cpp \ - $(LOCAL_SRC_PATH)/audio/resampler.cpp \ - $(LOCAL_SRC_PATH)/audio/dcblocker.cpp \ - $(LOCAL_SRC_PATH)/audio/opensl/opensllayer.cpp \ - $(LOCAL_SRC_PATH)/audio/sound/audiofile.cpp \ - $(LOCAL_SRC_PATH)/audio/sound/tone.cpp \ - $(LOCAL_SRC_PATH)/audio/sound/tonelist.cpp \ - $(LOCAL_SRC_PATH)/audio/sound/dtmf.cpp \ - $(LOCAL_SRC_PATH)/audio/dsp.cpp \ - $(LOCAL_SRC_PATH)/audio/sound/dtmfgenerator.cpp \ - $(LOCAL_SRC_PATH)/audio/codecs/audiocodecfactory.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/audio_rtp_session.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/audio_symmetric_rtp_session.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/audio_rtp_stream.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/audio_rtp_factory.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/audio_srtp_session.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/base64.c \ - $(LOCAL_SRC_PATH)/audio/audiortp/dtmf_event.cpp \ - $(LOCAL_SRC_PATH)/config/sfl_config.cpp \ - $(LOCAL_SRC_PATH)/config/yamlemitter.cpp \ - $(LOCAL_SRC_PATH)/config/yamlparser.cpp \ - $(LOCAL_SRC_PATH)/config/yamlnode.cpp \ - $(LOCAL_SRC_PATH)/client/client.cpp \ - $(LOCAL_SRC_PATH)/client/callmanager.cpp \ - $(LOCAL_SRC_PATH)/client/android/callmanager_jni.cpp \ - $(LOCAL_SRC_PATH)/client/configurationmanager.cpp \ - $(LOCAL_SRC_PATH)/client/android/configurationmanager_jni.cpp \ - $(LOCAL_SRC_PATH)/client/presencemanager.cpp \ - $(LOCAL_SRC_PATH)/client/android/presencemanager_jni.cpp \ - $(LOCAL_SRC_PATH)/client/android/callmanager_wrap.cpp \ - $(LOCAL_SRC_PATH)/history/historyitem.cpp \ - $(LOCAL_SRC_PATH)/history/history.cpp \ - $(LOCAL_SRC_PATH)/history/historynamecache.cpp \ - $(LOCAL_SRC_PATH)/hooks/urlhook.cpp \ - $(LOCAL_SRC_PATH)/im/instant_messaging.cpp \ - $(LOCAL_SRC_PATH)/sip/sdp.cpp \ - $(LOCAL_SRC_PATH)/sip/sipaccount.cpp \ - $(LOCAL_CODECS_PATH)/audiocodec.cpp \ - $(LOCAL_SRC_PATH)/sip/sipcall.cpp \ - $(LOCAL_SRC_PATH)/sip/sipvoiplink.cpp \ - $(LOCAL_SRC_PATH)/sip/siptransport.cpp \ - $(LOCAL_SRC_PATH)/sip/sip_utils.cpp \ - $(LOCAL_SRC_PATH)/sip/sippresence.cpp \ - $(LOCAL_SRC_PATH)/sip/pattern.cpp \ - $(LOCAL_SRC_PATH)/sip/sdes_negotiator.cpp \ - $(LOCAL_SRC_PATH)/sip/pres_sub_client.cpp \ - $(LOCAL_SRC_PATH)/sip/pres_sub_server.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/audio_zrtp_session.cpp \ - $(LOCAL_SRC_PATH)/audio/audiortp/zrtp_session_callback.cpp \ - $(LOCAL_SRC_PATH)/iax/iaxvoiplink.cpp \ - $(LOCAL_SRC_PATH)/iax/iaxaccount.cpp \ - $(LOCAL_SRC_PATH)/iax/iaxcall.cpp \ - $(LOCAL_SRC_PATH)/utf8_utils.cpp +LOCAL_SRC_FILES := $(LOCAL_SRC_PATH)/sflphone_api.cpp \ + sflphone_wrapper.cpp -# FIXME -LOCAL_C_INCLUDES += $(LOCAL_SRC_PATH)/.. \ - $(LOCAL_SRC_PATH) \ - $(LOCAL_SRC_PATH)/audio \ - $(LOCAL_SRC_PATH)/audio/opensl \ - $(LOCAL_SRC_PATH)/audio/sound \ - $(LOCAL_SRC_PATH)/audio/codecs \ - $(LOCAL_SRC_PATH)/audio/audiortp \ - $(LOCAL_SRC_PATH)/config \ - $(LOCAL_SRC_PATH)/client/android \ - $(LOCAL_SRC_PATH)/history \ - $(LOCAL_SRC_PATH)/hooks \ - $(LOCAL_SRC_PATH)/im \ - $(LOCAL_SRC_PATH)/sip \ - $(MY_SPEEX) \ - $(MY_SPEEX)/include \ - $(MY_LIBYAML)/inc \ - $(MY_LIBZRTPCPP) \ - $(MY_LIBZRTPCPP)/src \ - $(MY_LIBZRTPCPP)/src/libzrtpcpp \ - $(MY_CCRTP)/src \ - $(MY_LIBSAMPLE)/src \ - $(MY_OPENSSL)/include \ - $(MY_PJPROJECT)/pjsip/include \ - $(MY_PJPROJECT)/pjlib/include \ - $(MY_PJPROJECT)/pjlib-util/include \ - $(MY_PJPROJECT)/pjmedia/include \ - $(MY_PJPROJECT)/pjnath/include \ - $(MY_LIBEXPAT) \ - libsndfile/sources/src \ - libpcre/sources \ - $(MY_COMMONCPP)/inc \ - $(LOCAL_SRC_PATH)/../libs/iax2 \ - $(LOCAL_SRC_PATH)/iax \ +LOCAL_C_INCLUDES += $(LOCAL_SRC_PATH) \ + $(SFLPHONE_SRC)/daemon \ + $(SFLPHONE_SRC)/contrib/$(TARGET_TUPLE)/include -LOCAL_MODULE := libsflphone +LOCAL_MODULE := libsflphonejni LOCAL_CPPFLAGS += $(NETWORKMANAGER) \ -DCCPP_PREFIX \ @@ -179,9 +67,6 @@ LOCAL_CPPFLAGS += $(NETWORKMANAGER) \ -DDEBUG_DIRECTOR_OWNED \ -DPJ_AUTOCONF=1 -LOCAL_CFLAGS := $(MY_PJSIP_FLAGS) - - LOCAL_LDLIBS += -lz \ -llog \ -lOpenSLES \ @@ -213,91 +98,3 @@ LOCAL_STATIC_LIBRARIES += pjsip \ include $(BUILD_SHARED_LIBRARY) -############# ulaw ############### - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(LOCAL_CODECS_PATH)/ulaw.cpp \ - $(LOCAL_CODECS_PATH)/audiocodec.cpp - -# FIXME -LOCAL_C_INCLUDES += $(LOCAL_CODECS_PATH)/.. \ - $(LOCAL_CODECS_PATH)/../.. \ - $(APP_PROJECT_PATH)/jni/$(MY_CCRTP)/src \ - $(APP_PROJECT_PATH)/jni/$(MY_COMMONCPP)/inc - -LOCAL_MODULE := libcodec_ulaw - -LOCAL_LDLIBS := -llog - -LOCAL_CPPFLAGS += $(NETWORKMANAGER) \ - -DCCPP_PREFIX \ - -DPREFIX=\"$(MY_PREFIX)\" \ - -DPROGSHAREDIR=\"${MY_DATADIR}/sflphone\" \ - -std=c++11 -frtti -fpermissive -fexceptions \ - -DAPP_NAME=\"codec_ulaw\" - -include $(BUILD_SHARED_LIBRARY) - - - -############# alaw ############### - -include $(CLEAR_VARS) - - - -LOCAL_SRC_FILES := $(LOCAL_CODECS_PATH)/alaw.cpp \ - $(LOCAL_CODECS_PATH)/audiocodec.cpp - -LOCAL_C_INCLUDES += $(LOCAL_CODECS_PATH)/.. \ - $(LOCAL_CODECS_PATH)/../.. \ - $(APP_PROJECT_PATH)/jni/$(MY_CCRTP)/src \ - $(APP_PROJECT_PATH)/jni/$(MY_COMMONCPP)/inc \ - -LOCAL_MODULE := libcodec_alaw - -LOCAL_LDLIBS := -llog - -LOCAL_CPPFLAGS += $(NETWORKMANAGER) \ - -DCCPP_PREFIX \ - -DPREFIX=\"$(MY_PREFIX)\" \ - -DPROGSHAREDIR=\"${MY_DATADIR}/sflphone\" \ - -std=c++11 -frtti -fpermissive -fexceptions \ - -DAPP_NAME=\"codec_alaw\" - -LOCAL_LDFLAGS += -Wl,--export-dynamic - -include $(BUILD_SHARED_LIBRARY) - - -############# g722 ############### - -include $(CLEAR_VARS) - - - -LOCAL_SRC_FILES := $(LOCAL_CODECS_PATH)/g722.cpp \ - $(LOCAL_CODECS_PATH)/audiocodec.cpp - -LOCAL_C_INCLUDES += $(LOCAL_CODECS_PATH)/.. \ - $(LOCAL_CODECS_PATH)/../.. \ - $(LOCAL_CODECS_PATH)/../../.. \ - $(APP_PROJECT_PATH)/jni/$(MY_CCRTP)/src \ - $(APP_PROJECT_PATH)/jni/$(MY_COMMONCPP)/inc - -LOCAL_MODULE := libcodec_g722 - -LOCAL_LDLIBS := -llog - -LOCAL_CPPFLAGS += $(NETWORKMANAGER) \ - -DCCPP_PREFIX \ - -DCODECS_DIR=\"/usr/lib/sflphone/audio/codec\" \ - -DPREFIX=\"$(MY_PREFIX)\" \ - -DPROGSHAREDIR=\"${MY_DATADIR}/sflphone\" \ - -DHAVE_CONFIG_H \ - -std=c++11 -frtti -fpermissive -fexceptions \ - -DAPP_NAME=\"codecfactory\" - -include $(BUILD_SHARED_LIBRARY) - diff --git a/sflphone-android/jni/Application.mk b/sflphone-android/jni/Application.mk index 5d933ee798a7075b5180c209a21011862958c27e..3d569aaaae7b9c7e9eb7cf3a0f562d1277a092fa 100644 --- a/sflphone-android/jni/Application.mk +++ b/sflphone-android/jni/Application.mk @@ -32,12 +32,10 @@ APP_PLATFORM := android-14 APP_OPTIM := debug -NDK_DEBUG := 1 -APP_STL := gnustl_shared -APP_ABI := armeabi-v7a x86 +APP_ABI := ${ANDROID_ABI} NDK_TOOLCHAIN_VERSION := 4.8 -APP_MODULES += libcodec_ulaw -APP_MODULES += libcodec_alaw -APP_MODULES += libcodec_g722 -APP_MODULES += libsflphone +#APP_MODULES += libcodec_ulaw +#APP_MODULES += libcodec_alaw +#APP_MODULES += libcodec_g722 +APP_MODULES += libsflphonejni diff --git a/sflphone-android/jni/callmanager.i b/sflphone-android/jni/callmanager.i index a1d168f31cac6e170917ee6843b549700ac03230..127c89b9be5e63de56260664812ca080e2e6d5f3 100644 --- a/sflphone-android/jni/callmanager.i +++ b/sflphone-android/jni/callmanager.i @@ -30,137 +30,76 @@ %header %{ -#include "client/callmanager.h" +#include "sflphone.h" -typedef struct callmanager_callback -{ - void (*on_new_call_created)(const std::string& accountID, - const std::string& callID, - const std::string& to); +class CallManagerCallback { +public: + static void on_new_call_created(const std::string& arg1, + const std::string& arg2, + const std::string& arg3); - void (*on_call_state_changed)(const std::string& callID, - const std::string& state); + static void on_call_state_changed(const std::string& arg1, + const std::string& arg2); - void (*on_incoming_call)(const std::string& accountID, - const std::string& callID, - const std::string& from); + static void on_incoming_call(const std::string& arg1, + const std::string& arg2, + const std::string& arg3); - void (*on_transfer_state_changed) (const std::string& result); + static void on_transfer_state_changed(const std::string& arg1); - void (*on_conference_created) (const std::string& confID); + static void on_conference_created(const std::string& arg1); - void (*on_conference_removed) (const std::string& confID); + static void on_conference_removed(const std::string& arg1); - void (*on_conference_state_changed) (const std::string& confID, - const std::string& state); + static void on_conference_state_changed(const std::string& arg1, + const std::string& arg2); - void (*on_incoming_message) (const std::string& ID, + static void on_incoming_message(const std::string& ID, const std::string& from, const std::string& msg); - void (*on_record_playback_filepath) (const std::string& id, - const std::string& filename); + static void on_record_playback_filepath(const std::string& id, + const std::string& filename); - void (*on_recording_state_changed) (const std::string& callID, - const bool& state); + static void on_recording_state_changed(const std::string& callID, + const bool& state); - void (*newPresSubClientNotification) (const std::string& uri, - const std::string& basic, - const std::string& note); + static void newPresSubClientNotification(const std::string& uri, + const std::string& basic, + const std::string& note); - void (*newPresSubServerRequest) (const std::string& remote); + static void newPresSubServerRequest(const std::string& remote); - void (*on_secure_sdes_on) (const std::string& callID); + static void on_secure_sdes_on(const std::string& callID); - void (*on_secure_sdes_off) (const std::string& callID); + static void on_secure_sdes_off(const std::string& callID); - void (*on_secure_zrtp_on) (const std::string& callID, + static void on_secure_zrtp_on(const std::string& callID, const std::string& cipher); - void (*on_secure_zrtp_off) (const std::string& callID); + static void on_secure_zrtp_off(const std::string& callID); - void (*on_show_sas) (const std::string& callID, + static void on_show_sas(const std::string& callID, const std::string& sas, const bool& verified); - void (*on_zrtp_not_supported) (const std::string& callID); + static void on_zrtp_not_supported(const std::string& callID); - void (*on_zrtp_negociation_failed) (const std::string& callID, + static void on_zrtp_negociation_failed(const std::string& callID, const std::string& reason, const std::string& severity); - void (*on_rtcp_report_received) (const std::string& callID, + static void on_rtcp_report_received (const std::string& callID, const std::map<std::string, int>& stats); -} callmanager_callback_t; - - -class Callback { -public: - virtual ~Callback() {} - - virtual void on_new_call_created(const std::string& arg1, - const std::string& arg2, - const std::string& arg3) {} - - virtual void on_call_state_changed(const std::string& arg1, - const std::string& arg2) {} - - virtual void on_incoming_call(const std::string& arg1, - const std::string& arg2, - const std::string& arg3) {} - - virtual void on_transfer_state_changed (const std::string& arg1) {} - - virtual void on_conference_created (const std::string& arg1) {} - - virtual void on_conference_removed (const std::string& arg1) {} - - virtual void on_conference_state_changed (const std::string& arg1, - const std::string& arg2) {} - - virtual void on_incoming_message(const std::string& ID, - const std::string& from, - const std::string& msg) {} - - virtual void on_record_playback_filepath(const std::string& id, - const std::string& filename) {} - - virtual void on_recording_state_changed(const std::string& callID, - const bool& state) {} - - virtual void newPresSubClientNotification(const std::string& uri, - const std::string& basic, - const std::string& note) {} - - virtual void newPresSubServerRequest(const std::string& remote) {} - - virtual void on_secure_sdes_on(const std::string& callID) {} - - virtual void on_secure_sdes_off(const std::string& callID) {} - - virtual void on_secure_zrtp_on(const std::string& callID, - const std::string& cipher) {} - - virtual void on_secure_zrtp_off(const std::string& callID) {} - - virtual void on_show_sas(const std::string& callID, - const std::string& sas, - const bool& verified) {} - - virtual void on_zrtp_not_supported(const std::string& callID) {} - - virtual void on_zrtp_negociation_failed(const std::string& callID, - const std::string& reason, - const std::string& severity) {} - - virtual void on_rtcp_report_received (const std::string& callID, - const std::map<std::string, int>& stats) {} }; +static CallManagerCallback* registeredCallbackObject = NULL; -static Callback* registeredCallbackObject = NULL; +void setCallbackObject(CallManagerCallback* callback) { + registeredCallbackObject = callback; +} void on_new_call_created_wrapper (const std::string& accountID, const std::string& callID, @@ -248,7 +187,7 @@ void on_rtcp_report_received_wrapper (const std::string& callID, const std::map< registeredCallbackObject->on_rtcp_report_received(callID, stats); } -static struct callmanager_callback wrapper_callback_struct = { +static struct sflph_call_ev_handlers wrapper_callback_struct = { &on_new_call_created_wrapper, &on_call_state_changed_wrapper, &on_incoming_call_wrapper, @@ -271,133 +210,49 @@ static struct callmanager_callback wrapper_callback_struct = { &on_rtcp_report_received_wrapper }; -void setCallbackObject(Callback* callback) { - registeredCallbackObject = callback; -} - %} -%feature("director") Callback; +%feature("director") CallManagerCallback; + +bool sflph_call_place(const std::string& account_id, const std::string& call_id, const std::string& to); +bool sflph_call_refuse(const std::string& call_id); +bool sflph_call_accept(const std::string& call_id); +bool sflph_call_hang_up(const std::string& call_id); +bool sflph_call_hold(const std::string& call_id); +bool sflph_call_unhold(const std::string& call_id); +bool sflph_call_transfer(const std::string& call_id, const std::string& to); +bool sflph_call_attended_transfer(const std::string& transfer_id, const std::string& target_id); +std::map<std::string, std::string> sflph_call_get_call_details(const std::string& call_id); +std::vector<std::string> sflph_call_get_call_list(void); +void sflph_call_remove_conference(const std::string& conf_id); +bool sflph_call_join_participant(const std::string& sel_call_id, const std::string& drag_call_id); +void sflph_call_create_conf_from_participant_list(const std::vector<std::string>& participants); +bool sflph_call_is_conference_participant(const std::string& call_id); +bool sflph_call_add_participant(const std::string& call_id, const std::string& conf_id); +bool sflph_call_add_main_participant(const std::string& conf_id); +bool sflph_call_detach_participant(const std::string& call_id); +bool sflph_call_join_conference(const std::string& sel_conf_id, const std::string& drag_conf_id); +bool sflph_call_hang_up_conference(const std::string& conf_id); +bool sflph_call_hold_conference(const std::string& conf_id); +bool sflph_call_unhold_conference(const std::string& conf_id); +std::vector<std::string> sflph_call_get_conference_list(void); +std::vector<std::string> sflph_call_get_participant_list(const std::string& conf_id); +std::vector<std::string> sflph_call_get_display_names(const std::string& conf_id); +std::string sflph_call_get_conference_id(const std::string& call_id); +std::map<std::string, std::string> sflph_call_get_conference_details(const std::string& call_id); +bool sflph_call_play_recorded_file(const std::string& path); +void sflph_call_stop_recorded_file(const std::string& path); +bool sflph_call_toggle_recording(const std::string& call_id); +void sflph_call_set_recording(const std::string& call_id); +void sflph_call_record_playback_seek(double pos); +bool sflph_call_is_recording(const std::string& call_id); +std::string sflph_call_get_current_audio_codec_name(const std::string& call_id); +void sflph_call_play_dtmf(const std::string& key); +void sflph_call_start_tone(int start, int type); +void sflph_call_set_sas_verified(const std::string& call_id); +void sflph_call_reset_sas_verified(const std::string& call_id); +void sflph_call_set_confirm_go_clear(const std::string& call_id); +void sflph_call_request_go_clear(const std::string& call_id); +void sflph_call_accept_enrollment(const std::string& call_id, bool accepted); +void sflph_call_send_text_message(const std::string& call_id, const std::string& message); -class CallManager { -public: - bool placeCall(const std::string& accountID, const std::string& callID, const std::string& to); - - bool refuse(const std::string& callID); - bool accept(const std::string& callID); - bool hangUp(const std::string& callID); - bool hold(const std::string& callID); - bool unhold(const std::string& callID); - bool transfer(const std::string& callID, const std::string& to); - bool attendedTransfer(const std::string& transferID, const std::string& targetID); - std::map< std::string, std::string > getCallDetails(const std::string& callID); - std::vector< std::string > getCallList(); - - /* Conference related methods */ - void removeConference(const std::string& conference_id); - bool joinParticipant(const std::string& sel_callID, const std::string& drag_callID); - void createConfFromParticipantList(const std::vector< std::string >& participants); - bool isConferenceParticipant(const std::string& call_id); - bool addParticipant(const std::string& callID, const std::string& confID); - bool addMainParticipant(const std::string& confID); - bool detachParticipant(const std::string& callID); - bool joinConference(const std::string& sel_confID, const std::string& drag_confID); - bool hangUpConference(const std::string& confID); - bool holdConference(const std::string& confID); - bool unholdConference(const std::string& confID); - std::vector<std::string> getConferenceList(); - std::vector<std::string> getParticipantList(const std::string& confID); - std::string getConferenceId(const std::string& callID); - std::map<std::string, std::string> getConferenceDetails(const std::string& callID); - - /* File Playback methods */ - bool startRecordedFilePlayback(const std::string& filepath); - void stopRecordedFilePlayback(const std::string& filepath); - - /* General audio methods */ - bool toggleRecording(const std::string& callID); - void recordPlaybackSeek(const double& value); - bool getIsRecording(const std::string& callID); - std::string getCurrentAudioCodecName(const std::string& callID); - void playDTMF(const std::string& key); - void startTone(const int32_t& start, const int32_t& type); - - /* Security related methods */ - void setSASVerified(const std::string& callID); - void resetSASVerified(const std::string& callID); - void setConfirmGoClear(const std::string& callID); - void requestGoClear(const std::string& callID); - void acceptEnrollment(const std::string& callID, const bool& accepted); - - /* Instant messaging */ - void sendTextMessage(const std::string& callID, const std::string& message); -}; - -class Callback { -public: - virtual ~Callback(); - - virtual void on_new_call_created(const std::string& arg1, - const std::string& arg2, - const std::string& arg3); - - virtual void on_call_state_changed(const std::string& arg1, - const std::string& arg2); - - virtual void on_incoming_call(const std::string& arg1, - const std::string& arg2, - const std::string& arg3); - - virtual void on_transfer_state_changed(const std::string& arg1); - - virtual void on_conference_created(const std::string& arg1); - - virtual void on_conference_removed(const std::string& arg1); - - virtual void on_conference_state_changed(const std::string& arg1, - const std::string& arg2); - - virtual void on_incoming_message(const std::string& ID, - const std::string& from, - const std::string& msg); - - virtual void on_record_playback_filepath(const std::string& id, - const std::string& filename); - - virtual void on_recording_state_changed(const std::string& callID, - const bool& state); - - virtual void newPresSubClientNotification(const std::string& uri, - const std::string& basic, - const std::string& note); - - virtual void newPresSubServerRequest(const std::string& remote); - - virtual void on_secure_sdes_on(const std::string& callID); - - virtual void on_secure_sdes_off(const std::string& callID); - - virtual void on_secure_zrtp_on(const std::string& callID, - const std::string& cipher); - - virtual void on_secure_zrtp_off(const std::string& callID); - - virtual void on_show_sas(const std::string& callID, - const std::string& sas, - const bool& verified); - - virtual void on_zrtp_not_supported(const std::string& callID); - - virtual void on_zrtp_negociation_failed(const std::string& callID, - const std::string& reason, - const std::string& severity); - - virtual void on_rtcp_report_received (const std::string& callID, - const std::map<std::string, int>& stats); -}; - -static Callback* registeredCallbackObject = NULL; - -void setCallbackObject(Callback* callback) { - registeredCallbackObject = callback; -} diff --git a/sflphone-android/jni/callmanager_jni.cpp b/sflphone-android/jni/callmanager_jni.cpp deleted file mode 100644 index 4adbad1b59def899a3506abad5afa19bb99b9627..0000000000000000000000000000000000000000 --- a/sflphone-android/jni/callmanager_jni.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. - * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> - * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> - * Author: Emeric Vigier <emeric.vigier@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "client/callmanager.h" -#include "jni_callbacks.h" - -CallManager::CallManager() -{} - -void CallManager::callStateChanged(const std::string& callID, const std::string& state) -{ - on_call_state_changed_wrapper(callID, state); -} - -void CallManager::transferFailed() -{ - -} - -void CallManager::transferSucceeded() -{ - -} - -void CallManager::recordPlaybackStopped(const std::string& path) -{ - -} - -void CallManager::voiceMailNotify(const std::string& callID, const int32_t& nd_msg) -{ - -} - -void CallManager::incomingMessage(const std::string& ID, const std::string& from, const std::string& msg) -{ - on_incoming_message_wrapper(ID, from, msg); -} - -void CallManager::incomingCall(const std::string& accountID, const std::string& callID, const std::string& from) -{ - on_incoming_call_wrapper(accountID, callID, from); -} - -void CallManager::recordPlaybackFilepath(const std::string& id, const std::string& filename) -{ - on_record_playback_filepath_wrapper(id, filename); -} - -void CallManager::conferenceCreated(const std::string& confID) -{ - on_conference_created_wrapper(confID); -} - -void CallManager::conferenceChanged(const std::string& confID,const std::string& state) -{ - on_conference_state_changed_wrapper(confID, state); -} - -void CallManager::conferenceRemoved(const std::string& confID) -{ - on_conference_removed_wrapper(confID); -} - -void CallManager::newCallCreated(const std::string& accountID, const std::string& callID, const std::string& to) -{ - on_new_call_created_wrapper(accountID, callID, to); -} - -void CallManager::sipCallStateChanged(const std::string& accoundID, const std::string& state, const int32_t& code) -{ - -} - -void CallManager::recordingStateChanged(const std::string& callID, const bool& state) -{ - on_recording_state_changed_wrapper(callID, state); -} - -void CallManager::updatePlaybackScale(const std::string&, const int32_t&, const int32_t&) -{ - -} - -void CallManager::secureSdesOn(std::string const& callID) -{ - on_secure_sdes_on_wrapper(callID); -} - -void CallManager::secureSdesOff(std::string const& callID) -{ - on_secure_sdes_off_wrapper(callID); -} - -void CallManager::secureZrtpOn(const std::string& callID, const std::string& cipher) -{ - on_secure_zrtp_on_wrapper(callID, cipher); -} - -void CallManager::secureZrtpOff(const std::string& callID) -{ - on_secure_zrtp_off_wrapper(callID); -} - -void CallManager::showSAS(const std::string& callID, const std::string& sas, const bool& verified) -{ - on_show_sas_wrapper(callID, sas, verified); -} - -void CallManager::zrtpNotSuppOther(const std::string& callID) -{ - on_zrtp_not_supported_wrapper(callID); -} - -void CallManager::zrtpNegotiationFailed(const std::string& callID, const std::string& reason, const std::string& severity) -{ - on_zrtp_negociation_failed_wrapper(callID, reason, severity); -} - -void CallManager::onRtcpReportReceived(const std::string& callID, const std::map<std::string, int>& stats) -{ - on_rtcp_report_received_wrapper(callID, stats); -} diff --git a/sflphone-android/jni/configurationmanager.i b/sflphone-android/jni/configurationmanager.i index 329ab0ce23400e2f0f662a3c4be3e991b225c4cb..5d2b1dee205e94daa670cfad42f0afd7e53168bf 100644 --- a/sflphone-android/jni/configurationmanager.i +++ b/sflphone-android/jni/configurationmanager.i @@ -28,28 +28,42 @@ */ %header %{ -#include "client/configurationmanager.h" - -typedef struct configurationmanager_callback -{ - void (*on_accounts_changed)(void); - void (*on_account_state_changed)(const std::string& accountID, const int32_t& state); - void (*on_account_state_changed_with_code)(const std::string& accountID, const std::string& state, const int32_t& code); - std::vector<int32_t> (*get_hardware_audio_format)(void); -} configurationmanager_callback_t; - +#include "sflphone.h" class ConfigurationCallback { public: - virtual ~ConfigurationCallback() {} - virtual void on_accounts_changed(void) {} - virtual void on_account_state_changed(const std::string& accountID, const int32_t& state) {} - virtual void on_account_state_changed_with_code(const std::string& accountID, const std::string& state, const int32_t& code) {} - virtual std::vector<int32_t> get_hardware_audio_format(void) {} + static void on_volume_changed(void); + static void on_accounts_changed(void); + static void on_history_change(void); + static void on_stun_status_failed(const std::string& accountID); + static void on_account_state_changed(const std::string& accountID, const int32_t& state); + static void on_account_state_changed_with_code(const std::string& accountID, const std::string& state, const int32_t& code); + static void on_error(int alert); + static std::vector<int32_t> get_hardware_audio_format(void); }; static ConfigurationCallback *registeredConfigurationCallbackObject = NULL; +void setConfigurationCallbackObject(ConfigurationCallback *callback) { + registeredConfigurationCallbackObject = callback; +} + +void on_volume_change_wrapper (void) { + +} + +void on_stun_status_fail_wrapper (const std::string& accountID) { + +} + +void on_history_change_wrapper (void) { + +} + +void on_error_wrapper (int alert) { + +} + void on_accounts_changed_wrapper (void) { registeredConfigurationCallbackObject->on_accounts_changed(); } @@ -66,119 +80,84 @@ std::vector<int32_t> get_hardware_audio_format_wrapper(void) { return registeredConfigurationCallbackObject->get_hardware_audio_format(); } -static struct configurationmanager_callback wrapper_configurationcallback_struct = { +static struct sflph_config_ev_handlers wrapper_configurationcallback_struct = { + &on_volume_change_wrapper, &on_accounts_changed_wrapper, + &on_history_change_wrapper, + &on_stun_status_fail_wrapper, &on_account_state_changed_wrapper, &on_account_state_changed_with_code_wrapper, + &on_error_wrapper, &get_hardware_audio_format_wrapper }; -void setConfigurationCallbackObject(ConfigurationCallback *callback) { - registeredConfigurationCallbackObject = callback; -} - %} %feature("director") ConfigurationCallback; -class ConfigurationManager { -public: - std::map< std::string, std::string > getAccountDetails(const std::string& accountID); - void setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details); - std::map<std::string, std::string> getAccountTemplate(); - std::string addAccount(const std::map< std::string, std::string >& details); - void removeAccount(const std::string& accountID); - std::vector< std::string > getAccountList(); - void sendRegister(const std::string& accountID, const bool& enable); - void registerAllAccounts(void); - - std::map< std::string, std::string > getTlsSettingsDefault(); - - std::vector< int32_t > getAudioCodecList(); - std::vector< std::string > getSupportedTlsMethod(); - std::vector< std::string > getAudioCodecDetails(const int32_t& payload); - std::vector< int32_t > getActiveAudioCodecList(const std::string& accountID); - - void setActiveAudioCodecList(const std::vector< std::string >& list, const std::string& accountID); - - std::vector< std::string > getAudioPluginList(); - void setAudioPlugin(const std::string& audioPlugin); - std::vector< std::string > getAudioOutputDeviceList(); - void setAudioOutputDevice(const int32_t& index); - void setAudioInputDevice(const int32_t& index); - void setAudioRingtoneDevice(const int32_t& index); - std::vector< std::string > getAudioInputDeviceList(); - std::vector< std::string > getCurrentAudioDevicesIndex(); - int32_t getAudioInputDeviceIndex(const std::string& name); - int32_t getAudioOutputDeviceIndex(const std::string& name); - std::string getCurrentAudioOutputPlugin(); - bool getNoiseSuppressState(); - void setNoiseSuppressState(const bool& state); - bool isAgcEnabled(); - void setAgcState(const bool& state); - bool isDtmfMuted(); - void muteDtmf(const bool& mute); - bool isCaptureMuted(); - void muteCapture(const bool& mute); - bool isPlaybackMuted(); - void mutePlayback(const bool& mute); - void setVolume(const std::string& device, const double& value); - double getVolume(const std::string& device); - - std::map<std::string, std::string> getRingtoneList(); - - std::string getAudioManager(); - bool setAudioManager(const std::string& api); - - int32_t isIax2Enabled(); - std::string getRecordPath(); - void setRecordPath(const std::string& recPath); - bool getIsAlwaysRecording(); - void setIsAlwaysRecording(const bool& rec); - - void setHistoryLimit(const int32_t& days); - int32_t getHistoryLimit(); - void clearHistory(); - - void setAccountsOrder(const std::string& order); - - std::map<std::string, std::string> getHookSettings(); - void setHookSettings(const std::map<std::string, std::string>& settings); - - std::vector<std::map<std::string, std::string> > getHistory(); - - std::map<std::string, std::string> getTlsSettings(); - void setTlsSettings(const std::map< std::string, std::string >& details); - std::map< std::string, std::string > getIp2IpDetails(); - - std::vector< std::map< std::string, std::string > > getCredentials(const std::string& accountID); - void setCredentials(const std::string& accountID, const std::vector< std::map< std::string, std::string > >& details); - - std::string getAddrFromInterfaceName(const std::string& interface); - - std::vector<std::string> getAllIpInterface(); - std::vector<std::string> getAllIpInterfaceByName(); - - std::map<std::string, std::string> getShortcuts(); - void setShortcuts(const std::map<std::string, std::string> &shortcutsMap); - - bool checkForPrivateKey(const std::string& pemPath); - bool checkCertificateValidity(const std::string& caPath, const std::string& pemPath); - bool checkHostnameCertificate(const std::string& host, const std::string& port); - -}; - -class ConfigurationCallback { -public: - virtual ~ConfigurationCallback(); - virtual void on_accounts_changed(void); - virtual void on_account_state_changed(const std::string& accountID, const int32_t& state); - virtual void on_account_state_changed_with_code(const std::string& accountID, const std::string& state, const int32_t& code); - virtual std::vector<int32_t> get_hardware_audio_format(void); -}; - -static ConfigurationCallback *registeredConfigurationCallbackObject = NULL; - -void setConfigurationCallbackObject(ConfigurationCallback *callback) { - registeredConfigurationCallbackObject = callback; -} +std::map<std::string, std::string> sflph_config_get_account_details(const std::string& account_id); +void sflph_config_set_account_details(const std::string& account_id, const std::map<std::string, std::string>& details); +std::map<std::string, std::string> sflph_config_get_account_template(void); +std::string sflph_config_add_account(const std::map<std::string, std::string>& details); +void sflph_config_remove_account(const std::string& account_id); +std::vector<std::string> sflph_config_get_account_list(void); +void sflph_config_send_register(const std::string& account_id, bool enable); +void sflph_config_register_all_accounts(void); +std::map<std::string, std::string> sflph_config_get_tls_default_settings(void); +std::vector<int> sflph_config_get_audio_codec_list(void); +std::vector<std::string> sflph_config_get_supported_tls_method(void); +std::vector<std::string> sflph_config_get_audio_codec_details(int payload); +std::vector<int> sflph_config_get_active_audio_codec_list(const std::string& account_id); +void sflph_config_set_active_audio_codec_list(const std::vector<std::string>& list, const std::string& account_id); +std::vector<std::string> sflph_config_get_audio_plugin_list(void); +void sflph_config_set_audio_plugin(const std::string& audio_plugin); +std::vector<std::string> sflph_config_get_audio_output_device_list(); +void sflph_config_set_audio_output_device(int index); +void sflph_config_set_audio_input_device(int index); +void sflph_config_set_audio_ringtone_device(int index); +std::vector<std::string> sflph_config_get_audio_input_device_list(void); +std::vector<std::string> sflph_config_get_current_audio_devices_index(void); +int sflph_config_get_audio_input_device_index(const std::string& name); +int sflph_config_get_audio_output_device_index(const std::string& name); +std::string sflph_config_get_current_audio_output_plugin(void); +bool sflph_config_get_noise_suppress_state(void); +void sflph_config_set_noise_suppress_state(bool state); +bool sflph_config_is_agc_enabled(void); +void sflph_config_enable_agc(bool enabled); +void sflph_config_mute_dtmf(bool mute); +bool sflph_config_is_dtmf_muted(void); +bool sflph_config_is_capture_muted(void); +void sflph_config_mute_capture(bool mute); +bool sflph_config_is_playback_muted(void); +void sflph_config_mute_playback(int mute); +std::map<std::string, std::string> sflph_config_get_ringtone_list(void); +std::string sflph_config_get_audio_manager(void); +bool sflph_config_set_audio_manager(const std::string& api); +std::vector<std::string> sflph_config_get_supported_audio_managers(void); +int sflph_config_is_iax2_enabled(void); +std::string sflph_config_get_record_path(void); +void sflph_config_set_record_path(const std::string& path); +bool sflph_config_is_always_recording(void); +void sflph_config_set_always_recording(bool rec); +void sflph_config_set_history_limit(int days); +int sflph_config_get_history_limit(void); +void sflph_config_clear_history(void); +void sflph_config_set_accounts_order(const std::string& order); +std::map<std::string, std::string> sflph_config_get_hook_settings(void); +void sflph_config_set_hook_settings(const std::map<std::string, std::string>& settings); +std::vector<std::map<std::string, std::string> > sflph_config_get_history(void); +std::map<std::string, std::string> sflph_config_get_tls_settings(); +void sflph_config_set_tls_settings(const std::map< std::string, std::string >& settings); +std::map<std::string, std::string> sflph_config_get_ip2ip_details(void); +std::vector<std::map<std::string, std::string> > sflph_config_get_credentials(const std::string& account_id); +void sflph_config_set_credentials(const std::string& account_id, const std::vector<std::map<std::string, std::string> >& details); +std::string sflph_config_get_addr_from_interface_name(const std::string& interface); +std::vector<std::string> sflph_config_get_all_ip_interface(void); +std::vector<std::string> sflph_config_get_all_ip_interface_by_name(void); +std::map<std::string, std::string> sflph_config_get_shortcuts(); +void sflph_config_set_shortcuts(const std::map<std::string, std::string>& shortcuts); +void sflph_config_set_volume(const std::string& device, double value); +double sflph_config_get_volume(const std::string& device); +bool sflph_config_check_for_private_key(const std::string& pem_path); +bool sflph_config_check_certificate_validity(const std::string& ca_path, const std::string& pem_path); +bool sflph_config_check_hostname_certificate(const std::string& host, const std::string& port); diff --git a/sflphone-android/jni/configurationmanager_jni.cpp b/sflphone-android/jni/configurationmanager_jni.cpp deleted file mode 100644 index 5a9ab957e4d59887378108da1e638f6ada630361..0000000000000000000000000000000000000000 --- a/sflphone-android/jni/configurationmanager_jni.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc. - * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com> - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "client/configurationmanager.h" -#include "jni_callbacks.h" - -ConfigurationManager::ConfigurationManager() {} - -void ConfigurationManager::accountsChanged() -{ - on_accounts_changed_wrapper(); -} - -void ConfigurationManager::historyChanged() -{ - -} - -void ConfigurationManager::stunStatusFailure(const std::string& accountID) -{ - -} - -void ConfigurationManager::volumeChanged(const std::string&, const int&) -{ -} - -void ConfigurationManager::registrationStateChanged(const std::string& accountID, int const& state) -{ - on_account_state_changed_wrapper(accountID, state); -} - -void ConfigurationManager::sipRegistrationStateChanged(const std::string& accountID, const std::string& state, const int32_t& code) -{ - on_account_state_changed_with_code_wrapper(accountID, state, code); -} - -void ConfigurationManager::errorAlert(const int & /*alert*/) -{ -} - -std::vector< int32_t > ConfigurationManager::getHardwareAudioFormat() -{ - return get_hardware_audio_format_wrapper(); -} - -std::vector<std::string> ConfigurationManager::getSupportedAudioManagers() -{ - return {"opensl"}; -} diff --git a/sflphone-android/jni/jni_callbacks.h b/sflphone-android/jni/jni_callbacks.h index acc6539b00665484c7464c719b931fbe8b14f2ef..234950118a87e4119662ef8e05b2e7232c7f976c 100644 --- a/sflphone-android/jni/jni_callbacks.h +++ b/sflphone-android/jni/jni_callbacks.h @@ -1,8 +1,4 @@ - - - -extern struct callmanager_callback wrapper_callback_struct; void on_new_call_created_wrapper (const std::string& accountID, const std::string& callID, const std::string& to); @@ -29,11 +25,13 @@ void on_zrtp_not_supported_wrapper(const std::string& callID); void on_zrtp_negociation_failed_wrapper(const std::string& callID, const std::string& reason, const std::string& severity); void on_rtcp_report_received_wrapper(const std::string& callID, const std::map<std::basic_string<char>, int>& stats); -extern struct configurationmanager_callback wrapper_configurationcallback_struct; -extern void on_accounts_changed_wrapper (); -extern void on_account_state_changed_wrapper (const std::string& accoundID, int const& state); -extern void on_account_state_changed_with_code_wrapper (const std::string& accoundID, const std::string& state, const int32_t& code); -extern std::vector<int> get_hardware_audio_format_wrapper(); +void on_accounts_changed_wrapper (); +void on_account_state_changed_wrapper (const std::string& accoundID, int const& state); +void on_account_state_changed_with_code_wrapper (const std::string& accoundID, const std::string& state, const int32_t& code); +std::vector<int> get_hardware_audio_format_wrapper(); +void on_volume_changed_wrapper (void); +void on_stun_status_failed_wrapper (const std::string& accountID); +void on_history_change_wrapper (void); void on_record_playback_filepath_wrapper(const std::string& id, const std::string& filename); void on_recording_state_changed_wrapper(const std::string& callID, const bool& state); diff --git a/sflphone-android/jni/jni_interface.i b/sflphone-android/jni/jni_interface.i index 0021f977d635f2c2aadfc6cb9fc8f6018bbf3f5d..88a278506c50d6ed51d8ab4242e5e7c7c3d8edd1 100644 --- a/sflphone-android/jni/jni_interface.i +++ b/sflphone-android/jni/jni_interface.i @@ -46,14 +46,14 @@ %typemap(jstype) void * "byte[]" %typemap(javain) void * "$javainput" %typemap(in) void * %{ - $1 = $input; + $1 = $input; %} %typemap(javadirectorin) void * "$jniinput" %typemap(out) void * %{ - $result = $1; + $result = $1; %} %typemap(javaout) void * { - return $jnicall; + return $jnicall; } namespace std { @@ -81,7 +81,7 @@ namespace std { /* %include "../managerimpl.h" */ /* %include <client/callmanager.h> */ -//%constant struct callmanager_callback* WRAPPER_CALLBACK_STRUCT = &wrapper_callback_struct; +//%constant struct sflph_call_ev_handlers* WRAPPER_CALLBACK_STRUCT = &wrapper_callback_struct; %include "managerimpl.i" %include "callmanager.i" diff --git a/sflphone-android/jni/managerimpl.i b/sflphone-android/jni/managerimpl.i index 357d416f44b32015a9b39089e56127c300b3ad9f..f268649c1f97ae4549d8f895dd31fe89382cea09 100644 --- a/sflphone-android/jni/managerimpl.i +++ b/sflphone-android/jni/managerimpl.i @@ -30,29 +30,30 @@ /* %nodefaultctor ManagerImpl; %nodefaultdtor ManagerImpl; */ %header %{ -#include <managerimpl.h> -namespace Manager { -extern ManagerImpl& instance(); -} + +#include "sflphone.h" + %} class ManagerImpl { public: - void init(const std::string &config_file); - void setPath(const std::string &path); - void pollEvents(); - void finish(); -}; + /** + * Initializes libsflphone. + * + * @param ev_handlers Event handlers + * @param flags Flags to customize this initialization + * @returns 0 if successful or a negative error code + */ + int sflph_init(struct sflph_ev_handlers* ev_handlers, enum sflph_init_flag flags); -//%rename(Manager_instance) Manager::instance; + /** + * Finalizes libsflphone, freeing any resource allocated by the library. + */ + void sflph_fini(void); -namespace Manager { - -ManagerImpl& Manager::instance() -{ - // Meyers singleton - static ManagerImpl instance_; - return instance_; -} + /** + * Poll for SIP/IAX events + */ + void sflph_poll_events(void); +}; -} diff --git a/sflphone-android/jni/presencemanager_jni.cpp b/sflphone-android/jni/presencemanager_jni.cpp deleted file mode 100644 index 9a0b197dd83e8d239447757ad26cba25fa97d499..0000000000000000000000000000000000000000 --- a/sflphone-android/jni/presencemanager_jni.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2013 Savoir-Faire Linux Inc. - * Author: Patrick Keroulas <patrick.keroulas@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#include "client/presencemanager.h" - -PresenceManager::PresenceManager() -{} - -void -PresenceManager::newBuddyNotification(const std::string& accountID, const std::string& buddyUri, - const bool& status, const std::string& lineStatus) -{} - -void -PresenceManager::subscriptionStateChanged(const std::string& accountID, const std::string& buddyUri, - const bool& state) -{} - -void -PresenceManager::newServerSubscriptionRequest(const std::string& remote) -{} - -void -PresenceManager::serverError(const std::string& accountID, const std::string& error, const std::string& msg) -{} diff --git a/sflphone-android/make-swig.sh b/sflphone-android/make-swig.sh index dbaf20631772f1b3d80a030edd0ed807cc03991d..fb682d12e8a50bff4adf1ace4925e685bc7b0a33 100755 --- a/sflphone-android/make-swig.sh +++ b/sflphone-android/make-swig.sh @@ -30,16 +30,14 @@ # as that of the covered work. # -# input: jni/sflphone/daemon/src/dbus/jni_interface.i +# input: jni/jni_interface.i # output: sflphoneservice_loader.c -# callmanager_wrap.cpp +# sflphone_wrapper.cpp # sflphoneservice.java # sflphoneserviceJNI.java # ManagerImpl.java -SRCDIR=jni/sflphone/daemon/src -NATIVE=client/android -NATIVEDIR=$SRCDIR/$NATIVE +SRCDIR=jni PACKAGE=org.sflphone.service PACKAGEDIR=src/org/sflphone/service ROOT=`pwd` @@ -83,38 +81,24 @@ else exit 3 fi -# FIXME -echo "Generating callmanager_wrap.cpp..." +echo "Generating sflphone_wrapper.cpp..." swig -v -c++ -java \ -package $PACKAGE \ -outdir $PACKAGEDIR \ --o $SRCDIR/client/android/callmanager_wrap.cpp $SRCDIR/client/android/jni_interface.i - -pushd $SRCDIR -echo "in $PWD" +-o $SRCDIR/sflphone_wrapper.cpp $SRCDIR/jni_interface.i echo "Generating sflphoneservice_loader.c..." -python client/android/JavaJNI2CJNI_Load.py \ +python $SRCDIR/JavaJNI2CJNI_Load.py \ -i $ROOT/$PACKAGEDIR/SFLPhoneserviceJNI.java \ --o $NATIVE/sflphoneservice_loader.c \ --t client/android/sflphoneservice.c.template \ +-o $SRCDIR/sflphoneservice_loader.c \ +-t $SRCDIR/sflphoneservice.c.template \ -m SFLPhoneservice \ -p $PACKAGE -echo "Appending callmanager_wrap.cpp..." -cat $NATIVE/sflphoneservice_loader.c >> client/android/callmanager_wrap.cpp - - -#if [ "" != "$(find -iname sflphoneservice_loader.c)" ]; then - # -#fi -# callmanager_wrap.cpp -# callmanager_wrap.cpp -# sflphoneservice.java -# sflphoneserviceJNI.java -# ManagerImpl.java +echo "Appending sflphone_wrapper.cpp..." +cat $SRCDIR/sflphoneservice_loader.c >> $SRCDIR/sflphone_wrapper.cpp -echo -n "in " && popd +echo -n "in " echo "Done" exit 0 diff --git a/sflphone-android/src/org/sflphone/service/SipService.java b/sflphone-android/src/org/sflphone/service/SipService.java index e7e722f37ebd9f37eb3ee6b32e87f2ce705bb6d7..ebc46ccbf16549c476e6459f397b175cf260becd 100644 --- a/sflphone-android/src/org/sflphone/service/SipService.java +++ b/sflphone-android/src/org/sflphone/service/SipService.java @@ -58,7 +58,7 @@ public class SipService extends Service { private CallManager callManagerJNI; private ManagerImpl managerImpl; private CallManagerCallBack callManagerCallBack; - + private ConfigurationManager configurationManagerJNI; private ConfigurationManagerCallback configurationManagerCallback; private boolean isPjSipStackStarted = false; @@ -261,16 +261,8 @@ public class SipService extends Service { Log.i(TAG, "PjSIPStack started"); managerImpl = SFLPhoneservice.instance(); - /* set static AppPath before calling manager.init */ - // managerImpl.setPath(getApplication().getFilesDir().getAbsolutePath()); - callManagerJNI = new CallManager(); - callManagerCallBack = new CallManagerCallBack(this); - SFLPhoneservice.setCallbackObject(callManagerCallBack); - configurationManagerJNI = new ConfigurationManager(); - configurationManagerCallback = new ConfigurationManagerCallback(this); - SFLPhoneservice.setConfigurationCallbackObject(configurationManagerCallback); managerImpl.init(""); Log.i(TAG, "->startPjSipStack"); @@ -343,9 +335,9 @@ public class SipService extends Service { } /* ************************************ - * + * * Implement public interface for the service - * + * * ********************************* */