Source

Target

Commits (6)
Showing with 175 additions and 91 deletions
......@@ -3617,7 +3617,7 @@ static void update_primary_contact(LinphoneCore *lc) {
url = linphone_address_new(lc->sip_conf.contact);
if (!url) {
ms_error("Could not parse identity contact !");
url = linphone_address_new("sip:unknown@unkwownhost");
url = linphone_address_new("sip:unknown@unknownhost");
}
linphone_core_get_local_ip(lc, AF_UNSPEC, NULL, tmp);
if (strcmp(tmp, "127.0.0.1") == 0 || strcmp(tmp, "::1") == 0) {
......@@ -9708,9 +9708,9 @@ void linphone_core_set_srtp_crypto_suites(LinphoneCore *core, const char *suites
}
const char *linphone_core_get_srtp_crypto_suites(LinphoneCore *core) {
return linphone_config_get_string(core->config, "sip", "srtp_crypto_suites",
"AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_256_CM_HMAC_SHA1_80, "
"AES_256_CM_HMAC_SHA1_32, AEAD_AES_128_GCM, AEAD_AES_256_GCM");
return linphone_config_get_string(
core->config, "sip", "srtp_crypto_suites",
"AEAD_AES_128_GCM, AES_CM_128_HMAC_SHA1_80, AEAD_AES_256_GCM, AES_256_CM_HMAC_SHA1_80");
}
#ifndef _MSC_VER
......
......@@ -295,7 +295,7 @@ bool Address::clean() {
}
char *Address::toStringCstr() const {
return isValid() ? sal_address_as_string(mImpl) : nullptr;
return isValid() ? sal_address_as_string(mImpl) : ms_strdup("");
}
std::string Address::toString() const {
......@@ -349,7 +349,7 @@ string Address::toStringOrdered() const {
}
char *Address::asStringUriOnlyCstr() const {
return isValid() ? sal_address_as_string_uri_only(mImpl) : nullptr;
return isValid() ? sal_address_as_string_uri_only(mImpl) : ms_strdup("");
}
std::string Address::asStringUriOnly() const {
......
......@@ -102,7 +102,7 @@ LinphoneCore *linphone_chat_room_get_core(const LinphoneChatRoom *cr) {
const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *cr) {
const auto &address = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress();
if (address && address->isValid()) {
if (address) {
return address->toC();
} else {
return NULL;
......@@ -111,7 +111,7 @@ const LinphoneAddress *linphone_chat_room_get_peer_address(LinphoneChatRoom *cr)
const LinphoneAddress *linphone_chat_room_get_local_address(LinphoneChatRoom *cr) {
const auto &address = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getLocalAddress();
if (address && address->isValid()) {
if (address) {
return address->toC();
} else {
return NULL;
......
......@@ -97,10 +97,10 @@ shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSessionTo(const std::s
shared_ptr<CallSession> ClientGroupChatRoomPrivate::createSession() {
L_Q();
const std::shared_ptr<Address> &peerAddress(q->getConferenceId().getPeerAddress());
const std::shared_ptr<Address> &conferenceAddress = q->getConferenceAddress();
shared_ptr<Participant> &focus = static_pointer_cast<RemoteConference>(q->getConference())->focus;
const std::shared_ptr<Address> sessionTo =
(peerAddress && peerAddress->isValid()) ? peerAddress : focus->getAddress();
(conferenceAddress && conferenceAddress->isValid()) ? conferenceAddress : focus->getAddress();
return createSessionTo(sessionTo);
}
......
......@@ -30,20 +30,19 @@ LINPHONE_BEGIN_NAMESPACE
ConferenceId::ConferenceId() {
}
ConferenceId::ConferenceId(Address &&peerAddress, Address &&localAddress) {
this->peerAddress = Address::create(std::move(peerAddress));
this->localAddress = Address::create(std::move(localAddress));
ConferenceId::ConferenceId(Address &&pAddress, Address &&lAddress) {
peerAddress = Address::create(std::move(pAddress));
localAddress = Address::create(std::move(lAddress));
}
ConferenceId::ConferenceId(const std::shared_ptr<Address> &peerAddress,
const std::shared_ptr<const Address> &localAddress) {
this->peerAddress = (peerAddress) ? Address::create(peerAddress->getUri()) : nullptr;
this->localAddress = (localAddress) ? Address::create(localAddress->getUri()) : nullptr;
ConferenceId::ConferenceId(const std::shared_ptr<Address> &pAddress, const std::shared_ptr<const Address> &lAddress) {
setPeerAddress(pAddress);
setLocalAddress(lAddress);
}
ConferenceId::ConferenceId(const std::shared_ptr<Address> &peerAddress, const std::shared_ptr<Address> &localAddress) {
this->peerAddress = (peerAddress) ? Address::create(peerAddress->getUri()) : nullptr;
this->localAddress = (localAddress) ? Address::create(localAddress->getUri()) : nullptr;
ConferenceId::ConferenceId(const std::shared_ptr<Address> &pAddress, const std::shared_ptr<Address> &lAddress) {
setPeerAddress(pAddress);
setLocalAddress(lAddress);
}
ConferenceId::ConferenceId(const ConferenceId &other)
......@@ -51,8 +50,8 @@ ConferenceId::ConferenceId(const ConferenceId &other)
}
ConferenceId &ConferenceId::operator=(const ConferenceId &other) {
this->peerAddress = other.peerAddress;
this->localAddress = other.localAddress;
peerAddress = other.peerAddress;
localAddress = other.localAddress;
return *this;
}
......@@ -70,12 +69,12 @@ bool ConferenceId::operator<(const ConferenceId &other) const {
(*peerAddress == *(other.peerAddress) && *localAddress < *(other.localAddress));
}
void ConferenceId::setPeerAddress(const std::shared_ptr<Address> &addr) {
peerAddress = addr;
void ConferenceId::setPeerAddress(const std::shared_ptr<const Address> &addr) {
peerAddress = (addr) ? Address::create(addr->getUri()) : Address::create();
}
void ConferenceId::setLocalAddress(const std::shared_ptr<Address> &addr) {
localAddress = addr;
void ConferenceId::setLocalAddress(const std::shared_ptr<const Address> &addr) {
localAddress = (addr) ? Address::create(addr->getUri()) : Address::create();
}
const std::shared_ptr<Address> &ConferenceId::getPeerAddress() const {
......
......@@ -53,8 +53,8 @@ public:
const std::shared_ptr<Address> &getPeerAddress() const;
const std::shared_ptr<Address> &getLocalAddress() const;
void setPeerAddress(const std::shared_ptr<Address> &addr);
void setLocalAddress(const std::shared_ptr<Address> &addr);
void setPeerAddress(const std::shared_ptr<const Address> &addr);
void setLocalAddress(const std::shared_ptr<const Address> &addr);
bool isValid() const;
......
......@@ -133,42 +133,62 @@ void MS2AudioStream::initZrtp() {
void MS2AudioStream::setZrtpCryptoTypesParameters(MSZrtpParams *params, bool localIsOfferer) {
const MSCryptoSuite *srtpSuites = linphone_core_get_srtp_crypto_suites_array(getCCore());
if (srtpSuites) {
bool aes1 = false;
bool aes3 = false;
bool hs32 = false;
bool hs80 = false;
bool gcm = false;
for (int i = 0; (srtpSuites[i] != MS_CRYPTO_SUITE_INVALID) && (i < MS_MAX_ZRTP_CRYPTO_TYPES); i++) {
switch (srtpSuites[i]) {
case MS_AES_128_SHA1_32:
params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS32;
if (!aes1) params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
if (!hs32) params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS32;
aes1 = true;
hs32 = true;
break;
case MS_AES_128_SHA1_80_NO_AUTH:
case MS_AES_128_SHA1_32_NO_AUTH:
params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
if (!aes1) params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
aes1 = true;
break;
case MS_AES_128_SHA1_80_SRTP_NO_CIPHER:
case MS_AES_128_SHA1_80_SRTCP_NO_CIPHER:
case MS_AES_128_SHA1_80_NO_CIPHER:
params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS80;
if (!hs80) params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS80;
hs80 = true;
break;
case MS_AES_128_SHA1_80:
params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS80;
if (!aes1) params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
if (!hs80) params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS80;
hs80 = true;
aes1 = true;
break;
case MS_AES_CM_256_SHA1_80:
lWarning() << "Deprecated crypto suite MS_AES_CM_256_SHA1_80, use MS_AES_256_SHA1_80 instead";
BCTBX_NO_BREAK;
case MS_AES_256_SHA1_80:
params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES3;
params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS80;
if (!aes3) params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES3;
if (!hs80) params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS80;
hs80 = true;
aes3 = true;
break;
case MS_AES_256_SHA1_32:
params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES3;
params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS32;
if (!aes3) params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES3;
if (!hs80) params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_HS32;
hs32 = true;
aes3 = true;
break;
/* AEAD GCM suite not supported by ZRTP for now, just force the cipher setting according to key size */
case MS_AEAD_AES_128_GCM:
params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
if (!aes1) params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES1;
if (!gcm) params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_GCM;
gcm = true;
aes1 = true;
break;
case MS_AEAD_AES_256_GCM:
params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES3;
if (!aes3) params->ciphers[params->ciphersCount++] = MS_ZRTP_CIPHER_AES3;
if (!gcm) params->authTags[params->authTagsCount++] = MS_ZRTP_AUTHTAG_GCM;
gcm = true;
aes1 = true;
break;
case MS_CRYPTO_SUITE_INVALID:
break;
......
......@@ -193,24 +193,36 @@ void StreamsGroup::render(const OfferAnswerContext &constParams, CallSession::St
*/
mPostRenderHooks.clear();
for (auto &stream : mStreams) {
const size_t resultMediaDescriptionStreamNb =
(params.resultMediaDescription) ? params.resultMediaDescription->streams.size() : 0;
for (size_t index = 0; index < mStreams.size(); ++index) {
auto &stream = mStreams[index];
if (!stream) continue;
Stream *streamPtr = stream.get();
lInfo() << "StreamsGroup " << this << " rendering " << *stream;
params.scopeStreamToIndexWithDiff(stream->getIndex(), mCurrentOfferAnswerState);
if (index >= resultMediaDescriptionStreamNb) {
lInfo() << "StreamsGroup " << this << " deleting " << *stream
<< " because the negotiated media description has no stream at index " << index << " (it has only "
<< resultMediaDescriptionStreamNb << " streams)";
streamPtr->stop();
mStreams[index].reset(nullptr);
} else {
lInfo() << "StreamsGroup " << this << " rendering " << *stream;
params.scopeStreamToIndexWithDiff(stream->getIndex(), mCurrentOfferAnswerState);
if (params.localStreamDescriptionChanges) {
const std::string differences =
SalMediaDescription::printDifferences(params.localStreamDescriptionChanges);
lInfo() << "Local stream description has changed: " << differences;
}
if (params.resultStreamDescriptionChanges) {
const std::string differences =
SalMediaDescription::printDifferences(params.resultStreamDescriptionChanges);
lInfo() << "Result stream description has changed: " << differences;
}
if (streamPtr->getState() == Stream::Preparing) streamPtr->finishPrepare();
if (params.localStreamDescriptionChanges) {
const std::string differences = SalMediaDescription::printDifferences(params.localStreamDescriptionChanges);
lInfo() << "Local stream description has changed: " << differences;
streamPtr->render(params, targetState);
}
if (params.resultStreamDescriptionChanges) {
const std::string differences =
SalMediaDescription::printDifferences(params.resultStreamDescriptionChanges);
lInfo() << "Result stream description has changed: " << differences;
}
if (streamPtr->getState() == Stream::Preparing) streamPtr->finishPrepare();
streamPtr->render(params, targetState);
}
if (!mBandwidthReportTimer) {
mBandwidthReportTimer = getCore().createTimer(
......
......@@ -2477,7 +2477,27 @@ void MainDbPrivate::updateSchema() {
" joining_time" +
dbSession.timestampType() + " DEFAULT " + dbSession.currentTimestamp() + ") " + charset;
*session << "INSERT INTO chat_room_participant_device_clone SELECT * FROM chat_room_participant_device";
int idx = 0;
soci::rowset<soci::row> originalParticipantDeviceRows =
(session->prepare << "SELECT chat_room_participant_id, participant_device_sip_address_id, state, name, "
"joining_method, joining_time FROM chat_room_participant_device");
for (const auto &row : originalParticipantDeviceRows) {
lInfo() << __func__ << " DEBUG DEBUG clone idx " << idx;
idx++;
const auto participantId = dbSession.resolveId(row, 0);
const auto deviceId = dbSession.resolveId(row, 1);
const auto state = row.get<int>(2);
const auto name = row.get<string>(3, "");
const auto joiningMethod = row.get<int>(4);
const auto joiningTime = dbSession.getTime(row, 5);
auto joiningTimeDb = dbSession.getTimeWithSociIndicator(joiningTime);
*session << "INSERT INTO chat_room_participant_device_clone (chat_room_participant_id, "
"participant_device_sip_address_id, state, name, joining_method, joining_time)"
" VALUES (:participantId, :participantDeviceSipAddressId, :participantDeviceState, "
":participantDeviceName, :participantDeviceJoiningMethod, :participantDeviceJoiningTime)",
soci::use(participantId), soci::use(deviceId), soci::use(state), soci::use(name),
soci::use(joiningMethod), soci::use(joiningTimeDb.first, joiningTimeDb.second);
}
*session << "DROP TABLE IF EXISTS chat_room_participant_device";
......@@ -2507,10 +2527,13 @@ void MainDbPrivate::updateSchema() {
") " +
charset;
int idx2 = 0;
soci::rowset<soci::row> participantDeviceRows =
(session->prepare << "SELECT chat_room_participant_id, participant_device_sip_address_id, state, name, "
"joining_method, joining_time FROM chat_room_participant_device_clone");
for (const auto &row : participantDeviceRows) {
lInfo() << __func__ << " DEBUG DEBUG copy from clone idx " << idx2;
idx2++;
const auto participantId = dbSession.resolveId(row, 0);
const auto deviceId = dbSession.resolveId(row, 1);
const auto state = row.get<int>(2);
......@@ -2877,6 +2900,8 @@ void MainDb::init() {
* The mysql backend (used server-side) doesn't support this PRAGMA.
*/
initCleanup();
session->begin();
try {
......
......@@ -1005,7 +1005,10 @@ void SalCallOp::processRequestEventCb(void *userCtx, const belle_sip_request_eve
op->callTerminated(serverTransaction, 200, request);
// Call end not notified by dialog deletion because transaction can end before dialog
} else if ((method == "INVITE") || (isUpdate = (method == "UPDATE"))) {
if (isUpdate && !belle_sip_message_get_body(BELLE_SIP_MESSAGE(request))) {
if ((op->mState == State::Terminated) || (op->mState == State::Terminating)) {
// A BYE has already been sent therefore we cannot accept reINVITEs or UPDATEs anymore
response = op->createResponseFromRequest(request, 481);
} else if (isUpdate && !belle_sip_message_get_body(BELLE_SIP_MESSAGE(request))) {
response = op->createResponseFromRequest(request, 200);
if (op->mRoot->mSessionExpiresEnabled) {
......
......@@ -69,20 +69,21 @@ static void completion_cb(BCTBX_UNUSED(void *user_data), int percentage) {
}
#endif
static void audio_call_stereo_call(const char *codec_name, int clock_rate, int bitrate_override, bool_t stereo) {
static void
audio_call_stereo_call(const char *codec_name, int clock_rate, int bitrate_override, bool_t stereo, bool_t plc) {
LinphoneCoreManager *marie;
LinphoneCoreManager *pauline;
LinphonePayloadType *pt;
char *stereo_file = bc_tester_res("sounds/vrroom.wav");
char *recordpath = bc_tester_file("stereo-record.wav");
bool_t audio_cmp_failed = FALSE;
OrtpNetworkSimulatorParams simparams = {0};
unlink(recordpath);
marie = linphone_core_manager_new("marie_rc");
pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
/*make sure we have opus*/
/*make sure we have the requested codec */
pt = linphone_core_get_payload_type(marie->lc, codec_name, clock_rate, 2);
if (!pt) {
ms_warning("%s not available, stereo with %s not tested.", codec_name, codec_name);
......@@ -110,6 +111,16 @@ static void audio_call_stereo_call(const char *codec_name, int clock_rate, int b
/*stereo is supported only without volume control, echo canceller...*/
linphone_config_set_string(linphone_core_get_config(marie->lc), "sound", "features", "REMOTE_PLAYING");
linphone_config_set_string(linphone_core_get_config(pauline->lc), "sound", "features", "REMOTE_PLAYING");
if (plc) {
linphone_config_set_string(linphone_core_get_config(marie->lc), "sound", "features", "PLC");
linphone_config_set_string(linphone_core_get_config(pauline->lc), "sound", "features", "PLC");
// When PLC is enabled, for a 50% loss
simparams.mode = OrtpNetworkSimulatorOutbound;
simparams.enabled = TRUE;
simparams.consecutive_loss_probability = 0.000001f; // Ensure to have fec in n+1 packets
simparams.loss_rate = 50;
linphone_core_set_network_simulator_params(marie->lc, &simparams);
}
if (!BC_ASSERT_TRUE(call(pauline, marie))) goto end;
wait_for_until(marie->lc, pauline->lc, NULL, 0, 6000);
......@@ -146,16 +157,19 @@ end:
}
static void audio_stereo_call_l16(void) {
audio_call_stereo_call("L16", 44100, 0, TRUE);
audio_call_stereo_call("L16", 44100, 0, TRUE, FALSE);
}
static void audio_stereo_call_l16_plc(void) {
audio_call_stereo_call("L16", 44100, 0, TRUE, TRUE);
}
static void audio_stereo_call_opus(void) {
audio_call_stereo_call("opus", 48000, 150, TRUE);
audio_call_stereo_call("opus", 48000, 150, TRUE, FALSE);
}
static void audio_mono_call_opus(void) {
/*actually a call where input/output is made with stereo but opus transmits everything as mono*/
audio_call_stereo_call("opus", 48000, 150, FALSE);
audio_call_stereo_call("opus", 48000, 150, FALSE, FALSE);
}
#ifndef _MSC_VER
......@@ -174,7 +188,6 @@ static void audio_call_loss_resilience(const char *codec_name,
((void)(threshold));
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(__ANDROID__)
LinphoneCoreManager *marie = nullptr, *pauline = nullptr;
char *recordPath = nullptr;
char *playFile = bc_tester_res("sounds/continuous_48000_stereo.wav");
char *referenceFile = nullptr;
double similarity = 0.0;
......@@ -183,7 +196,7 @@ static void audio_call_loss_resilience(const char *codec_name,
OrtpNetworkSimulatorParams simparams = {0};
LinphonePayloadType *mariePt = NULL, *paulinePt = NULL;
int sampleLength = 6000;
std::string recordFileNameRoot = "loss-record.wav", recordFileName, refRecordFileName;
std::string recordFileNameRoot = "loss-record.wav", refRecordFileName;
FmtpManager marieFmtp, paulineFmtp;
std::vector<std::string> useinbandfec = {"1"};
std::vector<float> lossRates = {50.0f};
......@@ -214,7 +227,6 @@ static void audio_call_loss_resilience(const char *codec_name,
linphone_core_set_use_files(marie->lc, TRUE);
linphone_core_set_play_file(marie->lc, playFile);
linphone_core_set_use_files(pauline->lc, TRUE);
linphone_core_set_record_file(pauline->lc, recordPath);
/*stereo is supported only without volume control, echo canceller...*/
linphone_config_set_string(linphone_core_get_config(marie->lc), "sound", "features", "REMOTE_PLAYING");
linphone_config_set_string(linphone_core_get_config(pauline->lc), "sound", "features", "REMOTE_PLAYING");
......@@ -233,11 +245,11 @@ static void audio_call_loss_resilience(const char *codec_name,
marieFmtp.setFmtp("packetlosspercentage", "1");
refRecordFileName = "result_ref_" + recordFileNameRoot;
referenceFile = bc_tester_file(refRecordFileName.c_str());
unlink(referenceFile);
linphone_core_set_record_file(pauline->lc, referenceFile);
paulineFmtp = marieFmtp;
linphone_payload_type_set_recv_fmtp(mariePt, marieFmtp.toString().c_str());
linphone_payload_type_set_recv_fmtp(paulinePt, paulineFmtp.toString().c_str());
unlink(referenceFile);
if (BC_ASSERT_TRUE(call(pauline, marie))) {
wait_for_until(marie->lc, pauline->lc, NULL, 0, sampleLength + jitterBufferMs);
end_call(pauline, marie);
......@@ -260,13 +272,13 @@ static void audio_call_loss_resilience(const char *codec_name,
linphone_payload_type_set_recv_fmtp(mariePt, marieFmtp.toString().c_str());
linphone_payload_type_set_recv_fmtp(paulinePt, paulineFmtp.toString().c_str());
for (int loopIndex = 0; loopIndex < 2; ++loopIndex) {
recordFileName = useinbandfec[inbandIndex] + "_" + std::to_string(lossRates[lossRateIndex]) + "_" +
std::to_string(loopIndex) + "_" + packetLossPercentage[packetLossIndex] + "_out_" +
recordFileNameRoot;
bc_free(recordPath);
recordPath = bc_tester_file(recordFileName.c_str());
linphone_core_set_record_file(pauline->lc, recordPath);
std::string recordFileName = useinbandfec[inbandIndex] + "_" +
std::to_string(lossRates[lossRateIndex]) + "_" +
std::to_string(loopIndex) + "_" +
packetLossPercentage[packetLossIndex] + "_out_" + recordFileNameRoot;
char *recordPath = bc_tester_file(recordFileName.c_str());
unlink(recordPath);
linphone_core_set_record_file(pauline->lc, recordPath);
if (BC_ASSERT_TRUE(call(pauline, marie))) {
wait_for_until(marie->lc, pauline->lc, NULL, 0, sampleLength + jitterBufferMs);
end_call(pauline, marie);
......@@ -276,11 +288,12 @@ static void audio_call_loss_resilience(const char *codec_name,
}
similarityMin = min(similarityMin, similarity);
similarityMax = max(similarityMax, similarity);
unlink(recordPath);
bc_free(recordPath);
}
BC_ASSERT_GREATER(similarityMax, similarityRef, double, "%g");
similarityRef = similarityMin; // Min is used if we want to test more than 1 packetLossPercentage
}
unlink(recordFileName.c_str());
}
}
unlink(referenceFile);
......@@ -290,7 +303,6 @@ end:
linphone_payload_type_unref(paulinePt);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
bc_free(recordPath);
bc_free(referenceFile);
bc_free(playFile);
#else
......@@ -472,6 +484,7 @@ static void audio_bandwidth_estimation_on_secure_call() {
test_t audio_quality_tests[] = {
TEST_NO_TAG("Audio loss rate resilience opus", audio_call_loss_resilience_opus),
TEST_NO_TAG("Simple stereo call with L16", audio_stereo_call_l16),
TEST_NO_TAG("Simple stereo call with L16 (PLC)", audio_stereo_call_l16_plc),
TEST_NO_TAG("Simple stereo call with opus", audio_stereo_call_opus),
TEST_NO_TAG("Simple mono call with opus", audio_mono_call_opus),
TEST_NO_TAG("Audio bandwidth estimation", audio_bandwidth_estimation),
......
......@@ -208,8 +208,8 @@ ekt_call(MSEKTCipherType ekt_cipher, MSCryptoSuite crypto_suite, bool unmatching
marie, pauline,
([marie, pauline, ekt_cipher, crypto_suite, unmatching_ekt, update_ekt](LinphoneCall *marieCall,
LinphoneCall *paulineCall) {
BC_ASSERT_TRUE(srtp_check_call_stats(marieCall, paulineCall, MS_AES_128_SHA1_80,
MSSrtpKeySourceSDES)); // Default crypto suite is MS_AES_128_SHA1_80
BC_ASSERT_TRUE(srtp_check_call_stats(marieCall, paulineCall, MS_AEAD_AES_128_GCM,
MSSrtpKeySourceSDES)); // Default crypto suite is MS_AEAD_AES_128_GCM
MSEKTParametersSet ekt_params;
generate_ekt(&ekt_params, ekt_cipher, crypto_suite, 0x1234);
......@@ -326,8 +326,8 @@ static void srtp_call(void) {
mgr_calling_each_other(
marie, pauline, ([](LinphoneCall *marieCall, LinphoneCall *paulineCall) {
// Default is MS_AES_128_SHA1_80, we use SDES
BC_ASSERT_TRUE(srtp_check_call_stats(marieCall, paulineCall, MS_AES_128_SHA1_80, MSSrtpKeySourceSDES));
// Default is MS_AES_128_GCM, we use SDES
BC_ASSERT_TRUE(srtp_check_call_stats(marieCall, paulineCall, MS_AEAD_AES_128_GCM, MSSrtpKeySourceSDES));
}));
// Test differents crypto suites : AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_256_CM_HMAC_SHA1_80,
......@@ -389,7 +389,7 @@ static void srtp_call_with_different_crypto_suite(void) {
// same test using mgr_calling_each_other so we can check during the call that the correct suite are used
LinphoneCoreManager *marie =
linphone_core_manager_new("marie_rc"); // marie_rc does not specify any srtp crypto suite, propose all
// availables, default is AES128_SHA1-80
// availables, default is AES128_GCM
linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP);
LinphoneCoreManager *pauline =
linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
......@@ -1110,25 +1110,31 @@ static void zrtp_authtag_call(void) {
ZrtpAlgoString paulineAlgo;
ZrtpAlgoRes res;
// Default is HS80
// Default is GCM
// - this is a linphone internal default setting: SRTP crypto suite default is
// AES_CM_128_HMAC_SHA1_80, AES_CM_128_HMAC_SHA1_32, AES_256_CM_HMAC_SHA1_80, AES_256_CM_HMAC_SHA1_32.
// So the default auth tag set by the audio-stream is HS80, HS32
// - default in bzrtp is HS32, HS80
// AEAD_AES_128_GCM, AES_CM_128_HMAC_SHA1_80, AEAD_AES_256_GCM, AES_256_CM_HMAC_SHA1_80
// So the default auth tag set by the audio-stream is GCM
// - default in bzrtp is GCM, HS32, HS80
marieAlgo.auth_tag_algo = NULL;
paulineAlgo.auth_tag_algo = NULL;
res.auth_tag_algo = {MS_ZRTP_AUTHTAG_HS80};
res.auth_tag_algo = {MS_ZRTP_AUTHTAG_GCM};
BC_ASSERT_EQUAL(zrtp_params_call(marieAlgo, paulineAlgo, res), 0, int, "%d");
// Call using GCM
marieAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_GCM";
paulineAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_GCM";
res.auth_tag_algo = {MS_ZRTP_AUTHTAG_GCM};
BC_ASSERT_EQUAL(zrtp_params_call(marieAlgo, paulineAlgo, res), 0, int, "%d");
// Call using HS80
marieAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS80, MS_ZRTP_AUTHTAG_HS32";
paulineAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS80, MS_ZRTP_AUTHTAG_HS32";
marieAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS80, MS_ZRTP_AUTHTAG_HS32, MS_ZRTP_AUTHTAG_GCM";
paulineAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS80, MS_ZRTP_AUTHTAG_HS32, MS_ZRTP_AUTHTAG_GCM";
res.auth_tag_algo = {MS_ZRTP_AUTHTAG_HS80};
BC_ASSERT_EQUAL(zrtp_params_call(marieAlgo, paulineAlgo, res), 0, int, "%d");
// Call using HS32
marieAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS32, MS_ZRTP_AUTHTAG_HS80";
paulineAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS32, MS_ZRTP_AUTHTAG_HS80";
marieAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS32, MS_ZRTP_AUTHTAG_HS80, MS_ZRTP_AUTHTAG_GCM";
paulineAlgo.auth_tag_algo = "MS_ZRTP_AUTHTAG_HS32, MS_ZRTP_AUTHTAG_HS80, MS_ZRTP_AUTHTAG_GCM";
res.auth_tag_algo = {MS_ZRTP_AUTHTAG_HS32};
BC_ASSERT_EQUAL(zrtp_params_call(marieAlgo, paulineAlgo, res), 0, int, "%d");
......
......@@ -41,6 +41,10 @@
bool is_filepath_encrypted(const char *filepath) {
bool ret = false;
// if encryption openCallback is not set, file cannot be encrypted
if (bctoolbox::VfsEncryption::openCallbackGet() == nullptr) {
return false;
}
auto fp = bctbx_file_open(&bctoolbox::bcEncryptedVfs, filepath, "r");
if (fp != NULL) {
ret = (bctbx_file_is_encrypted(fp) == TRUE);
......
......@@ -137,7 +137,9 @@ if(ENABLE_DOC OR ENABLE_CXX_WRAPPER)
liblinphone-cxx-wrapper
)
add_custom_target(linphone-cpp-html-doc ALL DEPENDS "${CPP_HTML_DIR}/index.html")
install(DIRECTORY "${CPP_HTML_DIR}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/liblinphone-${LINPHONE_VERSION}")
if(ENABLE_DOC)
install(DIRECTORY "${CPP_HTML_DIR}"
DESTINATION "${CMAKE_INSTALL_DATADIR}/doc/liblinphone-${LINPHONE_VERSION}")
endif()
endif()
endif()