Skip to content
Snippets Groups Projects
Commit 2c4cef2a authored by yanmorin's avatar yanmorin
Browse files

Correct two calls in the same time
hold the first one
parent 809dff00
Branches
Tags
No related merge requests found
...@@ -162,6 +162,19 @@ GUIServerImpl::refuseCall(const std::string& callId) ...@@ -162,6 +162,19 @@ GUIServerImpl::refuseCall(const std::string& callId)
} }
return false; return false;
} }
bool
GUIServerImpl::transferCall(const std::string& callId, const std::string& to)
{
try {
short id = getIdFromCallId(callId);
if (GuiFramework::transferCall(id, to)) {
return true;
}
} catch(...) {
return false;
}
return false;
}
bool bool
GUIServerImpl::holdCall(const std::string& callId) GUIServerImpl::holdCall(const std::string& callId)
......
...@@ -75,6 +75,7 @@ arg); ...@@ -75,6 +75,7 @@ arg);
bool holdCall(const std::string& callId); bool holdCall(const std::string& callId);
bool unholdCall(const std::string& callId); bool unholdCall(const std::string& callId);
bool hangupCall(const std::string& callId); bool hangupCall(const std::string& callId);
bool transferCall(const std::string& callId, const std::string& to);
bool dtmfCall(const std::string& callId, const std::string& dtmfKey); bool dtmfCall(const std::string& callId, const std::string& dtmfKey);
bool hangupAll(); bool hangupAll();
bool getCurrentCallId(std::string& callId); bool getCurrentCallId(std::string& callId);
......
...@@ -66,10 +66,30 @@ RequestUnhold::execute() ...@@ -66,10 +66,30 @@ RequestUnhold::execute()
return message("500","Server Error"); return message("500","Server Error");
} }
RequestTransfer::RequestTransfer(const std::string &sequenceId,
const TokenList& argList) : RequestGlobalCall(sequenceId, argList)
{
TokenList::iterator iter = _argList.begin();
// check for the transfer destination
bool argsAreValid = false;
if (iter != _argList.end()) {
_destination = *iter;
_argList.pop_front();
argsAreValid = true;
}
if (!argsAreValid) {
throw RequestConstructorException();
}
}
ResponseMessage ResponseMessage
RequestTransfer::execute() RequestTransfer::execute()
{ {
return message("200","TODO"); if ( GUIServer::instance().transferCall(_callId, _destination) ) {
return message("200", "OK");
}
return message("500","Server Error");
} }
ResponseMessage ResponseMessage
......
...@@ -136,8 +136,10 @@ public: ...@@ -136,8 +136,10 @@ public:
}; };
class RequestTransfer : public RequestGlobalCall { class RequestTransfer : public RequestGlobalCall {
public: public:
RequestTransfer(const std::string &sequenceId, const TokenList& argList) : RequestGlobalCall(sequenceId,argList) {} RequestTransfer(const std::string &sequenceId, const TokenList& argList);
ResponseMessage execute(); ResponseMessage execute();
private:
std::string _destination;
}; };
class RequestHangup : public RequestGlobalCall { class RequestHangup : public RequestGlobalCall {
public: public:
......
...@@ -405,7 +405,8 @@ ManagerImpl::answerCall (short id) ...@@ -405,7 +405,8 @@ ManagerImpl::answerCall (short id)
call->setStatus(string(CONNECTED_STATUS)); call->setStatus(string(CONNECTED_STATUS));
call->setState(Answered); call->setState(Answered);
ringtone(false); ringtone(false);
setCurrentCallId(id);
switchCall(id);
return call->answer(); return call->answer();
} }
...@@ -676,7 +677,7 @@ ManagerImpl::peerAnsweredCall (short id) ...@@ -676,7 +677,7 @@ ManagerImpl::peerAnsweredCall (short id)
call->setState(Answered); call->setState(Answered);
//if (isCurrentId(id)) { //if (isCurrentId(id)) {
setCurrentCallId(id); switchCall(id);
_gui->peerAnsweredCall(id); _gui->peerAnsweredCall(id);
//} //}
} }
...@@ -1297,4 +1298,14 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam ...@@ -1297,4 +1298,14 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam
return returnValue; return returnValue;
} }
void
ManagerImpl::switchCall(short id)
{
short currentCallId = getCurrentCallId();
if (currentCallId!=0 && id!=currentCallId) {
onHoldCall(currentCallId);
}
setCurrentCallId(id);
}
// EOF // EOF
...@@ -379,6 +379,8 @@ private: ...@@ -379,6 +379,8 @@ private:
Conf::ConfigTree _config; Conf::ConfigTree _config;
void switchCall(short id);
#ifdef USE_ZEROCONF #ifdef USE_ZEROCONF
// DNSService contain every zeroconf services // DNSService contain every zeroconf services
// configuration detected on the network // configuration detected on the network
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment