From fc91a465d09b0f18fed29f6043c358c189f8dde0 Mon Sep 17 00:00:00 2001 From: Alexandre Lision <alexandre.lision@gmail.com> Date: Thu, 7 Aug 2014 18:21:07 -0400 Subject: [PATCH] Use new API in SipService Still some issues about static/virtual declarations of methods for Callback and ConfigurationCallback generated files. --- sflphone-android/Tests/Tests.iml | 21 +- sflphone-android/assets/.gitignore | 4 + sflphone-android/assets/builddate.txt | 1 - sflphone-android/assets/builder.txt | 1 - sflphone-android/assets/revision.txt | 1 - sflphone-android/jni/callmanager.i | 100 ++++----- sflphone-android/jni/configurationmanager.i | 32 +-- sflphone-android/jni/jni_interface.i | 57 +++-- sflphone-android/jni/managerimpl.i | 7 +- sflphone-android/sflphone-android.iml | 2 +- .../src/org/sflphone/model/SecureSipCall.java | 2 +- .../sflphone/service/CallManagerCallBack.java | 65 +++--- .../service/ConfigurationManagerCallback.java | 42 ++-- .../src/org/sflphone/service/ISipService.aidl | 1 - .../src/org/sflphone/service/SipService.java | 208 +++++++----------- 15 files changed, 239 insertions(+), 305 deletions(-) create mode 100644 sflphone-android/assets/.gitignore delete mode 100644 sflphone-android/assets/builddate.txt delete mode 100644 sflphone-android/assets/builder.txt delete mode 100644 sflphone-android/assets/revision.txt diff --git a/sflphone-android/Tests/Tests.iml b/sflphone-android/Tests/Tests.iml index f44fff240..a11a481e8 100644 --- a/sflphone-android/Tests/Tests.iml +++ b/sflphone-android/Tests/Tests.iml @@ -2,30 +2,19 @@ <module type="JAVA_MODULE" version="4"> <component name="FacetManager"> <facet type="android" name="Android"> - <configuration> - <option name="PACK_TEST_CODE" value="true" /> - <option name="UPDATE_PROPERTY_FILES" value="true" /> - </configuration> + <configuration /> </facet> </component> <component name="NewModuleRootManager" inherit-compiler-output="true"> <exclude-output /> <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="true" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="SFLPhone" scope="PROVIDED" /> - <orderEntry type="module-library" exported=""> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/../libs/robotium-solo-5.0.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> + <orderEntry type="library" name="libs" level="project" /> + <orderEntry type="module" module-name="sflphone-android" /> </component> </module> diff --git a/sflphone-android/assets/.gitignore b/sflphone-android/assets/.gitignore new file mode 100644 index 000000000..53515eff8 --- /dev/null +++ b/sflphone-android/assets/.gitignore @@ -0,0 +1,4 @@ +revision.txt +builddate.txt +builder.txt +env.txt diff --git a/sflphone-android/assets/builddate.txt b/sflphone-android/assets/builddate.txt deleted file mode 100644 index 3d089304e..000000000 --- a/sflphone-android/assets/builddate.txt +++ /dev/null @@ -1 +0,0 @@ -2014-08-07 diff --git a/sflphone-android/assets/builder.txt b/sflphone-android/assets/builder.txt deleted file mode 100644 index 535020477..000000000 --- a/sflphone-android/assets/builder.txt +++ /dev/null @@ -1 +0,0 @@ -tmatth@bodega diff --git a/sflphone-android/assets/revision.txt b/sflphone-android/assets/revision.txt deleted file mode 100644 index d2cebd00c..000000000 --- a/sflphone-android/assets/revision.txt +++ /dev/null @@ -1 +0,0 @@ -719259d diff --git a/sflphone-android/jni/callmanager.i b/sflphone-android/jni/callmanager.i index fd6d519ea..15e5df545 100644 --- a/sflphone-android/jni/callmanager.i +++ b/sflphone-android/jni/callmanager.i @@ -32,32 +32,32 @@ #include "sflphone.h" -class CallManagerCallback { +class Callback { public: - virtual ~CallManagerCallback() {} - static void callOnStateChange(const std::string& call_id, const std::string& state){} - static void callOnTransferFail(void){} - static void callOnTransferSuccess(void){} - static void callOnRecordPlaybackStopped(const std::string& path){} - static void callOnVoiceMailNotify(const std::string& call_id, int nd_msg){} - static void callOnIncomingMessage(const std::string& id, const std::string& from, const std::string& msg){} - static void callOnIncomingCall(const std::string& account_id, const std::string& call_id, const std::string& from){} - static void callOnRecordPlaybackFilepath(const std::string& id, const std::string& filename){} - static void callOnConferenceCreated(const std::string& conf_id){} - static void callOnConferenceChanged(const std::string& conf_id, const std::string& state){} - static void callOnUpdatePlaybackScale(const std::string& filepath, int position, int scale){} - static void callOnConferenceRemove(const std::string& conf_id){} - static void callOnNewCall(const std::string& account_id, const std::string& call_id, const std::string& to){} - static void callOnSipCallStateChange(const std::string& call_id, const std::string& state, int code){} - static void callOnRecordStateChange(const std::string& call_id, int state){} - static void callOnSecureSdesOn(const std::string& call_id){} - static void callOnSecureSdesOff(const std::string& call_id){} - static void callOnSecureZrtpOn(const std::string& call_id, const std::string& cipher){} - static void callOnSecureZrtpOff(const std::string& call_id){} - static void callOnShowSas(const std::string& call_id, const std::string& sas, int verified){} - static void callOnZrtpNotSuppOther(const std::string& call_id){} - static void callOnZrtpNegotiationFail(const std::string& call_id, const std::string& reason, const std::string& severity){} - static void callOnRtcpReceiveReport(const std::string& call_id, const std::map<std::string, int>& stats){} + virtual ~Callback() {} + virtual void callOnStateChange(const std::string& call_id, const std::string& state){} + virtual void callOnTransferFail(void){} + virtual void callOnTransferSuccess(void){} + virtual void callOnRecordPlaybackStopped(const std::string& path){} + virtual void callOnVoiceMailNotify(const std::string& call_id, int nd_msg){} + virtual void callOnIncomingMessage(const std::string& id, const std::string& from, const std::string& msg){} + virtual void callOnIncomingCall(const std::string& account_id, const std::string& call_id, const std::string& from){} + virtual void callOnRecordPlaybackFilepath(const std::string& id, const std::string& filename){} + virtual void callOnConferenceCreated(const std::string& conf_id){} + virtual void callOnConferenceChanged(const std::string& conf_id, const std::string& state){} + virtual void callOnUpdatePlaybackScale(const std::string& filepath, int position, int scale){} + virtual void callOnConferenceRemove(const std::string& conf_id){} + virtual void callOnNewCall(const std::string& account_id, const std::string& call_id, const std::string& to){} + virtual void callOnSipCallStateChange(const std::string& call_id, const std::string& state, int code){} + virtual void callOnRecordStateChange(const std::string& call_id, int state){} + virtual void callOnSecureSdesOn(const std::string& call_id){} + virtual void callOnSecureSdesOff(const std::string& call_id){} + virtual void callOnSecureZrtpOn(const std::string& call_id, const std::string& cipher){} + virtual void callOnSecureZrtpOff(const std::string& call_id){} + virtual void callOnShowSas(const std::string& call_id, const std::string& sas, int verified){} + virtual void callOnZrtpNotSuppOther(const std::string& call_id){} + virtual void callOnZrtpNegotiationFail(const std::string& call_id, const std::string& reason, const std::string& severity){} + virtual void callOnRtcpReceiveReport(const std::string& call_id, const std::map<std::string, int>& stats){} }; @@ -107,30 +107,30 @@ 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 CallManagerCallback { +class Callback { public: - virtual ~CallManagerCallback(); -static void callOnStateChange(const std::string& call_id, const std::string& state); - static void callOnTransferFail(void); - static void callOnTransferSuccess(void); - static void callOnRecordPlaybackStopped(const std::string& path); - static void callOnVoiceMailNotify(const std::string& call_id, int nd_msg); - static void callOnIncomingMessage(const std::string& id, const std::string& from, const std::string& msg); - static void callOnIncomingCall(const std::string& account_id, const std::string& call_id, const std::string& from); - static void callOnRecordPlaybackFilepath(const std::string& id, const std::string& filename); - static void callOnConferenceCreated(const std::string& conf_id); - static void callOnConferenceChanged(const std::string& conf_id, const std::string& state); - static void callOnUpdatePlaybackScale(const std::string& filepath, int position, int scale); - static void callOnConferenceRemove(const std::string& conf_id); - static void callOnNewCall(const std::string& account_id, const std::string& call_id, const std::string& to); - static void callOnSipCallStateChange(const std::string& call_id, const std::string& state, int code); - static void callOnRecordStateChange(const std::string& call_id, int state); - static void callOnSecureSdesOn(const std::string& call_id); - static void callOnSecureSdesOff(const std::string& call_id); - static void callOnSecureZrtpOn(const std::string& call_id, const std::string& cipher); - static void callOnSecureZrtpOff(const std::string& call_id); - static void callOnShowSas(const std::string& call_id, const std::string& sas, int verified); - static void callOnZrtpNotSuppOther(const std::string& call_id); - static void callOnZrtpNegotiationFail(const std::string& call_id, const std::string& reason, const std::string& severity); - static void callOnRtcpReceiveReport(const std::string& call_id, const std::map<std::string, int>& stats); + virtual ~Callback(); + virtual void callOnStateChange(const std::string& call_id, const std::string& state); + virtual void callOnTransferFail(void); + virtual void callOnTransferSuccess(void); + virtual void callOnRecordPlaybackStopped(const std::string& path); + virtual void callOnVoiceMailNotify(const std::string& call_id, int nd_msg); + virtual void callOnIncomingMessage(const std::string& id, const std::string& from, const std::string& msg); + virtual void callOnIncomingCall(const std::string& account_id, const std::string& call_id, const std::string& from); + virtual void callOnRecordPlaybackFilepath(const std::string& id, const std::string& filename); + virtual void callOnConferenceCreated(const std::string& conf_id); + virtual void callOnConferenceChanged(const std::string& conf_id, const std::string& state); + virtual void callOnUpdatePlaybackScale(const std::string& filepath, int position, int scale); + virtual void callOnConferenceRemove(const std::string& conf_id); + virtual void callOnNewCall(const std::string& account_id, const std::string& call_id, const std::string& to); + virtual void callOnSipCallStateChange(const std::string& call_id, const std::string& state, int code); + virtual void callOnRecordStateChange(const std::string& call_id, int state); + virtual void callOnSecureSdesOn(const std::string& call_id); + virtual void callOnSecureSdesOff(const std::string& call_id); + virtual void callOnSecureZrtpOn(const std::string& call_id, const std::string& cipher); + virtual void callOnSecureZrtpOff(const std::string& call_id); + virtual void callOnShowSas(const std::string& call_id, const std::string& sas, int verified); + virtual void callOnZrtpNotSuppOther(const std::string& call_id); + virtual void callOnZrtpNegotiationFail(const std::string& call_id, const std::string& reason, const std::string& severity); + virtual void callOnRtcpReceiveReport(const std::string& call_id, const std::map<std::string, int>& stats); }; diff --git a/sflphone-android/jni/configurationmanager.i b/sflphone-android/jni/configurationmanager.i index 8e21e5a07..f1fbbbd29 100644 --- a/sflphone-android/jni/configurationmanager.i +++ b/sflphone-android/jni/configurationmanager.i @@ -33,14 +33,14 @@ class ConfigurationCallback { public: virtual ~ConfigurationCallback(){} - static void configOnVolumeChange(const std::string& device, int value){} - static void configOnAccountsChange(void){} - static void configOnHistoryChange(void){} - static void configOnStunStatusFail(const std::string& account_id){} - static void configOnRegistrationStateChange(const std::string& account_id, int state){} - static void configOnSipRegistrationStateChange(const std::string& account_id, const std::string& state, int code){} - static void configOnError(int alert){} - + virtual void configOnVolumeChange(const std::string& device, int value){} + virtual void configOnAccountsChange(void){} + virtual void configOnHistoryChange(void){} + virtual void configOnStunStatusFail(const std::string& account_id){} + virtual void configOnRegistrationStateChange(const std::string& account_id, int state){} + virtual void configOnSipRegistrationStateChange(const std::string& account_id, const std::string& state, int code){} + virtual void configOnError(int alert){} + virtual std::vector<int32_t> configGetHardwareAudioFormat(void){} }; %} @@ -117,13 +117,13 @@ bool sflph_config_check_hostname_certificate(const std::string& host, const std: class ConfigurationCallback { public: virtual ~ConfigurationCallback(); - static void configOnVolumeChange(const std::string& device, int value); - static void configOnAccountsChange(void); - static void configOnHistoryChange(void); - static void configOnStunStatusFail(const std::string& account_id); - static void configOnRegistrationStateChange(const std::string& account_id, int state); - static void configOnSipRegistrationStateChange(const std::string& account_id, const std::string& state, int code); - static void configOnError(int alert); - + void configOnVolumeChange(const std::string& device, int value); + void configOnAccountsChange(void); + void configOnHistoryChange(void); + void configOnStunStatusFail(const std::string& account_id); + void configOnRegistrationStateChange(const std::string& account_id, int state); + void configOnSipRegistrationStateChange(const std::string& account_id, const std::string& state, int code); + void configOnError(int alert); + std::vector<int32_t> configGetHardwareAudioFormat(void); }; diff --git a/sflphone-android/jni/jni_interface.i b/sflphone-android/jni/jni_interface.i index 2c3a54063..e3b6ff855 100644 --- a/sflphone-android/jni/jni_interface.i +++ b/sflphone-android/jni/jni_interface.i @@ -87,33 +87,33 @@ namespace std { /* some functions that need to be declared in *_wrap.cpp * that are not declared elsewhere in the c++ code */ -void init(ConfigurationCallback* conf_cb, CallManagerCallback* call_cb) { +void init(ConfigurationCallback* conf_cb, Callback* call_cb) { // Call event handlers sflph_call_ev_handlers callEvHandlers = { - CallManagerCallback::callOnStateChange, - CallManagerCallback::callOnTransferFail, - CallManagerCallback::callOnTransferSuccess, - CallManagerCallback::callOnRecordPlaybackStopped, - CallManagerCallback::callOnVoiceMailNotify, - CallManagerCallback::callOnIncomingMessage, - CallManagerCallback::callOnIncomingCall, - CallManagerCallback::callOnRecordPlaybackFilepath, - CallManagerCallback::callOnConferenceCreated, - CallManagerCallback::callOnConferenceChanged, - CallManagerCallback::callOnUpdatePlaybackScale, - CallManagerCallback::callOnConferenceRemove, - CallManagerCallback::callOnNewCall, - CallManagerCallback::callOnSipCallStateChange, - CallManagerCallback::callOnRecordStateChange, - CallManagerCallback::callOnSecureSdesOn, - CallManagerCallback::callOnSecureSdesOff, - CallManagerCallback::callOnSecureZrtpOn, - CallManagerCallback::callOnSecureZrtpOff, - CallManagerCallback::callOnShowSas, - CallManagerCallback::callOnZrtpNotSuppOther, - CallManagerCallback::callOnZrtpNegotiationFail, - CallManagerCallback::callOnRtcpReceiveReport, + Callback::callOnStateChange, + Callback::callOnTransferFail, + Callback::callOnTransferSuccess, + Callback::callOnRecordPlaybackStopped, + Callback::callOnVoiceMailNotify, + Callback::callOnIncomingMessage, + Callback::callOnIncomingCall, + Callback::callOnRecordPlaybackFilepath, + Callback::callOnConferenceCreated, + Callback::callOnConferenceChanged, + Callback::callOnUpdatePlaybackScale, + Callback::callOnConferenceRemove, + Callback::callOnNewCall, + Callback::callOnSipCallStateChange, + Callback::callOnRecordStateChange, + Callback::callOnSecureSdesOn, + Callback::callOnSecureSdesOff, + Callback::callOnSecureZrtpOn, + Callback::callOnSecureZrtpOff, + Callback::callOnShowSas, + Callback::callOnZrtpNotSuppOther, + Callback::callOnZrtpNegotiationFail, + Callback::callOnRtcpReceiveReport, }; // Configuration event handlers @@ -125,19 +125,14 @@ void init(ConfigurationCallback* conf_cb, CallManagerCallback* call_cb) { ConfigurationCallback::configOnRegistrationStateChange, ConfigurationCallback::configOnSipRegistrationStateChange, ConfigurationCallback::configOnError, + ConfigurationCallback::configGetHardwareAudioFormat, }; - - // All event handlers - sflph_ev_handlers evHandlers; - memset(std::addressof(evHandlers), 0, sizeof(evHandlers)); - + sflph_ev_handlers evHandlers = {}; evHandlers.call_ev_handlers = callEvHandlers; evHandlers.config_ev_handlers = configEvHandlers; sflph_init(&evHandlers, 0); - - } %} diff --git a/sflphone-android/jni/managerimpl.i b/sflphone-android/jni/managerimpl.i index c2bc56499..9cdf41221 100644 --- a/sflphone-android/jni/managerimpl.i +++ b/sflphone-android/jni/managerimpl.i @@ -30,8 +30,9 @@ /* %nodefaultctor ManagerImpl; %nodefaultdtor ManagerImpl; */ %header %{ - #include "sflphone.h" +%} + /** * Initializes libsflphone. * @@ -50,7 +51,3 @@ void sflph_fini(void); * Poll for SIP/IAX events */ void sflph_poll_events(void); - -%} - - diff --git a/sflphone-android/sflphone-android.iml b/sflphone-android/sflphone-android.iml index ec0b651a6..32f50c702 100644 --- a/sflphone-android/sflphone-android.iml +++ b/sflphone-android/sflphone-android.iml @@ -11,7 +11,7 @@ <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> </content> - <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" /> + <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" name="libs" level="project" /> </component> diff --git a/sflphone-android/src/org/sflphone/model/SecureSipCall.java b/sflphone-android/src/org/sflphone/model/SecureSipCall.java index 58c04bb7a..df0163e9c 100644 --- a/sflphone-android/src/org/sflphone/model/SecureSipCall.java +++ b/sflphone-android/src/org/sflphone/model/SecureSipCall.java @@ -110,7 +110,7 @@ public class SecureSipCall extends SipCall { } }; - public void sasConfirmedByZrtpLayer(boolean verified) { + public void sasConfirmedByZrtpLayer(int verified) { // Not used } diff --git a/sflphone-android/src/org/sflphone/service/CallManagerCallBack.java b/sflphone-android/src/org/sflphone/service/CallManagerCallBack.java index df5dc3805..77677fca1 100644 --- a/sflphone-android/src/org/sflphone/service/CallManagerCallBack.java +++ b/sflphone-android/src/org/sflphone/service/CallManagerCallBack.java @@ -3,13 +3,11 @@ package org.sflphone.service; import android.content.Intent; import android.os.Bundle; import android.util.Log; -import org.sflphone.account.AccountDetailSrtp; import org.sflphone.client.CallActivity; import org.sflphone.model.*; import org.sflphone.utils.SwigNativeConverter; import java.util.ArrayList; -import java.util.Iterator; import java.util.Map; public class CallManagerCallBack extends Callback { @@ -39,7 +37,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_call_state_changed(String callID, String newState) { + public void callOnStateChange(String callID, String newState) { Log.d(TAG, "on_call_state_changed : (" + callID + ", " + newState + ")"); Conference toUpdate = mService.findConference(callID); @@ -79,7 +77,7 @@ public class CallManagerCallBack extends Callback { } else if (newState.equals("FAILURE")) { toUpdate.setCallState(callID, SipCall.state.CALL_STATE_FAILURE); mService.getConferences().remove(toUpdate.getId()); - mService.getCallManagerJNI().hangUp(callID); + SFLPhoneservice.sflph_call_hang_up(callID); } else if (newState.equals("HOLD")) { toUpdate.setCallState(callID, SipCall.state.CALL_STATE_HOLD); } else if (newState.equals("UNHOLD")) { @@ -91,12 +89,12 @@ public class CallManagerCallBack extends Callback { @Override - public void on_incoming_call(String accountID, String callID, String from) { + public void callOnIncomingCall(String accountID, String callID, String from) { Log.d(TAG, "on_incoming_call(" + accountID + ", " + callID + ", " + from + ")"); try { - StringMap details = mService.getConfigurationManagerJNI().getAccountDetails(accountID); - VectMap credentials = mService.getConfigurationManagerJNI().getCredentials(accountID); + StringMap details = SFLPhoneservice.sflph_config_get_account_details(accountID); + VectMap credentials = SFLPhoneservice.sflph_config_get_credentials(accountID); Account acc = new Account(accountID, SwigNativeConverter.convertAccountToNative(details), SwigNativeConverter.convertCredentialsToNative(credentials)); Bundle args = new Bundle(); @@ -137,26 +135,20 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_transfer_state_changed(String result) { - Log.w(TAG, "TRANSFER STATE CHANGED:" + result); - } - - @Override - public void on_conference_created(final String confID) { + public void callOnConferenceCreated(final String confID) { Log.w(TAG, "CONFERENCE CREATED:" + confID); Intent intent = new Intent(CONF_CREATED); Conference created = new Conference(confID); - StringVect all_participants = mService.getCallManagerJNI().getParticipantList(confID); + StringVect all_participants = SFLPhoneservice.sflph_call_get_participant_list(confID); Log.w(TAG, "all_participants:" + all_participants.size()); for (int i = 0; i < all_participants.size(); ++i) { if (mService.getConferences().get(all_participants.get(i)) != null) { created.addParticipant(mService.getConferences().get(all_participants.get(i)).getCallById(all_participants.get(i))); mService.getConferences().remove(all_participants.get(i)); } else { - Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator(); - while (it.hasNext()) { - Conference tmp = it.next().getValue(); + for (Map.Entry<String, Conference> stringConferenceEntry : mService.getConferences().entrySet()) { + Conference tmp = stringConferenceEntry.getValue(); for (SipCall c : tmp.getParticipants()) { if (c.getCallId().contentEquals(all_participants.get(i))) { created.addParticipant(c); @@ -173,7 +165,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_incoming_message(String ID, String from, String msg) { + public void callOnIncomingMessage(String ID, String from, String msg) { Log.w(TAG, "on_incoming_message:" + msg); Intent intent = new Intent(INCOMING_TEXT); intent.putExtra("CallID", ID); @@ -184,9 +176,8 @@ public class CallManagerCallBack extends Callback { mService.getConferences().get(ID).addSipMessage(new SipMessage(true, msg)); intent.putExtra("conference", mService.getConferences().get(ID)); } else { - Iterator<Map.Entry<String, Conference>> it = mService.getConferences().entrySet().iterator(); - while (it.hasNext()) { - Conference tmp = it.next().getValue(); + for (Map.Entry<String, Conference> stringConferenceEntry : mService.getConferences().entrySet()) { + Conference tmp = stringConferenceEntry.getValue(); for (SipCall c : tmp.getParticipants()) { if (c.getCallId().contentEquals(ID)) { mService.getConferences().get(tmp.getId()).addSipMessage(new SipMessage(true, msg)); @@ -200,7 +191,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_conference_removed(String confID) { + public void callOnConferenceRemove(String confID) { Log.i(TAG, "on_conference_removed:"); Intent intent = new Intent(CONF_REMOVED); intent.putExtra("confID", confID); @@ -216,7 +207,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_conference_state_changed(String confID, String state) { + public void callOnConferenceChanged(String confID, String state) { Log.i(TAG, "on_conference_state_changed:"); Intent intent = new Intent(CONF_CHANGED); intent.putExtra("confID", confID); @@ -229,13 +220,13 @@ public class CallManagerCallBack extends Callback { Conference toModify = mService.getConferences().get(confID); toModify.setCallState(confID, state); - ArrayList<String> newParticipants = SwigNativeConverter.convertSwigToNative(mService.getCallManagerJNI().getParticipantList(intent.getStringExtra("confID"))); + ArrayList<String> newParticipants = SwigNativeConverter.convertSwigToNative(SFLPhoneservice.sflph_call_get_participant_list(intent.getStringExtra("confID"))); if (toModify.getParticipants().size() < newParticipants.size()) { // We need to add the new participant to the conf - for (int i = 0; i < newParticipants.size(); ++i) { - if (toModify.getCallById(newParticipants.get(i)) == null) { - mService.addCallToConference(toModify.getId(), newParticipants.get(i)); + for (String newParticipant : newParticipants) { + if (toModify.getCallById(newParticipant) == null) { + mService.addCallToConference(toModify.getId(), newParticipant); } } } else if (toModify.getParticipants().size() > newParticipants.size()) { @@ -252,15 +243,15 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_record_playback_filepath(String id, String filename) { - Intent intent = new Intent(RECORD_STATE_CHANGED); + public void callOnRecordPlaybackFilepath(String id, String filename) { + Intent intent = new Intent(); intent.putExtra("callID", id); intent.putExtra("file", filename); mService.sendBroadcast(intent); } @Override - public void on_secure_sdes_on(String callID) { + public void callOnSecureSdesOn(String callID) { Log.i(TAG, "on_secure_sdes_on"); SecureSipCall call = (SecureSipCall) mService.getCallById(callID); call.setInitialized(); @@ -268,7 +259,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_secure_sdes_off(String callID) { + public void callOnSecureSdesOff(String callID) { Log.i(TAG, "on_secure_sdes_off"); SecureSipCall call = (SecureSipCall) mService.getCallById(callID); call.setInitialized(); @@ -276,7 +267,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_secure_zrtp_on(String callID, String cipher) { + public void callOnSecureZrtpOn(String callID, String cipher) { Log.i(TAG, "on_secure_zrtp_on"); Intent intent = new Intent(ZRTP_ON); SecureSipCall call = (SecureSipCall) mService.getCallById(callID); @@ -288,7 +279,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_secure_zrtp_off(String callID) { + public void callOnSecureZrtpOff(String callID) { Log.i(TAG, "on_secure_zrtp_off"); Intent intent = new Intent(ZRTP_OFF); intent.putExtra("callID", callID); @@ -304,7 +295,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_show_sas(String callID, String sas, boolean verified) { + public void callOnShowSas(String callID, String sas, int verified) { Log.i(TAG, "on_show_sas:" + sas); Intent intent = new Intent(DISPLAY_SAS); SecureSipCall call = (SecureSipCall) mService.getCallById(callID); @@ -319,7 +310,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_zrtp_not_supported(String callID) { + public void callOnZrtpNotSuppOther(String callID) { Log.i(TAG, "on_zrtp_not_supported"); Intent intent = new Intent(ZRTP_NOT_SUPPORTED); SecureSipCall call = (SecureSipCall) mService.getCallById(callID); @@ -331,7 +322,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_zrtp_negociation_failed(String callID, String reason, String severity) { + public void callOnZrtpNegotiationFail(String callID, String reason, String severity) { Log.i(TAG, "on_zrtp_negociation_failed"); Intent intent = new Intent(ZRTP_NEGOTIATION_FAILED); SecureSipCall call = (SecureSipCall) mService.getCallById(callID); @@ -343,7 +334,7 @@ public class CallManagerCallBack extends Callback { } @Override - public void on_rtcp_report_received(String callID, IntegerMap stats) { + public void callOnRtcpReceiveReport(String callID, IntegerMap stats) { Log.i(TAG, "on_rtcp_report_received"); Intent intent = new Intent(RTCP_REPORT_RECEIVED); mService.sendBroadcast(intent); diff --git a/sflphone-android/src/org/sflphone/service/ConfigurationManagerCallback.java b/sflphone-android/src/org/sflphone/service/ConfigurationManagerCallback.java index 77c157c3b..e3370ea08 100644 --- a/sflphone-android/src/org/sflphone/service/ConfigurationManagerCallback.java +++ b/sflphone-android/src/org/sflphone/service/ConfigurationManagerCallback.java @@ -23,10 +23,12 @@ package org.sflphone.service; import android.content.Intent; +import android.util.Log; public class ConfigurationManagerCallback extends ConfigurationCallback { private SipService mService; + private static final String TAG = "ConfigurationManagerCallback"; static public final String ACCOUNTS_CHANGED = "accounts-changed"; static public final String ACCOUNT_STATE_CHANGED = "account-state-changed"; @@ -36,12 +38,24 @@ public class ConfigurationManagerCallback extends ConfigurationCallback { } @Override - public void on_accounts_changed() { - sendAccountsChangedMessage(); + public void configOnVolumeChange(String device, int value) { + super.configOnVolumeChange(device, value); } @Override - public void on_account_state_changed(String accoundID, int state) { + public void configOnAccountsChange() { + super.configOnAccountsChange(); + Intent intent = new Intent(ACCOUNTS_CHANGED); + mService.sendBroadcast(intent); + } + + @Override + public void configOnStunStatusFail(String account_id) { + Log.d(TAG, "configOnStunStatusFail : (" + account_id); + } + + @Override + public void configOnRegistrationStateChange(String accoundID, int state) { String strState = ""; switch (state){ case 0: @@ -77,15 +91,20 @@ public class ConfigurationManagerCallback extends ConfigurationCallback { } - sendAccountsStateChangedMessage(accoundID, strState, 0); + sendAccountStateChangedMessage(accoundID, strState, 0); } - + + @Override + public void configOnSipRegistrationStateChange(String account_id, String state, int code) { + Log.d(TAG, "configOnSipRegistrationStateChange : (" + account_id); + } + @Override - public void on_account_state_changed_with_code(String accoundID, String state, int code) { -// sendAccountsStateChangedMessage(accoundID, state, code); + public void configOnError(int alert) { + Log.d(TAG, "configOnError : (" + alert); } - private void sendAccountsStateChangedMessage(String accoundID, String state, int code) { + private void sendAccountStateChangedMessage(String accoundID, String state, int code) { Intent intent = new Intent(ACCOUNT_STATE_CHANGED); intent.putExtra("Account", accoundID); intent.putExtra("state", state); @@ -93,12 +112,7 @@ public class ConfigurationManagerCallback extends ConfigurationCallback { mService.sendBroadcast(intent); } - private void sendAccountsChangedMessage() { - Intent intent = new Intent(ACCOUNTS_CHANGED); - mService.sendBroadcast(intent); - } - - public IntVect get_hardware_audio_format(){ + public IntVect configGetHardwareAudioFormat(){ IntVect result = new IntVect(); OpenSlParams audioParams = OpenSlParams.createInstance(mService); diff --git a/sflphone-android/src/org/sflphone/service/ISipService.aidl b/sflphone-android/src/org/sflphone/service/ISipService.aidl index 5cab757ab..1ec5664e1 100644 --- a/sflphone-android/src/org/sflphone/service/ISipService.aidl +++ b/sflphone-android/src/org/sflphone/service/ISipService.aidl @@ -27,7 +27,6 @@ interface ISipService { void setAudioPlugin(in String callID); String getCurrentAudioOutputPlugin(); List getAudioCodecList(in String accountID); - String getCurrentAudioCodecName(in String callID); void setActiveCodecList(in List codecs, in String accountID); Map getRingtoneList(); diff --git a/sflphone-android/src/org/sflphone/service/SipService.java b/sflphone-android/src/org/sflphone/service/SipService.java index ebc46ccbf..75ecae29d 100644 --- a/sflphone-android/src/org/sflphone/service/SipService.java +++ b/sflphone-android/src/org/sflphone/service/SipService.java @@ -24,30 +24,18 @@ */ package org.sflphone.service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.sflphone.account.AccountDetailSrtp; +import android.app.Service; +import android.content.Intent; +import android.os.*; +import android.util.Log; import org.sflphone.history.HistoryManager; import org.sflphone.model.*; import org.sflphone.utils.MediaManager; import org.sflphone.utils.SipNotifications; import org.sflphone.utils.SwigNativeConverter; -import android.app.Service; -import android.content.Intent; -import android.os.Bundle; -import android.os.Handler; -import android.os.HandlerThread; -import android.os.IBinder; -import android.os.Looper; -import android.os.Message; -import android.os.RemoteException; -import android.util.Log; +import java.util.*; +import java.util.Map.Entry; public class SipService extends Service { @@ -55,12 +43,6 @@ public class SipService extends Service { private SipServiceExecutor mExecutor; private static HandlerThread executorThread; - private CallManager callManagerJNI; - private ManagerImpl managerImpl; - private CallManagerCallBack callManagerCallBack; - - private ConfigurationManager configurationManagerJNI; - private ConfigurationManagerCallback configurationManagerCallback; private boolean isPjSipStackStarted = false; protected SipNotifications mNotificationManager; @@ -73,14 +55,6 @@ public class SipService extends Service { return mConferences; } - public CallManager getCallManagerJNI() { - return callManagerJNI; - } - - public ConfigurationManager getConfigurationManagerJNI() { - return configurationManagerJNI; - } - public void addCallToConference(String confId, String callId) { if(mConferences.get(callId) != null){ // We add a simple call to a conference @@ -89,9 +63,8 @@ public class SipService extends Service { mConferences.remove(callId); } else { Log.i(TAG, "addCallToConference"); - Iterator<Map.Entry<String, Conference>> it = mConferences.entrySet().iterator(); - while (it.hasNext()) { - Conference tmp = it.next().getValue(); + for (Entry<String, Conference> stringConferenceEntry : mConferences.entrySet()) { + Conference tmp = stringConferenceEntry.getValue(); for (SipCall c : tmp.getParticipants()) { if (c.getCallId().contentEquals(callId)) { mConferences.get(confId).addParticipant(c); @@ -188,12 +161,11 @@ public class SipService extends Service { return getConferences().get(callID).getCallById(callID); } else { // Check if call is in a conference - Iterator<Map.Entry<String, Conference>> it = getConferences().entrySet().iterator(); - while (it.hasNext()) { - Conference tmp = it.next().getValue(); + for (Entry<String, Conference> stringConferenceEntry : getConferences().entrySet()) { + Conference tmp = stringConferenceEntry.getValue(); SipCall c = tmp.getCallById(callID); - if(c != null) - return c; + if (c != null) + return c; } } return null; @@ -232,10 +204,8 @@ public class SipService extends Service { } private void stopDaemon() { - if (managerImpl != null) { - managerImpl.finish(); - isPjSipStackStarted = false; - } + SFLPhoneservice.sflph_fini(); + isPjSipStackStarted = false; } private void startPjSipStack() throws SameThreadException { @@ -259,11 +229,8 @@ public class SipService extends Service { } Log.i(TAG, "PjSIPStack started"); - managerImpl = SFLPhoneservice.instance(); - callManagerJNI = new CallManager(); - configurationManagerJNI = new ConfigurationManager(); - managerImpl.init(""); + SFLPhoneservice.init(new ConfigurationCallback(), new CallManagerCallBack(this)); Log.i(TAG, "->startPjSipStack"); } @@ -359,7 +326,7 @@ public class SipService extends Service { } mConferences.put(toAdd.getId(), toAdd); mMediaManager.obtainAudioFocus(false); - callManagerJNI.placeCall(call.getAccount().getAccountID(), call.getCallId(), call.getmContact().getPhones().get(0).getNumber()); + SFLPhoneservice.sflph_call_place(call.getAccount().getAccountID(), call.getCallId(), call.getmContact().getPhones().get(0).getNumber()); } }); } @@ -371,7 +338,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.refuse() thread running..."); - callManagerJNI.refuse(callID); + SFLPhoneservice.sflph_call_refuse(callID); } }); } @@ -383,7 +350,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.accept() thread running..."); - callManagerJNI.accept(callID); + SFLPhoneservice.sflph_call_accept(callID); mMediaManager.RouteToInternalSpeaker(); } }); @@ -397,7 +364,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.hangUp() thread running..."); - callManagerJNI.hangUp(callID); + SFLPhoneservice.sflph_call_hang_up(callID); removeCall(callID); if(mConferences.size() == 0) { Log.i(TAG, "No more calls!"); @@ -413,7 +380,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.hold() thread running..."); - callManagerJNI.hold(callID); + SFLPhoneservice.sflph_call_hold(callID); } }); } @@ -424,7 +391,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.unhold() thread running..."); - callManagerJNI.unhold(callID); + SFLPhoneservice.sflph_call_unhold(callID); } }); } @@ -441,7 +408,7 @@ public class SipService extends Service { @Override protected StringMap doRun() throws SameThreadException { Log.i(TAG, "SipService.getCallDetails() thread running..."); - return callManagerJNI.getCallDetails(id); + return SFLPhoneservice.sflph_call_get_call_details(id); } } @@ -452,9 +419,7 @@ public class SipService extends Service { } StringMap swigmap = (StringMap) runInstance.getVal(); - HashMap<String, String> nativemap = SwigNativeConverter.convertCallDetailsToNative(swigmap); - - return nativemap; + return SwigNativeConverter.convertCallDetailsToNative(swigmap); } @@ -464,7 +429,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.setAudioPlugin() thread running..."); - configurationManagerJNI.setAudioPlugin(audioPlugin); + SFLPhoneservice.sflph_config_set_audio_plugin(audioPlugin); } }); } @@ -475,11 +440,9 @@ public class SipService extends Service { @Override protected String doRun() throws SameThreadException { Log.i(TAG, "SipService.getCurrentAudioOutputPlugin() thread running..."); - return configurationManagerJNI.getCurrentAudioOutputPlugin(); + return SFLPhoneservice.sflph_config_get_current_audio_output_plugin(); } } - ; - CurrentAudioPlugin runInstance = new CurrentAudioPlugin(); getExecutor().execute(runInstance); while (!runInstance.isDone()) { @@ -494,7 +457,7 @@ public class SipService extends Service { @Override protected StringVect doRun() throws SameThreadException { Log.i(TAG, "SipService.getAccountList() thread running..."); - return configurationManagerJNI.getAccountList(); + return SFLPhoneservice.sflph_config_get_account_list(); } } AccountList runInstance = new AccountList(); @@ -517,7 +480,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.setAccountsOrder() thread running..."); - configurationManagerJNI.setAccountsOrder(order); + SFLPhoneservice.sflph_config_set_accounts_order(order); } }); } @@ -534,7 +497,7 @@ public class SipService extends Service { @Override protected StringMap doRun() throws SameThreadException { Log.i(TAG, "SipService.getAccountDetails() thread running..."); - return configurationManagerJNI.getAccountDetails(id); + return SFLPhoneservice.sflph_config_get_account_details(id); } } @@ -545,9 +508,7 @@ public class SipService extends Service { } StringMap swigmap = (StringMap) runInstance.getVal(); - HashMap<String, String> nativemap = SwigNativeConverter.convertAccountToNative(swigmap); - - return nativemap; + return SwigNativeConverter.convertAccountToNative(swigmap); } @SuppressWarnings("unchecked") @@ -562,7 +523,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { - configurationManagerJNI.setAccountDetails(accountId, swigmap); + SFLPhoneservice.sflph_config_set_account_details(accountId, swigmap); Log.i(TAG, "SipService.setAccountDetails() thread running..."); } @@ -576,7 +537,7 @@ public class SipService extends Service { @Override protected StringMap doRun() throws SameThreadException { Log.i(TAG, "SipService.getAccountTemplate() thread running..."); - return configurationManagerJNI.getAccountTemplate(); + return SFLPhoneservice.sflph_config_get_account_template(); } } @@ -606,7 +567,7 @@ public class SipService extends Service { @Override protected String doRun() throws SameThreadException { Log.i(TAG, "SipService.addAccount() thread running..."); - return configurationManagerJNI.addAccount(map); + return SFLPhoneservice.sflph_config_add_account(map); } } @@ -616,9 +577,8 @@ public class SipService extends Service { getExecutor().execute(runInstance); while (!runInstance.isDone()) { } - String accountId = (String) runInstance.getVal(); - return accountId; + return (String) runInstance.getVal(); } @Override @@ -627,7 +587,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException { Log.i(TAG, "SipService.setAccountDetails() thread running..."); - configurationManagerJNI.removeAccount(accountId); + SFLPhoneservice.sflph_config_remove_account(accountId); } }); } @@ -642,7 +602,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.transfer() thread running..."); - if (callManagerJNI.transfer(callID, to)) { + if (SFLPhoneservice.sflph_call_transfer(callID, to)) { Bundle bundle = new Bundle(); bundle.putString("CallID", callID); bundle.putString("State", "HUNGUP"); @@ -662,7 +622,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.attendedTransfer() thread running..."); - if (callManagerJNI.attendedTransfer(transferID, targetID)) { + if (SFLPhoneservice.sflph_call_attended_transfer(transferID, targetID)) { Log.i(TAG, "OK"); } else Log.i(TAG, "NOT OK"); @@ -681,7 +641,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.createConference() thread running..."); - callManagerJNI.removeConference(confID); + SFLPhoneservice.sflph_call_remove_conference(confID); } }); @@ -693,7 +653,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.joinParticipant() thread running..."); - callManagerJNI.joinParticipant(sel_callID, drag_callID); + SFLPhoneservice.sflph_call_join_participant(sel_callID, drag_callID); // Generate a CONF_CREATED callback } }); @@ -706,7 +666,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.addParticipant() thread running..."); - callManagerJNI.addParticipant(call.getCallId(), confID); + SFLPhoneservice.sflph_call_add_participant(call.getCallId(), confID); mConferences.get(confID).getParticipants().add(call); } }); @@ -719,7 +679,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.addMainParticipant() thread running..."); - callManagerJNI.addMainParticipant(confID); + SFLPhoneservice.sflph_call_add_main_participant(confID); } }); @@ -743,7 +703,7 @@ public class SipService extends Service { Log.i(TAG, "Call found and put in current_calls"); } } - callManagerJNI.detachParticipant(callID); + SFLPhoneservice.sflph_call_detach_participant(callID); } }); @@ -755,7 +715,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.joinConference() thread running..."); - callManagerJNI.joinConference(sel_confID, drag_confID); + SFLPhoneservice.sflph_call_join_conference(sel_confID, drag_confID); } }); @@ -768,7 +728,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.joinConference() thread running..."); - callManagerJNI.hangUpConference(confID); + SFLPhoneservice.sflph_call_hang_up_conference(confID); } }); @@ -780,7 +740,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.holdConference() thread running..."); - callManagerJNI.holdConference(confID); + SFLPhoneservice.sflph_call_hold_conference(confID); } }); @@ -792,7 +752,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.unholdConference() thread running..."); - callManagerJNI.unholdConference(confID); + SFLPhoneservice.sflph_call_unhold_conference(confID); } }); @@ -805,7 +765,7 @@ public class SipService extends Service { @Override protected Boolean doRun() throws SameThreadException { Log.i(TAG, "SipService.isRecording() thread running..."); - return callManagerJNI.isConferenceParticipant(callID); + return SFLPhoneservice.sflph_call_is_conference_participant(callID); } } @@ -849,7 +809,7 @@ public class SipService extends Service { @Override protected StringVect doRun() throws SameThreadException { Log.i(TAG, "SipService.getParticipantList() thread running..."); - return callManagerJNI.getParticipantList(confID); + return SFLPhoneservice.sflph_call_get_participant_list(confID); } } ; @@ -880,10 +840,9 @@ public class SipService extends Service { @Override protected StringMap doRun() throws SameThreadException { Log.i(TAG, "SipService.getConferenceDetails() thread running..."); - return callManagerJNI.getConferenceDetails(callID); + return SFLPhoneservice.sflph_call_get_conference_details(callID); } } - ; ConfDetails runInstance = new ConfDetails(); getExecutor().execute(runInstance); while (!runInstance.isDone()) { @@ -901,7 +860,7 @@ public class SipService extends Service { @Override protected String doRun() throws SameThreadException { Log.i(TAG, "SipService.getRecordPath() thread running..."); - return configurationManagerJNI.getRecordPath(); + return SFLPhoneservice.sflph_config_get_record_path(); } } @@ -910,9 +869,8 @@ public class SipService extends Service { while (!runInstance.isDone()) { // Log.w(TAG, "Waiting for getRecordPath"); } - String path = (String) runInstance.getVal(); - return path; + return (String) runInstance.getVal(); } @Override @@ -923,14 +881,12 @@ public class SipService extends Service { @Override protected Boolean doRun() throws SameThreadException { Log.i(TAG, "SipService.toggleRecordingCall() thread running..."); - boolean result = callManagerJNI.toggleRecording(id); + boolean result = SFLPhoneservice.sflph_call_toggle_recording(id); if (getConferences().containsKey(id)) { getConferences().get(id).setRecording(result); } else { - Iterator<Conference> it = getConferences().values().iterator(); - while (it.hasNext()) { - Conference c = it.next(); + for (Conference c : getConferences().values()) { if (c.getCallById(id) != null) c.getCallById(id).setRecording(result); } @@ -954,7 +910,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.setRecordingCall() thread running..."); - callManagerJNI.startRecordedFilePlayback(filepath); + SFLPhoneservice.sflph_call_play_recorded_file(filepath); } }); return false; @@ -966,7 +922,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.stopRecordedFilePlayback() thread running..."); - callManagerJNI.stopRecordedFilePlayback(filepath); + SFLPhoneservice.sflph_call_stop_recorded_file(filepath); } }); } @@ -977,7 +933,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.setRecordPath() " + path + " thread running..."); - configurationManagerJNI.setRecordPath(path); + SFLPhoneservice.sflph_config_set_record_path(path); } }); } @@ -988,7 +944,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.sendTextMessage() thread running..."); - callManagerJNI.sendTextMessage(callID, message.comment); + SFLPhoneservice.sflph_call_send_text_message(callID, message.comment); if (getConferences().get(callID) != null) getConferences().get(callID).addSipMessage(message); } @@ -1005,13 +961,13 @@ public class SipService extends Service { Log.i(TAG, "SipService.getAudioCodecList() thread running..."); ArrayList<Codec> results = new ArrayList<Codec>(); - IntVect active_payloads = configurationManagerJNI.getActiveAudioCodecList(accountID); + IntVect active_payloads = SFLPhoneservice.sflph_config_get_active_audio_codec_list(accountID); for (int i = 0; i < active_payloads.size(); ++i) { - results.add(new Codec(active_payloads.get(i), configurationManagerJNI.getAudioCodecDetails(active_payloads.get(i)), true)); + results.add(new Codec(active_payloads.get(i), SFLPhoneservice.sflph_config_get_audio_codec_details(active_payloads.get(i)), true)); } - IntVect payloads = configurationManagerJNI.getAudioCodecList(); + IntVect payloads = SFLPhoneservice.sflph_config_get_audio_codec_list(); for (int i = 0; i < payloads.size(); ++i) { boolean isActive = false; @@ -1023,7 +979,7 @@ public class SipService extends Service { if (isActive) continue; else - results.add(new Codec(payloads.get(i), configurationManagerJNI.getAudioCodecDetails(payloads.get(i)), false)); + results.add(new Codec(payloads.get(i), SFLPhoneservice.sflph_config_get_audio_codec_details(payloads.get(i)), false)); } @@ -1035,8 +991,7 @@ public class SipService extends Service { getExecutor().execute(runInstance); while (!runInstance.isDone()) { } - ArrayList<Codec> codecs = (ArrayList<Codec>) runInstance.getVal(); - return codecs; + return (ArrayList<Codec>) runInstance.getVal(); } @Override @@ -1046,7 +1001,7 @@ public class SipService extends Service { @Override protected StringMap doRun() throws SameThreadException { Log.i(TAG, "SipService.getRingtoneList() thread running..."); - return configurationManagerJNI.getRingtoneList(); + return SFLPhoneservice.sflph_config_get_ringtone_list(); } } @@ -1070,7 +1025,7 @@ public class SipService extends Service { @Override protected Boolean doRun() throws SameThreadException { Log.i(TAG, "SipService.isCaptureMuted() thread running..."); - return configurationManagerJNI.checkForPrivateKey(pemPath); + return SFLPhoneservice.sflph_config_check_for_private_key(pemPath); } } @@ -1089,7 +1044,7 @@ public class SipService extends Service { @Override protected Boolean doRun() throws SameThreadException { Log.i(TAG, "SipService.isCaptureMuted() thread running..."); - return configurationManagerJNI.checkCertificateValidity(pemPath,pemPath); + return SFLPhoneservice.sflph_config_check_certificate_validity(pemPath, pemPath); } } @@ -1108,7 +1063,7 @@ public class SipService extends Service { @Override protected Boolean doRun() throws SameThreadException { Log.i(TAG, "SipService.isCaptureMuted() thread running..."); - return configurationManagerJNI.checkHostnameCertificate(host, port); + return SFLPhoneservice.sflph_config_check_hostname_certificate(host, port); } } @@ -1127,10 +1082,10 @@ public class SipService extends Service { protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.setActiveAudioCodecList() thread running..."); StringVect list = new StringVect(); - for (int i = 0; i < codecs.size(); ++i) { - list.add((String) codecs.get(i)); + for (Object codec : codecs) { + list.add((String) codec); } - configurationManagerJNI.setActiveAudioCodecList(list, accountID); + SFLPhoneservice.sflph_config_set_active_audio_codec_list(list, accountID); } }); } @@ -1157,7 +1112,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.playDtmf() thread running..."); - callManagerJNI.playDTMF(key); + SFLPhoneservice.sflph_call_play_dtmf(key); } }); } @@ -1172,18 +1127,13 @@ public class SipService extends Service { return mConferences.get(id); } - @Override - public String getCurrentAudioCodecName(String callID) throws RemoteException { - return callManagerJNI.getCurrentAudioCodecName(callID); - } - @Override public void setMuted(final boolean mute) throws RemoteException { getExecutor().execute(new SipRunnable() { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.setMuted() thread running..."); - configurationManagerJNI.muteCapture(mute); + SFLPhoneservice.sflph_config_mute_capture(mute); } }); } @@ -1195,7 +1145,7 @@ public class SipService extends Service { @Override protected Boolean doRun() throws SameThreadException { Log.i(TAG, "SipService.isCaptureMuted() thread running..."); - return configurationManagerJNI.isCaptureMuted(); + return SFLPhoneservice.sflph_config_is_capture_muted(); } } @@ -1215,7 +1165,7 @@ public class SipService extends Service { Log.i(TAG, "SipService.confirmSAS() thread running..."); SecureSipCall call = (SecureSipCall) getCallById(callID); call.setSASConfirmed(true); - callManagerJNI.setSASVerified(callID); + SFLPhoneservice.sflph_call_set_sas_verified(callID); } }); } @@ -1228,9 +1178,8 @@ public class SipService extends Service { @Override protected List doRun() throws SameThreadException { Log.i(TAG, "SipService.getCredentials() thread running..."); - StringVect map = configurationManagerJNI.getSupportedTlsMethod(); - ArrayList<String> result = SwigNativeConverter.convertSwigToNative(map); - return result; + StringVect map = SFLPhoneservice.sflph_config_get_supported_tls_method(); + return SwigNativeConverter.convertSwigToNative(map); } } @@ -1248,9 +1197,8 @@ public class SipService extends Service { @Override protected List doRun() throws SameThreadException { Log.i(TAG, "SipService.getCredentials() thread running..."); - VectMap map = configurationManagerJNI.getCredentials(accountID); - ArrayList<HashMap<String, String>> result = SwigNativeConverter.convertCredentialsToNative(map); - return result; + VectMap map = SFLPhoneservice.sflph_config_get_credentials(accountID); + return SwigNativeConverter.convertCredentialsToNative(map); } } @@ -1268,7 +1216,7 @@ public class SipService extends Service { protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.setCredentials() thread running..."); ArrayList<HashMap<String, String>> list = (ArrayList<HashMap<String, String>>) creds; - configurationManagerJNI.setCredentials(accountID, SwigNativeConverter.convertFromNativeToSwig(creds)); + SFLPhoneservice.sflph_config_set_credentials(accountID, SwigNativeConverter.convertFromNativeToSwig(creds)); } }); } @@ -1279,7 +1227,7 @@ public class SipService extends Service { @Override protected void doRun() throws SameThreadException, RemoteException { Log.i(TAG, "SipService.registerAllAccounts() thread running..."); - configurationManagerJNI.registerAllAccounts(); + SFLPhoneservice.sflph_config_register_all_accounts(); } }); } -- GitLab