diff --git a/README.zrtp b/README.zrtp new file mode 100644 index 000000000..c71c8d2d7 --- /dev/null +++ b/README.zrtp @@ -0,0 +1,94 @@ +ZRTP guide + +== Downloads == +- SRTP +http://sourceforge.net/projects/srtp/ +or "apt-get source libsrtp0" on Debian + +- ZRTP (libzrtpcpp-2.0) +http://www.gnutelephony.org/index.php/GNU_ZRTP + + +== Patch libzrtpcpp == +Index: src/ZIDFile.cpp +=================================================================== +--- src/ZIDFile.cpp (révision 754) ++++ src/ZIDFile.cpp (copie de travail) +@@ -78,10 +78,11 @@ + + // create save file name, rename and re-open + // if rename fails, just unlink old ZID file and create a brand new file +- // just a little inconnvenience for the user, need to verify new SAS ++ // just a little inconvenience for the user, need to verify new SAS + std::string fn = std::string(name) + std::string(".save"); + if (rename(name, fn.c_str()) < 0) { +- unlink(name); ++ // unlink(name); + createZIDFile(name); + return; + } +Index: src/libzrtpcpp/ZrtpCallback.h +=================================================================== +--- src/libzrtpcpp/ZrtpCallback.h (révision 754) ++++ src/libzrtpcpp/ZrtpCallback.h (copie de travail) +@@ -27,7 +27,7 @@ + + #include + #include +-#include ++//#include + #include + + /** +Index: src/libzrtpcpp/ZIDRecord.h +=================================================================== +--- src/libzrtpcpp/ZIDRecord.h (révision 754) ++++ src/libzrtpcpp/ZIDRecord.h (copie de travail) +@@ -33,7 +33,7 @@ + + #include + #include +-#include ++//#include + + #define IDENTIFIER_LEN 12 + #define RS_LENGTH 32 +Index: CMakeLists.txt +=================================================================== +--- CMakeLists.txt (révision 754) ++++ CMakeLists.txt (copie de travail) +@@ -124,11 +124,15 @@ + if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-Wno-long-long -Wno-char-subscripts) + add_definitions(-Wall -ansi -pedantic) ++ add_definitions(-DNEW_STDCPP) + endif() + + add_subdirectory(src) +-add_subdirectory(demo) + ++if (enable_ccrtp) ++ add_subdirectory(demo) ++endif() ++ + if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/package/) + MESSAGE(STATUS "package dir not found") + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/package/) + + + +== Create simlinks or move folders == +submodules/external/srtp -> path_to_your_srtp_source +submodules/external/libzrtpcpp -> path_to_your_patched_zrtpcpp_source + + + +== Compilation for Android == +ndk-build BUILD_GPLV3_ZRTP=1 -j5 + + +== Compilation for Desktop version == +First ortp: ./autogen.sh && ./configure --enable-zrtp && make -j5 && sudo make install +Then mediastreamer2: ./autogen.sh && ./configure && make -j5 && sudo make install +Finally linphone: ./autogen.sh && ./configure --enable-external-ortp && make -j5 && sudo make install + diff --git a/build/android/Android.mk b/build/android/Android.mk index 468afbfa3..7c9d13491 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -61,8 +61,7 @@ LOCAL_CFLAGS += \ -DENABLE_TRACE \ -DLINPHONE_VERSION=\"3.4.0\" \ -DLINPHONE_PLUGINS_DIR=\"\\tmp\" \ - -DLOG_DOMAIN=$(MY_LOG_DOMAIN) \ - -UNE_BONNE_PIPE_CA_FAIT_DU_BIEN + -DLOG_DOMAIN=$(MY_LOG_DOMAIN) LOCAL_CFLAGS += -DIN_LINPHONE @@ -115,6 +114,7 @@ LOCAL_SHARED_LIBRARIES += \ libavutil endif + LOCAL_STATIC_LIBRARIES += libspeex @@ -127,6 +127,17 @@ LOCAL_SRC_FILES += $(LIBLINPHONE_EXTENDED_SRC_FILES) LOCAL_C_INCLUDES += $(LIBLINPHONE_EXTENDED_C_INCLUDES) endif +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) +ifeq ($(BUILD_GPLV3_ZRTP),1) +LOCAL_SHARED_LIBRARIES += \ + libzrtpcpp +endif + +ifeq ($(BUILD_SRTP),1) +LOCAL_SHARED_LIBRARIES += \ + libsrtp +endif +endif LOCAL_MODULE := liblinphone include $(BUILD_SHARED_LIBRARY) diff --git a/console/linphonec.c b/console/linphonec.c index 40a243607..fef795d86 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -323,6 +323,16 @@ static void linphonec_call_updated(LinphoneCall *call){ } } +static void linphonec_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t encrypted, const char *auth_token) { + long id=(long)linphone_call_get_user_pointer (call); + if (!encrypted) { + linphonec_out("Call %i is not encrypted.\n", id); + } else { + linphonec_out("Call %i is encrypted and auth token is %s.\n", id, + (auth_token != NULL) ? auth_token : "absent"); + } +} + static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){ char *from=linphone_call_get_remote_address_as_string(call); long id=(long)linphone_call_get_user_pointer (call); @@ -626,6 +636,7 @@ main (int argc, char *argv[]) { linphonec_vtable.dtmf_received=linphonec_dtmf_received; linphonec_vtable.refer_received=linphonec_display_refer; linphonec_vtable.notify_recv=linphonec_notify_received; + linphonec_vtable.call_encryption_changed=linphonec_call_encryption_changed; if (! linphonec_init(argc, argv) ) exit(EXIT_FAILURE); diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java index d5351d99c..e7db170b8 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialBuddyStatus.java @@ -97,7 +97,7 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} - + public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public static void main(String[] args) { @@ -231,5 +231,4 @@ public class TutorialBuddyStatus implements LinphoneCoreListener { } - } diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java index 9309779bf..5837876cb 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialChatRoom.java @@ -75,7 +75,7 @@ public class TutorialChatRoom implements LinphoneCoreListener { public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg){} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} - + public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) { write("Message ["+message+"] received from ["+from.asString()+"]"); diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java index d9fdd4f41..30510fd84 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialHelloWorld.java @@ -69,6 +69,8 @@ public class TutorialHelloWorld implements LinphoneCoreListener { public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {} public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} + public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} + /* * Call state notification listener */ diff --git a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java index c00ff9b73..8af45162c 100644 --- a/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java +++ b/coreapi/help/java/org/linphone/core/tutorials/TutorialRegistration.java @@ -80,6 +80,7 @@ public class TutorialRegistration implements LinphoneCoreListener { public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from, String message) {} public void callState(LinphoneCore lc, LinphoneCall call, State cstate, String msg) {} public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,int delay_ms, Object data) {} + public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,boolean encrypted, String authenticationToken) {} public static void main(String[] args) { // Check tutorial was called with the right number of arguments diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7e6e0380a..7f9c12c20 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -40,6 +40,102 @@ static MSWebCam *get_nowebcam_device(){ } #endif +static const char* get_zrtp_identifier(LinphoneCore *lc){ + const char *confZid=lp_config_get_string(lc->config,"rtp","zid",NULL); + if (confZid != NULL) { + return confZid; + } else { + int32_t *zid=calloc(3,32); + int i=0; + for(;i<3;i++) { + zid[i]=rand(); + } + lp_config_set_string(lc->config,"rtp","zid",(char*)zid); + return lp_config_get_string(lc->config,"rtp","zid",NULL); + } +} + +const char* linphone_call_get_authentication_token(LinphoneCall *call){ + return call->audiostream->auth_token; +} + +bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call){ + return call->audiostream->auth_token_verified; +} +bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call) { + // Check ZRTP encryption in audiostream + if (!call->audiostream->encrypted) { + return FALSE; + } + +#ifdef VIDEO_ENABLED + // If video enabled, check ZRTP encryption in videostream + const LinphoneCallParams *params=linphone_call_get_current_params(call); + if (params->has_video && !call->videostream->encrypted) { + return FALSE; + } +#endif + + return TRUE; +} + +static void propagate_encryption_changed(LinphoneCall *call){ + if (call->core->vtable.call_encryption_changed == NULL) return; + + if (!linphone_call_are_all_streams_encrypted(call)) { + call->core->vtable.call_encryption_changed(call->core, call, FALSE, NULL); + } else { + call->core->vtable.call_encryption_changed(call->core, call, TRUE, call->audiostream->auth_token); + } +} + +#ifdef VIDEO_ENABLED +static void linphone_call_videostream_encryption_changed(void *data, bool_t encrypted){ + ms_message("Video stream is %s", encrypted ? "encrypted" : "not encrypted"); + + LinphoneCall *call = (LinphoneCall *)data; + call->videostream->encrypted=encrypted; + propagate_encryption_changed(call); +} +#endif + +static void linphone_call_audiostream_encryption_changed(void *data, bool_t encrypted) { + ms_message("Audio stream is %s ", encrypted ? "encrypted" : "not encrypted"); + + LinphoneCall *call = (LinphoneCall *)data; + call->audiostream->encrypted=encrypted; + propagate_encryption_changed(call); + + +#ifdef VIDEO_ENABLED + // Enable video encryption + const LinphoneCallParams *params=linphone_call_get_current_params(call); + if (params->has_video) { + ms_message("Trying to enable encryption on video stream"); + OrtpZrtpParams params; + params.zid=get_zrtp_identifier(call->core); + params.zid_file=NULL; //unused + OrtpZrtpUiCb cbs={0}; + cbs.data=call; + cbs.encryption_changed=linphone_call_videostream_encryption_changed; + params.ui_cbs=&cbs; + video_stream_enable_zrtp(call->videostream,call->audiostream,¶ms); + } +#endif +} + + +static void linphone_call_audiostream_auth_token_ready(void *data, const char* auth_token, bool_t verified) { + LinphoneCall *call=(LinphoneCall *)data; + if (call->audiostream->auth_token != NULL) + ms_free(call->audiostream->auth_token); + + call->audiostream->auth_token=ms_strdup(auth_token); + call->audiostream->auth_token_verified=verified; + + ms_message("Authentication token is %s (%s)", auth_token, verified?"verified":"unverified"); +} + static MSList *make_codec_list(LinphoneCore *lc, const MSList *codecs, int bandwidth_limit){ MSList *l=NULL; @@ -1017,6 +1113,18 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut call->playing_ringbacktone=send_ringbacktone; call->up_bw=linphone_core_get_upload_bandwidth(lc); + if (ortp_zrtp_available()) { + OrtpZrtpParams params; + params.zid=get_zrtp_identifier(lc); + params.zid_file=lc->zrtp_secrets_cache; + OrtpZrtpUiCb cbs={0}; + cbs.data=call; + cbs.encryption_changed=linphone_call_audiostream_encryption_changed; + cbs.sas_ready=linphone_call_audiostream_auth_token_ready; + params.ui_cbs=&cbs; + audio_stream_enable_zrtp(call->audiostream,¶ms); + } + goto end; end: ms_free(cname); @@ -1268,3 +1376,4 @@ void linphone_call_log_completed(LinphoneCall *call){ call_logs_write_to_config_file(lc); } + diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 934ebefa6..02647bfa4 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4210,4 +4210,9 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook ms_error("linphone_core_remove_iterate_hook(): No such hook found."); } - +void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ + if (lc->zrtp_secrets_cache != NULL) { + ms_free(lc->zrtp_secrets_cache); + } + lc->zrtp_secrets_cache=file ? ms_strdup(file) : NULL; +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 12bf72655..3d263082d 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -527,6 +527,9 @@ const char *linphone_global_state_to_string(LinphoneGlobalState gs); typedef void (*LinphoneGlobalStateCb)(struct _LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); /**Call state notification callback prototype*/ typedef void (*LinphoneCallStateCb)(struct _LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message); +/**Call encryption changed callback prototype*/ +typedef void (*CallEncryptionChangedCb)(struct _LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token); + /** @ingroup Proxies * Registration state notification callback prototype * */ @@ -600,6 +603,7 @@ typedef struct _LinphoneVTable{ DisplayMessageCb display_warning;/** Callback to display a warning to the user */ DisplayUrlCb display_url; ShowInterfaceCb show; /**< Notifies the application that it should show up*/ + CallEncryptionChangedCb call_encryption_changed; /** #include "linphonecore_utils.h" +#include #include "mediastreamer2/msjava.h" @@ -89,29 +90,39 @@ public: vTable.global_state_changed = globalStateChange; vTable.registration_state_changed = registrationStateChange; vTable.call_state_changed = callStateChange; + //vTable.call_encryption_changed = callEncryptionChange; vTable.text_received = text_received; vTable.new_subscription_request = new_subscription_request; vTable.notify_presence_recv = notify_presence_recv; listernerClass = (jclass)env->NewGlobalRef(env->GetObjectClass( alistener)); + /*displayStatus(LinphoneCore lc,String message);*/ displayStatusId = env->GetMethodID(listernerClass,"displayStatus","(Lorg/linphone/core/LinphoneCore;Ljava/lang/String;)V"); + /*void generalState(LinphoneCore lc,int state); */ globalStateId = env->GetMethodID(listernerClass,"globalState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$GlobalState;Ljava/lang/String;)V"); globalStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$GlobalState")); globalStateFromIntId = env->GetStaticMethodID(globalStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$GlobalState;"); + /*registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage);*/ registrationStateId = env->GetMethodID(listernerClass,"registrationState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneProxyConfig;Lorg/linphone/core/LinphoneCore$RegistrationState;Ljava/lang/String;)V"); registrationStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$RegistrationState")); registrationStateFromIntId = env->GetStaticMethodID(registrationStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$RegistrationState;"); + /*callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message);*/ callStateId = env->GetMethodID(listernerClass,"callState","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;Lorg/linphone/core/LinphoneCall$State;Ljava/lang/String;)V"); callStateClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCall$State")); callStateFromIntId = env->GetStaticMethodID(callStateClass,"fromInt","(I)Lorg/linphone/core/LinphoneCall$State;"); + + /*callEncryption(LinphoneCore lc, LinphoneCall call, boolean encrypted,String auth_token);*/ + callEncryptionChangedId=env->GetMethodID(listernerClass,"callEncryptionChanged","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCall;ZLjava/lang/String;)V"); + /*void ecCalibrationStatus(LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data);*/ ecCalibrationStatusId = env->GetMethodID(listernerClass,"ecCalibrationStatus","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;ILjava/lang/Object;)V"); ecCalibratorStatusClass = (jclass)env->NewGlobalRef(env->FindClass("org/linphone/core/LinphoneCore$EcCalibratorStatus")); ecCalibratorStatusFromIntId = env->GetStaticMethodID(ecCalibratorStatusClass,"fromInt","(I)Lorg/linphone/core/LinphoneCore$EcCalibratorStatus;"); + /*void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url)*/ newSubscriptionRequestId = env->GetMethodID(listernerClass,"newSubscriptionRequest","(Lorg/linphone/core/LinphoneCore;Lorg/linphone/core/LinphoneFriend;Ljava/lang/String;)V"); @@ -176,6 +187,8 @@ public: jmethodID callStateId; jmethodID callStateFromIntId; + jmethodID callEncryptionChangedId; + jclass ecCalibratorStatusClass; jmethodID ecCalibrationStatusId; jmethodID ecCalibratorStatusFromIntId; @@ -263,6 +276,21 @@ public: ,env->CallStaticObjectMethod(lcData->callStateClass,lcData->callStateFromIntId,(jint)state), message ? env->NewStringUTF(message) : NULL); } + static void callEncryptionChange(LinphoneCore *lc, LinphoneCall* call, bool_t encrypted,const char* authentication_token) { + JNIEnv *env = 0; + jint result = jvm->AttachCurrentThread(&env,NULL); + if (result != 0) { + ms_error("cannot attach VM\n"); + return; + } + LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_get_user_data(lc); + env->CallVoidMethod(lcData->listener + ,lcData->callEncryptionChangedId + ,lcData->core + ,env->NewObject(lcData->callClass,lcData->callCtrId,(jlong)call) + ,encrypted + ,authentication_token ? env->NewStringUTF(authentication_token) : NULL); + } static void notify_presence_recv (LinphoneCore *lc, LinphoneFriend *my_friend) { JNIEnv *env = 0; jint result = jvm->AttachCurrentThread(&env,NULL); @@ -1268,6 +1296,9 @@ extern "C" jboolean Java_org_linphone_core_Version_nativeHasNeon(JNIEnv *env){ } return 0; } +extern "C" jboolean Java_org_linphone_core_Version_nativeHasZrtp(JNIEnv *env){ + return ortp_zrtp_available(); +} extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_pauseCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) { return linphone_core_pause_call((LinphoneCore *) pCore, (LinphoneCall *) pCall); @@ -1278,3 +1309,27 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_pauseAllCalls(JNIEnv *en extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_resumeCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) { return linphone_core_resume_call((LinphoneCore *) pCore, (LinphoneCall *) pCall); } + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIEnv *env,jobject thiz,jlong pCore, jstring jFile) { + if (jFile) { + const char* cFile=env->GetStringUTFChars(jFile, NULL); + linphone_core_set_zrtp_secrets_file((LinphoneCore *) pCore,cFile); + env->ReleaseStringUTFChars(jFile, cFile); + } else { + linphone_core_set_zrtp_secrets_file((LinphoneCore *) pCore,NULL); + } +} + +extern "C" jstring Java_org_linphone_core_LinphoneCallImpl_getAuthenticationToken(JNIEnv* env,jobject thiz,jlong ptr) { + LinphoneCall *call = (LinphoneCall *) ptr; + const char* token = linphone_call_get_authentication_token(call); + if (token == NULL) return NULL; + return env->NewStringUTF(token); +} +extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_isAuthenticationTokenVerified(JNIEnv* env,jobject thiz,jlong ptr) { + LinphoneCall *call = (LinphoneCall *) ptr; + return linphone_call_get_authentication_token_verified(call); +} +extern "C" jboolean Java_org_linphone_core_LinphoneCallImpl_areStreamsEncrypted(JNIEnv* env,jobject thiz,jlong ptr) { + return linphone_call_are_all_streams_encrypted((LinphoneCall *) ptr); +} diff --git a/coreapi/private.h b/coreapi/private.h index 4739c0c70..7fd8f1934 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -440,6 +440,7 @@ struct _LinphoneCore bool_t network_reachable; bool_t use_preview_window; bool_t ringstream_autorelease; + char* zrtp_secrets_cache; }; bool_t linphone_core_can_we_add_call(LinphoneCore *lc); diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index e0f7cde34..a6edf1b7e 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -214,4 +214,9 @@ public interface LinphoneCall { * See getCurrentQuality() for more details about quality measurement. */ float getAverageQuality(); + + + String getAuthenticationToken(); + boolean isAuthenticationTokenVerified(); + boolean areStreamsEncrypted(); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 4afe7182f..bb52cc874 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -581,4 +581,7 @@ public interface LinphoneCore { boolean pauseCall(LinphoneCall call); boolean resumeCall(LinphoneCall call); boolean pauseAllCalls(); + + void setZrtpSecretsCache(String file); + } diff --git a/java/common/org/linphone/core/LinphoneCoreListener.java b/java/common/org/linphone/core/LinphoneCoreListener.java index ddd58a3ac..cfe43895e 100644 --- a/java/common/org/linphone/core/LinphoneCoreListener.java +++ b/java/common/org/linphone/core/LinphoneCoreListener.java @@ -15,7 +15,7 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ + */ package org.linphone.core; @@ -27,65 +27,81 @@ public interface LinphoneCoreListener { /**< Notifies the application that it should show up * @return */ - public void show(LinphoneCore lc); - /**< Ask the application some authentication information - * @return */ - public void authInfoRequested(LinphoneCore lc,String realm,String username); - /**< Callback that notifies various events with human readable text. - * @return */ - public void displayStatus(LinphoneCore lc,String message); - /**< Callback to display a message to the user - * @return */ - public void displayMessage(LinphoneCore lc,String message); - /** Callback to display a warning to the user - * @return */ - public void displayWarning(LinphoneCore lc,String message); - /** General State notification - * @param state LinphoneCore.State - * @return - * */ - public void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message); - /** Call State notification - * @param state LinphoneCall.State - * @return - * */ - - public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message); - /** - * Registration state notification - * */ - public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage); - /** - * Reports that a new subscription request has been received and wait for a decision. - *Status on this subscription request is notified by changing policy for this friend - *@param lc LinphoneCore - *@param lf LinphoneFriend corresponding to the subscriber - *@param url of the subscriber - * - */ - public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url); - /** - * Report status change for a friend previously added to LinphoneCore. - * @param lc LinphoneCore - * @param lf updated LinphoneFriend - */ - public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf); - /** - * invoked when a new text message is received - * @param lc LinphoneCore - * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. - * @param from LinphoneAddress from - * @param message incoming message - */ - public void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message); - /** - * Invoked when echo cancalation calibration is completed - * @param lc LinphoneCore - * @param status - * @param delay_ms echo delay - * @param data - */ - void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data); - + void show(LinphoneCore lc); + + /**< Ask the application some authentication information + * @return */ + void authInfoRequested(LinphoneCore lc,String realm,String username); + + /**< Callback that notifies various events with human readable text. + * @return */ + void displayStatus(LinphoneCore lc,String message); + + /**< Callback to display a message to the user + * @return */ + void displayMessage(LinphoneCore lc,String message); + + /** Callback to display a warning to the user + * @return */ + void displayWarning(LinphoneCore lc,String message); + + /** General State notification + * @param state LinphoneCore.State + * @return + * */ + void globalState(LinphoneCore lc,LinphoneCore.GlobalState state, String message); + + /** Call State notification + * @param state LinphoneCall.State + * @return + * */ + void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State cstate,String message); + + /** + * Callback to display change in encryption state. + * @param encrypted true if all streams of the call are encrypted + * @param authenticationToken token like ZRTP SAS that may be displayed to user + */ + void callEncryptionChanged(LinphoneCore lc, LinphoneCall call, boolean encrypted, String authenticationToken); + + /** + * Registration state notification + * */ + void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg, LinphoneCore.RegistrationState cstate, String smessage); + + /** + * Reports that a new subscription request has been received and wait for a decision. + *Status on this subscription request is notified by changing policy for this friend + *@param lc LinphoneCore + *@param lf LinphoneFriend corresponding to the subscriber + *@param url of the subscriber + * + */ + void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf, String url); + + /** + * Report status change for a friend previously added to LinphoneCore. + * @param lc LinphoneCore + * @param lf updated LinphoneFriend + */ + void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf); + + /** + * invoked when a new text message is received + * @param lc LinphoneCore + * @param room LinphoneChatRoom involved in this conversation. Can be be created by the framework in case the from is not present in any chat room. + * @param from LinphoneAddress from + * @param message incoming message + */ + void textReceived(LinphoneCore lc, LinphoneChatRoom cr,LinphoneAddress from,String message); + + /** + * Invoked when echo cancalation calibration is completed + * @param lc LinphoneCore + * @param status + * @param delay_ms echo delay + * @param data + */ + void ecCalibrationStatus(LinphoneCore lc,LinphoneCore.EcCalibratorStatus status, int delay_ms, Object data); } diff --git a/mediastreamer2 b/mediastreamer2 index d1ea30fb5..909125059 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d1ea30fb58954005d1ac3c2a71fbcfcb85d3bf40 +Subproject commit 9091250591e54e6533cea8ba8c203f6f4f47550d diff --git a/oRTP b/oRTP index 662a65869..9cdfa6c82 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 662a65869902a927673d9ceff10781e217ca8e9d +Subproject commit 9cdfa6c826b2a2701122a50ed3c78afa8ef17ec6