Skip to content
Snippets Groups Projects
Commit 0c2cb826 authored by yanmorin's avatar yanmorin
Browse files

New tests and features
Add mute/unmute
Change the refuse message send
parent a3c37ad1
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,17 @@ GuiFramework::transferCall (short id, const string& to)
}
}
void
GuiFramework::mute()
{
Manager::instance().mute();
}
void
GuiFramework::unmute()
{
Manager::instance().unmute();
}
void
GuiFramework::muteOn (short id)
{
......
......@@ -55,6 +55,8 @@ public:
int onHoldCall (short id);
int offHoldCall (short id);
int transferCall (short id, const std::string& to);
void mute ();
void unmute ();
void muteOn (short id);
void muteOff (short id);
int refuseCall (short id);
......
......@@ -181,6 +181,16 @@ GUIServerImpl::dtmfCall(const std::string& callId, const std::string& dtmfKey)
int
GUIServerImpl::incomingCall (short id)
{
std::ostringstream responseMessage, callId;
callId << "s" << id;
responseMessage << "acc1 " << callId.str() << " call";
SubCall subcall("seq0", callId.str());
insertSubCall(id, subcall);
_requestManager.sendResponse(ResponseMessage("001", "seq0", responseMessage.str()));
return 0;
}
......@@ -228,7 +238,7 @@ GUIServerImpl::displayTextMessage (short id, const std::string& message)
{
std::ostringstream responseMessage;
std::string seq = getSequenceIdFromId(id);
responseMessage <<"s" << id << "text message: " + message;
responseMessage << "s" << id << " text message: " + message;
_requestManager.sendResponse(ResponseMessage("700", seq, responseMessage.str()));
}
......
......@@ -112,13 +112,15 @@ RequestDTMF::execute()
ResponseMessage
RequestMute::execute()
{
return message("200","TODO");
GUI::instance().muteOn();
return message("200","OK");
}
ResponseMessage
RequestUnmute::execute()
{
return message("200","TODO");
GUI::instance().unmute();
return message("200","OK");
}
ResponseMessage
......
......@@ -95,6 +95,7 @@ class RequestGlobalCall : public Request
public:
RequestGlobalCall(const std::string &sequenceId, const TokenList& argList) : Request(sequenceId, argList) {
TokenList::iterator iter = _argList.begin();
if (iter != _argList.end() && ((*iter)[0]=='c' || (*iter)[0]=='s') ) {
_callId = *iter;
_argList.pop_front();
......
......@@ -87,12 +87,12 @@ RequestFactory::registerAll() {
registerRequest<RequestSyntaxError> ("syntaxerror");
registerRequest<RequestCall> ("call");
registerRequest<RequestQuit> ("quit");
registerRequest<RequestAnswer> ("anwser");
registerRequest<RequestAnswer> ("answer");
registerRequest<RequestRefuse> ("refuse");
registerRequest<RequestHold> ("hold");
registerRequest<RequestUnhold> ("unhold");
registerRequest<RequestHangup> ("hangup");
registerRequest<RequestDTMF> ("dtmf");
registerRequest<RequestDTMF> ("dtmf");
registerRequest<RequestTransfer> ("transfer");
registerRequest<RequestMute> ("mute");
registerRequest<RequestUnmute> ("unmute");
......
......@@ -87,7 +87,8 @@ ManagerImpl::ManagerImpl (void)
// Initialize after by init() -> initVolume()
_spkr_volume = 0;
_mic_volume = 0;
_mic_volume = 0;
_mic_volume_before_mute = 0;
}
ManagerImpl::~ManagerImpl (void)
......@@ -430,6 +431,16 @@ ManagerImpl::transferCall (short id, const string& to)
call->setState(Transfered);
return call->transfer(to);
}
void
ManagerImpl::mute() {
_mic_volume_before_mute = _mic_volume;
_mic_volume = 0;
}
void
ManagerImpl::unmute() {
_mic_volume = _mic_volume_before_mute;
}
void
ManagerImpl::muteOn (short id)
......@@ -559,7 +570,7 @@ ManagerImpl::incomingCall (short id)
call->setStatus(string(RINGING_STATUS));
call->setState(Progressing);
ringtone(true);
displayStatus(RINGING_STATUS);
//displayStatus(RINGING_STATUS);
return _gui->incomingCall(id);
}
......
......@@ -149,6 +149,8 @@ public:
int onHoldCall (short id);
int offHoldCall (short id);
int transferCall (short id, const std::string& to);
void mute();
void unmute();
void muteOn (short id);
void muteOff (short id);
int refuseCall (short id);
......@@ -220,7 +222,7 @@ public:
inline int getSpkrVolume (void) { return _spkr_volume; }
inline void setSpkrVolume (int spkr_vol) { _spkr_volume = spkr_vol; }
inline int getMicroVolume (void) { return _mic_volume; }
inline void setMicroVolume (int mic_vol) { _mic_volume = mic_vol; }
inline void setMicroVolume (int mic_vol) { _mic_volume = _mic_volume_before_mute = mic_vol; }
/*
* Manage information about firewall
......@@ -341,6 +343,7 @@ private:
// To handle volume control
int _spkr_volume;
int _mic_volume;
int _mic_volume_before_mute;
// To handle firewall
int _firewallPort;
......
......@@ -526,9 +526,10 @@ SipVoIPLink::refuse (short id)
osip_message_t *answer = NULL;
eXosip_lock();
i = eXosip_call_build_answer (getSipCall(id)->getTid(), BUSY_HERE, &answer);
// not BUSY.. where decline the invitation!
i = eXosip_call_build_answer (getSipCall(id)->getTid(), SIP_DECLINE, &answer);
if (i == 0) {
i = eXosip_call_send_answer (getSipCall(id)->getTid(), BUSY_HERE, answer);
i = eXosip_call_send_answer (getSipCall(id)->getTid(), SIP_DECLINE, answer);
}
eXosip_unlock();
return i;
......@@ -570,7 +571,7 @@ SipVoIPLink::getEvent (void)
// Generate id
id = Manager::instance().generateNewCallId();
Manager::instance().pushBackNewCall(id, Incoming);
_debug("Incoming Call with identifiant %d [cid = %d, did = %d]\n",
_debug("Incoming Call with id %d [cid = %d, did = %d]\n",
id, event->cid, event->did);
_debug("Local audio port: %d\n", _localPort);
......@@ -737,6 +738,7 @@ SipVoIPLink::getEvent (void)
default:
break;
}
break;
case EXOSIP_CALL_SERVERFAILURE:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment