From adda9e4b4921366adaf4fb4cd42e815062838515 Mon Sep 17 00:00:00 2001
From: yanmorin <yanmorin>
Date: Wed, 3 May 2006 21:04:36 +0000
Subject: [PATCH] Fix onhold/getcallstatus issues

---
 src/audio/audiortp.cpp | 3 ++-
 src/audio/tone.cpp     | 3 ++-
 src/managerimpl.cpp    | 2 +-
 src/sipvoiplink.cpp    | 1 +
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp
index 98d0fbc59d..aacc61bd3a 100644
--- a/src/audio/audiortp.cpp
+++ b/src/audio/audiortp.cpp
@@ -97,7 +97,8 @@ AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, AudioLayer* driver, bool sym) {
   _sym = sym;
   _audioDevice = driver;
   if (_audioDevice!=0) {
-    _nbFrames = 20 * _audioDevice->getSampleRate()/1000; // 20 ms
+//    _nbFrames = 20 * _audioDevice->getSampleRate()/1000; // 20 ms
+    _nbFrames = _audioDevice->getSampleRate()/50; // 20 ms / 1000
   } else {
     _nbFrames = RTP_FRAMES2SEND;
   }
diff --git a/src/audio/tone.cpp b/src/audio/tone.cpp
index 8a84e140b2..ab329dfd26 100644
--- a/src/audio/tone.cpp
+++ b/src/audio/tone.cpp
@@ -116,7 +116,8 @@ Tone::genSin(int16 *buffer, int frequency1, int frequency2, int nb)
   double var1 = (double)2 * (double)M_PI * (double)frequency1 / (double)_sampleRate; 
   double var2 = (double)2 * (double)M_PI * (double)frequency2 / (double)_sampleRate;
 
-  double amp = (double)(INT16_AMPLITUDE >> 2);
+  // softer
+  double amp = (double)(INT16_AMPLITUDE >> 3);
   if (_nbChannel == 2) { // stereo
     int k = 0;
     for(int t = 0; t < nb; t++) {
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index 49cbd91582..6ccde181ce 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -1237,7 +1237,7 @@ ManagerImpl::getCallStatus(const std::string& sequenceId)
   std::string destination;  
   std::string number;
 
-  while (iter != _callAccountMap.begin())
+  while (iter != _callAccountMap.end())
   {
     Call* call = getAccountLink(iter->second)->getCall(iter->first);
     Call::ConnectionState state = call->getConnectionState();
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index d92a0704b9..8137b61b18 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -663,6 +663,7 @@ SIPVoIPLink::onhold(const CallID& id)
   
   // Stop sound
   call->setAudioStart(false);
+  call->setState(Call::Hold);
   _debug("SIP: Stopping AudioRTP when onhold\n");
   _audiortp.closeRtpSession();
 
-- 
GitLab