diff --git a/src/gui/official/PhoneLine.cpp b/src/gui/official/PhoneLine.cpp index e3ddc1a58b18a1a6fa52eff534a556a0ce726f75..fe8f61d6071ac7fbd113fe7038d517784635b0bc 100644 --- a/src/gui/official/PhoneLine.cpp +++ b/src/gui/official/PhoneLine.cpp @@ -268,14 +268,23 @@ PhoneLine::answer() } void -PhoneLine::hangup() +PhoneLine::hangup(bool sendrequest) { + if(sendrequest) { + setAction(tr("Hanguping...")); + } + else { + setAction(tr("Hanguped.")); + } + if(mCall) { - setAction("Hanguping..."); - DebugOutput::instance() << tr("PhoneLine %1: Trying to Hangup.\n").arg(mLine); - mCall->hangup(); - delete mCall; - mCall = NULL; + if(sendrequest) { + mCall->hangup(); + } + else { + delete mCall; + mCall = NULL; + } } else { clear(); diff --git a/src/gui/official/PhoneLine.hpp b/src/gui/official/PhoneLine.hpp index 03b1b22bf9814c99ce6b92dd3858319544c15cf9..6c1d74fdab2f2b36be71845dfbdced682d464f8d 100644 --- a/src/gui/official/PhoneLine.hpp +++ b/src/gui/official/PhoneLine.hpp @@ -21,7 +21,7 @@ public: void call(const QString &to); void call(); void answer(); - void hangup(); + void hangup(bool sendrequest = true); void hold(); void unhold(); diff --git a/src/gui/official/PhoneLineManagerImpl.cpp b/src/gui/official/PhoneLineManagerImpl.cpp index d6291187cbe9915dbd07f593461b0b11c7aa6f98..74805de378d6e987842271303cce1fa862f59d06 100644 --- a/src/gui/official/PhoneLineManagerImpl.cpp +++ b/src/gui/official/PhoneLineManagerImpl.cpp @@ -424,12 +424,13 @@ PhoneLineManagerImpl::hold() mCurrentLineMutex.unlock(); if(selectedLine) { + mSession->stopTone(); selectedLine->hold(); } } void -PhoneLineManagerImpl::hangup() +PhoneLineManagerImpl::hangup(bool sendrequest) { mCurrentLineMutex.lock(); PhoneLine *selectedLine = mCurrentLine; @@ -438,7 +439,8 @@ PhoneLineManagerImpl::hangup() mCurrentLineMutex.unlock(); if(selectedLine) { - selectedLine->hangup(); + mSession->stopTone(); + selectedLine->hangup(sendrequest); lineStatusSet(""); } } @@ -471,22 +473,24 @@ PhoneLineManagerImpl::unmute() } void -PhoneLineManagerImpl::hangup(const QString &callId) +PhoneLineManagerImpl::hangup(const QString &callId, bool sendrequest) { PhoneLine *selectedLine = getPhoneLine(callId); if(selectedLine) { + mSession->stopTone(); PhoneLineLocker guard(selectedLine); - selectedLine->hangup(); + selectedLine->hangup(sendrequest); } } void -PhoneLineManagerImpl::hangup(unsigned int line) +PhoneLineManagerImpl::hangup(unsigned int line, bool sendrequest) { PhoneLine *selectedLine = getPhoneLine(line); if(selectedLine) { + mSession->stopTone(); PhoneLineLocker guard(selectedLine); - selectedLine->hangup(); + selectedLine->hangup(sendrequest); } } @@ -505,8 +509,8 @@ PhoneLineManagerImpl::clear() void PhoneLineManagerImpl::incomming(const QString &accountId, - const QString &peer, - const QString &callId) + const QString &callId, + const QString &peer) { Call call(mSession->id(), accountId, callId, true); addCall(call, peer, "Incomming"); diff --git a/src/gui/official/PhoneLineManagerImpl.hpp b/src/gui/official/PhoneLineManagerImpl.hpp index e17bdcd1bf179f15054dc4af655bd3cc0563a5a8..5bbaf0267f3dedb03d09d4cd4546244beeceee7f 100644 --- a/src/gui/official/PhoneLineManagerImpl.hpp +++ b/src/gui/official/PhoneLineManagerImpl.hpp @@ -95,7 +95,7 @@ public slots: * This function will hanp up the current line * If there's no current line, it will do nothing. */ - void hangup(); + void hangup(bool sendrequest = true); /** * This function will mute the microphone if muting @@ -118,14 +118,14 @@ public slots: * argument. Be aware that the first line is 1, not * zero. */ - void hangup(unsigned int line); + void hangup(unsigned int line, bool sendrequest = true); /** * This function will hanp up the line with the * following call ID. If there's no line with * the call ID, it will do nothing. */ - void hangup(const QString &callId); + void hangup(const QString &callId, bool sendrequest = true); /** * This function will make a call on the diff --git a/src/gui/official/SFLEvents.cpp b/src/gui/official/SFLEvents.cpp index 6e191bb174fd1bf4cc5d21ab95b07d3e3058b950..e985b065e336c9eaf130903a1124e91545537ad9 100644 --- a/src/gui/official/SFLEvents.cpp +++ b/src/gui/official/SFLEvents.cpp @@ -28,7 +28,7 @@ HangupEvent::execute() if(id.length() > 0) { DebugOutput::instance() << QObject::tr("Hangup Event received for call ID: %1.\n") .arg(id); - PhoneLineManager::instance().hangup(id); + PhoneLineManager::instance().hangup(id, false); } else { DebugOutput::instance() << QObject::tr("Hangup Event invalid (missing call ID): %1\n") diff --git a/src/gui/official/SFLPhoneApp.cpp b/src/gui/official/SFLPhoneApp.cpp index 486c1c1d2878a8209e5a8c898ea199b6a49a2338..05f4785ade5b939d446296f875ec6158063e1daf 100644 --- a/src/gui/official/SFLPhoneApp.cpp +++ b/src/gui/official/SFLPhoneApp.cpp @@ -20,6 +20,7 @@ SFLPhoneApp::SFLPhoneApp(int argc, char **argv) PhoneLineManager::instance().initialize(); PhoneLineManager::instance().setNbLines(NB_PHONELINES); Requester::instance().registerObject< Request >(QString("playtone")); + Requester::instance().registerObject< Request >(QString("stoptone")); Requester::instance().registerObject< Request >(QString("playdtmf")); Requester::instance().registerObject< CallRequest >(QString("call")); Requester::instance().registerObject< EventRequest >(QString("getevents")); diff --git a/src/gui/official/Session.cpp b/src/gui/official/Session.cpp index 3e8c0b1dfc0796c65781409e93540bf0ca132951..815baea42d27b4bba3b71f5123daad0272b97f48 100644 --- a/src/gui/official/Session.cpp +++ b/src/gui/official/Session.cpp @@ -49,6 +49,12 @@ Session::playTone() const return Requester::instance().send(mId, "playtone", std::list< QString >()); } +QString +Session::stopTone() const +{ + return Requester::instance().send(mId, "stoptone", std::list< QString >()); +} + void Session::connect() const { diff --git a/src/gui/official/Session.hpp b/src/gui/official/Session.hpp index 6af32f0e938f31582f01764f0691b1d09817ad19..7062f03bf9fe036c650d4f50ed6f40703cc6e3de 100644 --- a/src/gui/official/Session.hpp +++ b/src/gui/official/Session.hpp @@ -83,6 +83,7 @@ class Session void connect() const; QString id() const; + QString stopTone() const; QString playTone() const; private: