Commit b485789d authored by Ghislain MARY's avatar Ghislain MARY

Huge cleaning in linphone-daemon.

parent 2f508dc3
......@@ -32,7 +32,7 @@ public:
AdaptiveBufferCompensationResponse(LinphoneCore *core, StreamType type);
private:
void outputAdaptiveBufferCompensation(LinphoneCore *core, ostringstream &ost, const char *header, bool_t value);
void outputAdaptiveBufferCompensation(LinphoneCore *core, ostringstream &ost, const string& header, bool_t value);
};
AdaptiveBufferCompensationResponse::AdaptiveBufferCompensationResponse(LinphoneCore *core, StreamType type) : Response() {
......@@ -54,10 +54,10 @@ AdaptiveBufferCompensationResponse::AdaptiveBufferCompensationResponse(LinphoneC
outputAdaptiveBufferCompensation(core, ost, "Video", enabled);
break;
}
setBody(ost.str().c_str());
setBody(ost.str());
}
void AdaptiveBufferCompensationResponse::outputAdaptiveBufferCompensation(LinphoneCore *core, ostringstream &ost, const char *header, bool_t value) {
void AdaptiveBufferCompensationResponse::outputAdaptiveBufferCompensation(LinphoneCore *core, ostringstream &ost, const string& header, bool_t value) {
ost << header << ": ";
if (value) {
ost << "enabled\n";
......@@ -86,48 +86,51 @@ AdaptiveBufferCompensationCommand::AdaptiveBufferCompensationCommand() :
"Video: enabled"));
}
void AdaptiveBufferCompensationCommand::exec(Daemon *app, const char *args) {
void AdaptiveBufferCompensationCommand::exec(Daemon *app, const string& args) {
string stream;
string state;
istringstream ist(args);
ist >> stream;
if (ist.fail()) {
app->sendResponse(AdaptiveBufferCompensationResponse(app->getCore(), AdaptiveBufferCompensationResponse::AllStreams));
} else {
ist >> state;
if (ist.fail()) {
if (stream.compare("audio") == 0) {
app->sendResponse(AdaptiveBufferCompensationResponse(app->getCore(), AdaptiveBufferCompensationResponse::AudioStream));
} else if (stream.compare("video") == 0) {
app->sendResponse(AdaptiveBufferCompensationResponse(app->getCore(), AdaptiveBufferCompensationResponse::VideoStream));
} else {
app->sendResponse(Response("Incorrect stream parameter.", Response::Error));
}
return;
}
ist >> state;
if (ist.fail()) {
if (stream.compare("audio") == 0) {
app->sendResponse(AdaptiveBufferCompensationResponse(app->getCore(), AdaptiveBufferCompensationResponse::AudioStream));
} else if (stream.compare("video") == 0) {
app->sendResponse(AdaptiveBufferCompensationResponse(app->getCore(), AdaptiveBufferCompensationResponse::VideoStream));
} else {
AdaptiveBufferCompensationResponse::StreamType type;
bool enabled;
if (stream.compare("audio") == 0) {
type = AdaptiveBufferCompensationResponse::AudioStream;
} else if (stream.compare("video") == 0) {
type = AdaptiveBufferCompensationResponse::VideoStream;
} else {
app->sendResponse(Response("Incorrect stream parameter.", Response::Error));
return;
}
if (state.compare("enable") == 0) {
enabled = TRUE;
} else if (state.compare("disable") == 0) {
enabled = FALSE;
} else {
app->sendResponse(Response("Incorrect parameter.", Response::Error));
return;
}
if (type == AdaptiveBufferCompensationResponse::AudioStream) {
linphone_core_enable_audio_adaptive_jittcomp(app->getCore(), enabled);
} else if (type == AdaptiveBufferCompensationResponse::VideoStream) {
linphone_core_enable_video_adaptive_jittcomp(app->getCore(), enabled);
}
app->sendResponse(AdaptiveBufferCompensationResponse(app->getCore(), AdaptiveBufferCompensationResponse::AllStreams));
app->sendResponse(Response("Incorrect stream parameter.", Response::Error));
}
return;
}
AdaptiveBufferCompensationResponse::StreamType type;
bool enabled;
if (stream.compare("audio") == 0) {
type = AdaptiveBufferCompensationResponse::AudioStream;
} else if (stream.compare("video") == 0) {
type = AdaptiveBufferCompensationResponse::VideoStream;
} else {
app->sendResponse(Response("Incorrect stream parameter.", Response::Error));
return;
}
if (state.compare("enable") == 0) {
enabled = TRUE;
} else if (state.compare("disable") == 0) {
enabled = FALSE;
} else {
app->sendResponse(Response("Incorrect parameter.", Response::Error));
return;
}
if (type == AdaptiveBufferCompensationResponse::AudioStream) {
linphone_core_enable_audio_adaptive_jittcomp(app->getCore(), enabled);
} else if (type == AdaptiveBufferCompensationResponse::VideoStream) {
linphone_core_enable_video_adaptive_jittcomp(app->getCore(), enabled);
}
app->sendResponse(AdaptiveBufferCompensationResponse(app->getCore(), AdaptiveBufferCompensationResponse::AllStreams));
}
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
#define COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
#ifndef LINPHONE_DAEMON_COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
#define LINPHONE_DAEMON_COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
#include "../daemon.h"
#include "daemon.h"
class AdaptiveBufferCompensationCommand: public DaemonCommand {
public:
AdaptiveBufferCompensationCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
#endif // LINPHONE_DAEMON_COMMAND_ADAPTIVE_BUFFER_COMPENSATION_H_
......@@ -38,16 +38,15 @@ AnswerCommand::AnswerCommand() :
"Reason: No call to accept."));
}
void AnswerCommand::exec(Daemon *app, const char *args) {
void AnswerCommand::exec(Daemon *app, const string& args) {
LinphoneCore *lc = app->getCore();
int cid;
LinphoneCall *call;
if (sscanf(args, "%i", &cid) == 1) {
call = app->findCall(cid);
if (call == NULL) {
app->sendResponse(Response("No call with such id."));
return;
} else {
istringstream ist(args);
ist >> cid;
if (ist.fail()) {
for (const MSList* elem = linphone_core_get_calls(lc); elem != NULL; elem = elem->next) {
call = (LinphoneCall*)elem->data;
LinphoneCallState cstate = linphone_call_get_state(call);
if (cstate == LinphoneCallIncomingReceived || cstate == LinphoneCallIncomingEarlyMedia) {
if (linphone_core_accept_call(lc, call) == 0) {
......@@ -55,20 +54,24 @@ void AnswerCommand::exec(Daemon *app, const char *args) {
return;
}
}
app->sendResponse(Response("Can't accept this call."));
return;
}
} else {
for (const MSList* elem = linphone_core_get_calls(lc); elem != NULL; elem = elem->next) {
call = (LinphoneCall*) elem->data;
LinphoneCallState cstate = linphone_call_get_state(call);
if (cstate == LinphoneCallIncomingReceived || cstate == LinphoneCallIncomingEarlyMedia) {
if (linphone_core_accept_call(lc, call) == 0) {
app->sendResponse(Response());
return;
}
call = app->findCall(cid);
if (call == NULL) {
app->sendResponse(Response("No call with such id."));
return;
}
LinphoneCallState cstate = linphone_call_get_state(call);
if (cstate == LinphoneCallIncomingReceived || cstate == LinphoneCallIncomingEarlyMedia) {
if (linphone_core_accept_call(lc, call) == 0) {
app->sendResponse(Response());
return;
}
}
app->sendResponse(Response("Can't accept this call."));
return;
}
app->sendResponse(Response("No call to accept."));
}
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_ANSWER_H_
#define COMMAND_ANSWER_H_
#ifndef LINPHONE_DAEMON_COMMAND_ANSWER_H_
#define LINPHONE_DAEMON_COMMAND_ANSWER_H_
#include "../daemon.h"
#include "daemon.h"
class AnswerCommand: public DaemonCommand {
public:
AnswerCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_ANSWER_H_
#endif // LINPHONE_DAEMON_COMMAND_ANSWER_H_
......@@ -52,12 +52,12 @@ AudioCodecGetCommand::AudioCodecGetCommand() :
"Reason: Audio codec not found."));
}
void AudioCodecGetCommand::exec(Daemon *app, const char *args) {
void AudioCodecGetCommand::exec(Daemon *app, const string& args) {
bool list = false;
bool found = false;
istringstream ist(args);
ostringstream ost;
PayloadType *pt=NULL;
PayloadType *pt = NULL;
if (ist.peek() == EOF) {
found = list = true;
......@@ -88,6 +88,6 @@ void AudioCodecGetCommand::exec(Daemon *app, const char *args) {
if (!found) {
app->sendResponse(Response("Audio codec not found.", Response::Error));
} else {
app->sendResponse(Response(ost.str().c_str(), Response::Ok));
app->sendResponse(Response(ost.str(), Response::Ok));
}
}
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_GET_H_
#define COMMAND_AUDIO_CODEC_GET_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_GET_H_
#define LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_GET_H_
#include "../daemon.h"
#include "daemon.h"
class AudioCodecGetCommand: public DaemonCommand {
public:
AudioCodecGetCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_AUDIO_CODEC_GET_H_
#endif // LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_GET_H_
......@@ -49,7 +49,7 @@ AudioCodecMoveCommand::AudioCodecMoveCommand() :
"Enabled: false"));
}
void AudioCodecMoveCommand::exec(Daemon *app, const char *args) {
void AudioCodecMoveCommand::exec(Daemon *app, const string& args) {
istringstream ist(args);
if (ist.peek() == EOF) {
......
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_MOVE_H_
#define COMMAND_AUDIO_CODEC_MOVE_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_MOVE_H_
#define LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_MOVE_H_
#include "../daemon.h"
#include "daemon.h"
class AudioCodecMoveCommand: public DaemonCommand {
public:
AudioCodecMoveCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_AUDIO_CODEC_MOVE_H_
#endif // LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_MOVE_H_
......@@ -78,7 +78,7 @@ static PayloadType *findPayload(LinphoneCore *lc, int payload_type, int *index){
return NULL;
}
void AudioCodecSetCommand::exec(Daemon *app, const char *args) {
void AudioCodecSetCommand::exec(Daemon *app, const string& args) {
istringstream ist(args);
if (ist.peek() == EOF) {
......
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_SET_H_
#define COMMAND_AUDIO_CODEC_SET_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_SET_H_
#define LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_SET_H_
#include "../daemon.h"
#include "daemon.h"
class AudioCodecSetCommand: public DaemonCommand {
public:
AudioCodecSetCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_AUDIO_CODEC_SET_H_
#endif // LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_SET_H_
......@@ -26,7 +26,7 @@ AudioCodecToggleCommand::AudioCodecToggleCommand(const char *name, const char *p
DaemonCommand(name, proto, help), mEnable(enable) {
}
void AudioCodecToggleCommand::exec(Daemon *app, const char *args) {
void AudioCodecToggleCommand::exec(Daemon *app, const string& args) {
istringstream ist(args);
if (ist.peek() == EOF) {
......
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_CODEC_TOGGLE_H_
#define COMMAND_AUDIO_CODEC_TOGGLE_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_TOGGLE_H_
#define LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_TOGGLE_H_
#include "../daemon.h"
#include "daemon.h"
class AudioCodecToggleCommand: public DaemonCommand {
public:
AudioCodecToggleCommand(const char *name, const char *proto, const char *help, bool enable);
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
protected:
bool mEnable;
};
......@@ -40,4 +40,4 @@ public:
AudioCodecDisableCommand();
};
#endif //COMMAND_AUDIO_CODEC_TOGGLE_H_
#endif // LINPHONE_DAEMON_COMMAND_AUDIO_CODEC_TOGGLE_H_
......@@ -31,65 +31,66 @@ AudioStreamStartCommand::AudioStreamStartCommand() :
static PayloadType *getPayloadType(LinphoneCore *lc, const MSList *codecs, int number){
const MSList *elem;
for (elem=codecs;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
if (linphone_core_get_payload_type_number(lc, pt)==number)
for (elem = codecs; elem != NULL; elem = elem->next) {
PayloadType *pt = (PayloadType*)elem->data;
if (linphone_core_get_payload_type_number(lc, pt) == number)
return pt;
}
return NULL;
}
void AudioStreamStartCommand::exec(Daemon *app, const char *args) {
char addr[256];
void AudioStreamStartCommand::exec(Daemon *app, const string& args) {
string addr;
int port;
int payload_type;
MSFactory* factory ;
factory = (app->getCore())->factory;
MSFactory* factory = app->getCore()->factory;
if (sscanf(args, "%255s %d %d", addr, &port, &payload_type) == 3) {
int local_port = linphone_core_get_audio_port(app->getCore());
int jitt = linphone_core_get_audio_jittcomp(app->getCore());
bool_t echo_canceller = linphone_core_echo_cancellation_enabled(app->getCore());
int ptime=linphone_core_get_upload_ptime(app->getCore());
MSSndCardManager *manager = ms_factory_get_snd_card_manager(factory);
MSSndCard *capture_card = ms_snd_card_manager_get_card(manager, linphone_core_get_capture_device(app->getCore()));
MSSndCard *play_card = ms_snd_card_manager_get_card(manager, linphone_core_get_playback_device(app->getCore()));
RtpProfile *prof=rtp_profile_new("stream");
PayloadType *pt=getPayloadType(app->getCore(), linphone_core_get_audio_codecs(app->getCore()), payload_type);
if (!pt){
app->sendResponse(Response("No payload type were assigned to this number."));
return;
}
AudioStream *stream = audio_stream_new(factory, local_port, local_port + 1, linphone_core_ipv6_enabled(app->getCore()));
audio_stream_set_features(stream,linphone_core_get_audio_features(app->getCore()));
pt=payload_type_clone(pt);
if (ptime!=0){
char fmtp[32];
snprintf(fmtp,sizeof(fmtp)-1,"ptime=%i",ptime);
payload_type_append_send_fmtp(pt,fmtp);
}
rtp_profile_set_payload(prof,payload_type,pt);
if (linphone_core_generic_confort_noise_enabled(app->getCore())){
rtp_profile_set_payload(prof,13,payload_type_clone(&payload_type_cn));
}
istringstream ist(args);
ist >> addr;
ist >> port;
ist >> payload_type;
if (ist.fail()) {
app->sendResponse(Response("Missing/Incorrect parameter(s)."));
return;
}
int local_port = linphone_core_get_audio_port(app->getCore());
int jitt = linphone_core_get_audio_jittcomp(app->getCore());
bool_t echo_canceller = linphone_core_echo_cancellation_enabled(app->getCore());
int ptime = linphone_core_get_upload_ptime(app->getCore());
MSSndCardManager *manager = ms_factory_get_snd_card_manager(factory);
MSSndCard *capture_card = ms_snd_card_manager_get_card(manager, linphone_core_get_capture_device(app->getCore()));
MSSndCard *play_card = ms_snd_card_manager_get_card(manager, linphone_core_get_playback_device(app->getCore()));
RtpProfile *prof = rtp_profile_new("stream");
PayloadType *pt = getPayloadType(app->getCore(), linphone_core_get_audio_codecs(app->getCore()), payload_type);
audio_stream_enable_adaptive_jittcomp(stream, linphone_core_audio_adaptive_jittcomp_enabled(app->getCore()));
rtp_session_set_symmetric_rtp(stream->ms.sessions.rtp_session, linphone_core_symmetric_rtp_enabled(app->getCore()));
int err=audio_stream_start_now(stream, prof, addr, port, port + 1, payload_type, jitt, play_card, capture_card, echo_canceller);
if (!pt){
app->sendResponse(Response("No payload type were assigned to this number."));
return;
}
AudioStream *stream = audio_stream_new(factory, local_port, local_port + 1, linphone_core_ipv6_enabled(app->getCore()));
audio_stream_set_features(stream, linphone_core_get_audio_features(app->getCore()));
pt = payload_type_clone(pt);
if (ptime != 0) {
char fmtp[32];
snprintf(fmtp, sizeof(fmtp) - 1, "ptime=%i", ptime);
payload_type_append_send_fmtp(pt, fmtp);
}
rtp_profile_set_payload(prof, payload_type,pt);
if (linphone_core_generic_confort_noise_enabled(app->getCore())){
rtp_profile_set_payload(prof, 13, payload_type_clone(&payload_type_cn));
}
audio_stream_enable_adaptive_jittcomp(stream, linphone_core_audio_adaptive_jittcomp_enabled(app->getCore()));
rtp_session_set_symmetric_rtp(stream->ms.sessions.rtp_session, linphone_core_symmetric_rtp_enabled(app->getCore()));
if (err != 0) {
app->sendResponse(Response("Error during audio stream creation."));
return;
}
ostringstream ostr;
ostr << "Id: " << app->updateAudioStreamId(stream) << "\n";
app->sendResponse(Response(ostr.str().c_str(), Response::Ok));
} else {
app->sendResponse(Response("Missing/Incorrect parameter(s)."));
int err = audio_stream_start_now(stream, prof, addr.c_str(), port, port + 1, payload_type, jitt, play_card, capture_card, echo_canceller);
if (err != 0) {
app->sendResponse(Response("Error during audio stream creation."));
return;
}
ostringstream ostr;
ostr << "Id: " << app->updateAudioStreamId(stream) << "\n";
app->sendResponse(Response(ostr.str(), Response::Ok));
}
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_STREAM_START_H_
#define COMMAND_AUDIO_STREAM_START_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_START_H_
#define LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_START_H_
#include "../daemon.h"
#include "daemon.h"
class AudioStreamStartCommand: public DaemonCommand {
public:
AudioStreamStartCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_AUDIO_STREAM_START_H_
#endif // LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_START_H_
......@@ -45,21 +45,21 @@ AudioStreamStatsCommand::AudioStreamStatsCommand() :
"Reason: No audio stream with such id."));
}
void AudioStreamStatsCommand::exec(Daemon *app, const char *args) {
void AudioStreamStatsCommand::exec(Daemon *app, const string& args) {
int sid;
AudioStreamAndOther *stream = NULL;
if (sscanf(args, "%i", &sid) == 1) {
stream = app->findAudioStreamAndOther(sid);
if (!stream) {
app->sendResponse(Response("No audio stream with such id."));
return;
}
} else {
istringstream ist(args);
ist >> sid;
if (ist.fail()) {
app->sendResponse(Response("No stream specified."));
return;
}
ostringstream ostr;
ostr << AudioStreamStatsResponse(app, stream->stream, &stream->stats, false).getBody();
app->sendResponse(Response(ostr.str().c_str(), Response::Ok));
stream = app->findAudioStreamAndOther(sid);
if (!stream) {
app->sendResponse(Response("No audio stream with such id."));
return;
}
app->sendResponse(Response(AudioStreamStatsResponse(app, stream->stream, &stream->stats, false).getBody(), Response::Ok));
}
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_STREAM_STATS_H_
#define COMMAND_AUDIO_STREAM_STATS_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_STATS_H_
#define LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_STATS_H_
#include "../daemon.h"
#include "daemon.h"
class AudioStreamStatsCommand: public DaemonCommand {
public:
AudioStreamStatsCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_AUDIO_STREAM_STATS_H_
#endif // LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_STATS_H_
......@@ -30,20 +30,23 @@ AudioStreamStopCommand::AudioStreamStopCommand() :
"Reason: No Audio Stream with such id."));
}
void AudioStreamStopCommand::exec(Daemon *app, const char *args) {
void AudioStreamStopCommand::exec(Daemon *app, const string& args) {
int id;
if (sscanf(args, "%d", &id) == 1) {
AudioStream *stream = app->findAudioStream(id);
if (stream == NULL) {
app->sendResponse(Response("No Audio Stream with such id."));
return;
}
app->removeAudioStream(id);
RtpProfile *prof=rtp_session_get_profile(stream->ms.sessions.rtp_session);
audio_stream_stop(stream);
rtp_profile_destroy(prof);
app->sendResponse(Response());
} else {
istringstream ist(args);
ist >> id;
if (ist.fail()) {
app->sendResponse(Response("Missing/Incorrect parameter(s)."));
return;
}
AudioStream *stream = app->findAudioStream(id);
if (stream == NULL) {
app->sendResponse(Response("No Audio Stream with such id."));
return;
}
app->removeAudioStream(id);
RtpProfile *prof=rtp_session_get_profile(stream->ms.sessions.rtp_session);
audio_stream_stop(stream);
rtp_profile_destroy(prof);
app->sendResponse(Response());
}
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUDIO_STREAM_STOP_H_
#define COMMAND_AUDIO_STREAM_STOP_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_STOP_H_
#define LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_STOP_H_
#include "../daemon.h"
#include "daemon.h"
class AudioStreamStopCommand: public DaemonCommand {
public:
AudioStreamStopCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_AUDIO_STREAM_STOP_H_
#endif // LINPHONE_DAEMON_COMMAND_AUDIO_STREAM_STOP_H_
......@@ -34,7 +34,7 @@ AuthInfosClearCommand::AuthInfosClearCommand() :
"Reason: No auth info with such id."));
}
void AuthInfosClearCommand::exec(Daemon *app, const char *args) {
void AuthInfosClearCommand::exec(Daemon *app, const string& args) {
string param;
int pid;
ostringstream ostr;
......@@ -49,7 +49,7 @@ void AuthInfosClearCommand::exec(Daemon *app, const char *args) {
int previous_size = app->maxAuthInfoId();
linphone_core_clear_all_auth_info(app->getCore());
ostr << "Successfully cleared " << previous_size - app->maxAuthInfoId() << " auth infos." << endl;
app->sendResponse(Response(ostr.str().c_str(), Response::Ok));
app->sendResponse(Response(ostr.str(), Response::Ok));
} else {
LinphoneAuthInfo *auth_info = NULL;
ist.clear();
......@@ -66,6 +66,6 @@ void AuthInfosClearCommand::exec(Daemon *app, const char *args) {
}
linphone_core_remove_auth_info(app->getCore(), auth_info);
ostr << "Successfully cleared auth info " << pid << "." << endl;
app->sendResponse(Response(ostr.str().c_str(), Response::Ok));
app->sendResponse(Response(ostr.str(), Response::Ok));
}
}
......@@ -17,15 +17,15 @@ along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef COMMAND_AUTH_INFOS_CLEAR_H_
#define COMMAND_AUTH_INFOS_CLEAR_H_
#ifndef LINPHONE_DAEMON_COMMAND_AUTH_INFOS_CLEAR_H_
#define LINPHONE_DAEMON_COMMAND_AUTH_INFOS_CLEAR_H_
#include "../daemon.h"
#include "daemon.h"
class AuthInfosClearCommand: public DaemonCommand {
public:
AuthInfosClearCommand();
virtual void exec(Daemon *app, const char *args);
virtual void exec(Daemon *app, const std::string& args);
};
#endif //COMMAND_AUTH_INFOS_CLEAR_H_
#endif // LINPHONE_DAEMON_COMMAND_AUTH_INFOS_CLEAR_H_
......@@ -19,7 +19,9 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "call-mute.h"
CallMute::CallMute() :
using namespace std;
CallMuteCommand::CallMuteCommand() :
DaemonCommand("call-mute", "call-mute 0|1", "mute/unmute the microphone (1 to mute, 0 to unmute). No argument means MUTE.")
{
addExample(new DaemonCommandExample("call-mute 1",
......@@ -36,24 +38,25 @@ CallMute::CallMute() :
"Reason: No call in progress. Can't mute."));
}
void CallMute::exec(Daemon* app, const char* args)
void CallMuteCommand::exec(Daemon* app, const string& args)
{
LinphoneCore *lc = app->getCore();
int muted = TRUE; // no arg means MUTE
int muted;
LinphoneCall *call = linphone_core_get_current_call(lc);