From 90de0c0eccf76e9da23eadfe6364d640d252d66a Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.net>
Date: Tue, 22 Sep 2009 15:17:38 -0400
Subject: [PATCH] [#2176] Fix getAudioCodecName in IAXvoipLink

---
 sflphone-common/src/iax/iaxvoiplink.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp
index 373bf29a99..934ea17de5 100644
--- a/sflphone-common/src/iax/iaxvoiplink.cpp
+++ b/sflphone-common/src/iax/iaxvoiplink.cpp
@@ -630,11 +630,19 @@ IAXVoIPLink::carryingDTMFdigits (const CallID& id, char code)
 std::string
 IAXVoIPLink::getCurrentCodecName()
 {
-    IAXCall *call = getIAXCall (Manager::instance().getCurrentCallId());
+    IAXCall *call = NULL;
+    AudioCodec *ac = NULL;
+    std::string name = "";
 
-    AudioCodec *ac = call->getCodecMap().getCodec (call->getAudioCodec());
+    call = getIAXCall (Manager::instance().getCurrentCallId());
 
-    return ac->getCodecName();
+    if(call)
+	ac = call->getCodecMap().getCodec (call->getAudioCodec());
+
+    if(ac)
+	name = ac->getCodecName();
+    
+    return name;
 }
 
 
-- 
GitLab