From 37e5ccfbc24b9bbc6b1c8c7c4acd5f7eb3ec11ee Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Tue, 13 Jan 2015 14:53:18 +0100 Subject: [PATCH] DTLS-SRTP init linphone console too --- console/linphonec.c | 6 ++++++ coreapi/linphonecore.c | 13 +++++++------ mediastreamer2 | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/console/linphonec.c b/console/linphonec.c index 439702b85..d768b4a08 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -161,6 +161,7 @@ static int trace_level = 0; static char *logfile_name = NULL; static char configfile_name[PATH_MAX]; static char zrtpsecrets[PATH_MAX]; +static char usr_certificates_path[PATH_MAX]; static const char *factory_configfile_name=NULL; static char *sip_addr_to_call = NULL; /* for autocall */ static int window_id = 0; /* 0=standalone window, or window id for embedding video */ @@ -680,6 +681,8 @@ linphonec_init(int argc, char **argv) getenv("HOME")); snprintf(zrtpsecrets, PATH_MAX, "%s/.linphone-zidcache", getenv("HOME")); + snprintf(usr_certificates_path, PATH_MAX, "%s/.linphone-usr-crt", + getenv("HOME")); #elif defined(_WIN32_WCE) strncpy(configfile_name,PACKAGE_DIR "\\linphonerc",PATH_MAX); mylogfile=fopen(PACKAGE_DIR "\\" "linphonec.log","w"); @@ -689,6 +692,8 @@ linphonec_init(int argc, char **argv) getenv("APPDATA")); snprintf(zrtpsecrets, PATH_MAX, "%s/Linphone/linphone-zidcache", getenv("APPDATA")); + snprintf(usr_certificates_path, PATH_MAX, "%s/Linphone/linphone-usr-crt", + getenv("APPDATA")); #endif /* Handle configuration filename changes */ switch (handle_configfile_migration()) @@ -745,6 +750,7 @@ linphonec_init(int argc, char **argv) linphone_core_set_user_agent(linphonec,"Linphonec", LINPHONE_VERSION); linphone_core_set_zrtp_secrets_file(linphonec,zrtpsecrets); + linphone_core_set_user_certificates_path(linphonec,usr_certificates_path); linphone_core_enable_video_capture(linphonec, vcap_enabled); linphone_core_enable_video_display(linphonec, display_enabled); if (display_enabled && window_id != 0) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 057e3be32..c8ba1b332 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1489,10 +1489,11 @@ static void misc_config_read(LinphoneCore *lc) { }else if (strcmp(uuid,"0")!=0) /*to allow to disable sip.instance*/ sal_set_uuid(lc->sal, uuid); - /* DTLS: if media_encryption is DTLS, get or create the certificate directory */ - if (linphone_core_get_media_encryption(lc) == LinphoneMediaEncryptionDTLS) { - /* TODO*/ - } + /* DTLS: if media_encryption DTLS SRTP is available, get or create the certificate directory */ + /*if (ms_dtls_srtp_available()){ + *//*JOHAN: USELESS? REMOVE IT*/ + //const char *user_certificate_config_path = lp_config_get_string(config,"misc","uuid",); +// }*/ } static void linphone_core_start(LinphoneCore * lc) { @@ -6834,7 +6835,7 @@ bool_t linphone_core_media_encryption_supported(const LinphoneCore *lc, Linphone case LinphoneMediaEncryptionSRTP: return ms_srtp_supported(); case LinphoneMediaEncryptionDTLS: - return ms_dtls_available(); + return ms_dtls_srtp_available(); case LinphoneMediaEncryptionZRTP: return ms_zrtp_available(); case LinphoneMediaEncryptionNone: @@ -6859,7 +6860,7 @@ int linphone_core_set_media_encryption(LinphoneCore *lc, LinphoneMediaEncryption ret=-1; }else type="zrtp"; }else if (menc == LinphoneMediaEncryptionDTLS){ - if (!ms_dtls_available()){ + if (!ms_dtls_srtp_available()){ ms_warning("DTLS not supported by library."); type="none"; ret=-1; diff --git a/mediastreamer2 b/mediastreamer2 index 44b25ea43..c300a5806 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 44b25ea43a65afc118d9586fca82bd772c41cd76 +Subproject commit c300a5806ca1f731fe2899aa39925c20dc825899