mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 23:28:09 +00:00
Added new commands to the linphone daemon executable.
This commit is contained in:
parent
ea935eb8f6
commit
6385f6d41d
15 changed files with 167 additions and 8 deletions
|
|
@ -15,6 +15,12 @@ linphone_daemon_SOURCES=daemon.cc \
|
|||
commands/call.cc \
|
||||
commands/call-stats.cc \
|
||||
commands/call-status.cc \
|
||||
commands/call-pause.cc \
|
||||
commands/call-resume.cc \
|
||||
commands/call-mute.cc \
|
||||
commands/call-camera.cc \
|
||||
commands/call-transfer.cc \
|
||||
commands/conference.cc \
|
||||
commands/dtmf.cc \
|
||||
commands/firewall-policy.cc \
|
||||
commands/help.cc \
|
||||
|
|
@ -46,6 +52,12 @@ linphone_daemon_SOURCES=daemon.cc \
|
|||
commands/call.h \
|
||||
commands/call-stats.h \
|
||||
commands/call-status.h \
|
||||
commands/call-pause.h \
|
||||
commands/call-resume.h \
|
||||
commands/call-mute.h \
|
||||
commands/call-camera.h \
|
||||
commands/call-transfer.h \
|
||||
commands/conference.h \
|
||||
commands/dtmf.h \
|
||||
commands/firewall-policy.h \
|
||||
commands/help.h \
|
||||
|
|
|
|||
5
daemon/commands/call-mute.cc
Normal file
5
daemon/commands/call-mute.cc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "call-mute.h"
|
||||
|
||||
CallMute::CallMute()
|
||||
{
|
||||
}
|
||||
10
daemon/commands/call-mute.h
Normal file
10
daemon/commands/call-mute.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef CALLMUTE_H
|
||||
#define CALLMUTE_H
|
||||
|
||||
class CallMute : public DaemonCommand
|
||||
{
|
||||
public:
|
||||
CallMute();
|
||||
};
|
||||
|
||||
#endif // CALLMUTE_H
|
||||
31
daemon/commands/call-pause.cc
Normal file
31
daemon/commands/call-pause.cc
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include "call-pause.h"
|
||||
|
||||
CallPause::CallPause()
|
||||
{
|
||||
}
|
||||
|
||||
void CallPause::exec(Daemon* app, const char* args)
|
||||
{
|
||||
LinphoneCore *lc = app->getCore();
|
||||
int cid;
|
||||
LinphoneCall *call = NULL;
|
||||
if (sscanf(args, "%i", &cid) == 1) {
|
||||
call = app->findCall(cid);
|
||||
if (call == NULL) {
|
||||
app->sendResponse(Response("No call with such id."));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
call = linphone_core_get_current_call(lc);
|
||||
if (call == NULL) {
|
||||
app->sendResponse(Response("No current call available."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( linphone_core_pause_call(lc, call) == 0 ) {
|
||||
app->sendResponse(Response("Call was paused", Response::Ok));
|
||||
} else {
|
||||
app->sendResponse(Response("Error pausing call"));
|
||||
}
|
||||
}
|
||||
14
daemon/commands/call-pause.h
Normal file
14
daemon/commands/call-pause.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef CALLPAUSE_H
|
||||
#define CALLPAUSE_H
|
||||
|
||||
#include "daemon.h"
|
||||
|
||||
class CallPause : public DaemonCommand
|
||||
{
|
||||
public:
|
||||
CallPause();
|
||||
|
||||
virtual void exec(Daemon *app, const char *args);
|
||||
};
|
||||
|
||||
#endif // CALLPAUSE_H
|
||||
5
daemon/commands/call-resume.cc
Normal file
5
daemon/commands/call-resume.cc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "call-resume.h"
|
||||
|
||||
CallResume::CallResume()
|
||||
{
|
||||
}
|
||||
10
daemon/commands/call-resume.h
Normal file
10
daemon/commands/call-resume.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef CALLRESUME_H
|
||||
#define CALLRESUME_H
|
||||
|
||||
class CallResume : public DaemonCommand
|
||||
{
|
||||
public:
|
||||
CallResume();
|
||||
};
|
||||
|
||||
#endif // CALLRESUME_H
|
||||
5
daemon/commands/call-transfer.cc
Normal file
5
daemon/commands/call-transfer.cc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "call-transfer.h"
|
||||
|
||||
CallTransfer::CallTransfer()
|
||||
{
|
||||
}
|
||||
10
daemon/commands/call-transfer.h
Normal file
10
daemon/commands/call-transfer.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef CALLTRANSFER_H
|
||||
#define CALLTRANSFER_H
|
||||
|
||||
class CallTransfer : public DaemonCommand
|
||||
{
|
||||
public:
|
||||
CallTransfer();
|
||||
};
|
||||
|
||||
#endif // CALLTRANSFER_H
|
||||
5
daemon/commands/conference.cc
Normal file
5
daemon/commands/conference.cc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "conference.h"
|
||||
|
||||
Conference::Conference()
|
||||
{
|
||||
}
|
||||
10
daemon/commands/conference.h
Normal file
10
daemon/commands/conference.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef CONFERENCE_H
|
||||
#define CONFERENCE_H
|
||||
|
||||
class Conference : public DaemonCommand
|
||||
{
|
||||
public:
|
||||
Conference();
|
||||
};
|
||||
|
||||
#endif // CONFERENCE_H
|
||||
5
daemon/commands/video.cc
Normal file
5
daemon/commands/video.cc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "call-camera.h"
|
||||
|
||||
CallCamera::CallCamera()
|
||||
{
|
||||
}
|
||||
10
daemon/commands/video.h
Normal file
10
daemon/commands/video.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef CALLCAMERA_H
|
||||
#define CALLCAMERA_H
|
||||
|
||||
class CallCamera : public DaemonCommand
|
||||
{
|
||||
public:
|
||||
CallCamera();
|
||||
};
|
||||
|
||||
#endif // CALLCAMERA_H
|
||||
|
|
@ -26,6 +26,12 @@
|
|||
#include "commands/call.h"
|
||||
#include "commands/call-stats.h"
|
||||
#include "commands/call-status.h"
|
||||
#include "commands/call-pause.h"
|
||||
#include "commands/call-mute.h"
|
||||
#include "commands/call-resume.h"
|
||||
#include "commands/call-camera.h"
|
||||
#include "commands/call-transfer.h"
|
||||
#include "commands/conference.h"
|
||||
#include "commands/contact.h"
|
||||
#include "commands/dtmf.h"
|
||||
#include "commands/firewall-policy.h"
|
||||
|
|
@ -186,7 +192,7 @@ CallStatsResponse::CallStatsResponse(Daemon *daemon, LinphoneCall *call, const L
|
|||
AudioStreamStatsResponse::AudioStreamStatsResponse(Daemon* daemon, AudioStream* stream,
|
||||
const LinphoneCallStats *stats, bool event) {
|
||||
const char *prefix = "";
|
||||
|
||||
|
||||
ostringstream ostr;
|
||||
if (event) {
|
||||
ostr << "Event-type: audio-stream-stats\n";
|
||||
|
|
@ -201,9 +207,9 @@ AudioStreamStatsResponse::AudioStreamStatsResponse(Daemon* daemon, AudioStream*
|
|||
} else {
|
||||
prefix = ((stats->type == LINPHONE_CALL_STATS_AUDIO) ? "Audio-" : "Video-");
|
||||
}
|
||||
|
||||
|
||||
printCallStatsHelper(ostr, stats, prefix);
|
||||
|
||||
|
||||
setBody(ostr.str().c_str());
|
||||
}
|
||||
|
||||
|
|
@ -413,6 +419,12 @@ void Daemon::initCommands() {
|
|||
mCommands.push_back(new AnswerCommand());
|
||||
mCommands.push_back(new CallStatusCommand());
|
||||
mCommands.push_back(new CallStatsCommand());
|
||||
mCommands.push_back(new CallPause());
|
||||
mCommands.push_back(new CallMute());
|
||||
mCommands.push_back(new CallResume());
|
||||
mCommands.push_back(new CallTransfer());
|
||||
mCommands.push_back(new CallCamera());
|
||||
mCommands.push_back(new Conference());
|
||||
mCommands.push_back(new AudioCodecGetCommand());
|
||||
mCommands.push_back(new AudioCodecEnableCommand());
|
||||
mCommands.push_back(new AudioCodecDisableCommand());
|
||||
|
|
@ -459,8 +471,9 @@ bool Daemon::pullEvent() {
|
|||
|
||||
void Daemon::callStateChanged(LinphoneCall *call, LinphoneCallState state, const char *msg) {
|
||||
switch (state) {
|
||||
case LinphoneCallOutgoingProgress:
|
||||
case LinphoneCallIncomingReceived:
|
||||
linphone_call_enable_camera (call,mAutoVideo);
|
||||
case LinphoneCallOutgoingProgress:
|
||||
case LinphoneCallIncomingEarlyMedia:
|
||||
case LinphoneCallConnected:
|
||||
case LinphoneCallStreamsRunning:
|
||||
|
|
|
|||
|
|
@ -93,6 +93,15 @@ public:
|
|||
mReason = msg;
|
||||
}
|
||||
}
|
||||
Response(const std::string& msg, Status status = Error):
|
||||
mStatus(status) {
|
||||
if( status == Ok) {
|
||||
mBody = msg;
|
||||
} else {
|
||||
mReason = msg;
|
||||
}
|
||||
}
|
||||
|
||||
void setStatus(Status st) {
|
||||
mStatus = st;
|
||||
}
|
||||
|
|
@ -151,9 +160,9 @@ public:
|
|||
class PayloadTypeParser {
|
||||
public:
|
||||
PayloadTypeParser(LinphoneCore *core, const std::string &mime_type, bool accept_all = false);
|
||||
inline bool all() { return mAll; };
|
||||
inline bool successful() { return mSuccesful; };
|
||||
inline int payloadTypeNumber() { return mPayloadTypeNumber; };
|
||||
inline bool all() { return mAll; }
|
||||
inline bool successful() { return mSuccesful; }
|
||||
inline int payloadTypeNumber() { return mPayloadTypeNumber; }
|
||||
private:
|
||||
bool mAll;
|
||||
bool mSuccesful;
|
||||
|
|
@ -195,12 +204,16 @@ public:
|
|||
bool pullEvent();
|
||||
int updateCallId(LinphoneCall *call);
|
||||
int updateProxyId(LinphoneProxyConfig *proxy);
|
||||
inline int maxProxyId() { return mProxyIds; };
|
||||
inline int maxProxyId() { return mProxyIds; }
|
||||
int updateAudioStreamId(AudioStream *audio_stream);
|
||||
void dumpCommandsHelp();
|
||||
void dumpCommandsHelpHtml();
|
||||
void enableStatsEvents(bool enabled);
|
||||
void enableLSD(bool enabled);
|
||||
|
||||
void setAutoVideo( bool enabled ){ mAutoVideo = enabled; }
|
||||
inline bool autoVideo(){ return mAutoVideo; }
|
||||
|
||||
private:
|
||||
static void* iterateThread(void *arg);
|
||||
static void callStateChanged(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState state, const char *msg);
|
||||
|
|
@ -229,6 +242,7 @@ private:
|
|||
bool mRunning;
|
||||
bool mUseStatsEvents;
|
||||
FILE *mLogFile;
|
||||
bool mAutoVideo;
|
||||
int mCallIds;
|
||||
int mProxyIds;
|
||||
int mAudioStreamIds;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue