From 825d09a51808bafcc1a189e12bfcd097a0ce68dd Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)> Date: Thu, 5 Nov 2009 17:02:19 -0500 Subject: [PATCH] [#2392] Fix ringtone during call in IAX --- .../src/audio/audiortp/AudioRtpSession.h | 4 ++-- sflphone-common/src/iax/iaxvoiplink.cpp | 15 +++++++++++++++ sflphone-common/src/iax/iaxvoiplink.h | 3 +++ sflphone-common/src/managerimpl.cpp | 2 +- sflphone-common/src/managerimpl.h | 12 ++++++------ 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/sflphone-common/src/audio/audiortp/AudioRtpSession.h b/sflphone-common/src/audio/audiortp/AudioRtpSession.h index dca9512703..870926c0ae 100644 --- a/sflphone-common/src/audio/audiortp/AudioRtpSession.h +++ b/sflphone-common/src/audio/audiortp/AudioRtpSession.h @@ -398,8 +398,8 @@ namespace sfl { if (_manager->incomingCallWaiting() > 0) { int countTime_modulo = countTime % 4000; - _debug("countTime: %i\n", countTime); - _debug("countTime_modulo: %i\n", countTime_modulo); + // _debug("countTime: %i\n", countTime); + // _debug("countTime_modulo: %i\n", countTime_modulo); if ((countTime_modulo - countTime) < 0) { _manager->notificationIncomingCall(); } diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp index 8c634a692d..920eb6a873 100644 --- a/sflphone-common/src/iax/iaxvoiplink.cpp +++ b/sflphone-common/src/iax/iaxvoiplink.cpp @@ -47,6 +47,7 @@ _evThread = new EventThread (this); _regSession = NULL; _nextRefreshStamp = 0; + countTime = 0; // to get random number for RANDOM_PORT srand (time (NULL)); @@ -256,6 +257,20 @@ IAXVoIPLink::getEvent() sendRegister (""); } + // Notify (with a beep) an incoming call when there is already a call + countTime += 3; + + if((Manager::instance().incomingCallWaiting() > 0) && Manager::instance().hasCurrentCall()) { + + int countTime_modulo = countTime % 4000; + // _debug("countTime: %i\n", countTime); + // _debug("countTime_modulo: %i\n", countTime_modulo); + if ((countTime_modulo - countTime) < 0) { + Manager::instance().notificationIncomingCall(); + } + + countTime = countTime_modulo; + } // thread wait 3 millisecond _evThread->sleep (3); diff --git a/sflphone-common/src/iax/iaxvoiplink.h b/sflphone-common/src/iax/iaxvoiplink.h index a7771c782d..d67ef72b3e 100644 --- a/sflphone-common/src/iax/iaxvoiplink.h +++ b/sflphone-common/src/iax/iaxvoiplink.h @@ -298,6 +298,9 @@ class IAXVoIPLink : public VoIPLink /* URL hook */ UrlHook *urlhook; + + /** Counter for IncomingCallNotification */ + int countTime; }; #endif diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index d232daa3fc..ad9c5b4fda 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -189,7 +189,7 @@ ManagerImpl::isCurrentCall (const CallID& callId) bool ManagerImpl::hasCurrentCall() { - _debug ("ManagerImpl::hasCurrentCall current call ID = %s\n", _currentCallId2.c_str()); + // _debug ("ManagerImpl::hasCurrentCall current call ID = %s\n", _currentCallId2.c_str()); if (_currentCallId2 != "") { return true; diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index 8c4406ae79..40ed90c089 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -1097,12 +1097,6 @@ class ManagerImpl { */ void initVolume(); - /** - * Tell if there is a current call processed - * @return bool True if there is a current call - */ - bool hasCurrentCall(); - /** * Switch of current call id * @param id The new callid @@ -1264,6 +1258,12 @@ class ManagerImpl { public: + + /** + * Tell if there is a current call processed + * @return bool True if there is a current call + */ + bool hasCurrentCall(); /** * Return the current DBusManagerImpl -- GitLab