From 9e7a215c9ca81a463a0a87bc3f59c237737e0036 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Thu, 19 Mar 2009 10:34:21 -0400
Subject: [PATCH] Put on RINGING_STATE only on outgoing call

---
 src/managerimpl.cpp | 4 ++--
 src/sipvoiplink.cpp | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index fb7fd32d28..16d22b136a 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -741,7 +741,7 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
     /* Broadcast a signal over DBus */
     if (_dbus) _dbus->getCallManager()->incomingCall(accountId, call->getCallId(), from);
 
-    if (_dbus) _dbus->getCallManager()->callStateChanged(call->getCallId(), "INCOMING");
+    //if (_dbus) _dbus->getCallManager()->callStateChanged(call->getCallId(), "INCOMING");
   
     // Reduce volume of the other pulseaudio-connected audio applications
     if( _audiodriver->getLayerType() == PULSEAUDIO && getConfigInt( PREFERENCES , CONFIG_PA_VOLUME_CTRL ) ) {
@@ -782,7 +782,7 @@ ManagerImpl::peerRingingCall(const CallID& id)
   if (isCurrentCall(id)) {
     ringback();
   }
-  // if (_dbus) _dbus->getCallManager()->callStateChanged(id, "RINGING");
+  if (_dbus) _dbus->getCallManager()->callStateChanged(id, "RINGING");
 }
 
 //THREAD=VoIP Call=Outgoing/Ingoing
diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp
index 4053df3cc6..33ce2d4ec2 100644
--- a/src/sipvoiplink.cpp
+++ b/src/sipvoiplink.cpp
@@ -1619,8 +1619,6 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
         SIPVoIPLink *link;
         pjsip_rx_data *rdata;
 
-        _debug (" *****************************  NEW CALL STATE %i **************************\n", inv->state);        
-
         /* Retrieve the call information */
         call = reinterpret_cast<SIPCall*> (inv->mod_data[_mod_ua.id]);
         if(!call)
@@ -1688,8 +1686,8 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
         }
         else {
 
-            // The call is ringing
-            if (inv->state == PJSIP_INV_STATE_EARLY){
+            // The call is ringing - We need to handle this case only on outgoing call
+            if (inv->state == PJSIP_INV_STATE_EARLY && e->body.tsx_state.tsx->role == PJSIP_ROLE_UAC){
                 _debug ("*************************** PJSIP_INV_STATE_EARLY - PEER RINGING ***********************************\n");
                 call->setConnectionState(Call::Ringing);
                 Manager::instance().peerRingingCall(call->getCallId());
-- 
GitLab