diff --git a/src/api/avmodel.h b/src/api/avmodel.h index 913fa15dcb1adddd3565aff16620e6789b8890c4..51945f414b57aedbb2fa681a9c1237d8c59ccd7a 100644 --- a/src/api/avmodel.h +++ b/src/api/avmodel.h @@ -253,47 +253,6 @@ public: * @throw std::out_of_range if not found */ const video::Renderer& getRenderer(const QString& id) const; - /** - * @deprecated Render a file to the call id specified - * @param uri the path of the file - * @param callId - * @note callId can be omitted to switch the input of the local recorder - */ - void setInputFile(const QString& uri, const QString& callId = {}); - /** - * Change the current device rendered for the call id specified - * @param id of the camera - * @param callId - * @note renders a black frame if device not found or empty - * @note callId can be omitted to switch the input of the local recorder - */ - void switchInputTo(const QString& id, const QString& callId = {}); - /** - * @deprecated Render the current display to the call id specified - * @param idx of the display - * @param x top left of the area - * @param y top up of the area - * @param w width of the area - * @param h height of the area - * @param callId - * @note callId can be omitted to switch the input of the local recorder - */ - void setDisplay(int idx, int x, int y, int w, int h, const QString& callId = {}); - /** - * Get the current display resource string - * @param idx of the display - * @param x top left of the area - * @param y top up of the area - * @param w width of the area - * @param h height of the area - */ - QString getDisplay(int idx, int x, int y, int w, int h); - /** - * Get informations on the rendered device - * @param call_id linked call to the renderer - * @return the device rendered - */ - video::RenderedDevice getCurrentRenderedDevice(const QString& call_id) const; /** * set to true to receive AVFrames from render */ diff --git a/src/api/lrc.h b/src/api/lrc.h index 96cf7641cbd20923da383d6f0b28e4ccf01f5d02..4666c684101a411246c4e8f3f9cebd682f516512 100644 --- a/src/api/lrc.h +++ b/src/api/lrc.h @@ -95,19 +95,19 @@ public: static VectorString activeCalls(); /** - * Helper: get call list from daemon + * Close all active calls and conferences */ - static VectorString getCalls(); + void hangupCallsAndConferences(); /** - * Helper: get conference list from daemon + * Helper: get call list from daemon */ - static VectorString getConferences(); + static VectorString getCalls(); /** - * Helper: get subcalls list for a conference from daemon + * Helper: get conference list from daemon */ - static VectorString getConferenceSubcalls(const QString& cid); + static VectorString getConferences(const QString& accountId = ""); /** * Preference diff --git a/src/api/newcallmodel.h b/src/api/newcallmodel.h index 4ad783a8cd45fdfa509dd02109e8470f2b591839..2a70620c69a3471fb4ae17aa774c2d6c82a0f7f8 100644 --- a/src/api/newcallmodel.h +++ b/src/api/newcallmodel.h @@ -21,6 +21,7 @@ #include "api/behaviorcontroller.h" #include "api/call.h" #include "api/account.h" +#include "api/newvideo.h" #include "typedefs.h" #include <QObject> @@ -87,6 +88,7 @@ public: /** * Request a media change in a ongoing call. + * @param accountId * @param callId * @param mediaLabel label of media to be changed * @param source @@ -124,6 +126,11 @@ public: */ const call::Info& getConferenceFromURI(const QString& uri) const; + /** + * Helper: get subcalls list for a conference from daemon + */ + VectorString getConferenceSubcalls(const QString& cid); + /** * @param callId to test * @return true if callId is presend else false. @@ -235,12 +242,6 @@ public: * @return true if the call is recording else false */ bool isRecording(const QString& callId) const; - - /** - * Close all active calls and conferences - */ - static void hangupCallsAndConferences(); - /** * Extract Status Message From Status Map * @param statusCode @@ -336,6 +337,48 @@ public: */ const QList<call::PendingConferenceeInfo>& getPendingConferencees(); + /** + * Get informations on the rendered device + * @param call_id linked call to the renderer + * @return the device rendered + */ + video::RenderedDevice getCurrentRenderedDevice(const QString& call_id) const; + + /** + * Render a file to the call id specified + * @param uri the path of the file + * @param callId + * @note callId can be omitted to switch the input of the local recorder + */ + void setInputFile(const QString& uri, const QString& callId = {}); + /** + * Change the current device rendered for the call id specified + * @param id of the camera + * @param callId + * @note renders a black frame if device not found or empty + * @note callId can be omitted to switch the input of the local recorder + */ + void switchInputTo(const QString& id, const QString& callId = {}); + /** + * Get the current display resource string + * @param idx of the display + * @param x top left of the area + * @param y top up of the area + * @param w width of the area + * @param h height of the area + */ + QString getDisplay(int idx, int x, int y, int w, int h); + /** + * Render the current display to the call id specified + * @param idx of the display + * @param x top left of the area + * @param y top up of the area + * @param w width of the area + * @param h height of the area + * @param callId + * @note callId can be omitted to switch the input of the local recorder + */ + void setDisplay(int idx, int x, int y, int w, int h, const QString& callId = {}); Q_SIGNALS: /** * Emitted when a call state changes diff --git a/src/avmodel.cpp b/src/avmodel.cpp index 27c16b30e37b7d95d36447e9c5d4abd61c303158..653bc370371d27502d280ec1c8271389890769a6 100644 --- a/src/avmodel.cpp +++ b/src/avmodel.cpp @@ -39,6 +39,7 @@ // LRC #include "api/call.h" +#include "api/lrc.h" #include "callbackshandler.h" #include "dbus/callmanager.h" #include "dbus/configurationmanager.h" @@ -519,13 +520,13 @@ AVModel::useAVFrame(bool useAVFrame) QString AVModel::startPreview(const QString& resource) { - return QString(VideoManager::instance().openVideoInput(resource.toStdString()).c_str()); + return VideoManager::instance().openVideoInput(resource); } void AVModel::stopPreview(const QString& resource) { - VideoManager::instance().closeVideoInput(resource.toStdString()); + VideoManager::instance().closeVideoInput(resource); } const video::Renderer& @@ -539,95 +540,6 @@ AVModel::getRenderer(const QString& id) const return *pimpl_->renderers_[id]; } -void -AVModel::setInputFile(const QString& uri, const QString& callId) -{ - QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR; - auto resource = !uri.isEmpty() ? QString("%1%2%3") - .arg(DRing::Media::VideoProtocolPrefix::FILE) - .arg(sep) - .arg(QUrl(uri).toLocalFile()) - : DRing::Media::VideoProtocolPrefix::NONE; - if (callId.isEmpty()) { - VideoManager::instance().openVideoInput(resource.toStdString()); - } else { - CallManager::instance().switchInput(callId, resource); - } -} - -void -AVModel::setDisplay(int idx, int x, int y, int w, int h, const QString& callId) -{ - auto resource = getDisplay(idx, x, y, w, h); - if (callId.isEmpty()) { - VideoManager::instance().switchInput(resource); - } else { - CallManager::instance().switchInput(callId, resource); - } -} - -QString -AVModel::getDisplay(int idx, int x, int y, int w, int h) -{ - QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR; - return QString("%1%2:%3+%4,%5 %6x%7") - .arg(DRing::Media::VideoProtocolPrefix::DISPLAY) - .arg(sep) - .arg(idx) - .arg(x) - .arg(y) - .arg(w) - .arg(h); -} - -void -AVModel::switchInputTo(const QString& id, const QString& callId) -{ - QString resource; - auto devices = getDevices(); - auto deviceAvailable = std::find(std::begin(devices), std::end(devices), id); - if (deviceAvailable != devices.end()) { - QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR; - resource = QString("%1%2%3").arg(DRing::Media::VideoProtocolPrefix::CAMERA).arg(sep).arg(id); - } else { - resource = QString(DRing::Media::VideoProtocolPrefix::NONE); - } - if (callId.isEmpty()) { - VideoManager::instance().openVideoInput(resource.toStdString()); - } else { - CallManager::instance().switchInput(callId, resource); - } -} - -video::RenderedDevice -AVModel::getCurrentRenderedDevice(const QString& call_id) const -{ - video::RenderedDevice result; - MapStringString callDetails; - QStringList conferences = CallManager::instance().getConferenceList(); - if (conferences.indexOf(call_id) != -1) { - callDetails = CallManager::instance().getConferenceDetails(call_id); - } else { - callDetails = CallManager::instance().getCallDetails(call_id); - } - if (!callDetails.contains("VIDEO_SOURCE")) { - return result; - } - auto source = callDetails["VIDEO_SOURCE"]; - auto sourceSize = source.size(); - if (source.startsWith("camera://")) { - result.type = video::DeviceType::CAMERA; - result.name = source.right(sourceSize - QString("camera://").size()); - } else if (source.startsWith("file://")) { - result.type = video::DeviceType::FILE; - result.name = source.right(sourceSize - QString("file://").size()); - } else if (source.startsWith("display://")) { - result.type = video::DeviceType::DISPLAY; - result.name = source.right(sourceSize - QString("display://").size()); - } - return result; -} - void AVModel::setCurrentVideoCaptureDevice(const QString& currentVideoCaptureDevice) { @@ -700,8 +612,13 @@ AVModelPimpl::AVModelPimpl(AVModel& linked, const CallbacksHandler& callbacksHan } } }; - restartRenderers(CallManager::instance().getCallList()); - restartRenderers(CallManager::instance().getConferenceList()); + restartRenderers(CallManager::instance().getCallList("")); + auto confIds = lrc::api::Lrc::getConferences(); + QStringList list; + foreach (QString confId, confIds) { + list << confId; + } + restartRenderers(list); if (startedPreview) restartRenderers({"local"}); currentVideoCaptureDevice_ = VideoManager::instance().getDefaultDevice(); @@ -737,7 +654,7 @@ AVModelPimpl::getRecordingPath() const void AVModelPimpl::startedDecoding(const QString& id, const QString& shmPath, int width, int height) { - if (id != "" && id != "local") // Else managed by callmodel + if (id != "" && id != "local" && !id.contains("://")) // Else managed by callmodel return; video::Settings settings; settings.size = toQString(width) + "x" + toQString(height); @@ -758,7 +675,7 @@ AVModelPimpl::stopCameraAndQuit(int) { if (SIZE_RENDERER == 1) { // This will stop the preview if needed (not in a call). - VideoManager::instance().stopCamera(); + VideoManager::instance().closeVideoInput(video::PREVIEW_RENDERER_ID); // HACK: this sleep is just here to let the camera stop and // avoid immediate raise std::this_thread::sleep_for(std::chrono::milliseconds(50)); diff --git a/src/callbackshandler.cpp b/src/callbackshandler.cpp index 843976974a2d9c519f784d505fabf21c4c8949a8..5f47cf7da17ea88ace7224e52d45509f6c96ffb4 100644 --- a/src/callbackshandler.cpp +++ b/src/callbackshandler.cpp @@ -459,9 +459,12 @@ CallbacksHandler::slotMediaChangeRequested(const QString& accountId, } void -CallbacksHandler::slotCallStateChanged(const QString& callId, const QString& state, int code) +CallbacksHandler::slotCallStateChanged(const QString& accountId, + const QString& callId, + const QString& state, + int code) { - emit callStateChanged(callId, state, code); + emit callStateChanged(accountId, callId, state, code); } void @@ -503,7 +506,8 @@ CallbacksHandler::slotRegistrationStateChanged(const QString& accountId, } void -CallbacksHandler::slotIncomingMessage(const QString& callId, +CallbacksHandler::slotIncomingMessage(const QString& accountId, + const QString& callId, const QString& from, const MapStringString& interaction) { @@ -522,30 +526,37 @@ CallbacksHandler::slotIncomingMessage(const QString& callId, auto pieces1 = pieces0[1].split(","); auto pieces2 = pieces1[1].split("="); auto pieces3 = pieces1[2].split("="); - emit incomingVCardChunk(callId, from2, pieces2[1].toInt(), pieces3[1].toInt(), e.second); + emit incomingVCardChunk(accountId, + callId, + from2, + pieces2[1].toInt(), + pieces3[1].toInt(), + e.second); } else if (e.first.contains( "text/plain")) { // we consider it as an usual message interaction - emit incomingCallMessage(callId, from2, e.second); + emit incomingCallMessage(accountId, callId, from2, e.second); } } } void -CallbacksHandler::slotConferenceCreated(const QString& callId) +CallbacksHandler::slotConferenceCreated(const QString& accountId, const QString& callId) { - emit conferenceCreated(callId); + emit conferenceCreated(accountId, callId); } void -CallbacksHandler::slotConferenceChanged(const QString& callId, const QString& state) +CallbacksHandler::slotConferenceChanged(const QString& accountId, + const QString& callId, + const QString& state) { - slotCallStateChanged(callId, state, 0); + slotCallStateChanged(accountId, callId, state, 0); } void -CallbacksHandler::slotConferenceRemoved(const QString& callId) +CallbacksHandler::slotConferenceRemoved(const QString& accountId, const QString& callId) { - emit conferenceRemoved(callId); + emit conferenceRemoved(accountId, callId); } void diff --git a/src/callbackshandler.h b/src/callbackshandler.h index 3d4257a2204983531765142997c79c475a2a0f09..7de5609dc0f70742fc4d912da27ad01808c22bd4 100644 --- a/src/callbackshandler.h +++ b/src/callbackshandler.h @@ -124,11 +124,15 @@ Q_SIGNALS: const VectorMapStringString& mediaList); /** * Connect this signal to know when a call is updated + * @param accountId * @param callId the call id * @param state the new state * @param code */ - void callStateChanged(const QString& callId, const QString& state, int code); + void callStateChanged(const QString& accountId, + const QString& callId, + const QString& state, + int code); /** * Connect this signal to know when a call medias are available * @param callId the call id @@ -162,34 +166,41 @@ Q_SIGNALS: void accountStatusChanged(const QString& accountId, const api::account::Status status); /** * Connect this signal to know where a VCard is incoming + * @param accountId * @param callId the call linked to this VCard * @param from the sender URI * @param part the number of the part * @param numberOfParts of the VCard * @param payload content of the VCard */ - void incomingVCardChunk(const QString& callId, + void incomingVCardChunk(const QString& accountId, + const QString& callId, const QString& from, int part, int numberOfParts, const QString& payload); /** * Connect this signal to get incoming text interaction from SIP. + * @param accountId the account linked. * @param callId the call linked. * @param from interaction sender. * @param body the text received. */ - void incomingCallMessage(const QString& callId, const QString& from, const QString& body) const; + void incomingCallMessage(const QString& accountId, + const QString& callId, + const QString& from, + const QString& body) const; /** * Connect this signal to know when a new conference is created * @param callId of the conference */ - void conferenceCreated(const QString& callId); + void conferenceCreated(const QString& accountId, const QString& callId); /** * Connect this signal to know when a conference is removed + * @param accountId * @param callId of the conference */ - void conferenceRemoved(const QString& callId); + void conferenceRemoved(const QString& accountId, const QString& callId); /** * Connect this signal to know when a message sent get a new status * @param accountId, account linked @@ -460,11 +471,15 @@ private Q_SLOTS: const VectorMapStringString& mediaList); /** * Emit callStateChanged + * @param accountId * @param callId the call which changes. * @param state the new state * @param code unused for now */ - void slotCallStateChanged(const QString& callId, const QString& state, int code); + void slotCallStateChanged(const QString& accountId, + const QString& callId, + const QString& state, + int code); /** * Emit mediaNegotiationStatus * @param callId the call which changes. @@ -477,29 +492,36 @@ private Q_SLOTS: /** * Parse a call message and emit incomingVCardChunk if it's a VCard chunk * else incomingCallMessage if it's a text message + * @param accountId account linked * @param callId call linked * @param from the URI * @param interaction the content of the Message. */ - void slotIncomingMessage(const QString& callId, + void slotIncomingMessage(const QString& accountId, + const QString& callId, const QString& from, const QMap<QString, QString>& interaction); /** * Emit conferenceCreated + * @param accountId * @param callId of the conference */ - void slotConferenceCreated(const QString& callId); + void slotConferenceCreated(const QString& accountId, const QString& callId); /** * Emit conferenceRemove + * @param accountId * @param callId of the conference */ - void slotConferenceRemoved(const QString& callId); + void slotConferenceRemoved(const QString& accountId, const QString& callId); /** * Call slotCallStateChanged + * @param accountId * @param callId of the conference * @param state, new state */ - void slotConferenceChanged(const QString& callId, const QString& state); + void slotConferenceChanged(const QString& accountId, + const QString& callId, + const QString& state); /** * Emit accountMessageStatusChanged * @param accountId, account linked diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp index 7ac3764453e2a9195b53bfc4d1d85e3a57805418..f57c50a1f13821f7cc9883ffeb6faa3c5817ef83 100644 --- a/src/conversationmodel.cpp +++ b/src/conversationmodel.cpp @@ -311,11 +311,15 @@ public Q_SLOTS: const MapStringString& payloads); /** * Listen from CallbacksHandler for new messages in a SIP call + * @param accountId account linked to the interaction * @param callId call linked to the interaction * @param from author uri * @param body of the message */ - void slotIncomingCallMessage(const QString& callId, const QString& from, const QString& body); + void slotIncomingCallMessage(const QString& accountId, + const QString& callId, + const QString& from, + const QString& body); /** * Listen from CallModel when a call is added to a conference * @param callId @@ -324,9 +328,10 @@ public Q_SLOTS: void slotCallAddedToConference(const QString& callId, const QString& confId); /** * Listen from CallbacksHandler when a conference is deleted. + * @param accountId * @param confId */ - void slotConferenceRemoved(const QString& confId); + void slotConferenceRemoved(const QString& accountId, const QString& confId); /** * Listen for when a contact is composing * @param accountId @@ -420,7 +425,7 @@ ConversationModel::getConferenceableConversations(const QString& convId, const Q auto currentConfId = pimpl_->conversations.at(conversationIdx).confId; auto currentCallId = pimpl_->conversations.at(conversationIdx).callId; auto calls = pimpl_->lrc.getCalls(); - auto conferences = pimpl_->lrc.getConferences(); + auto conferences = pimpl_->lrc.getConferences(owner.id); auto& conversations = pimpl_->conversations; auto currentAccountID = pimpl_->linked.owner.id; // add contacts for current account @@ -463,8 +468,8 @@ ConversationModel::getConferenceableConversations(const QString& convId, const Q // filter out calls from conference for (const auto& c : conferences) { - for (const auto& subcal : pimpl_->lrc.getConferenceSubcalls(c)) { - auto position = std::find(calls.begin(), calls.end(), subcal); + for (const auto& subcall : owner.callModel->getConferenceSubcalls(c)) { + auto position = std::find(calls.begin(), calls.end(), subcall); if (position != calls.end()) { calls.erase(position); } @@ -737,7 +742,7 @@ ConversationModel::selectConversation(const QString& uid) const if (!conversation.confId.isEmpty() && owner.confProperties.isRendezVous) { // If we are on a rendez vous account and we select the conversation, // attach to the call. - CallManager::instance().unholdConference(conversation.confId); + CallManager::instance().unholdConference(owner.id, conversation.confId); } if (not callEnded and not conversation.confId.isEmpty()) { @@ -1108,7 +1113,7 @@ ConversationModel::sendMessage(const QString& uid, const QString& body, const QS auto status = interaction::Status::SENDING; auto convId = newConv.uid; - QStringList callLists = CallManager::instance().getCallList(); // no auto + 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. @@ -3226,11 +3231,12 @@ ConversationModelPimpl::slotNewAccountMessage(const QString& accountId, } void -ConversationModelPimpl::slotIncomingCallMessage(const QString& callId, +ConversationModelPimpl::slotIncomingCallMessage(const QString& accountId, + const QString& callId, const QString& from, const QString& body) { - if (not linked.owner.callModel->hasCall(callId)) + if (accountId != linked.owner.id || !linked.owner.callModel->hasCall(callId)) return; auto& call = linked.owner.callModel->getCall(callId); @@ -3318,7 +3324,8 @@ ConversationModelPimpl::slotCallAddedToConference(const QString& callId, const Q conversation.confId = confId; invalidateModel(); // Refresh the conference status only if attached - MapStringString confDetails = CallManager::instance().getConferenceDetails(confId); + MapStringString confDetails = CallManager::instance() + .getConferenceDetails(linked.owner.id, confId); if (confDetails["STATE"] == "ACTIVE_ATTACHED") emit linked.selectConversation(conversation.uid); } @@ -3449,8 +3456,10 @@ ConversationModelPimpl::slotUpdateInteractionStatus(const QString& accountId, } void -ConversationModelPimpl::slotConferenceRemoved(const QString& confId) +ConversationModelPimpl::slotConferenceRemoved(const QString& accountId, const QString& confId) { + if (accountId != linked.owner.id) + return; // Get conversation for (auto& i : conversations) { if (i.confId == confId) { diff --git a/src/lrc.cpp b/src/lrc.cpp index 74e2e96ec28ff1800510b93d95a7696da277a156..6aa896aff6a282b91c1bd55e497a53af05168d4d 100644 --- a/src/lrc.cpp +++ b/src/lrc.cpp @@ -146,21 +146,39 @@ Lrc::subscribeToDebugReceived() VectorString Lrc::activeCalls() { - QStringList callLists = CallManager::instance().getCallList(); VectorString result; - result.reserve(callLists.size()); - for (const auto& call : callLists) { - MapStringString callDetails = CallManager::instance().getCallDetails(call); - if (!isFinished(callDetails[QString(DRing::Call::Details::CALL_STATE)])) - result.push_back(call); + const QStringList accountIds = ConfigurationManager::instance().getAccountList(); + for (const auto& accId : accountIds) { + QStringList callLists = CallManager::instance().getCallList(accId); + for (const auto& call : callLists) { + MapStringString callDetails = CallManager::instance().getCallDetails(accId, call); + if (!isFinished(callDetails[QString(DRing::Call::Details::CALL_STATE)])) + result.push_back(call); + } } return result; } +void +Lrc::hangupCallsAndConferences() +{ + const QStringList accountIds = ConfigurationManager::instance().getAccountList(); + for (const auto& accId : accountIds) { + QStringList conferences = CallManager::instance().getConferenceList(accId); + for (const auto& conf : conferences) { + CallManager::instance().hangUpConference(accId, conf); + } + QStringList calls = CallManager::instance().getCallList(accId); + for (const auto& call : calls) { + CallManager::instance().hangUp(accId, call); + } + } +} + VectorString Lrc::getCalls() { - QStringList callLists = CallManager::instance().getCallList(); + QStringList callLists = CallManager::instance().getCallList(""); VectorString result; result.reserve(callLists.size()); for (const auto& call : callLists) { @@ -170,25 +188,20 @@ Lrc::getCalls() } VectorString -Lrc::getConferences() -{ - QStringList conferencesList = CallManager::instance().getConferenceList(); - VectorString result; - result.reserve(conferencesList.size()); - for (const auto& conf : conferencesList) { - result.push_back(conf); - } - return result; -} - -VectorString -Lrc::getConferenceSubcalls(const QString& cid) +Lrc::getConferences(const QString& accountId) { - QStringList callList = CallManager::instance().getParticipantList(cid); VectorString result; - result.reserve(callList.size()); - foreach (const auto& callId, callList) { - result.push_back(callId); + if (accountId.isEmpty()) { + const QStringList accountIds = ConfigurationManager::instance().getAccountList(); + for (const auto& accId : accountIds) { + QStringList conferencesList = CallManager::instance().getConferenceList(accId); + for (const auto& conf : conferencesList) + result.push_back(conf); + } + } else { + QStringList conferencesList = CallManager::instance().getConferenceList(accountId); + for (const auto& conf : conferencesList) + result.push_back(conf); } return result; } diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp index 3c31f2363fc878acfdfb0e39023da69ae309714e..2c4f1d02fcd7d2ac73e05eb728419595bb917a11 100644 --- a/src/newcallmodel.cpp +++ b/src/newcallmodel.cpp @@ -31,6 +31,7 @@ #include "api/newaccountmodel.h" #include "authority/storagehelper.h" #include "dbus/callmanager.h" +#include "dbus/videomanager.h" #include "vcard.h" #include "video/renderer.h" #include "typedefs.h" @@ -131,7 +132,6 @@ public: void sendProfile(const QString& callId); NewCallModel::CallInfoMap calls; - Lrc& lrc_; const CallbacksHandler& callbacksHandler; const NewCallModel& linked; const BehaviorController& behaviorController; @@ -162,6 +162,8 @@ public: bool manageCurrentCall_ {true}; QString currentCall_ {}; + Lrc& lrc; + QList<call::PendingConferenceeInfo> pendingConferencees_; public Q_SLOTS: @@ -189,11 +191,15 @@ public Q_SLOTS: const VectorMapStringString& mediaList); /** * Listen from CallbacksHandler when a call got a new state + * @param accountId * @param callId * @param state the new state * @param code unused */ - void slotCallStateChanged(const QString& callId, const QString& state, int code); + void slotCallStateChanged(const QString& accountId, + const QString& callId, + const QString& state, + int code); /** * Listen from CallbacksHandler when a call medias are ready * @param callId @@ -205,13 +211,15 @@ public Q_SLOTS: const VectorMapStringString& mediaList); /** * Listen from CallbacksHandler when a VCard chunk is incoming + * @param accountId * @param callId * @param from * @param part * @param numberOfParts * @param payload */ - void slotincomingVCardChunk(const QString& callId, + void slotincomingVCardChunk(const QString& accountId, + const QString& callId, const QString& from, int part, int numberOfParts, @@ -220,7 +228,7 @@ public Q_SLOTS: * Listen from CallbacksHandler when a conference is created. * @param callId */ - void slotConferenceCreated(const QString& callId); + void slotConferenceCreated(const QString& accountId, const QString& callId); /** * Listen from CallbacksHandler when a voice mail notice is incoming * @param accountId @@ -285,7 +293,7 @@ NewCallModel::getConferenceFromURI(const QString& uri) const { for (const auto& call : pimpl_->calls) { if (call.second->type == call::Type::CONFERENCE) { - QStringList callList = CallManager::instance().getParticipantList(call.first); + QStringList callList = CallManager::instance().getParticipantList(owner.id, call.first); foreach (const auto& callId, callList) { try { if (pimpl_->calls.find(callId) != pimpl_->calls.end() @@ -300,6 +308,18 @@ NewCallModel::getConferenceFromURI(const QString& uri) const throw std::out_of_range("No call at URI " + uri.toStdString()); } +VectorString +NewCallModel::getConferenceSubcalls(const QString& confId) +{ + QStringList callList = CallManager::instance().getParticipantList(owner.id, confId); + VectorString result; + result.reserve(callList.size()); + foreach (const auto& callId, callList) { + result.push_back(callId); + } + return result; +} + const call::Info& NewCallModel::getCall(const QString& uid) const { @@ -398,7 +418,7 @@ NewCallModel::requestMediaChange(const QString& callId, .arg(QUrl(uri).toLocalFile()) : DRing::Media::VideoProtocolPrefix::NONE; if (callInfo->type == call::Type::CONFERENCE) { - CallManager::instance().switchInput(callId, resource); + CallManager::instance().switchInput(owner.id, callId, resource); return; } if (!resource.isEmpty()) @@ -410,7 +430,7 @@ NewCallModel::requestMediaChange(const QString& callId, // Screen/window sharing resource = uri; if (callInfo->type == call::Type::CONFERENCE) { - CallManager::instance().switchInput(callId, resource); + CallManager::instance().switchInput(owner.id, callId, resource); return; } srctype = MediaAttributeValue::SRC_TYPE_DISPLAY; @@ -426,11 +446,13 @@ NewCallModel::requestMediaChange(const QString& callId, if (callInfo->type == call::Type::CONFERENCE) { if (mediaLabel.contains("audio_0")) { - CallManager::instance().muteLocalMedia(callId, + CallManager::instance().muteLocalMedia(owner.id, + callId, DRing::Media::Details::MEDIA_TYPE_AUDIO, !callInfo->audioMuted && mute); } else if (mediaLabel.contains("video_0")) { - CallManager::instance().muteLocalMedia(callId, + CallManager::instance().muteLocalMedia(owner.id, + callId, DRing::Media::Details::MEDIA_TYPE_VIDEO, !callInfo->videoMuted && mute); } @@ -470,7 +492,7 @@ NewCallModel::requestMediaChange(const QString& callId, {MediaAttributeKey::LABEL, mediaLabel}}; proposedList.push_back(mediaAttribute); } - CallManager::instance().requestMediaChange(callId, proposedList); + CallManager::instance().requestMediaChange(owner.id, callId, proposedList); // If media existed and its mute state was changed here, then we should // update the mediaList because we will not receive signal // mediaNegotiationStatus @@ -494,9 +516,9 @@ NewCallModel::accept(const QString& callId) const if (!callInfo) return; if (callInfo->mediaList.empty()) - CallManager::instance().accept(callId); + CallManager::instance().accept(owner.id, callId); else - CallManager::instance().acceptWithMedia(callId, callInfo->mediaList); + CallManager::instance().acceptWithMedia(owner.id, callId, callInfo->mediaList); } catch (...) { } } @@ -509,16 +531,16 @@ NewCallModel::hangUp(const QString& callId) const auto& call = pimpl_->calls[callId]; if (call->status == call::Status::INCOMING_RINGING) { - CallManager::instance().refuse(callId); + CallManager::instance().refuse(owner.id, callId); return; } switch (call->type) { case call::Type::DIALOG: - CallManager::instance().hangUp(callId); + CallManager::instance().hangUp(owner.id, callId); break; case call::Type::CONFERENCE: - CallManager::instance().hangUpConference(callId); + CallManager::instance().hangUpConference(owner.id, callId); break; case call::Type::INVALID: default: @@ -531,13 +553,13 @@ NewCallModel::refuse(const QString& callId) const { if (!hasCall(callId)) return; - CallManager::instance().refuse(callId); + CallManager::instance().refuse(owner.id, callId); } void NewCallModel::toggleAudioRecord(const QString& callId) const { - CallManager::instance().toggleRecording(callId); + CallManager::instance().toggleRecording(owner.id, callId); } void @@ -560,15 +582,15 @@ NewCallModel::togglePause(const QString& callId) const if (call->status == call::Status::PAUSED) { if (call->type == call::Type::DIALOG) { - CallManager::instance().unhold(callId); + CallManager::instance().unhold(owner.id, callId); } else { - CallManager::instance().unholdConference(callId); + CallManager::instance().unholdConference(owner.id, callId); } } else if (call->status == call::Status::IN_PROGRESS) { if (call->type == call::Type::DIALOG) - CallManager::instance().hold(callId); + CallManager::instance().hold(owner.id, callId); else { - CallManager::instance().holdConference(callId); + CallManager::instance().holdConference(owner.id, callId); } } } @@ -593,13 +615,13 @@ NewCallModel::setQuality(const QString& callId, const double quality) const void NewCallModel::transfer(const QString& callId, const QString& to) const { - CallManager::instance().transfer(callId, to); + CallManager::instance().transfer(owner.id, callId, to); } void NewCallModel::transferToCall(const QString& callId, const QString& callIdDest) const { - CallManager::instance().attendedTransfer(callId, callIdDest); + CallManager::instance().attendedTransfer(owner.id, callId, callIdDest); } void @@ -630,7 +652,10 @@ NewCallModel::joinCalls(const QString& callIdA, const QString& callIdB) const } if (call1.type == call::Type::CONFERENCE && call2.type == call::Type::CONFERENCE) { - bool joined = CallManager::instance().joinConference(callIdA, callIdB); + bool joined = CallManager::instance().joinConference(accountIdCall1, + callIdA, + accountIdCall2, + callIdB); if (!joined) { qWarning() << "Conference: " << callIdA << " couldn't join conference " << callIdB; @@ -652,10 +677,10 @@ NewCallModel::joinCalls(const QString& callIdA, const QString& callIdB) const auto call = call1.type == call::Type::CONFERENCE ? callIdB : callIdA; auto conf = call1.type == call::Type::CONFERENCE ? callIdA : callIdB; // Unpause conference if conference was not active - CallManager::instance().unholdConference(conf); + CallManager::instance().unholdConference(owner.id, conf); auto accountCall = call1.type == call::Type::CONFERENCE ? accountIdCall2 : accountIdCall1; - bool joined = CallManager::instance().addParticipant(call, conf); + bool joined = CallManager::instance().addParticipant(accountCall, call, accountCall, conf); if (!joined) { qWarning() << "Call: " << call << " couldn't join conference " << conf; return; @@ -665,7 +690,7 @@ NewCallModel::joinCalls(const QString& callIdA, const QString& callIdB) const try { auto& accountInfo = owner.accountModel->getAccountInfo(accountCall); if (accountInfo.callModel->hasCall(call)) { - accountInfo.callModel->pimpl_->slotConferenceCreated(conf); + accountInfo.callModel->pimpl_->slotConferenceCreated(owner.id, conf); } } catch (...) { } @@ -682,7 +707,7 @@ NewCallModel::joinCalls(const QString& callIdA, const QString& callIdB) const } } } else { - CallManager::instance().joinParticipant(callIdA, callIdB); + CallManager::instance().joinParticipant(accountIdCall1, callIdA, accountIdCall2, callIdB); // NOTE: This will trigger slotConferenceCreated. } } @@ -725,7 +750,7 @@ NewCallModel::isRecording(const QString& callId) const { if (!hasCall(callId)) return false; - return CallManager::instance().getIsRecording(callId); + return CallManager::instance().getIsRecording(owner.id, callId); } QString @@ -744,12 +769,101 @@ NewCallModel::getPendingConferencees() return pimpl_->pendingConferencees_; } +video::RenderedDevice +NewCallModel::getCurrentRenderedDevice(const QString& call_id) const +{ + video::RenderedDevice result; + MapStringString callDetails; + QStringList conferences = CallManager::instance().getConferenceList(owner.id); + if (conferences.indexOf(call_id) != -1) { + callDetails = CallManager::instance().getConferenceDetails(owner.id, call_id); + } else { + callDetails = CallManager::instance().getCallDetails(owner.id, call_id); + } + if (!callDetails.contains("VIDEO_SOURCE")) { + return result; + } + auto source = callDetails["VIDEO_SOURCE"]; + auto sourceSize = source.size(); + if (source.startsWith("camera://")) { + result.type = video::DeviceType::CAMERA; + result.name = source.right(sourceSize - QString("camera://").size()); + } else if (source.startsWith("file://")) { + result.type = video::DeviceType::FILE; + result.name = source.right(sourceSize - QString("file://").size()); + } else if (source.startsWith("display://")) { + result.type = video::DeviceType::DISPLAY; + result.name = source.right(sourceSize - QString("display://").size()); + } + return result; +} + +void +NewCallModel::setInputFile(const QString& uri, const QString& callId) +{ + QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR; + auto resource = !uri.isEmpty() ? QString("%1%2%3") + .arg(DRing::Media::VideoProtocolPrefix::FILE) + .arg(sep) + .arg(QUrl(uri).toLocalFile()) + : DRing::Media::VideoProtocolPrefix::NONE; + if (callId.isEmpty()) { + VideoManager::instance().openVideoInput(resource); + } else { + CallManager::instance().switchInput(owner.id, callId, resource); + } +} + +QString +NewCallModel::getDisplay(int idx, int x, int y, int w, int h) +{ + QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR; + return QString("%1%2:%3+%4,%5 %6x%7") + .arg(DRing::Media::VideoProtocolPrefix::DISPLAY) + .arg(sep) + .arg(idx) + .arg(x) + .arg(y) + .arg(w) + .arg(h); +} + +void +NewCallModel::setDisplay(int idx, int x, int y, int w, int h, const QString& callId) +{ + auto resource = getDisplay(idx, x, y, w, h); + if (callId.isEmpty()) { + VideoManager::instance().openVideoInput(resource); + } else { + CallManager::instance().switchInput(owner.id, callId, resource); + } +} + +void +NewCallModel::switchInputTo(const QString& id, const QString& callId) +{ + QString resource; + auto devices = pimpl_->lrc.getAVModel().getDevices(); + auto deviceAvailable = std::find(std::begin(devices), std::end(devices), id); + if (deviceAvailable != devices.end()) { + QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR; + resource = QString("%1%2%3").arg(DRing::Media::VideoProtocolPrefix::CAMERA).arg(sep).arg(id); + } else { + resource = QString(DRing::Media::VideoProtocolPrefix::NONE); + } + if (callId.isEmpty()) { + VideoManager::instance().openVideoInput(resource); + } else { + CallManager::instance().switchInput(owner.id, callId, resource); + } +} + NewCallModelPimpl::NewCallModelPimpl(const NewCallModel& linked, Lrc& lrc, const CallbacksHandler& callbacksHandler, const BehaviorController& behaviorController) : linked(linked) - , lrc_(lrc) + , lrc(lrc) , callbacksHandler(callbacksHandler) , behaviorController(behaviorController) { @@ -806,34 +920,32 @@ NewCallModelPimpl::~NewCallModelPimpl() {} void NewCallModelPimpl::initCallFromDaemon() { - QStringList callList = CallManager::instance().getCallList(); + QStringList callList = CallManager::instance().getCallList(linked.owner.id); for (const auto& callId : callList) { - MapStringString details = CallManager::instance().getCallDetails(callId); - auto accountId = details["ACCOUNTID"]; - if (accountId == linked.owner.id) { - auto callInfo = std::make_shared<call::Info>(); - callInfo->id = callId; - auto now = std::chrono::steady_clock::now(); - auto system_now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - auto diff = static_cast<int64_t>(system_now) - - std::stol(details["TIMESTAMP_START"].toStdString()); - callInfo->startTime = now - std::chrono::seconds(diff); - callInfo->status = call::to_status(details["CALL_STATE"]); - auto endId = details["PEER_NUMBER"].indexOf("@"); - callInfo->peerUri = details["PEER_NUMBER"].left(endId); - if (linked.owner.profileInfo.type == lrc::api::profile::Type::JAMI) { - callInfo->peerUri = "ring:" + callInfo->peerUri; - } - callInfo->videoMuted = details["VIDEO_MUTED"] == "true"; - callInfo->audioMuted = details["AUDIO_MUTED"] == "true"; - callInfo->type = call::Type::DIALOG; - VectorMapStringString infos = CallManager::instance().getConferenceInfos(callId); - callInfo->participantsInfos = infos; - calls.emplace(callId, std::move(callInfo)); - // NOTE/BUG: the videorenderer can't know that the client has restarted - // So, for now, a user will have to manually restart the medias until - // this renderer is not redesigned. + MapStringString details = CallManager::instance().getCallDetails(linked.owner.id, callId); + auto callInfo = std::make_shared<call::Info>(); + callInfo->id = callId; + auto now = std::chrono::steady_clock::now(); + auto system_now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + auto diff = static_cast<int64_t>(system_now) + - std::stol(details["TIMESTAMP_START"].toStdString()); + callInfo->startTime = now - std::chrono::seconds(diff); + callInfo->status = call::to_status(details["CALL_STATE"]); + auto endId = details["PEER_NUMBER"].indexOf("@"); + callInfo->peerUri = details["PEER_NUMBER"].left(endId); + if (linked.owner.profileInfo.type == lrc::api::profile::Type::JAMI) { + callInfo->peerUri = "ring:" + callInfo->peerUri; } + callInfo->videoMuted = details["VIDEO_MUTED"] == "true"; + callInfo->audioMuted = details["AUDIO_MUTED"] == "true"; + callInfo->type = call::Type::DIALOG; + VectorMapStringString infos = CallManager::instance().getConferenceInfos(linked.owner.id, + callId); + callInfo->participantsInfos = infos; + calls.emplace(callId, std::move(callInfo)); + // NOTE/BUG: the videorenderer can't know that the client has restarted + // So, for now, a user will have to manually restart the medias until + // this renderer is not redesigned. } } @@ -849,18 +961,16 @@ NewCallModelPimpl::checkMediaDeviceMuted(const MapStringString& mediaAttributes) void NewCallModelPimpl::initConferencesFromDaemon() { - QStringList callList = CallManager::instance().getConferenceList(); + QStringList callList = CallManager::instance().getConferenceList(linked.owner.id); for (const auto& callId : callList) { - QMap<QString, QString> details = CallManager::instance().getConferenceDetails(callId); + QMap<QString, QString> details = CallManager::instance() + .getConferenceDetails(linked.owner.id, callId); auto callInfo = std::make_shared<call::Info>(); callInfo->id = callId; - QStringList callList = CallManager::instance().getParticipantList(callId); - auto isForThisAccount = true; + QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, callId); foreach (const auto& call, callList) { - MapStringString callDetails = CallManager::instance().getCallDetails(call); - isForThisAccount = callDetails["ACCOUNTID"] == linked.owner.id; - if (!isForThisAccount) - break; + MapStringString callDetails = CallManager::instance().getCallDetails(linked.owner.id, + call); auto now = std::chrono::steady_clock::now(); auto system_now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); auto diff = static_cast<int64_t>(system_now) @@ -871,10 +981,9 @@ NewCallModelPimpl::initConferencesFromDaemon() callInfo->startTime = now - std::chrono::seconds(diff); emit linked.callAddedToConference(call, callId); } - if (!isForThisAccount) - break; callInfo->type = call::Type::CONFERENCE; - VectorMapStringString infos = CallManager::instance().getConferenceInfos(callId); + VectorMapStringString infos = CallManager::instance().getConferenceInfos(linked.owner.id, + callId); callInfo->participantsInfos = infos; calls.emplace(callId, std::move(callInfo)); } @@ -908,16 +1017,16 @@ NewCallModel::setCurrentCall(const QString& callId) const if (call->status == call::Status::PAUSED) { auto& call = pimpl_->calls[callId]; if (call->type == call::Type::DIALOG) { - CallManager::instance().unhold(callId); + CallManager::instance().unhold(owner.id, callId); } else { - CallManager::instance().unholdConference(callId); + CallManager::instance().unholdConference(owner.id, callId); } } VectorString filterCalls; - QStringList conferences = CallManager::instance().getConferenceList(); + QStringList conferences = CallManager::instance().getConferenceList(owner.id); for (const auto& confId : conferences) { - QStringList callList = CallManager::instance().getParticipantList(confId); + QStringList callList = CallManager::instance().getParticipantList(owner.id, confId); foreach (const auto& cid, callList) { filterCalls.push_back(cid); } @@ -926,9 +1035,9 @@ NewCallModel::setCurrentCall(const QString& callId) const auto filtered = std::find(filterCalls.begin(), filterCalls.end(), cid) != filterCalls.end(); if (cid != callId && !filtered) { // Only hold calls for a non rendez-vous point - MapStringString callDetails = CallManager::instance().getCallDetails(callId); + MapStringString callDetails = CallManager::instance().getCallDetails(owner.id, callId); auto accountId = callDetails["ACCOUNTID"]; - CallManager::instance().hold(cid); + CallManager::instance().hold(owner.id, cid); } } if (!lrc::api::Lrc::holdConferences) { @@ -936,13 +1045,14 @@ NewCallModel::setCurrentCall(const QString& callId) const } for (const auto& confId : conferences) { if (callId != confId) { - MapStringString confDetails = CallManager::instance().getConferenceDetails(confId); + MapStringString confDetails = CallManager::instance().getConferenceDetails(owner.id, + confId); // Only hold conference if attached if (confDetails["CALL_STATE"] == "ACTIVE_DETACHED") continue; - QStringList callList = CallManager::instance().getParticipantList(confId); + QStringList callList = CallManager::instance().getParticipantList(owner.id, confId); if (callList.indexOf(callId) == -1) - CallManager::instance().holdConference(confId); + CallManager::instance().holdConference(owner.id, confId); } } } @@ -954,13 +1064,13 @@ NewCallModel::setConferenceLayout(const QString& confId, const call::Layout& lay if (call != pimpl_->calls.end()) { switch (layout) { case call::Layout::GRID: - CallManager::instance().setConferenceLayout(confId, 0); + CallManager::instance().setConferenceLayout(owner.id, confId, 0); break; case call::Layout::ONE_WITH_SMALL: - CallManager::instance().setConferenceLayout(confId, 1); + CallManager::instance().setConferenceLayout(owner.id, confId, 1); break; case call::Layout::ONE: - CallManager::instance().setConferenceLayout(confId, 2); + CallManager::instance().setConferenceLayout(owner.id, confId, 2); break; } call->second->layout = layout; @@ -970,7 +1080,7 @@ NewCallModel::setConferenceLayout(const QString& confId, const call::Layout& lay void NewCallModel::setActiveParticipant(const QString& confId, const QString& participant) { - CallManager::instance().setActiveParticipant(confId, participant); + CallManager::instance().setActiveParticipant(owner.id, confId, participant); } bool @@ -1001,7 +1111,7 @@ NewCallModel::isModerator(const QString& confId, const QString& uri) void NewCallModel::setModerator(const QString& confId, const QString& peerId, const bool& state) { - CallManager::instance().setModerator(confId, peerId, state); + CallManager::instance().setModerator(owner.id, confId, peerId, state); } bool @@ -1044,13 +1154,13 @@ NewCallModel::setHandRaised(const QString& accountId, void NewCallModel::muteParticipant(const QString& confId, const QString& peerId, const bool& state) { - CallManager::instance().muteParticipant(confId, peerId, state); + CallManager::instance().muteParticipant(owner.id, confId, peerId, state); } void NewCallModel::hangupParticipant(const QString& confId, const QString& participant) { - CallManager::instance().hangupParticipant(confId, participant); + CallManager::instance().hangupParticipant(owner.id, confId, participant); } void @@ -1059,20 +1169,7 @@ NewCallModel::sendSipMessage(const QString& callId, const QString& body) const MapStringString payloads; payloads["text/plain"] = body; - CallManager::instance().sendTextMessage(callId, payloads, true /* not used */); -} - -void -NewCallModel::hangupCallsAndConferences() -{ - QStringList conferences = CallManager::instance().getConferenceList(); - for (const auto& conf : conferences) { - CallManager::instance().hangUpConference(conf); - } - QStringList calls = CallManager::instance().getCallList(); - for (const auto& call : calls) { - CallManager::instance().hangUp(call); - } + CallManager::instance().sendTextMessage(owner.id, callId, payloads, true /* not used */); } bool @@ -1167,15 +1264,19 @@ NewCallModelPimpl::slotMediaChangeRequested(const QString& accountId, item[MediaAttributeKey::ENABLED] = "true"; } } - CallManager::instance().answerMediaChangeRequest(callId, + CallManager::instance().answerMediaChangeRequest(linked.owner.id, + callId, QVector<MapStringString>::fromList( answerMedia)); } void -NewCallModelPimpl::slotCallStateChanged(const QString& callId, const QString& state, int code) +NewCallModelPimpl::slotCallStateChanged(const QString& accountId, + const QString& callId, + const QString& state, + int code) { - if (!linked.hasCall(callId)) + if (accountId != linked.owner.id || !linked.hasCall(callId)) return; auto status = call::to_status(state); @@ -1247,7 +1348,7 @@ NewCallModelPimpl::slotCallStateChanged(const QString& callId, const QString& st void NewCallModelPimpl::slotMediaNegotiationStatus(const QString& callId, - const QString& event, + const QString&, const VectorMapStringString& mediaList) { if (!linked.hasCall(callId)) { @@ -1278,10 +1379,14 @@ NewCallModelPimpl::slotMediaNegotiationStatus(const QString& callId, } void -NewCallModelPimpl::slotincomingVCardChunk( - const QString& callId, const QString& from, int part, int numberOfParts, const QString& payload) +NewCallModelPimpl::slotincomingVCardChunk(const QString& accountId, + const QString& callId, + const QString& from, + int part, + int numberOfParts, + const QString& payload) { - if (!linked.hasCall(callId)) + if (accountId != linked.owner.id || !linked.hasCall(callId)) return; auto it = vcardsChunks.find(from); @@ -1362,7 +1467,7 @@ NewCallModelPimpl::slotOnConferenceInfosUpdated(const QString& confId, // TODO: remove when the rendez-vous UI will be done // For now, the rendez-vous account can see ongoing calls // And must be notified when a new - QStringList callList = CallManager::instance().getParticipantList(confId); + QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, confId); foreach (const auto& call, callList) { emit linked.callAddedToConference(call, confId); calls[call]->videoMuted = it->second->videoMuted; @@ -1378,10 +1483,12 @@ NewCallModel::hasCall(const QString& callId) const } void -NewCallModelPimpl::slotConferenceCreated(const QString& confId) +NewCallModelPimpl::slotConferenceCreated(const QString& accountId, const QString& confId) { + if (accountId != linked.owner.id) + return; // Detect if conference is created for this account - QStringList callList = CallManager::instance().getParticipantList(confId); + QStringList callList = CallManager::instance().getParticipantList(linked.owner.id, confId); auto hasConference = false; foreach (const auto& call, callList) { hasConference |= linked.hasCall(call); @@ -1394,7 +1501,8 @@ NewCallModelPimpl::slotConferenceCreated(const QString& confId) callInfo->status = call::Status::IN_PROGRESS; callInfo->type = call::Type::CONFERENCE; callInfo->startTime = std::chrono::steady_clock::now(); - callInfo->participantsInfos = CallManager::instance().getConferenceInfos(confId); + callInfo->participantsInfos = CallManager::instance().getConferenceInfos(linked.owner.id, + confId); for (auto& i : callInfo->participantsInfos) i["uri"].replace("@ring.dht", ""); calls[confId] = callInfo; @@ -1433,7 +1541,7 @@ NewCallModelPimpl::sendProfile(const QString& callId) = vCard.left(sizeLimit); vCard.remove(0, sizeLimit); ++i; - CallManager::instance().sendTextMessage(callId, chunk, false); + CallManager::instance().sendTextMessage(linked.owner.id, callId, chunk, false); } } @@ -1474,7 +1582,7 @@ NewCallModelPimpl::startedDecoding(const QString& id, const QString& shmPath, in return; video::Settings settings; settings.size = toQString(width) + "x" + toQString(height); - lrc_.getAVModel().addRenderer(id, settings, shmPath); + lrc.getAVModel().addRenderer(id, settings, shmPath); } } // namespace lrc diff --git a/src/qtwrapper/callmanager_wrap.h b/src/qtwrapper/callmanager_wrap.h index 9b09bd9a478282e35ff1a294d4b46e9ad82c89c0..aa2b43fdfd2473bc2689a444775670b85fe8ae37 100644 --- a/src/qtwrapper/callmanager_wrap.h +++ b/src/qtwrapper/callmanager_wrap.h @@ -47,23 +47,28 @@ public: using DRing::CallSignal; callHandlers = { - exportable_callback<CallSignal::StateChange>( - [this](const std::string& callID, const std::string& state, int code) { - LOG_DRING_SIGNAL3("callStateChanged", - QString(callID.c_str()), - QString(state.c_str()), - code); - Q_EMIT callStateChanged(QString(callID.c_str()), QString(state.c_str()), code); - }), + exportable_callback<CallSignal::StateChange>([this](const std::string& accountId, + const std::string& callId, + const std::string& state, + int code) { + LOG_DRING_SIGNAL3("callStateChanged", + QString(callId.c_str()), + QString(state.c_str()), + code); + Q_EMIT callStateChanged(QString(accountId.c_str()), + QString(callId.c_str()), + QString(state.c_str()), + code); + }), exportable_callback<CallSignal::MediaNegotiationStatus>( - [this](const std::string& callID, + [this](const std::string& callId, const std::string& event, const std::vector<std::map<std::string, std::string>>& mediaList) { LOG_DRING_SIGNAL3("mediaNegotiationStatus", - QString(callID.c_str()), + QString(callId.c_str()), QString(event.c_str()), convertVecMap(mediaList)); - Q_EMIT mediaNegotiationStatus(QString(callID.c_str()), + Q_EMIT mediaNegotiationStatus(QString(callId.c_str()), QString(event.c_str()), convertVecMap(mediaList)); }), @@ -93,95 +98,108 @@ public: urgentCount); }), exportable_callback<CallSignal::IncomingMessage>( - [this](const std::string& callID, + [this](const std::string& accountId, + const std::string& callId, const std::string& from, const std::map<std::string, std::string>& message) { - LOG_DRING_SIGNAL3("incomingMessage", - QString(callID.c_str()), + LOG_DRING_SIGNAL4("incomingMessage", + QString(accountId.c_str()), + QString(callId.c_str()), QString(from.c_str()), convertMap(message)); - Q_EMIT incomingMessage(QString(callID.c_str()), + Q_EMIT incomingMessage(QString(accountId.c_str()), + QString(callId.c_str()), QString(from.c_str()), convertMap(message)); }), - exportable_callback<CallSignal::IncomingCall>([this](const std::string& accountID, - const std::string& callID, + exportable_callback<CallSignal::IncomingCall>([this](const std::string& accountId, + const std::string& callId, const std::string& from) { LOG_DRING_SIGNAL3("incomingCall", - QString(accountID.c_str()), - QString(callID.c_str()), + QString(accountId.c_str()), + QString(callId.c_str()), QString(from.c_str())); - Q_EMIT incomingCall(QString(accountID.c_str()), - QString(callID.c_str()), + Q_EMIT incomingCall(QString(accountId.c_str()), + QString(callId.c_str()), QString(from.c_str())); }), exportable_callback<CallSignal::IncomingCallWithMedia>( - [this](const std::string& accountID, - const std::string& callID, + [this](const std::string& accountId, + const std::string& callId, const std::string& from, const std::vector<std::map<std::string, std::string>>& mediaList) { LOG_DRING_SIGNAL4("incomingCallWithMedia", - QString(accountID.c_str()), - QString(callID.c_str()), + QString(accountId.c_str()), + QString(callId.c_str()), QString(from.c_str()), convertVecMap(mediaList)); - Q_EMIT incomingCallWithMedia(QString(accountID.c_str()), - QString(callID.c_str()), + Q_EMIT incomingCallWithMedia(QString(accountId.c_str()), + QString(callId.c_str()), QString(from.c_str()), convertVecMap(mediaList)); }), exportable_callback<CallSignal::MediaChangeRequested>( - [this](const std::string& accountID, - const std::string& callID, + [this](const std::string& accountId, + const std::string& callId, const std::vector<std::map<std::string, std::string>>& mediaList) { LOG_DRING_SIGNAL3("mediaChangeRequested", - QString(accountID.c_str()), - QString(callID.c_str()), + QString(accountId.c_str()), + QString(callId.c_str()), convertVecMap(mediaList)); - Q_EMIT mediaChangeRequested(QString(accountID.c_str()), - QString(callID.c_str()), + Q_EMIT mediaChangeRequested(QString(accountId.c_str()), + QString(callId.c_str()), convertVecMap(mediaList)); }), exportable_callback<CallSignal::RecordPlaybackFilepath>( - [this](const std::string& callID, const std::string& filepath) { + [this](const std::string& callId, const std::string& filepath) { LOG_DRING_SIGNAL2("recordPlaybackFilepath", - QString(callID.c_str()), + QString(callId.c_str()), QString(filepath.c_str())); - Q_EMIT recordPlaybackFilepath(QString(callID.c_str()), + Q_EMIT recordPlaybackFilepath(QString(callId.c_str()), QString(filepath.c_str())); }), - exportable_callback<CallSignal::ConferenceCreated>([this](const std::string& confID) { - LOG_DRING_SIGNAL("conferenceCreated", QString(confID.c_str())); - Q_EMIT conferenceCreated(QString(confID.c_str())); - }), - exportable_callback<CallSignal::ConferenceChanged>( - [this](const std::string& confID, const std::string& state) { - LOG_DRING_SIGNAL2("conferenceChanged", - QString(confID.c_str()), - QString(state.c_str())); - Q_EMIT conferenceChanged(QString(confID.c_str()), QString(state.c_str())); + exportable_callback<CallSignal::ConferenceCreated>( + [this](const std::string& accountId, const std::string& confId) { + LOG_DRING_SIGNAL2("conferenceCreated", + QString(accountId.c_str()), + QString(confId.c_str())); + Q_EMIT conferenceCreated(QString(accountId.c_str()), QString(confId.c_str())); }), + exportable_callback<CallSignal::ConferenceChanged>([this](const std::string& accountId, + const std::string& confId, + const std::string& state) { + LOG_DRING_SIGNAL3("conferenceChanged", + QString(accountId.c_str()), + QString(confId.c_str()), + QString(state.c_str())); + Q_EMIT conferenceChanged(QString(accountId.c_str()), + QString(confId.c_str()), + QString(state.c_str())); + }), exportable_callback<CallSignal::UpdatePlaybackScale>([this](const std::string& filepath, int position, int size) { LOG_DRING_SIGNAL3("updatePlaybackScale", QString(filepath.c_str()), position, size); Q_EMIT updatePlaybackScale(QString(filepath.c_str()), position, size); }), - exportable_callback<CallSignal::ConferenceRemoved>([this](const std::string& confID) { - LOG_DRING_SIGNAL("conferenceRemoved", QString(confID.c_str())); - Q_EMIT conferenceRemoved(QString(confID.c_str())); - }), - exportable_callback<CallSignal::RecordingStateChanged>([this](const std::string& callID, + exportable_callback<CallSignal::ConferenceRemoved>( + [this](const std::string& accountId, const std::string& confId) { + LOG_DRING_SIGNAL2("conferenceRemoved", + QString(accountId.c_str()), + QString(confId.c_str())); + Q_EMIT conferenceRemoved(QString(accountId.c_str()), QString(confId.c_str())); + }), + exportable_callback<CallSignal::RecordingStateChanged>([this](const std::string& callId, bool recordingState) { - LOG_DRING_SIGNAL2("recordingStateChanged", QString(callID.c_str()), recordingState); - Q_EMIT recordingStateChanged(QString(callID.c_str()), recordingState); + LOG_DRING_SIGNAL2("recordingStateChanged", QString(callId.c_str()), recordingState); + Q_EMIT recordingStateChanged(QString(callId.c_str()), recordingState); }), exportable_callback<CallSignal::RtcpReportReceived>( - [this](const std::string& callID, const std::map<std::string, int>& report) { + [this](const std::string& callId, const std::map<std::string, int>& report) { LOG_DRING_SIGNAL2("onRtcpReportReceived", - QString(callID.c_str()), + QString(callId.c_str()), convertStringInt(report)); - Q_EMIT onRtcpReportReceived(QString(callID.c_str()), convertStringInt(report)); + Q_EMIT onRtcpReportReceived(QString(callId.c_str()), convertStringInt(report)); }), exportable_callback<CallSignal::OnConferenceInfosUpdated>( [this](const std::string& confId, @@ -191,19 +209,19 @@ public: convertVecMap(infos)); Q_EMIT onConferenceInfosUpdated(QString(confId.c_str()), convertVecMap(infos)); }), - exportable_callback<CallSignal::PeerHold>([this](const std::string& callID, bool state) { - LOG_DRING_SIGNAL2("peerHold", QString(callID.c_str()), state); - Q_EMIT peerHold(QString(callID.c_str()), state); + exportable_callback<CallSignal::PeerHold>([this](const std::string& callId, bool state) { + LOG_DRING_SIGNAL2("peerHold", QString(callId.c_str()), state); + Q_EMIT peerHold(QString(callId.c_str()), state); }), exportable_callback<CallSignal::AudioMuted>( - [this](const std::string& callID, bool state) { - LOG_DRING_SIGNAL2("audioMuted", QString(callID.c_str()), state); - Q_EMIT audioMuted(QString(callID.c_str()), state); + [this](const std::string& callId, bool state) { + LOG_DRING_SIGNAL2("audioMuted", QString(callId.c_str()), state); + Q_EMIT audioMuted(QString(callId.c_str()), state); }), exportable_callback<CallSignal::VideoMuted>( - [this](const std::string& callID, bool state) { - LOG_DRING_SIGNAL2("videoMuted", QString(callID.c_str()), state); - Q_EMIT videoMuted(QString(callID.c_str()), state); + [this](const std::string& callId, bool state) { + LOG_DRING_SIGNAL2("videoMuted", QString(callId.c_str()), state); + Q_EMIT videoMuted(QString(callId.c_str()), state); }), exportable_callback<CallSignal::SmartInfo>( [this](const std::map<std::string, std::string>& info) { @@ -211,12 +229,12 @@ public: Q_EMIT smartInfo(convertMap(info)); }), exportable_callback<CallSignal::RemoteRecordingChanged>( - [this](const std::string& callID, const std::string& contactId, bool state) { + [this](const std::string& callId, const std::string& contactId, bool state) { LOG_DRING_SIGNAL3("remoteRecordingChanged", - QString(callID.c_str()), + QString(callId.c_str()), QString(contactId.c_str()), state); - Q_EMIT remoteRecordingChanged(QString(callID.c_str()), + Q_EMIT remoteRecordingChanged(QString(callId.c_str()), QString(contactId.c_str()), state); })}; @@ -227,141 +245,188 @@ public: bool isValid() { return true; } public Q_SLOTS: // METHODS - bool accept(const QString& callID) { return DRing::accept(callID.toStdString()); } + bool accept(const QString& accountId, const QString& callId) + { + return DRing::accept(accountId.toStdString(), callId.toStdString()); + } - bool addMainParticipant(const QString& confID) + bool addMainParticipant(const QString& accountId, const QString& confId) { - return DRing::addMainParticipant(confID.toStdString()); + return DRing::addMainParticipant(accountId.toStdString(), confId.toStdString()); } - bool addParticipant(const QString& callID, const QString& confID) + bool addParticipant(const QString& accountId, + const QString& callId, + const QString& account2Id, + const QString& confId) { - return DRing::addParticipant(callID.toStdString(), confID.toStdString()); + return DRing::addParticipant(accountId.toStdString(), + callId.toStdString(), + account2Id.toStdString(), + confId.toStdString()); } - bool attendedTransfer(const QString& transferID, const QString& targetID) + bool attendedTransfer(const QString& accountId, + const QString& transferId, + const QString& targetId) { - return DRing::attendedTransfer(transferID.toStdString(), targetID.toStdString()); + return DRing::attendedTransfer(accountId.toStdString(), + transferId.toStdString(), + targetId.toStdString()); } - void createConfFromParticipantList(const QStringList& participants) + void createConfFromParticipantList(const QString& accountId, const QStringList& participants) { - DRing::createConfFromParticipantList(convertStringList(participants)); + DRing::createConfFromParticipantList(accountId.toStdString(), + convertStringList(participants)); } - bool detachParticipant(const QString& callID) + bool detachParticipant(const QString& accountId, const QString& callId) { - return DRing::detachParticipant(callID.toStdString()); + return DRing::detachParticipant(accountId.toStdString(), callId.toStdString()); } - MapStringString getCallDetails(const QString& callID) + MapStringString getCallDetails(const QString& accountId, const QString& callId) { - MapStringString temp = convertMap(DRing::getCallDetails(callID.toStdString())); + MapStringString temp = convertMap( + DRing::getCallDetails(accountId.toStdString(), callId.toStdString())); return temp; } - QStringList getCallList() + QStringList getCallList(const QString& accountId) { - QStringList temp = convertStringList(DRing::getCallList()); + QStringList temp = convertStringList(DRing::getCallList(accountId.toStdString())); return temp; } - MapStringString getConferenceDetails(const QString& callID) + MapStringString getConferenceDetails(const QString& accountId, const QString& callId) { - MapStringString temp = convertMap(DRing::getConferenceDetails(callID.toStdString())); + MapStringString temp = convertMap( + DRing::getConferenceDetails(accountId.toStdString(), callId.toStdString())); return temp; } - VectorMapStringString getConferenceInfos(const QString& confId) + VectorMapStringString getConferenceInfos(const QString& accountId, const QString& confId) { - VectorMapStringString temp = convertVecMap(DRing::getConferenceInfos(confId.toStdString())); + VectorMapStringString temp = convertVecMap( + DRing::getConferenceInfos(accountId.toStdString(), confId.toStdString())); return temp; } - QString getConferenceId(const QString& callID) + QString getConferenceId(const QString& accountId, const QString& callId) { - QString temp(DRing::getConferenceId(callID.toStdString()).c_str()); + QString temp(DRing::getConferenceId(accountId.toStdString(), callId.toStdString()).c_str()); return temp; } - QStringList getConferenceList() + QStringList getConferenceList(const QString& accountId) { - QStringList temp = convertStringList(DRing::getConferenceList()); + QStringList temp = convertStringList(DRing::getConferenceList(accountId.toStdString())); return temp; } - bool getIsRecording(const QString& callID) + bool getIsRecording(const QString& accountId, const QString& callId) { - // TODO: match API - return DRing::getIsRecording(callID.toStdString()); + return DRing::getIsRecording(accountId.toStdString(), callId.toStdString()); } - QStringList getParticipantList(const QString& confID) + QStringList getParticipantList(const QString& accountId, const QString& confId) { - QStringList temp = convertStringList(DRing::getParticipantList(confID.toStdString())); + QStringList temp = convertStringList( + DRing::getParticipantList(accountId.toStdString(), confId.toStdString())); return temp; } - bool hangUp(const QString& callID) { return DRing::hangUp(callID.toStdString()); } + bool hangUp(const QString& accountId, const QString& callId) + { + return DRing::hangUp(accountId.toStdString(), callId.toStdString()); + } - bool hangUpConference(const QString& confID) + bool hangUpConference(const QString& accountId, const QString& confId) { - return DRing::hangUpConference(confID.toStdString()); + return DRing::hangUpConference(accountId.toStdString(), confId.toStdString()); } - bool hold(const QString& callID) { return DRing::hold(callID.toStdString()); } + bool hold(const QString& accountId, const QString& callId) + { + return DRing::hold(accountId.toStdString(), callId.toStdString()); + } - bool holdConference(const QString& confID) + bool holdConference(const QString& accountId, const QString& confId) { - return DRing::holdConference(confID.toStdString()); + return DRing::holdConference(accountId.toStdString(), confId.toStdString()); } - bool isConferenceParticipant(const QString& callID) + bool isConferenceParticipant(const QString& accountId, const QString& callId) { - return DRing::isConferenceParticipant(callID.toStdString()); + return DRing::isConferenceParticipant(accountId.toStdString(), callId.toStdString()); } - bool joinConference(const QString& sel_confID, const QString& drag_confID) + bool joinConference(const QString& accountId, + const QString& sel_confId, + const QString& account2Id, + const QString& drag_confId) { - return DRing::joinConference(sel_confID.toStdString(), drag_confID.toStdString()); + return DRing::joinConference(accountId.toStdString(), + sel_confId.toStdString(), + account2Id.toStdString(), + drag_confId.toStdString()); } - bool joinParticipant(const QString& sel_callID, const QString& drag_callID) + bool joinParticipant(const QString& accountId, + const QString& sel_callId, + const QString& account2Id, + const QString& drag_callId) { - return DRing::joinParticipant(sel_callID.toStdString(), drag_callID.toStdString()); + return DRing::joinParticipant(accountId.toStdString(), + sel_callId.toStdString(), + account2Id.toStdString(), + drag_callId.toStdString()); } - QString placeCall(const QString& accountID, const QString& to) + QString placeCall(const QString& accountId, const QString& to) { - QString temp(DRing::placeCall(accountID.toStdString(), to.toStdString()).c_str()); + QString temp(DRing::placeCall(accountId.toStdString(), to.toStdString()).c_str()); return temp; } // MULTISTREAM FUNCTIONS - QString placeCallWithMedia(const QString& accountID, + QString placeCallWithMedia(const QString& accountId, const QString& to, const VectorMapStringString& mediaList) { - QString temp(DRing::placeCallWithMedia(accountID.toStdString(), + QString temp(DRing::placeCallWithMedia(accountId.toStdString(), to.toStdString(), convertVecMap(mediaList)) .c_str()); return temp; } - bool requestMediaChange(const QString& callID, const VectorMapStringString& mediaList) + bool requestMediaChange(const QString& accountId, + const QString& callId, + const VectorMapStringString& mediaList) { - return DRing::requestMediaChange(callID.toStdString(), convertVecMap(mediaList)); + return DRing::requestMediaChange(accountId.toStdString(), + callId.toStdString(), + convertVecMap(mediaList)); } - bool acceptWithMedia(const QString& callID, const VectorMapStringString& mediaList) + bool acceptWithMedia(const QString& accountId, + const QString& callId, + const VectorMapStringString& mediaList) { - return DRing::acceptWithMedia(callID.toStdString(), convertVecMap(mediaList)); + return DRing::acceptWithMedia(accountId.toStdString(), + callId.toStdString(), + convertVecMap(mediaList)); } - bool answerMediaChangeRequest(const QString& callID, const VectorMapStringString& mediaList) + bool answerMediaChangeRequest(const QString& accountId, + const QString& callId, + const VectorMapStringString& mediaList) { - return DRing::answerMediaChangeRequest(callID.toStdString(), convertVecMap(mediaList)); + return DRing::answerMediaChangeRequest(accountId.toStdString(), + callId.toStdString(), + convertVecMap(mediaList)); } // END OF MULTISTREAM FUNCTIONS @@ -369,11 +434,18 @@ public Q_SLOTS: // METHODS void recordPlaybackSeek(double value) { DRing::recordPlaybackSeek(value); } - bool refuse(const QString& callID) { return DRing::refuse(callID.toStdString()); } + bool refuse(const QString& accountId, const QString& callId) + { + return DRing::refuse(accountId.toStdString(), callId.toStdString()); + } - void sendTextMessage(const QString& callID, const QMap<QString, QString>& message, bool isMixed) + void sendTextMessage(const QString& accountId, + const QString& callId, + const QMap<QString, QString>& message, + bool isMixed) { - DRing::sendTextMessage(callID.toStdString(), + DRing::sendTextMessage(accountId.toStdString(), + callId.toStdString(), convertMap(message), QObject::tr("Me").toStdString(), isMixed); @@ -389,56 +461,96 @@ public Q_SLOTS: // METHODS void stopRecordedFilePlayback() { DRing::stopRecordedFilePlayback(); } - bool toggleRecording(const QString& callID) + bool toggleRecording(const QString& accountId, const QString& callId) { - return DRing::toggleRecording(callID.toStdString()); + return DRing::toggleRecording(accountId.toStdString(), callId.toStdString()); } - bool transfer(const QString& callID, const QString& to) + bool transfer(const QString& accountId, const QString& callId, const QString& to) { - return DRing::transfer(callID.toStdString(), to.toStdString()); + return DRing::transfer(accountId.toStdString(), callId.toStdString(), to.toStdString()); } - bool unhold(const QString& callID) { return DRing::unhold(callID.toStdString()); } + bool unhold(const QString& accountId, const QString& callId) + { + return DRing::unhold(accountId.toStdString(), callId.toStdString()); + } - bool unholdConference(const QString& confID) + bool unholdConference(const QString& accountId, const QString& confId) { - return DRing::unholdConference(confID.toStdString()); + return DRing::unholdConference(accountId.toStdString(), confId.toStdString()); } - bool muteLocalMedia(const QString& callid, const QString& mediaType, bool mute) + bool muteLocalMedia(const QString& accountId, + const QString& callId, + const QString& mediaType, + bool mute) { - return DRing::muteLocalMedia(callid.toStdString(), mediaType.toStdString(), mute); + return DRing::muteLocalMedia(accountId.toStdString(), + callId.toStdString(), + mediaType.toStdString(), + mute); } void startSmartInfo(int refresh) { DRing::startSmartInfo(refresh); } void stopSmartInfo() { DRing::stopSmartInfo(); } - void setConferenceLayout(const QString& confId, int layout) + void setConferenceLayout(const QString& accountId, const QString& confId, int layout) { - DRing::setConferenceLayout(confId.toStdString(), layout); + DRing::setConferenceLayout(accountId.toStdString(), confId.toStdString(), layout); } - void setActiveParticipant(const QString& confId, const QString& callId) + void setActiveParticipant(const QString& accountId, const QString& confId, const QString& callId) { - DRing::setActiveParticipant(confId.toStdString(), callId.toStdString()); + DRing::setActiveParticipant(accountId.toStdString(), + confId.toStdString(), + callId.toStdString()); } - bool switchInput(const QString& callId, const QString& resource) + bool switchInput(const QString& accountId, const QString& callId, const QString& resource) { #ifdef ENABLE_VIDEO - return DRing::switchInput(callId.toStdString(), resource.toStdString()); + return DRing::switchInput(accountId.toStdString(), + callId.toStdString(), + resource.toStdString()); #else + Q_UNUSED(accountId) Q_UNUSED(callId) Q_UNUSED(resource) return false; #endif } - void setModerator(const QString& confId, const QString& peerId, const bool& state) + void setModerator(const QString& accountId, + const QString& confId, + const QString& peerId, + const bool& state) { - DRing::setModerator(confId.toStdString(), peerId.toStdString(), state); + DRing::setModerator(accountId.toStdString(), + confId.toStdString(), + peerId.toStdString(), + state); + } + + void muteParticipant(const QString& accountId, + const QString& confId, + const QString& peerId, + const bool& state) + { + DRing::muteParticipant(accountId.toStdString(), + confId.toStdString(), + peerId.toStdString(), + state); + } + + void hangupParticipant(const QString& accountId, + const QString& confId, + const QString& participant) + { + DRing::hangupParticipant(accountId.toStdString(), + confId.toStdString(), + participant.toStdString()); } void raiseParticipantHand(const QString& accountId, @@ -452,47 +564,43 @@ public Q_SLOTS: // METHODS state); } - void muteParticipant(const QString& confId, const QString& peerId, const bool& state) - { - DRing::muteParticipant(confId.toStdString(), peerId.toStdString(), state); - } - - void hangupParticipant(const QString& confId, const QString& participant) - { - DRing::hangupParticipant(confId.toStdString(), participant.toStdString()); - } - Q_SIGNALS: // SIGNALS - void callStateChanged(const QString& callID, const QString& state, int code); - void mediaNegotiationStatus(const QString& callID, + void callStateChanged(const QString& accountId, + const QString& callId, + const QString& state, + int code); + void mediaNegotiationStatus(const QString& callId, const QString& event, const VectorMapStringString& mediaList); void transferFailed(); void transferSucceeded(); void recordPlaybackStopped(const QString& filepath); void voiceMailNotify(const QString& accountId, int newCount, int oldCount, int urgentCount); - void incomingMessage(const QString& callID, const QString& from, const MapStringString& message); - void incomingCall(const QString& accountID, const QString& callID, const QString& from); - void incomingCallWithMedia(const QString& accountID, - const QString& callID, + void incomingMessage(const QString& accountId, + const QString& callId, + const QString& from, + const MapStringString& message); + void incomingCall(const QString& accountId, const QString& callId, const QString& from); + void incomingCallWithMedia(const QString& accountId, + const QString& callId, const QString& from, const VectorMapStringString& mediaList); - void mediaChangeRequested(const QString& accountID, - const QString& callID, + void mediaChangeRequested(const QString& accountId, + const QString& callId, const VectorMapStringString& mediaList); - void recordPlaybackFilepath(const QString& callID, const QString& filepath); - void conferenceCreated(const QString& confID); - void conferenceChanged(const QString& confID, const QString& state); + void recordPlaybackFilepath(const QString& callId, const QString& filepath); + void conferenceCreated(const QString& accountId, const QString& confId); + void conferenceChanged(const QString& accountId, const QString& confId, const QString& state); void updatePlaybackScale(const QString& filepath, int position, int size); - void conferenceRemoved(const QString& confID); - void recordingStateChanged(const QString& callID, bool recordingState); - void onRtcpReportReceived(const QString& callID, MapStringInt report); + void conferenceRemoved(const QString& accountId, const QString& confId); + void recordingStateChanged(const QString& callId, bool recordingState); + void onRtcpReportReceived(const QString& callId, MapStringInt report); void onConferenceInfosUpdated(const QString& confId, VectorMapStringString infos); - void audioMuted(const QString& callID, bool state); - void videoMuted(const QString& callID, bool state); - void peerHold(const QString& callID, bool state); + void audioMuted(const QString& callId, bool state); + void videoMuted(const QString& callId, bool state); + void peerHold(const QString& callId, bool state); void smartInfo(const MapStringString& info); - void remoteRecordingChanged(const QString& callID, + void remoteRecordingChanged(const QString& callId, const QString& peerNumber, bool remoteRecordingState); }; diff --git a/src/qtwrapper/configurationmanager_wrap.h b/src/qtwrapper/configurationmanager_wrap.h index 4420bb81d700f49d033c2449613e0c8a64514bc9..3f61ab58d9c332c5cbc4aa525242db03f2245b2f 100644 --- a/src/qtwrapper/configurationmanager_wrap.h +++ b/src/qtwrapper/configurationmanager_wrap.h @@ -407,10 +407,10 @@ public Q_SLOTS: // METHODS } // TODO: works? - VectorUInt getActiveCodecList(const QString& accountID) + VectorUInt getActiveCodecList(const QString& accountId) { - return QVector<unsigned int>::fromStdVector( - DRing::getActiveCodecList(accountID.toStdString())); + std::vector<unsigned int> v = DRing::getActiveCodecList(accountId.toStdString()); + return QVector<unsigned int>(v.begin(), v.end()); } QString getAddrFromInterfaceName(const QString& interface) @@ -440,7 +440,8 @@ public Q_SLOTS: // METHODS VectorUInt getCodecList() { - return QVector<unsigned int>::fromStdVector(DRing::getCodecList()); + std::vector<unsigned int> v = DRing::getCodecList(); + return QVector<unsigned int>(v.begin(), v.end()); } VectorMapStringString getContacts(const QString& accountID) @@ -632,7 +633,8 @@ public Q_SLOTS: // METHODS void setActiveCodecList(const QString& accountID, VectorUInt& list) { // const std::vector<unsigned int> converted = convertStringList(list); - DRing::setActiveCodecList(accountID.toStdString(), list.toStdVector()); + DRing::setActiveCodecList(accountID.toStdString(), + std::vector<unsigned>(list.begin(), list.end())); } void setAgcState(bool enabled) { DRing::setAgcState(enabled); } diff --git a/src/qtwrapper/videomanager_wrap.h b/src/qtwrapper/videomanager_wrap.h index 26c63960c66b1c65491c2dcdb16e75bf03446143..feb3f1186f665b6592766091781b61931577aff9 100644 --- a/src/qtwrapper/videomanager_wrap.h +++ b/src/qtwrapper/videomanager_wrap.h @@ -162,17 +162,17 @@ public Q_SLOTS: // METHODS #endif } - std::string openVideoInput(const std::string& resource) + QString openVideoInput(const QString& resource) { #ifdef ENABLE_VIDEO - return DRing::openVideoInput(resource); + return DRing::openVideoInput(resource.toStdString()).c_str(); #endif } - void closeVideoInput(const std::string& resource) + void closeVideoInput(const QString& resource) { #ifdef ENABLE_VIDEO - DRing::closeVideoInput(resource); + DRing::closeVideoInput(resource.toStdString()); #endif }