Skip to content
Snippets Groups Projects
Commit 8e2d826a authored by Nicolas Jager's avatar Nicolas Jager
Browse files

fix: message send with invalid call id or invalid call status

bug: sometime lrc asks the daemon to send a message with an invalid
     call id.

fix: lrc checks if the call is still in the calls list and if the
     call is running.

bug: lrc send messages trough sip channel when the call is in status
     other than in progress or on hold.

fix: lrc checks the status, and decide wich way to send the message.

Change-Id: Ifafb74e2b0f3c66e303c300483c33252926415da
parent 04ea0149
Branches
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
// Dbus // Dbus
#include "dbus/configurationmanager.h" #include "dbus/configurationmanager.h"
#include "dbus/callmanager.h"
namespace lrc namespace lrc
{ {
...@@ -449,10 +450,22 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body) ...@@ -449,10 +450,22 @@ ConversationModel::sendMessage(const std::string& uid, const std::string& body)
for (const auto& participant: conversation.participants) { for (const auto& participant: conversation.participants) {
auto contactInfo = owner.contactModel->getContact(participant); auto contactInfo = owner.contactModel->getContact(participant);
pimpl_->sendContactRequest(participant); pimpl_->sendContactRequest(participant);
if (not conversation.callId.empty())
QStringList callLists = CallManager::instance().getCallList(); // no auto
// workaround: sometimes, it may happen that the daemon delete a call, but lrc don't. We check if the call is
// still valid every time the user want to send a message.
if (not conversation.callId.empty() and not callLists.contains(conversation.callId.c_str()))
conversation.callId.clear();
if (not conversation.callId.empty()
or owner.callModel->getCall(conversation.callId).status != call::Status::IN_PROGRESS
or owner.callModel->getCall(conversation.callId).status != call::Status::PAUSED) {
owner.callModel->sendSipMessage(conversation.callId, body); owner.callModel->sendSipMessage(conversation.callId, body);
else
} else
daemonMsgId = owner.contactModel->sendDhtMessage(contactInfo.profileInfo.uri, body); daemonMsgId = owner.contactModel->sendDhtMessage(contactInfo.profileInfo.uri, body);
if (convId.empty()) { if (convId.empty()) {
// The conversation has changed because it was with the temporary item // The conversation has changed because it was with the temporary item
auto contactProfileId = database::getProfileId(pimpl_->db, contactInfo.profileInfo.uri); auto contactProfileId = database::getProfileId(pimpl_->db, contactInfo.profileInfo.uri);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment