diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h
index 25421e6844beca02d6186886493440a7a0b289b0..1dab73ee9ecae28879f4f3631189a20d06f2fa35 100644
--- a/daemon/src/audio/audiolayer.h
+++ b/daemon/src/audio/audiolayer.h
@@ -73,7 +73,7 @@ class AudioLayer
             : _layerType (type)
         	, _isStarted(false)
             , _manager (manager)
-            , _urgentRingBuffer (SIZEBUF, default_id)
+            , _urgentRingBuffer (SIZEBUF, Call::DEFAULT_ID)
             , _mainBuffer(0)
             , _recorder(0)
             , _indexIn (0)
diff --git a/daemon/src/audio/mainbuffer.cpp b/daemon/src/audio/mainbuffer.cpp
index 0c6c281af7606b124b880259e8d0e536c2445abb..4a2c5154576fc41089b4fc5aefb8ffa7361a873e 100644
--- a/daemon/src/audio/mainbuffer.cpp
+++ b/daemon/src/audio/mainbuffer.cpp
@@ -54,18 +54,18 @@ void MainBuffer::setInternalSamplingRate (int sr)
     }
 }
 
-CallIDSet* MainBuffer::getCallIDSet (std::string call_id)
+CallIDSet* MainBuffer::getCallIDSet (const std::string & call_id)
 {
     CallIDMap::iterator iter = _callIDMap.find (call_id);
     return (iter != _callIDMap.end()) ? iter->second : NULL;
 }
 
-void MainBuffer::createCallIDSet (std::string set_id)
+void MainBuffer::createCallIDSet (const std::string & set_id)
 {
     _callIDMap.insert (std::pair<std::string, CallIDSet*> (set_id, new CallIDSet));
 }
 
-bool MainBuffer::removeCallIDSet (std::string set_id)
+bool MainBuffer::removeCallIDSet (const std::string & set_id)
 {
     CallIDSet* callid_set = getCallIDSet (set_id);
 
@@ -83,13 +83,13 @@ bool MainBuffer::removeCallIDSet (std::string set_id)
 	return true;
 }
 
-void MainBuffer::addCallIDtoSet (std::string set_id, std::string call_id)
+void MainBuffer::addCallIDtoSet (const std::string & set_id, const std::string & call_id)
 {
     CallIDSet* callid_set = getCallIDSet (set_id);
     callid_set->insert (call_id);
 }
 
-void MainBuffer::removeCallIDfromSet (std::string set_id, std::string call_id)
+void MainBuffer::removeCallIDfromSet (const std::string & set_id, const std::string & call_id)
 {
     CallIDSet* callid_set = getCallIDSet (set_id);
 
@@ -104,7 +104,7 @@ void MainBuffer::removeCallIDfromSet (std::string set_id, std::string call_id)
 }
 
 
-RingBuffer* MainBuffer::getRingBuffer (std::string call_id)
+RingBuffer* MainBuffer::getRingBuffer (const std::string & call_id)
 {
     RingBufferMap::iterator iter = _ringBufferMap.find (call_id);
 
@@ -116,7 +116,7 @@ RingBuffer* MainBuffer::getRingBuffer (std::string call_id)
 }
 
 
-RingBuffer* MainBuffer::createRingBuffer (std::string call_id)
+RingBuffer* MainBuffer::createRingBuffer (const std::string & call_id)
 {
     RingBuffer* newRingBuffer = new RingBuffer (SIZEBUF, call_id);
     _ringBufferMap.insert (std::pair<std::string, RingBuffer*> (call_id, newRingBuffer));
@@ -124,7 +124,7 @@ RingBuffer* MainBuffer::createRingBuffer (std::string call_id)
 }
 
 
-bool MainBuffer::removeRingBuffer (std::string call_id)
+bool MainBuffer::removeRingBuffer (const std::string & call_id)
 {
     RingBuffer* ring_buffer = getRingBuffer (call_id);
 
@@ -143,7 +143,7 @@ bool MainBuffer::removeRingBuffer (std::string call_id)
 }
 
 
-void MainBuffer::bindCallID (std::string call_id1, std::string call_id2)
+void MainBuffer::bindCallID (const std::string & call_id1, const std::string & call_id2)
 {
     ost::MutexLock guard (_mutex);
 
@@ -172,7 +172,7 @@ void MainBuffer::bindCallID (std::string call_id1, std::string call_id2)
 
 }
 
-void MainBuffer::bindHalfDuplexOut (std::string process_id, std::string call_id)
+void MainBuffer::bindHalfDuplexOut (const std::string & process_id, const std::string & call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -190,7 +190,7 @@ void MainBuffer::bindHalfDuplexOut (std::string process_id, std::string call_id)
 }
 
 
-void MainBuffer::unBindCallID (std::string call_id1, std::string call_id2)
+void MainBuffer::unBindCallID (const std::string & call_id1, const std::string & call_id2)
 {
     ost::MutexLock guard (_mutex);
 
@@ -223,7 +223,7 @@ void MainBuffer::unBindCallID (std::string call_id1, std::string call_id2)
     }
 }
 
-void MainBuffer::unBindHalfDuplexOut (std::string process_id, std::string call_id)
+void MainBuffer::unBindHalfDuplexOut (const std::string & process_id, const std::string & call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -254,7 +254,7 @@ void MainBuffer::unBindHalfDuplexOut (std::string process_id, std::string call_i
 }
 
 
-void MainBuffer::unBindAll (std::string call_id)
+void MainBuffer::unBindAll (const std::string & call_id)
 {
     CallIDSet* callid_set = getCallIDSet (call_id);
 
@@ -278,7 +278,7 @@ void MainBuffer::unBindAll (std::string call_id)
 }
 
 
-void MainBuffer::unBindAllHalfDuplexOut (std::string process_id)
+void MainBuffer::unBindAllHalfDuplexOut (const std::string & process_id)
 {
     CallIDSet* callid_set = getCallIDSet (process_id);
 
@@ -301,7 +301,7 @@ void MainBuffer::unBindAllHalfDuplexOut (std::string process_id)
 }
 
 
-void MainBuffer::putData (void *buffer, int toCopy, std::string call_id)
+void MainBuffer::putData (void *buffer, int toCopy, const std::string & call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -310,7 +310,7 @@ void MainBuffer::putData (void *buffer, int toCopy, std::string call_id)
     	ring_buffer->Put (buffer, toCopy);
 }
 
-int MainBuffer::getData (void *buffer, int toCopy, std::string call_id)
+int MainBuffer::getData (void *buffer, int toCopy, const std::string & call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -355,7 +355,7 @@ int MainBuffer::getData (void *buffer, int toCopy, std::string call_id)
 }
 
 
-int MainBuffer::getDataByID (void *buffer, int toCopy, std::string call_id, std::string reader_id)
+int MainBuffer::getDataByID (void *buffer, int toCopy, const std::string & call_id, const std::string & reader_id)
 {
     RingBuffer* ring_buffer = getRingBuffer (call_id);
 
@@ -367,7 +367,7 @@ int MainBuffer::getDataByID (void *buffer, int toCopy, std::string call_id, std:
 }
 
 
-int MainBuffer::availForGet (std::string call_id)
+int MainBuffer::availForGet (const std::string & call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -383,7 +383,7 @@ int MainBuffer::availForGet (std::string call_id)
     if (callid_set->size() == 1) {
         CallIDSet::iterator iter_id = callid_set->begin();
 
-        if ( (call_id != default_id) && (*iter_id == call_id)) {
+        if ( (call_id != Call::DEFAULT_ID) && (*iter_id == call_id)) {
             _debug ("This problem should not occur since we have %i element", (int) callid_set->size());
         }
 
@@ -410,9 +410,9 @@ int MainBuffer::availForGet (std::string call_id)
 }
 
 
-int MainBuffer::availForGetByID (std::string call_id, std::string reader_id)
+int MainBuffer::availForGetByID (const std::string & call_id, const std::string & reader_id)
 {
-    if ( (call_id != default_id) && (reader_id == call_id)) {
+    if ( (call_id != Call::DEFAULT_ID) && (reader_id == call_id)) {
         _error ("MainBuffer: Error: RingBuffer has a readpointer on tiself");
     }
 
@@ -427,7 +427,7 @@ int MainBuffer::availForGetByID (std::string call_id, std::string reader_id)
 }
 
 
-int MainBuffer::discard (int toDiscard, std::string call_id)
+int MainBuffer::discard (int toDiscard, const std::string & call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -460,7 +460,7 @@ int MainBuffer::discard (int toDiscard, std::string call_id)
 }
 
 
-int MainBuffer::discardByID (int toDiscard, std::string call_id, std::string reader_id)
+int MainBuffer::discardByID (int toDiscard, const std::string & call_id, const std::string & reader_id)
 {
     RingBuffer* ringbuffer = getRingBuffer (call_id);
 
@@ -473,7 +473,7 @@ int MainBuffer::discardByID (int toDiscard, std::string call_id, std::string rea
 
 
 
-void MainBuffer::flush (std::string call_id)
+void MainBuffer::flush (const std::string & call_id)
 {
     ost::MutexLock guard (_mutex);
 
@@ -503,11 +503,11 @@ void MainBuffer::flushDefault()
 {
     ost::MutexLock guard (_mutex);
 
-    flushByID (default_id, default_id);
+    flushByID (Call::DEFAULT_ID, Call::DEFAULT_ID);
 }
 
 
-void MainBuffer::flushByID (std::string call_id, std::string reader_id)
+void MainBuffer::flushByID (const std::string & call_id, const std::string & reader_id)
 {
     RingBuffer* ringbuffer = getRingBuffer (call_id);
 
@@ -528,7 +528,7 @@ void MainBuffer::flushAllBuffers()
     }
 }
 
-void MainBuffer:: syncBuffers (std::string call_id)
+void MainBuffer:: syncBuffers (const std::string & call_id)
 {
     CallIDSet* callid_set = getCallIDSet (call_id);
 
diff --git a/daemon/src/audio/mainbuffer.h b/daemon/src/audio/mainbuffer.h
index 5346d94f34bb8ba17f1d9648e45b6489687c658c..d3fadb845b649ca2a140623186b93d89a197928c 100644
--- a/daemon/src/audio/mainbuffer.h
+++ b/daemon/src/audio/mainbuffer.h
@@ -66,78 +66,78 @@ class MainBuffer
          * Bind together two audio streams so taht a client will be able
          * to put and get data specifying its callid only.
          */
-        void bindCallID (std::string call_id1, std::string call_id2 = default_id);
+        void bindCallID (const std::string & call_id1, const std::string & call_id2 = Call::DEFAULT_ID);
 
         /**
          * Add a new call_id to unidirectional outgoing stream
          * \param call_id New call id to be added for this stream
          * \param process_id Process that require this stream
          */
-        void bindHalfDuplexOut (std::string process_id, std::string call_id = default_id);
+        void bindHalfDuplexOut (const std::string & process_id, const std::string & call_id = Call::DEFAULT_ID);
 
         /**
          * Unbind two calls
          */
-        void unBindCallID (std::string call_id1, std::string call_id2 = default_id);
+        void unBindCallID (const std::string & call_id1, const std::string & call_id2 = Call::DEFAULT_ID);
 
         /**
          * Unbind a unidirectional stream
          */
-        void unBindHalfDuplexOut (std::string process_id, std::string call_id = default_id);
+        void unBindHalfDuplexOut (const std::string & process_id, const std::string & call_id = Call::DEFAULT_ID);
 
-        void unBindAll (std::string call_id);
+        void unBindAll (const std::string & call_id);
 
-        void unBindAllHalfDuplexOut (std::string process_id);
+        void unBindAllHalfDuplexOut (const std::string & process_id);
 
-        void putData (void *buffer, int toCopy, std::string call_id = default_id);
+        void putData (void *buffer, int toCopy, const std::string & call_id = Call::DEFAULT_ID);
 
-        int getData (void *buffer, int toCopy, std::string call_id = default_id);
+        int getData (void *buffer, int toCopy, const std::string & call_id = Call::DEFAULT_ID);
 
-        int availForGet (std::string call_id = default_id);
+        int availForGet (const std::string & call_id = Call::DEFAULT_ID);
 
-        int discard (int toDiscard, std::string call_id = default_id);
+        int discard (int toDiscard, const std::string & call_id = Call::DEFAULT_ID);
 
-        void flush (std::string call_id = default_id);
+        void flush (const std::string & call_id = Call::DEFAULT_ID);
 
         void flushAllBuffers();
 
         void flushDefault();
 
-        void syncBuffers (std::string call_id);
+        void syncBuffers (const std::string & call_id);
 
         void stateInfo();
 
     private:
 
-        CallIDSet* getCallIDSet (std::string call_id);
+        CallIDSet* getCallIDSet (const std::string & call_id);
 
-        void createCallIDSet (std::string set_id);
+        void createCallIDSet (const std::string & set_id);
 
-        bool removeCallIDSet (std::string set_id);
+        bool removeCallIDSet (const std::string & set_id);
 
         /**
          * Add a new call id to this set
          */
-        void addCallIDtoSet (std::string set_id, std::string call_id);
+        void addCallIDtoSet (const std::string & set_id, const std::string & call_id);
 
-        void removeCallIDfromSet (std::string set_id, std::string call_id);
+        void removeCallIDfromSet (const std::string & set_id, const std::string & call_id);
 
         /**
          * Create a new ringbuffer with default readpointer
          */
-        RingBuffer* createRingBuffer (std::string call_id);
+        RingBuffer* createRingBuffer (const std::string & call_id);
 
-        bool removeRingBuffer (std::string call_id);
+        bool removeRingBuffer (const std::string & call_id);
 
-        RingBuffer* getRingBuffer (std::string call_id);
+        RingBuffer* getRingBuffer (const std::string & call_id);
 
-        int getDataByID (void *buffer, int toCopy, std::string call_id, std::string reader_id);
+        int getDataByID (void *buffer, int toCopy, const std::string & call_id, const std::string & reader_id);
 
-        int availForGetByID (std::string call_id, std::string reader_id);
+        int availForGetByID (const std::string & call_id, const std::string & reader_id);
 
-        int discardByID (int toDiscard, std::string call_id, std::string reader_id);
+        int discardByID (int toDiscard, const std::string & call_id, const std::string & reader_id);
 
-        void flushByID (std::string call_id, std::string reader_id);
+        void flushByID (const std::string & call_id, const std::string & reader_id);
 
         RingBufferMap _ringBufferMap;
 
diff --git a/daemon/src/audio/ringbuffer.cpp b/daemon/src/audio/ringbuffer.cpp
index 2304b29709a76e8a647317273022403e014c4996..31232c109ab0e657d46290b2aa8a864d2334dac7 100644
--- a/daemon/src/audio/ringbuffer.cpp
+++ b/daemon/src/audio/ringbuffer.cpp
@@ -46,7 +46,7 @@
 int RingBuffer::count_rb = 0;
 
 // Create  a ring buffer with 'size' bytes
-RingBuffer::RingBuffer (int size, std::string call_id) : mEnd (0)
+RingBuffer::RingBuffer (int size, const std::string &call_id) : mEnd (0)
     , mBufferSize (size > MIN_BUFFER_SIZE ? size : MIN_BUFFER_SIZE)
     , mBuffer (NULL)
     , buffer_id (call_id)
@@ -65,7 +65,7 @@ RingBuffer::~RingBuffer()
 }
 
 void
-RingBuffer::flush (std::string call_id)
+RingBuffer::flush (const std::string &call_id)
 {
 
     storeReadPointer (mEnd, call_id);
@@ -95,7 +95,7 @@ RingBuffer::putLen()
 }
 
 int
-RingBuffer::getLen (std::string call_id)
+RingBuffer::getLen (const std::string &call_id)
 {
     return (mEnd + mBufferSize - getReadPointer (call_id)) % mBufferSize;
 }
@@ -107,7 +107,7 @@ RingBuffer::debug()
 }
 
 int
-RingBuffer::getReadPointer (std::string call_id)
+RingBuffer::getReadPointer (const std::string &call_id)
 {
     if (getNbReadPointer() == 0)
         return 0;
@@ -133,7 +133,7 @@ RingBuffer::getSmallestReadPointer()
 }
 
 void
-RingBuffer::storeReadPointer (int pointer_value, std::string call_id)
+RingBuffer::storeReadPointer (int pointer_value, const std::string &call_id)
 {
     ReadPointer::iterator iter = _readpointer.find (call_id);
 
@@ -146,7 +146,7 @@ RingBuffer::storeReadPointer (int pointer_value, std::string call_id)
 
 
 void
-RingBuffer::createReadPointer (std::string call_id)
+RingBuffer::createReadPointer (const std::string &call_id)
 {
     if (!hasThisReadPointer (call_id))
         _readpointer.insert (std::pair<std::string, int> (call_id, mEnd));
@@ -154,7 +154,7 @@ RingBuffer::createReadPointer (std::string call_id)
 
 
 void
-RingBuffer::removeReadPointer (std::string call_id)
+RingBuffer::removeReadPointer (const std::string &call_id)
 {
     ReadPointer::iterator iter = _readpointer.find (call_id);
     if (iter != _readpointer.end())
@@ -163,7 +163,7 @@ RingBuffer::removeReadPointer (std::string call_id)
 
 
 bool
-RingBuffer::hasThisReadPointer (std::string call_id)
+RingBuffer::hasThisReadPointer (const std::string &call_id)
 {
     return _readpointer.find (call_id) != _readpointer.end();
 }
@@ -210,7 +210,7 @@ RingBuffer::Put (void* buffer, int toCopy)
 //
 
 int
-RingBuffer::AvailForGet (std::string call_id)
+RingBuffer::AvailForGet (const std::string &call_id)
 {
     // Used space
 
@@ -219,7 +219,7 @@ RingBuffer::AvailForGet (std::string call_id)
 
 // Get will move 'toCopy' bytes from the internal FIFO to 'buffer'
 int
-RingBuffer::Get (void *buffer, int toCopy, std::string call_id)
+RingBuffer::Get (void *buffer, int toCopy, const std::string &call_id)
 {
     if (getNbReadPointer() == 0)
         return 0;
@@ -252,7 +252,7 @@ RingBuffer::Get (void *buffer, int toCopy, std::string call_id)
 
 // Used to discard some bytes.
 int
-RingBuffer::Discard (int toDiscard, std::string call_id)
+RingBuffer::Discard (int toDiscard, const std::string &call_id)
 {
 
     int len = getLen (call_id);
diff --git a/daemon/src/audio/ringbuffer.h b/daemon/src/audio/ringbuffer.h
index 4fbb34aa2e0f87f9ea7576574b416f9c6d0239d4..804edf2d475d2388ff1fe8df0b9851f564635fb8 100644
--- a/daemon/src/audio/ringbuffer.h
+++ b/daemon/src/audio/ringbuffer.h
@@ -1,170 +1,167 @@
-/*
- *  Copyright (C) 2007 Savoir-Faire Linux inc.
- *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
- *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
- *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __RING_BUFFER__
-#define __RING_BUFFER__
-
-#include "../call.h"
-
-#include <fstream>
-
-typedef std::map<std::string, int> ReadPointer;
-
-static std::string default_id = "audiolayer_id";
-
-class RingBuffer
-{
-    public:
-        /**
-         * Constructor
-         * @param size  Size of the buffer to create
-         */
-        RingBuffer (int size, std::string call_id = default_id);
-
-        /**
-         * Destructor
-         */
-        ~RingBuffer();
-
-        std::string getBufferId() {
-            return buffer_id;
-        }
-
-        /**
-         * Reset the counters to 0 for this read pointer
-         */
-        void flush (std::string call_id = default_id);
-
-        void flushAll();
-
-        /**
-         * Get read pointer coresponding to this call
-         */
-        int getReadPointer (std::string call_id = default_id);
-
-        /**
-         * Get the whole readpointer list for this ringbuffer
-         */
-        ReadPointer* getReadPointerList() {
-            return &_readpointer;
-        }
-
-        /**
-         * Return the smalest readpointer. Usefull to evaluate if ringbuffer is full
-         */
-        int getSmallestReadPointer();
-
-        /**
-         * Move readpointer forward by pointer_value
-         */
-        void storeReadPointer (int pointer_value, std::string call_id = default_id);
-
-        /**
-         * Add a new readpointer for this ringbuffer
-         */
-        void createReadPointer (std::string call_id = default_id);
-
-        /**
-         * Remove a readpointer for this ringbuffer
-         */
-        void removeReadPointer (std::string call_id = default_id);
-
-        /**
-         * Test if readpointer coresponding to this call is still active
-         */
-        bool hasThisReadPointer (std::string call_id);
-
-        int getNbReadPointer();
-
-        /**
-         * Write data in the ring buffer
-         * @param buffer Data to copied
-         * @param toCopy Number of bytes to copy
-         */
-        void Put (void* buffer, int toCopy);
-
-        /**
-         * To get how much space is available in the buffer to read in
-         * @return int The available size
-         */
-        int AvailForGet (std::string call_id = default_id);
-
-        /**
-         * Get data in the ring buffer
-         * @param buffer Data to copied
-         * @param toCopy Number of bytes to copy
-         * @return int Number of bytes copied
-         */
-        int Get (void* buffer, int toCopy, std::string call_id = default_id);
-
-        /**
-         * Discard data from the buffer
-         * @param toDiscard Number of bytes to discard
-         * @return int Number of bytes discarded
-         */
-        int Discard (int toDiscard, std::string call_id = default_id);
-
-        /**
-         * Total length of the ring buffer
-         * @return int
-         */
-        int putLen();
-
-        int getLen (std::string call_id = default_id);
-
-        /**
-         * Debug function print mEnd, mStart, mBufferSize
-         */
-        void debug();
-
-    private:
-        // Copy Constructor
-        RingBuffer (const RingBuffer& rh);
-
-        // Assignment operator
-        RingBuffer& operator= (const RingBuffer& rh);
-
-        /** Pointer on the first data */
-        // int           mStart;
-        /** Pointer on the last data */
-        int           mEnd;
-        /** Buffer size */
-        int           mBufferSize;
-        /** Data */
-        unsigned char *mBuffer;
-
-        ReadPointer   _readpointer;
-
-        std::string buffer_id;
-
-    public:
-
-        friend class MainBufferTest;
-
-        std::fstream *buffer_input_rec;
-        std::fstream *buffer_output_rec;
-
-        static int count_rb;
-
-};
-
-
-#endif /*  __RING_BUFFER__ */
+/*
+ *  Copyright (C) 2007 Savoir-Faire Linux inc.
+ *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
+ *  Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
+ *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __RING_BUFFER__
+#define __RING_BUFFER__
+
+#include "../call.h"
+
+#include <fstream>
+
+typedef std::map<std::string, int> ReadPointer;
+
+class RingBuffer
+{
+    public:
+        /**
+         * Constructor
+         * @param size  Size of the buffer to create
+         */
+        RingBuffer (int size, const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Destructor
+         */
+        ~RingBuffer();
+
+        std::string getBufferId() {
+            return buffer_id;
+        }
+
+        /**
+         * Reset the counters to 0 for this read pointer
+         */
+        void flush (const std::string &call_id = Call::DEFAULT_ID);
+
+        void flushAll();
+
+        /**
+         * Get read pointer coresponding to this call
+         */
+        int getReadPointer (const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Get the whole readpointer list for this ringbuffer
+         */
+        ReadPointer* getReadPointerList() {
+            return &_readpointer;
+        }
+
+        /**
+         * Return the smalest readpointer. Usefull to evaluate if ringbuffer is full
+         */
+        int getSmallestReadPointer();
+
+        /**
+         * Move readpointer forward by pointer_value
+         */
+        void storeReadPointer (int pointer_value, const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Add a new readpointer for this ringbuffer
+         */
+        void createReadPointer (const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Remove a readpointer for this ringbuffer
+         */
+        void removeReadPointer (const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Test if readpointer coresponding to this call is still active
+         */
+        bool hasThisReadPointer (const std::string &call_id);
+
+        int getNbReadPointer();
+
+        /**
+         * Write data in the ring buffer
+         * @param buffer Data to copied
+         * @param toCopy Number of bytes to copy
+         */
+        void Put (void* buffer, int toCopy);
+
+        /**
+         * To get how much space is available in the buffer to read in
+         * @return int The available size
+         */
+        int AvailForGet (const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Get data in the ring buffer
+         * @param buffer Data to copied
+         * @param toCopy Number of bytes to copy
+         * @return int Number of bytes copied
+         */
+        int Get (void* buffer, int toCopy, const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Discard data from the buffer
+         * @param toDiscard Number of bytes to discard
+         * @return int Number of bytes discarded
+         */
+        int Discard (int toDiscard, const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Total length of the ring buffer
+         * @return int
+         */
+        int putLen();
+
+        int getLen (const std::string &call_id = Call::DEFAULT_ID);
+
+        /**
+         * Debug function print mEnd, mStart, mBufferSize
+         */
+        void debug();
+
+    private:
+        // Copy Constructor
+        RingBuffer (const RingBuffer& rh);
+
+        // Assignment operator
+        RingBuffer& operator= (const RingBuffer& rh);
+
+        /** Pointer on the first data */
+        // int           mStart;
+        /** Pointer on the last data */
+        int           mEnd;
+        /** Buffer size */
+        int           mBufferSize;
+        /** Data */
+        unsigned char *mBuffer;
+
+        ReadPointer   _readpointer;
+
+        std::string buffer_id;
+
+    public:
+
+        friend class MainBufferTest;
+
+        std::fstream *buffer_input_rec;
+        std::fstream *buffer_output_rec;
+
+        static int count_rb;
+};
+
+
+#endif /*  __RING_BUFFER__ */
diff --git a/daemon/src/call.cpp b/daemon/src/call.cpp
index 6ce1b91cd02edf2618d5cd82a5e30e2aea5bffd0..3540654e8632ee68e393b6756f2540553b1f9e60 100644
--- a/daemon/src/call.cpp
+++ b/daemon/src/call.cpp
@@ -32,6 +32,8 @@
 #include "manager.h"
 #include "audio/mainbuffer.h"
 
+const char * const Call::DEFAULT_ID = "audiolayer_id";
+
 Call::Call (const std::string& id, Call::CallType type)
     : _callMutex()
     , _localIPAddress ("")
diff --git a/daemon/src/call.h b/daemon/src/call.h
index d05daef07ff9b5a83b03597ec4a4137b9f063485..8f46d33c6b97ee6915cb121ff24e821a8cdf084e 100644
--- a/daemon/src/call.h
+++ b/daemon/src/call.h
@@ -50,6 +50,7 @@
 class Call: public Recordable
 {
     public:
+        static const char * const DEFAULT_ID;
 
         /**
          * This determines if the call is a direct IP-to-IP call or a classic call, made with an existing account
diff --git a/daemon/src/conference.cpp b/daemon/src/conference.cpp
index e0c9a726256421114cd9eec2ef7c1b7891e5423b..ef5de3b89ff37bc326127bda8a9b9857927c8bbd 100644
--- a/daemon/src/conference.cpp
+++ b/daemon/src/conference.cpp
@@ -36,18 +36,11 @@
 #include "audio/audiolayer.h"
 #include "audio/mainbuffer.h"
 
-int Conference::count = 0;
-
 Conference::Conference() : _id (""), _confState (ACTIVE_ATTACHED), _nbParticipant (0)
 {
-    _nbParticipant = 0;
-
-    ++count;
-    _nbParticipant = 0;
     _id = Manager::instance().getNewCallID();
 
     Recordable::initRecFileName (_id);
-
 }
 
 
diff --git a/daemon/src/conference.h b/daemon/src/conference.h
index 7ba94ba76f45e372e361fafd34fb7f5851abed81..b6126133b5b271072337d6a3b25f36d56e964737 100644
--- a/daemon/src/conference.h
+++ b/daemon/src/conference.h
@@ -48,8 +48,6 @@ class Conference: public Recordable
 
         enum ConferenceState {ACTIVE_ATTACHED, ACTIVE_DETACHED, ACTIVE_ATTACHED_REC, ACTIVE_DETACHED_REC, HOLD, HOLD_REC};
 
-        static int count;
-
         /**
          * Constructor for this class, increment static counter
          */
@@ -145,6 +143,4 @@ class Conference: public Recordable
 
 };
 
-// Conference::count = 0;
-
 #endif
diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index adecb4a105b913b1b3cbe1e648a99fea56b20b06..4bd5b08f1cc9389ce9dfac1cd4bdcf2a1c53225e 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -248,7 +248,7 @@ bool ManagerImpl::outgoingCall (const std::string& account_id,
         if (!isConference (current_call_id) && !participToConference (current_call_id))
        	    onHoldCall (current_call_id);
         else if (isConference (current_call_id) && !participToConference (call_id))
-            detachParticipant (default_id, current_call_id);
+            detachParticipant (Call::DEFAULT_ID, current_call_id);
     }
 
     if (callConfig == Call::IPtoIP) {
@@ -325,7 +325,7 @@ bool ManagerImpl::answerCall (const std::string& call_id)
         } else if (isConference (current_call_id) && !participToConference (call_id)) {
             // if we are talking to a conference and we are answering an incoming call
             _debug ("Manager: Detach main participant from conference");
-            detachParticipant (default_id, current_call_id);
+            detachParticipant (Call::DEFAULT_ID, current_call_id);
         }
     }
 
@@ -585,7 +585,7 @@ bool ManagerImpl::offHoldCall (const std::string& callId)
         	_debug ("Manager: Has current call (%s), put on hold", currentCallId.c_str());
             onHoldCall (currentCallId);
         } else if (isConference (currentCallId) && !participToConference (callId))
-            detachParticipant (default_id, currentCallId);
+            detachParticipant (Call::DEFAULT_ID, currentCallId);
     }
 
     /* Direct IP to IP call */
@@ -800,7 +800,7 @@ void ManagerImpl::removeConference (const std::string& conference_id)
     // We now need to bind the audio to the remain participant
 
     // Unbind main participant audio from conference
-    getMainBuffer()->unBindAll (default_id);
+    getMainBuffer()->unBindAll (Call::DEFAULT_ID);
 
     ParticipantSet participants = conf->getParticipantList();
 
@@ -808,7 +808,7 @@ void ManagerImpl::removeConference (const std::string& conference_id)
     ParticipantSet::iterator iter_p = participants.begin();
 
     if (iter_p != participants.end())
-        getMainBuffer()->bindCallID (*iter_p, default_id);
+        getMainBuffer()->bindCallID (*iter_p, Call::DEFAULT_ID);
 
     // Then remove the conference from the conference map
     if (_conferencemap.erase (conference_id) == 1)
@@ -973,7 +973,7 @@ void ManagerImpl::addParticipant (const std::string& callId, const std::string&
     // detach from prior communication and switch to this conference
     if (current_call_id != callId) {
         if (isConference (current_call_id)) {
-            detachParticipant (default_id, current_call_id);
+            detachParticipant (Call::DEFAULT_ID, current_call_id);
         } else {
             onHoldCall (current_call_id);
         }
@@ -1021,7 +1021,7 @@ void ManagerImpl::addParticipant (const std::string& callId, const std::string&
     	iter_p++;
     }
 
-    getMainBuffer()->flush (default_id);
+    getMainBuffer()->flush (Call::DEFAULT_ID);
 
     // Connect stream
     addStream(callId);
@@ -1033,7 +1033,7 @@ void ManagerImpl::addMainParticipant (const std::string& conference_id)
         std::string current_call_id = getCurrentCallId();
 
         if (isConference (current_call_id)) {
-            detachParticipant (default_id, current_call_id);
+            detachParticipant (Call::DEFAULT_ID, current_call_id);
         } else {
             onHoldCall (current_call_id);
         }
@@ -1055,7 +1055,7 @@ void ManagerImpl::addMainParticipant (const std::string& conference_id)
         ParticipantSet::iterator iter_participant = participants.begin();
 
         while (iter_participant != participants.end()) {
-            getMainBuffer()->bindCallID (*iter_participant, default_id);
+            getMainBuffer()->bindCallID (*iter_participant, Call::DEFAULT_ID);
             iter_participant++;
         }
 
@@ -1067,7 +1067,7 @@ void ManagerImpl::addMainParticipant (const std::string& conference_id)
             iter_participant++;
         }
 
-        getMainBuffer()->flush (default_id);
+        getMainBuffer()->flush (Call::DEFAULT_ID);
 
         if(conf->getState() == Conference::ACTIVE_DETACHED) {
             conf->setState (Conference::ACTIVE_ATTACHED);
@@ -1104,7 +1104,7 @@ void ManagerImpl::joinParticipant (const std::string& callId1, const std::string
 
         if (isConference (current_call_id)) {
         	// If currently in a conference
-            detachParticipant (default_id, current_call_id);
+            detachParticipant (Call::DEFAULT_ID, current_call_id);
         }
         else {
             // If currently in a call
@@ -1258,7 +1258,7 @@ void ManagerImpl::detachParticipant (const std::string& call_id,
 
     std::string current_call_id = getCurrentCallId();
 
-    if (call_id != default_id) {
+    if (call_id != Call::DEFAULT_ID) {
 
         std::string currentAccountId = getAccountFromCall (call_id);
         Call *call = getAccountLink (currentAccountId)->getCall (call_id);
@@ -1296,7 +1296,7 @@ void ManagerImpl::detachParticipant (const std::string& call_id,
     } else {
 
         _debug ("Manager: Unbind main participant from conference %d");
-        getMainBuffer()->unBindAll (default_id);
+        getMainBuffer()->unBindAll (Call::DEFAULT_ID);
 
         if(!isConference(current_call_id)) {
         	_error("Manager: Warning: Current call id (%s) is not a conference", current_call_id.c_str());
@@ -1381,7 +1381,7 @@ void ManagerImpl::processRemainingParticipant (std::string current_call_id, Conf
             iter_participant++;
         }
 
-        getMainBuffer()->flush (default_id);
+        getMainBuffer()->flush (Call::DEFAULT_ID);
 
     } else if (conf->getNbParticipants() == 1) {
 
@@ -1501,7 +1501,7 @@ void ManagerImpl::addStream (const std::string& call_id)
                 iter_p++;
             }
 
-            getMainBuffer()->flush (default_id);
+            getMainBuffer()->flush (Call::DEFAULT_ID);
         }
 
     } else {