diff --git a/sflphone-common/src/sip/Pattern.cpp b/sflphone-common/src/sip/Pattern.cpp
index cc62a6871e74db2f49c57a31f5d296227faa9c0f..2e7619fd76eb11bab22b1c0b85d80615714249b0 100644
--- a/sflphone-common/src/sip/Pattern.cpp
+++ b/sflphone-common/src/sip/Pattern.cpp
@@ -31,6 +31,8 @@ Pattern::Pattern (const std::string& pattern, const std::string& options) :
         _count (0),
         _options (0)
 {
+
+    printf("Pattern constructor called for %s!\n", pattern.c_str());
     // Set offsets
     _offset[0] = _offset[1] = 0;
 
@@ -137,6 +139,8 @@ std::string Pattern::group (int groupNumber)
 {
     const char * stringPtr;
 
+    printf("_subject.substr : %s\n", _subject.substr (_offset[0]).c_str());
+
     int rc = pcre_get_substring (
                  _subject.substr (_offset[0]).c_str(),
                  _ovector,
@@ -169,6 +173,10 @@ std::string Pattern::group (const std::string& groupName)
 {
     const char * stringPtr = NULL;
 
+    printf("Pattern::group %s\n", groupName.c_str());
+    printf("_subject.substr : %s\n", _subject.substr (_offset[0]).c_str());
+    printf("_count : %i\n", _count);
+
     int rc = pcre_get_named_substring (
                  _re,
                  _subject.substr (_offset[0]).c_str(),
@@ -177,10 +185,13 @@ std::string Pattern::group (const std::string& groupName)
                  groupName.c_str(),
                  &stringPtr);
 
+    printf("stringPtr : %s\n", stringPtr);
+    
     if (rc < 0) {
         switch (rc) {
 
             case PCRE_ERROR_NOSUBSTRING:
+	        printf("Pattern::PCRE_ERROR_NOSUBSTRING\n");
                 throw std::out_of_range ("Invalid group reference.");
 
             case PCRE_ERROR_NOMEMORY:
@@ -245,8 +256,9 @@ bool Pattern::matches (void) throw (match_error)
 
 bool Pattern::matches (const std::string& subject) throw (match_error)
 {
-    //printf("Current offset: %d, old offset: %d", _offset[1], _offset[0]);
-    //printf("Trying <start>%s<end>", subject.substr(_offset[1]).c_str());
+    printf("Pattern::matches\n");
+    printf("  Current offset: %d, old offset: %d", _offset[1], _offset[0]);
+    printf("  Trying <start>%s<end>\n", subject.substr(_offset[1]).c_str());
 
     // Try to find a match for this pattern
     int rc = pcre_exec (
@@ -263,7 +275,7 @@ bool Pattern::matches (const std::string& subject) throw (match_error)
 
     if (rc < 0) {
         _offset[0] = _offset[1] = 0;
-        //printf("Matching failed with %d", rc);
+        printf("  Matching failed with %d\n", rc);
         return false;
     }
 
@@ -274,7 +286,7 @@ bool Pattern::matches (const std::string& subject) throw (match_error)
         _offset[1] =  _ovector[1] + _offset[0];
     }
 
-    //printf("Matching succeeded with %d to %d", (int) start(), (int) end());
+    printf("  Matching succeeded with %d to %d\n", (int) start(), (int) end());
 
     // Matching succeded but not enough space.
     if (rc == 0) {
@@ -284,7 +296,8 @@ bool Pattern::matches (const std::string& subject) throw (match_error)
 
     // Matching succeeded. Keep the number of substrings for
     // subsequent calls to group().
-    _count = rc;
+    printf("_count: %i = %i\n", _count, rc);
+      _count = rc;
 
     return true;
 }
@@ -300,6 +313,8 @@ std::vector<std::string> Pattern::split (void)
         tokenStart = start();
         substringSplitted.push_back (_subject.substr (tokenEnd + 1,
                                      tokenStart - tokenEnd - 1));
+	printf("split: %s\n", _subject.substr (tokenEnd + 1,
+						 tokenStart - tokenEnd - 1).c_str());
         tokenEnd = end();
     }
 
diff --git a/sflphone-common/src/sip/SdesNegotiator.cpp b/sflphone-common/src/sip/SdesNegotiator.cpp
index f0b837a453684149ae8efbc1ff07494d5e7cae1d..8e9593783274c2361fffec2c65ccbb59813da00c 100644
--- a/sflphone-common/src/sip/SdesNegotiator.cpp
+++ b/sflphone-common/src/sip/SdesNegotiator.cpp
@@ -20,6 +20,7 @@
 
 #include "Pattern.h"
 
+#include <cstdio>
 #include <iostream>
 #include <sstream>
 #include <algorithm>
@@ -101,10 +102,11 @@ void SdesNegotiator::parse (void)
 
         // Split the line into its component
         // that we will analyze further down.
-
+	std::vector<std::string> sdesLine;
+	
         *generalSyntaxPattern << (*iter);
-        std::vector<std::string> sdesLine;
-
+        
+	
         try {
             sdesLine = generalSyntaxPattern->split();
 
@@ -114,11 +116,14 @@ void SdesNegotiator::parse (void)
         } catch (match_error& exception) {
             throw parse_error ("Error while analyzing the SDES line.");
         }
+	
 
         // Check if the attribute starts with a=crypto
         // and get the tag for this line
         *tagPattern << sdesLine.at (0);
 
+	printf("sdesLine.at (0).c_str() : %s\n", sdesLine.at (0).c_str());
+
         try {
             std::string tag = tagPattern->group ("tag");
             std::cout << "tag = " << tag << std::endl;
diff --git a/sflphone-common/test/sdesnegotiatorTest.cpp b/sflphone-common/test/sdesnegotiatorTest.cpp
index cf2158064980eb43e1259c2091c2a6ad30ed3571..749ef1b0a6b6c643834085d3eceacd41f1a18615 100644
--- a/sflphone-common/test/sdesnegotiatorTest.cpp
+++ b/sflphone-common/test/sdesnegotiatorTest.cpp
@@ -41,6 +41,19 @@ using std::endl;
 void SdesNegotiatorTest::setUp()
 {
 
+    // std::string attr("1 AES_CM_128_HMAC_SHA1_32 srtp inline:16/14/AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwd/2^20/1:32");
+
+    std::string attr("a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj|2^20|1:32");
+
+    remoteOffer = new std::vector<std::string>();
+    remoteOffer->push_back(attr);
+
+    localCapabilities = new std::vector<sfl::CryptoSuiteDefinition>();
+    for(int i = 0; i < 3; i++) {
+        localCapabilities->push_back(sfl::CryptoSuites[i]);
+    }
+
+    sdesnego = new sfl::SdesNegotiator(*localCapabilities, *remoteOffer);
 
 }
 
@@ -48,12 +61,20 @@ void SdesNegotiatorTest::setUp()
 void SdesNegotiatorTest::tearDown()
 {
 
+    delete remoteOffer;
+    remoteOffer = NULL;
+
+    delete localCapabilities;
+    localCapabilities = NULL;
+
+    delete sdesnego;
+    sdesnego = NULL;
+
 }
 
 void SdesNegotiatorTest::testNegotiation()
 {
-
-
+    CPPUNIT_ASSERT(sdesnego->negotiate());
 }
 
 
diff --git a/sflphone-common/test/sdesnegotiatorTest.h b/sflphone-common/test/sdesnegotiatorTest.h
index 16c2dfb7f8ab8d45a5a3876facd8454771950f1c..119ba9a2c7076d1b1063f0afda35ca2be3ad79e0 100644
--- a/sflphone-common/test/sdesnegotiatorTest.h
+++ b/sflphone-common/test/sdesnegotiatorTest.h
@@ -29,6 +29,7 @@
 #include <sstream>
 #include <ccrtp/rtp.h>
 
+#include <vector>
 
 // pjsip import
 #include <pjsip.h>
@@ -84,6 +85,12 @@ class SdesNegotiatorTest : public CppUnit::TestCase {
 
     private:
 
+	sfl::SdesNegotiator *sdesnego;
+
+	std::vector<std::string> *remoteOffer;
+
+	std::vector<sfl::CryptoSuiteDefinition> *localCapabilities;
+
 };
 
 /* Register our test module */