Correct two calls in the same time

hold the first one
This commit is contained in:
yanmorin
2005-09-30 18:21:39 +00:00
parent 809dff0090
commit 2c4cef2a2c
6 changed files with 54 additions and 5 deletions

View File

@ -162,6 +162,19 @@ GUIServerImpl::refuseCall(const std::string& callId)
}
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
GUIServerImpl::holdCall(const std::string& callId)

View File

@ -75,6 +75,7 @@ arg);
bool holdCall(const std::string& callId);
bool unholdCall(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 hangupAll();
bool getCurrentCallId(std::string& callId);

View File

@ -66,10 +66,30 @@ RequestUnhold::execute()
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
RequestTransfer::execute()
{
return message("200","TODO");
if ( GUIServer::instance().transferCall(_callId, _destination) ) {
return message("200", "OK");
}
return message("500","Server Error");
}
ResponseMessage

View File

@ -136,8 +136,10 @@ public:
};
class RequestTransfer : public RequestGlobalCall {
public:
RequestTransfer(const std::string &sequenceId, const TokenList& argList) : RequestGlobalCall(sequenceId,argList) {}
RequestTransfer(const std::string &sequenceId, const TokenList& argList);
ResponseMessage execute();
private:
std::string _destination;
};
class RequestHangup : public RequestGlobalCall {
public:

View File

@ -405,7 +405,8 @@ ManagerImpl::answerCall (short id)
call->setStatus(string(CONNECTED_STATUS));
call->setState(Answered);
ringtone(false);
setCurrentCallId(id);
switchCall(id);
return call->answer();
}
@ -676,8 +677,8 @@ ManagerImpl::peerAnsweredCall (short id)
call->setState(Answered);
//if (isCurrentId(id)) {
setCurrentCallId(id);
_gui->peerAnsweredCall(id);
switchCall(id);
_gui->peerAnsweredCall(id);
//}
}
@ -1297,4 +1298,14 @@ ManagerImpl::getConfigList(const std::string& sequenceId, const std::string& nam
return returnValue;
}
void
ManagerImpl::switchCall(short id)
{
short currentCallId = getCurrentCallId();
if (currentCallId!=0 && id!=currentCallId) {
onHoldCall(currentCallId);
}
setCurrentCallId(id);
}
// EOF

View File

@ -379,6 +379,8 @@ private:
Conf::ConfigTree _config;
void switchCall(short id);
#ifdef USE_ZEROCONF
// DNSService contain every zeroconf services
// configuration detected on the network