From 69e7fba23e7781462d46a5ae6ede9ab2aff475b6 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Thu, 16 Sep 2010 16:05:09 -0400
Subject: [PATCH] [#4068] Implement iax transfer event when call beeing
 redirected

---
 sflphone-common/src/iax/iaxvoiplink.cpp | 31 +++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp
index a997aa4f19..7e50006fce 100644
--- a/sflphone-common/src/iax/iaxvoiplink.cpp
+++ b/sflphone-common/src/iax/iaxvoiplink.cpp
@@ -918,6 +918,37 @@ IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
             break;
 
         case IAX_EVENT_TRANSFER:
+            _debug ("IAX_EVENT_TRANSFER");
+
+            if (call->getConnectionState() != Call::Connected) {
+
+                Manager::instance().addStream (call->getCallId());
+
+                call->setConnectionState (Call::Connected);
+                call->setState (Call::Active);
+                // audiolayer->startStream();
+
+                _debug ("IAX_EVENT_ANSWER: codec format: ");
+
+                if (event->ies.format) {
+                    // Should not get here, should have been set in EVENT_ACCEPT
+                    printf ("%i", event->ies.format);
+                    call->setFormat (event->ies.format);
+                }
+
+                {
+                    printf ("no codec format");
+                }
+
+                Manager::instance().peerAnsweredCall (id);
+
+                // start audio here?
+                audiolayer->startStream();
+                audiolayer->flushMain();
+            } else {
+                // deja connecté ?
+            }
+
             break;
 
         default:
-- 
GitLab