mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 12:08:11 +00:00
- Add examples for each command - Add the --dump-commands-help option to output the entire help
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#include "terminate.h"
|
|
|
|
using namespace std;
|
|
|
|
TerminateCommand::TerminateCommand() :
|
|
DaemonCommand("terminate", "terminate <call id>", "Terminate a call.") {
|
|
addExample(new DaemonCommandExample("terminate 2",
|
|
"Status: Error\n"
|
|
"Reason: No call with such id."));
|
|
addExample(new DaemonCommandExample("terminate 1",
|
|
"Status: Ok\n"));
|
|
addExample(new DaemonCommandExample("terminate",
|
|
"Status: Ok\n"));
|
|
addExample(new DaemonCommandExample("terminate",
|
|
"Status: Error\n"
|
|
"Reason: No active 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());
|
|
}
|