mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 15:48:09 +00:00
30 lines
763 B
C++
30 lines
763 B
C++
#include "terminate.h"
|
|
|
|
using namespace std;
|
|
|
|
TerminateCommand::TerminateCommand() :
|
|
DaemonCommand("terminate", "terminate <call id>", "Terminate a call.") {
|
|
}
|
|
void TerminateCommand::exec(Daemon *app, const char *args) {
|
|
LinphoneCall *call = NULL;
|
|
int cid;
|
|
const MSList *elem;
|
|
if (sscanf(args, "%i", &cid) == 1) {
|
|
call = app->findCall(cid);
|
|
if (call == NULL) {
|
|
app->sendResponse(Response("No call with such id."));
|
|
return;
|
|
}
|
|
} else {
|
|
elem = linphone_core_get_calls(app->getCore());
|
|
if (elem != NULL && elem->next == NULL) {
|
|
call = (LinphoneCall*) elem->data;
|
|
}
|
|
}
|
|
if (call == NULL) {
|
|
app->sendResponse(Response("No active call."));
|
|
return;
|
|
}
|
|
linphone_core_terminate_call(app->getCore(), call);
|
|
app->sendResponse(Response());
|
|
}
|