diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 79f57875f..7ef9445b9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -532,6 +532,7 @@ void linphone_core_set_log_level(OrtpLogLevel loglevel) { void linphone_core_set_log_level_mask(unsigned int loglevel) { //we only have 2 domain for now ortp and belle-sip bctbx_set_log_level_mask(ORTP_LOG_DOMAIN, (int)loglevel); + bctbx_set_log_level_mask("mediastreamer", (int)loglevel); bctbx_set_log_level_mask("bzrtp", (int)loglevel); /*need something to set log lvel for all domains*/ sal_set_log_level((OrtpLogLevel)loglevel); } diff --git a/src/c-wrapper/api/c-call.cpp b/src/c-wrapper/api/c-call.cpp index dc86b5a1c..e1e9c4058 100644 --- a/src/c-wrapper/api/c-call.cpp +++ b/src/c-wrapper/api/c-call.cpp @@ -38,11 +38,13 @@ L_DECLARE_C_OBJECT_IMPL_WITH_XTORS(Call, _linphone_call_constructor, _linphone_call_destructor, bctbx_list_t *callbacks; /* A list of LinphoneCallCbs object */ LinphoneCallCbs *currentCbs; /* The current LinphoneCallCbs object used to call a callback */ + char *authenticationTokenCache; LinphoneCallParams *currentParamsCache; LinphoneCallParams *paramsCache; LinphoneCallParams *remoteParamsCache; LinphoneAddress *remoteAddressCache; char *remoteContactCache; + char *remoteUserAgentCache; /* TODO: all the fields need to be removed */ struct _LinphoneCore *core; LinphoneErrorInfo *ei; @@ -713,14 +715,13 @@ const LinphoneErrorInfo *linphone_call_get_error_info (const LinphoneCall *call) } const char *linphone_call_get_remote_user_agent (LinphoneCall *call) { -#if 0 - if (call->op){ - return sal_op_get_remote_ua (call->op); - } - return nullptr; -#else - return nullptr; -#endif + string ua = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getRemoteUserAgent(); + if (ua.empty()) + return nullptr; + if (call->remoteUserAgentCache) + bctbx_free(call->remoteUserAgentCache); + call->remoteUserAgentCache = bctbx_strdup(ua.c_str()); + return call->remoteUserAgentCache; } const char * linphone_call_get_remote_contact (LinphoneCall *call) { @@ -734,7 +735,13 @@ const char * linphone_call_get_remote_contact (LinphoneCall *call) { } const char *linphone_call_get_authentication_token (LinphoneCall *call) { - return L_STRING_TO_C(L_GET_CPP_PTR_FROM_C_OBJECT(call)->getAuthenticationToken()); + string token = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getAuthenticationToken(); + if (token.empty()) + return nullptr; + if (call->authenticationTokenCache) + bctbx_free(call->authenticationTokenCache); + call->authenticationTokenCache = bctbx_strdup(token.c_str()); + return call->authenticationTokenCache; } bool_t linphone_call_get_authentication_token_verified (const LinphoneCall *call) { diff --git a/src/call/call.cpp b/src/call/call.cpp index 3a6eeef86..d371c5a1b 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -475,6 +475,11 @@ const MediaSessionParams *Call::getRemoteParams () const { return static_cast(d->getActiveSession().get())->getRemoteParams(); } +string Call::getRemoteUserAgent () const { + L_D(); + return d->getActiveSession()->getRemoteUserAgent(); +} + float Call::getSpeakerVolumeGain () const { L_D(); return static_cast(d->getActiveSession().get())->getSpeakerVolumeGain(); diff --git a/src/call/call.h b/src/call/call.h index a3d840c87..0b46058db 100644 --- a/src/call/call.h +++ b/src/call/call.h @@ -96,6 +96,7 @@ public: std::string getRemoteAddressAsString () const; std::string getRemoteContact () const; const MediaSessionParams *getRemoteParams () const; + std::string getRemoteUserAgent () const; float getSpeakerVolumeGain () const; LinphoneCallState getState () const; LinphoneCallStats *getStats (LinphoneStreamType type) const; diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 4f32a203a..36b04a315 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -926,7 +926,7 @@ int MediaSessionPrivate::selectFixedPort (int streamIndex, pair portRa int MediaSessionPrivate::selectRandomPort (int streamIndex, pair portRange) { for (int nbTries = 0; nbTries < 100; nbTries++) { bool alreadyUsed = false; - int triedPort = (static_cast(ortp_random()) % (portRange.second - portRange.first) + portRange.first) & ~0x1; + int triedPort = static_cast((ortp_random() % (portRange.second - portRange.first) + portRange.first) & ~0x1); if (triedPort < portRange.first) triedPort = portRange.first + 2; for (const bctbx_list_t *elem = linphone_core_get_calls(core); elem != nullptr; elem = bctbx_list_next(elem)) { LinphoneCall *lcall = reinterpret_cast(bctbx_list_get_data(elem));