Commit 5c66f193 authored by nicolas's avatar nicolas

feat(Cli): 2 method to join conference: with if there is not a sip address...

feat(Cli): 2 method to join conference: with  if there is not a sip address linked to the database, with  if there is one
parent a9a3e896
...@@ -429,6 +429,10 @@ Server url not configured.</translation> ...@@ -429,6 +429,10 @@ Server url not configured.</translation>
<source>initiateConferenceFunctionDescription</source> <source>initiateConferenceFunctionDescription</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>joinConferenceAsFunctionDescription</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CodecsViewer</name> <name>CodecsViewer</name>
......
...@@ -429,6 +429,10 @@ Url du serveur non configurée.</translation> ...@@ -429,6 +429,10 @@ Url du serveur non configurée.</translation>
<source>initiateConferenceFunctionDescription</source> <source>initiateConferenceFunctionDescription</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>joinConferenceAsFunctionDescription</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CodecsViewer</name> <name>CodecsViewer</name>
......
...@@ -43,20 +43,31 @@ static void cliCall (QHash<QString, QString> &args) { ...@@ -43,20 +43,31 @@ static void cliCall (QHash<QString, QString> &args) {
static void cliJoinConference (QHash<QString, QString> &args) { static void cliJoinConference (QHash<QString, QString> &args) {
const QString sipAddress = args.take("sip-address"); 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::Core> core = CoreManager::getInstance()->getCore(); shared_ptr<linphone::Address> address;
const shared_ptr<linphone::ProxyConfig> defaultProxyConfig = core->getDefaultProxyConfig(); address = core->getPrimaryContactParsed();
shared_ptr<linphone::Address> address; address->setDisplayName(::Utils::appStringToCoreString(args.take("display-name")));
if (!defaultProxyConfig) { core->setPrimaryContact(address->asString());
address = core->getPrimaryContactParsed();
address->setDisplayName(::Utils::appStringToCoreString(args.take("default-display-name")));
core->setPrimaryContact(address->asString());
}
}
args["method"] = QStringLiteral("join-conference"); args["method"] = QStringLiteral("join-conference");
CoreManager::getInstance()->getCallsListModel()->launchAudioCall(sipAddress, args); 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) { static void cliInitiateConference (QHash<QString, QString> &args) {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore(); shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
...@@ -182,7 +193,10 @@ Cli::Cli (QObject *parent) : QObject(parent) { ...@@ -182,7 +193,10 @@ Cli::Cli (QObject *parent) : QObject(parent) {
{ "sip-address", {} }, { "conference-id", {} } { "sip-address", {} }, { "conference-id", {} }
}); });
addCommand("join-conference", tr("joinConferenceFunctionDescription"), ::cliJoinConference, { 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", {} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment