diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts
index c193225a7..119aa2fe6 100644
--- a/linphone-app/assets/languages/en.ts
+++ b/linphone-app/assets/languages/en.ts
@@ -477,6 +477,10 @@ Server URL not configured.
callFunctionDescription
Initiate a call to the sip-address.
+
+ byeFunctionDescription
+ End a specific call, all calls or current call.
+
initiateConferenceFunctionDescription
Initiate a conference.
diff --git a/linphone-app/src/app/cli/Cli.cpp b/linphone-app/src/app/cli/Cli.cpp
index 79b44d3b4..5c77ecbb2 100644
--- a/linphone-app/src/app/cli/Cli.cpp
+++ b/linphone-app/src/app/cli/Cli.cpp
@@ -61,6 +61,17 @@ static void cliCall (QHash &args) {
CoreManager::getInstance()->getCallsListModel()->launchAudioCall(args["sip-address"]);
}
+static void cliBye (QHash &args) {
+ if(args.size() > 0) {
+ if( args["sip-address"] == "*")// Call with options
+ CoreManager::getInstance()->getCallsListModel()->terminateAllCalls();
+ else
+ CoreManager::getInstance()->getCallsListModel()->terminateCall(args["sip-address"]);
+ }else if( CoreManager::getInstance()->getCore()->getCurrentCall()){
+ CoreManager::getInstance()->getCore()->getCurrentCall()->terminate();
+ }
+}
+
static void cliJoinConference (QHash &args) {
const QString sipAddress = args.take("sip-address");
@@ -399,7 +410,8 @@ QMap Cli::mCommands = {
}),
createCommand("join-conference-as", QT_TR_NOOP("joinConferenceAsFunctionDescription"), cliJoinConferenceAs, {
{ "sip-address", {} }, { "conference-id", {} }, { "guest-sip-address", {} }
- })
+ }),
+ createCommand("bye", QT_TR_NOOP("byeFunctionDescription"), cliBye, QHash(), true),
};
// -----------------------------------------------------------------------------
diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp
index 21600aa46..55bd0b6f0 100644
--- a/linphone-app/src/components/calls/CallsListModel.cpp
+++ b/linphone-app/src/components/calls/CallsListModel.cpp
@@ -160,7 +160,22 @@ int CallsListModel::getRunningCallsNumber () const {
void CallsListModel::terminateAllCalls () const {
CoreManager::getInstance()->getCore()->terminateAllCalls();
}
-
+void CallsListModel::terminateCall (const QString& sipAddress) const{
+ auto coreManager = CoreManager::getInstance();
+ shared_ptr address = coreManager->getCore()->interpretUrl(Utils::appStringToCoreString(sipAddress));
+ if (!address)
+ qWarning() << "Cannot terminate Call. The address cannot be parsed : " << sipAddress;
+ else{
+ std::shared_ptr call = coreManager->getCore()->getCallByRemoteAddress2(address);
+ if( call){
+ coreManager->lockVideoRender();
+ call->terminate();
+ coreManager->unlockVideoRender();
+ }else{
+ qWarning() << "Cannot terminate call as it doesn't exist : " << sipAddress;
+ }
+ }
+}
// -----------------------------------------------------------------------------
static void joinConference (const shared_ptr &call) {
diff --git a/linphone-app/src/components/calls/CallsListModel.hpp b/linphone-app/src/components/calls/CallsListModel.hpp
index be8be3a54..b5cf1d052 100644
--- a/linphone-app/src/components/calls/CallsListModel.hpp
+++ b/linphone-app/src/components/calls/CallsListModel.hpp
@@ -48,6 +48,7 @@ public:
Q_INVOKABLE int getRunningCallsNumber () const;
Q_INVOKABLE void terminateAllCalls () const;
+ Q_INVOKABLE void terminateCall (const QString& sipAddress) const;
signals:
void callRunning (int index, CallModel *callModel);