diff --git a/src/call/call.cpp b/src/call/call.cpp index f7b915a54..f60387011 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -311,25 +311,24 @@ void CallPrivate::onCallSessionTransferStateChanged (const shared_ptr &session) { L_Q(); - LinphoneCall *lcall = L_GET_C_BACK_PTR(q); - bctbx_list_t *copy = bctbx_list_copy(linphone_core_get_calls(q->getCore()->getCCore())); - for (bctbx_list_t *it = copy; it != nullptr; it = bctbx_list_next(it)) { - LinphoneCall *call = reinterpret_cast(bctbx_list_get_data(it)); - if (call == lcall) continue; - switch (L_GET_CPP_PTR_FROM_C_OBJECT(call)->getState()) { + list> calls = q->getCore()->getCalls(); + shared_ptr currentCall = q->getSharedFromThis(); + for (const auto &call : calls) { + if (call == currentCall) + continue; + switch (call->getState()) { case CallSession::State::OutgoingInit: case CallSession::State::OutgoingProgress: case CallSession::State::OutgoingRinging: case CallSession::State::OutgoingEarlyMedia: - lInfo() << "Already existing call [" << call << "] in state [" << linphone_call_state_to_string(linphone_call_get_state(call)) << - "], canceling it before accepting new call [" << lcall << "]"; - linphone_call_terminate(call); + lInfo() << "Already existing call [" << call << "] in state [" << Utils::toString(call->getState()) + << "], canceling it before accepting new call [" << currentCall << "]"; + call->terminate(); break; default: - break; /* Nothing to do */ + break; // Nothing to do } } - bctbx_list_free(copy); } void CallPrivate::onDtmfReceived (const shared_ptr &session, char dtmf) { diff --git a/src/call/call.h b/src/call/call.h index 15204a797..4cfbf9a8a 100644 --- a/src/call/call.h +++ b/src/call/call.h @@ -37,6 +37,7 @@ class MediaSessionPrivate; class Call : public Object, public CoreAccessor { friend class CallSessionPrivate; friend class ChatMessage; + friend class ChatMessagePrivate; friend class CorePrivate; friend class MediaSessionPrivate; diff --git a/src/chat/chat-message/chat-message.cpp b/src/chat/chat-message/chat-message.cpp index e5d1a8db6..f28305460 100644 --- a/src/chat/chat-message/chat-message.cpp +++ b/src/chat/chat-message/chat-message.cpp @@ -621,8 +621,8 @@ void ChatMessagePrivate::send () { || (call->getState() == CallSession::State::Pausing) || (call->getState() == CallSession::State::PausedByRemote) ) { - lInfo() << "send SIP msg through the existing call."; - op = linphone_call_get_op(lcall); + lInfo() << "Send SIP msg through the existing call"; + op = call->getPrivate()->getOp(); string identity = linphone_core_find_best_identity(core->getCCore(), linphone_call_get_remote_address(lcall)); if (identity.empty()) { LinphoneAddress *addr = linphone_address_new(q->getToAddress().asString().c_str()); @@ -1019,7 +1019,7 @@ void ChatMessage::send () { // Do not allow sending a message that is already being sent or that has been correctly delivered/displayed if ((d->state == State::InProgress) || (d->state == State::Delivered) || (d->state == State::FileTransferDone) || (d->state == State::DeliveredToUser) || (d->state == State::Displayed)) { - lWarning() << "Cannot send chat message in state " << linphone_chat_message_state_to_string((LinphoneChatMessageState)d->state); + lWarning() << "Cannot send chat message in state " << Utils::toString(d->state); return; } diff --git a/src/conference/session/call-session.cpp b/src/conference/session/call-session.cpp index 1d525bad9..2aad40f1a 100644 --- a/src/conference/session/call-session.cpp +++ b/src/conference/session/call-session.cpp @@ -469,13 +469,13 @@ void CallSessionPrivate::updatedByRemote () { setState(CallSession::State::UpdatedByRemote,"Call updated by remote"); if (deferUpdate) { if (state == CallSession::State::UpdatedByRemote) - lInfo() << "CallSession [" << q << "]: UpdatedByRemoted was signaled but defered. LinphoneCore expects the application to call linphone_core_accept_call_update() later."; + lInfo() << "CallSession [" << q << "]: UpdatedByRemoted was signaled but defered. LinphoneCore expects the application to call CallSession::acceptUpdate() later"; } else { if (state == CallSession::State::UpdatedByRemote) q->acceptUpdate(nullptr); else { - /* Otherwise it means that the app responded by linphone_core_accept_call_update - * within the callback, so job is already done. */ + // Otherwise it means that the app responded by CallSession::acceptUpdate() within the callback, + // so job is already done } } } diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 2994d721d..d79b6a34a 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -4254,7 +4254,7 @@ int MediaSession::startInvite (const Address *destination, const string &subject void MediaSession::startRecording () { L_D(); if (d->getParams()->getRecordFilePath().empty()) { - lError() << "MediaSession::startRecording(): no output file specified. Use linphone_call_params_set_record_file()"; + lError() << "MediaSession::startRecording(): no output file specified. Use MediaSessionParams::setRecordFilePath()"; return; } if (d->audioStream && !d->getParams()->getPrivate()->getInConference())