mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
Correct two calls in the same time
hold the first one
This commit is contained in:
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user