diff --git a/daemon/src/dbus/callmanager-introspec.xml b/daemon/src/dbus/callmanager-introspec.xml index a7ce5f874e4a09d4f4ceec50557989b60ec2201e..8a4d324c82a9264e5bc69a2fedbea689ddb27504 100644 --- a/daemon/src/dbus/callmanager-introspec.xml +++ b/daemon/src/dbus/callmanager-introspec.xml @@ -114,6 +114,11 @@ The callID. </tp:docstring> </arg> + <arg type="b" name="isOnHold" direction="out"> + <tp:docstring> + Returns true is the call has been put on hold. False otherwise. + </tp:docstring> + </arg> </method> <method name="unhold" tp:name-for-bindings="unhold"> @@ -125,6 +130,11 @@ The callID. </tp:docstring> </arg> + <arg type="b" name="isOffHold" direction="out"> + <tp:docstring> + Returns true is the call has been taken off hold. False otherwise. + </tp:docstring> + </arg> </method> <method name="transfer" tp:name-for-bindings="transfer"> diff --git a/daemon/src/dbus/callmanager.cpp b/daemon/src/dbus/callmanager.cpp index 31160fb5867524a0717f937e339a6290bdbbc4f3..744962c36efef163f4ae929f2d491dc44194c7d9 100644 --- a/daemon/src/dbus/callmanager.cpp +++ b/daemon/src/dbus/callmanager.cpp @@ -108,16 +108,16 @@ CallManager::hangUpConference(const std::string& confID) return Manager::instance().hangupConference(confID); } -void +bool CallManager::hold(const std::string& callID) { - Manager::instance().onHoldCall(callID); + return Manager::instance().onHoldCall(callID); } -void +bool CallManager::unhold(const std::string& callID) { - Manager::instance().offHoldCall(callID); + return Manager::instance().offHoldCall(callID); } void diff --git a/daemon/src/dbus/callmanager.h b/daemon/src/dbus/callmanager.h index 143ae318b0a05ce8f682606442e132a9984dd18c..63254f74ecad80840a5bd60c548e22c536321dcd 100644 --- a/daemon/src/dbus/callmanager.h +++ b/daemon/src/dbus/callmanager.h @@ -79,8 +79,8 @@ class CallManager void refuse(const std::string& callID); void accept(const std::string& callID); bool hangUp(const std::string& callID); - void hold(const std::string& callID); - void unhold(const std::string& callID); + bool hold(const std::string& callID); + bool unhold(const std::string& callID); void transfer(const std::string& callID, const std::string& to); void attendedTransfer(const std::string& transferID, const std::string& targetID); std::map< std::string, std::string > getCallDetails(const std::string& callID); diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index a96ab6b284b44db436e1b2809e33b18666d266ad..f2a5a00b8618a310a2874aae8395b1ba005c06e1 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -481,9 +481,9 @@ bool ManagerImpl::hangupConference(const std::string& id) //THREAD=Main -void ManagerImpl::onHoldCall(const std::string& callId) +bool ManagerImpl::onHoldCall(const std::string& callId) { - DEBUG("Put call %s on hold", callId.c_str()); + bool result = true; stopTone(); @@ -498,13 +498,14 @@ void ManagerImpl::onHoldCall(const std::string& callId) if (account_id.empty()) { DEBUG("Account ID %s or callid %s doesn't exist in call onHold", account_id.c_str(), callId.c_str()); - return; + return false; } getAccountLink(account_id)->onhold(callId); } } catch (const VoipLinkException &e) { ERROR("%s", e.what()); + result = false; } // Unbind calls in main buffer @@ -521,14 +522,14 @@ void ManagerImpl::onHoldCall(const std::string& callId) dbus_.getCallManager()->callStateChanged(callId, "HOLD"); getMainBuffer().dumpInfo(); + return result; } //THREAD=Main -void ManagerImpl::offHoldCall(const std::string& callId) +bool ManagerImpl::offHoldCall(const std::string& callId) { std::string codecName; - - DEBUG("Put call %s off hold", callId.c_str()); + bool result = true; stopTone(); @@ -555,6 +556,8 @@ void ManagerImpl::offHoldCall(const std::string& callId) if (call) getAccountLink(accountId)->offhold(callId); + else + result = false; } dbus_.getCallManager()->callStateChanged(callId, "UNHOLD"); @@ -563,13 +566,15 @@ void ManagerImpl::offHoldCall(const std::string& callId) Call *call = getCallFromCallID(callId); if (call) switchCall(call->getConfId()); - + else + result = false; } else switchCall(callId); addStream(callId); getMainBuffer().dumpInfo(); + return result; } //THREAD=Main diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 6eaf021b2c60330c58b86d80c553470593a63591..7cb53c5b4f26bacb20079361c05e2119b3899a38 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -193,14 +193,14 @@ class ManagerImpl { * Put the call on hold * @param id The call identifier */ - void onHoldCall(const std::string& id); + bool onHoldCall(const std::string& id); /** * Functions which occur with a user's action * Put the call off hold * @param id The call identifier */ - void offHoldCall(const std::string& id); + bool offHoldCall(const std::string& id); /** * Functions which occur with a user's action diff --git a/gnome/src/dbus/callmanager-introspec.xml b/gnome/src/dbus/callmanager-introspec.xml index a7ce5f874e4a09d4f4ceec50557989b60ec2201e..8a4d324c82a9264e5bc69a2fedbea689ddb27504 100644 --- a/gnome/src/dbus/callmanager-introspec.xml +++ b/gnome/src/dbus/callmanager-introspec.xml @@ -114,6 +114,11 @@ The callID. </tp:docstring> </arg> + <arg type="b" name="isOnHold" direction="out"> + <tp:docstring> + Returns true is the call has been put on hold. False otherwise. + </tp:docstring> + </arg> </method> <method name="unhold" tp:name-for-bindings="unhold"> @@ -125,6 +130,11 @@ The callID. </tp:docstring> </arg> + <arg type="b" name="isOffHold" direction="out"> + <tp:docstring> + Returns true is the call has been taken off hold. False otherwise. + </tp:docstring> + </arg> </method> <method name="transfer" tp:name-for-bindings="transfer"> diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c index 41f002c9e4e9615834c8d8a4b14ac51a715af13e..35ae9fd310645de7102a76fc9464530476fd957f 100644 --- a/gnome/src/dbus/dbus.c +++ b/gnome/src/dbus/dbus.c @@ -924,7 +924,8 @@ void dbus_clean() void dbus_hold(const callable_obj_t *c) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_hold(call_proxy, c->_callID, &error); + gboolean result; + org_sflphone_SFLphone_CallManager_hold(call_proxy, c->_callID, &result, &error); check_error(error); } @@ -932,7 +933,8 @@ void dbus_unhold(const callable_obj_t *c) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_unhold(call_proxy, c->_callID, &error); + gboolean result; + org_sflphone_SFLphone_CallManager_unhold(call_proxy, c->_callID, &result, &error); check_error(error); }