From be2c5779999eb89a9e2dd66f938b7fcf558ef35a Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Fri, 28 Mar 2008 17:27:18 -0400
Subject: [PATCH] IAX2 bug fix: Accept incoming calls

You have to add your IAX2 account in /etc/asterisk/extensions.conf
No more segmentation fault when an incoming call is answered.
---
 src/iaxvoiplink.cpp | 5 +++--
 src/managerimpl.cpp | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp
index af8038886f..f28a33bc41 100644
--- a/src/iaxvoiplink.cpp
+++ b/src/iaxvoiplink.cpp
@@ -257,7 +257,6 @@ IAXVoIPLink::sendAudioFromMic(void)
   }
 
   AudioCodec* ac = currentCall -> getCodecMap().getCodec( currentCall -> getAudioCodec() );
-  _debug("Audiocodec name = %s\n" , ac->getCodecName().c_str());
   if (!ac) {
     // Audio codec still not determined.
     if (audiolayer) {
@@ -666,7 +665,6 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
     if (event->ies.format) {
       call->setFormat(event->ies.format);
     }
-
     break;
     
   case IAX_EVENT_ANSWER:
@@ -697,6 +695,9 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
     break;
     
   case IAX_EVENT_VOICE:
+    //_debug("Should have a decent value!!!!!! = %i\n" , call -> getAudioCodec());
+    if( !audiolayer -> isCaptureActive())
+      audiolayer->startStream();
     iaxHandleVoiceEvent(event, call);
     break;
     
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index cd0b8da0ee..da557b72aa 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -245,7 +245,7 @@ ManagerImpl::answerCall(const CallID& id)
     removeCallAccount(id);
     return false;
   }
-
+  
   //Place current call on hold if it isn't
 
 
-- 
GitLab