mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-26 00:08:13 +00:00
feat(Cli): 2 method to join conference: with if there is not a sip address linked to the database, with if there is one
This commit is contained in:
parent
a9a3e896a3
commit
5c66f193d5
3 changed files with 33 additions and 11 deletions
|
|
@ -429,6 +429,10 @@ Server url not configured.</translation>
|
|||
<source>initiateConferenceFunctionDescription</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>joinConferenceAsFunctionDescription</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CodecsViewer</name>
|
||||
|
|
|
|||
|
|
@ -429,6 +429,10 @@ Url du serveur non configurée.</translation>
|
|||
<source>initiateConferenceFunctionDescription</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>joinConferenceAsFunctionDescription</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CodecsViewer</name>
|
||||
|
|
|
|||
|
|
@ -43,20 +43,31 @@ static void cliCall (QHash<QString, QString> &args) {
|
|||
|
||||
static void cliJoinConference (QHash<QString, QString> &args) {
|
||||
const QString sipAddress = args.take("sip-address");
|
||||
if (!args["default-display-name"].isEmpty()) {
|
||||
const shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
const shared_ptr<linphone::ProxyConfig> defaultProxyConfig = core->getDefaultProxyConfig();
|
||||
shared_ptr<linphone::Address> address;
|
||||
if (!defaultProxyConfig) {
|
||||
address = core->getPrimaryContactParsed();
|
||||
address->setDisplayName(::Utils::appStringToCoreString(args.take("default-display-name")));
|
||||
core->setPrimaryContact(address->asString());
|
||||
}
|
||||
}
|
||||
const shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::Address> address;
|
||||
address = core->getPrimaryContactParsed();
|
||||
address->setDisplayName(::Utils::appStringToCoreString(args.take("display-name")));
|
||||
core->setPrimaryContact(address->asString());
|
||||
args["method"] = QStringLiteral("join-conference");
|
||||
CoreManager::getInstance()->getCallsListModel()->launchAudioCall(sipAddress, args);
|
||||
}
|
||||
|
||||
|
||||
static void cliJoinConferenceAs (QHash<QString, QString> &args) {
|
||||
const QString toSipAddress = args.take("sip-address");
|
||||
const QString fromSipAddress = args.take("guest-sip-address");
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::Address> currentSipAddress = core->getDefaultProxyConfig()->getIdentityAddress()->clone();
|
||||
currentSipAddress->clean();
|
||||
if (fromSipAddress!=::Utils::coreStringToAppString(currentSipAddress->asStringUriOnly())) {
|
||||
qWarning() << QStringLiteral("guest sip address `%1` is not one of yours.")
|
||||
.arg(fromSipAddress);
|
||||
return;
|
||||
}
|
||||
args["method"] = QStringLiteral("join-conference");
|
||||
CoreManager::getInstance()->getCallsListModel()->launchAudioCall(toSipAddress, args);
|
||||
}
|
||||
|
||||
static void cliInitiateConference (QHash<QString, QString> &args) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
|
||||
|
|
@ -182,7 +193,10 @@ Cli::Cli (QObject *parent) : QObject(parent) {
|
|||
{ "sip-address", {} }, { "conference-id", {} }
|
||||
});
|
||||
addCommand("join-conference", tr("joinConferenceFunctionDescription"), ::cliJoinConference, {
|
||||
{ "sip-address", {} }, { "conference-id", {} }, { "default-display-name", {STRING, true} }
|
||||
{ "sip-address", {} }, { "conference-id", {} }, { "display-name", {} }
|
||||
});
|
||||
addCommand("join-conference-as", tr("joinConferenceAsFunctionDescription"), ::cliJoinConferenceAs, {
|
||||
{ "sip-address", {} }, { "conference-id", {} }, { "guest-sip-address", {} }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue