diff --git a/sflphone-common/libs/pjproject/build.mak.in b/sflphone-common/libs/pjproject/build.mak.in
index 06edb2d565ab6b91f6654639788b0aa91e153629..d9e9e09cbf6abf2b40e52bc06e999fc0cc92e1f8 100644
--- a/sflphone-common/libs/pjproject/build.mak.in
+++ b/sflphone-common/libs/pjproject/build.mak.in
@@ -10,8 +10,8 @@ export LINUX_POLL := @ac_linux_poll@
 LIB_SUFFIX = $(TARGET_NAME).a
 
 # Determine which party libraries to use
-export APP_THIRD_PARTY_LIBS := -lresample-$(TARGET_NAME) -lmilenage-$(TARGET_NAME) -lsrtp-$(TARGET_NAME)
-export APP_THIRD_PARTY_LIB_FILES = $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libmilenage-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
+export APP_THIRD_PARTY_LIBS := -lresample-$(TARGET_NAME) -lsrtp-$(TARGET_NAME)
+export APP_THIRD_PARTY_LIB_FILES = $(PJ_DIR)/third_party/lib/libresample-$(LIB_SUFFIX) $(PJ_DIR)/third_party/lib/libsrtp-$(LIB_SUFFIX)
 
 ifneq (@ac_no_gsm_codec@,1)
 APP_THIRD_PARTY_LIBS += -lgsmcodec-$(TARGET_NAME)
diff --git a/sflphone-common/libs/pjproject/pjlib-util/bin/pjlib-util-test-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjlib-util/bin/pjlib-util-test-x86_64-unknown-linux-gnu
deleted file mode 100755
index e18117993cacb50a354a618f6a0fe067e76d95e8..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjlib-util/bin/pjlib-util-test-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/pjlib/bin/pjlib-test-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjlib/bin/pjlib-test-x86_64-unknown-linux-gnu
deleted file mode 100755
index 59898ef0d1d5335498d5f17aa58a52b6752def35..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjlib/bin/pjlib-test-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/pjmedia/bin/pjmedia-test-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjmedia/bin/pjmedia-test-x86_64-unknown-linux-gnu
deleted file mode 100755
index 8d52e7a1352ac0a2038df830bd52f4e3bdf78725..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjmedia/bin/pjmedia-test-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/pjmedia/build/os-auto.mak b/sflphone-common/libs/pjproject/pjmedia/build/os-auto.mak
deleted file mode 100644
index 6fefec36530d0fa87bf1a1c5a03bbd835508ff24..0000000000000000000000000000000000000000
--- a/sflphone-common/libs/pjproject/pjmedia/build/os-auto.mak
+++ /dev/null
@@ -1,115 +0,0 @@
-# pjmedia/build/os-auto.mak.  Generated from os-auto.mak.in by configure.
-
-# PJMEDIA features exclusion
-export CFLAGS +=   
-
-# Define the desired sound device backend
-# Valid values are:
-#   - pa_unix:	    	PortAudio on Unix (OSS or ALSA)
-#   - pa_darwinos:  	PortAudio on MacOSX (CoreAudio)
-#   - pa_old_darwinos:  PortAudio on MacOSX (old CoreAudio, for OSX 10.2)
-#   - pa_win32:	    	PortAudio on Win32 (WMME)
-#   - ds:	    	Win32 DirectSound (dsound.c)
-#   - null:	    	Null sound device (nullsound.c)
-#   - external:		Link with no sounddev (app will provide)
-AC_PJMEDIA_SND=pa_unix
-
-# For Unix, specify if ALSA should be supported
-AC_PA_USE_ALSA=1
-
-# Additional PortAudio CFLAGS are in  -DHAVE_SYS_SOUNDCARD_H -DHAVE_LINUX_SOUNDCARD_H -DPA_LITTLE_ENDIAN
-
-#
-# Codecs
-#
-AC_NO_G711_CODEC=
-AC_NO_L16_CODEC=
-AC_NO_GSM_CODEC=
-AC_NO_SPEEX_CODEC=
-AC_NO_ILBC_CODEC=
-AC_NO_G722_CODEC=
-AC_NO_G7221_CODEC=
-
-export CODEC_OBJS=
-
-ifeq ($(AC_NO_G711_CODEC),1)
-export CFLAGS += -DPJMEDIA_HAS_G711_CODEC=0
-else
-export CODEC_OBJS +=
-endif
-
-ifeq ($(AC_NO_L16_CODEC),1)
-export CFLAGS += -DPJMEDIA_HAS_L16_CODEC=0
-else
-export CODEC_OBJS += l16.o
-endif
-
-ifeq ($(AC_NO_GSM_CODEC),1)
-export CFLAGS += -DPJMEDIA_HAS_GSM_CODEC=0
-else
-export CODEC_OBJS += gsm.o
-endif
-
-ifeq ($(AC_NO_SPEEX_CODEC),1)
-export CFLAGS += -DPJMEDIA_HAS_SPEEX_CODEC=0
-else
-export CFLAGS += -I$(THIRD_PARTY)/build/speex -I$(THIRD_PARTY)/speex/include
-export CODEC_OBJS += speex_codec.o
-
-ifneq (,1)
-export PJMEDIA_OBJS += echo_speex.o
-endif
-
-endif
-
-ifeq ($(AC_NO_ILBC_CODEC),1)
-export CFLAGS += -DPJMEDIA_HAS_ILBC_CODEC=0
-else
-export CODEC_OBJS += ilbc.o
-endif
-
-ifeq ($(AC_NO_G722_CODEC),1)
-export CFLAGS += -DPJMEDIA_HAS_G722_CODEC=0
-else
-export CODEC_OBJS += g722.o g722/g722_enc.o g722/g722_dec.o
-endif
-
-ifeq ($(AC_NO_G7221_CODEC),1)
-export CFLAGS += -DPJMEDIA_HAS_G7221_CODEC=0
-else
-export CODEC_OBJS += g7221.o
-export G7221_CFLAGS += -I$(THIRD_PARTY)
-endif
-
-
-#
-# PortAudio
-#
-ifneq ($(findstring pa,$(AC_PJMEDIA_SND)),)
-export CFLAGS += -I$(THIRD_PARTY)/build/portaudio -I$(THIRD_PARTY)/portaudio/include -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=1
-endif
-
-#
-# Windows specific
-#
-ifneq ($(findstring win32,$(AC_PJMEDIA_SND)),)
-export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_WMME=1
-else
-export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
-endif
-
-#
-# Null sound device
-#
-ifeq ($(AC_PJMEDIA_SND),null)
-export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
-endif
-
-#
-# External sound device
-#
-ifeq ($(AC_PJMEDIA_SND),external)
-export CFLAGS += -DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0 -DPJMEDIA_AUDIO_DEV_HAS_WMME=0
-endif
-
-
diff --git a/sflphone-common/libs/pjproject/pjmedia/include/pjmedia-codec/config_auto.h b/sflphone-common/libs/pjproject/pjmedia/include/pjmedia-codec/config_auto.h
deleted file mode 100644
index a050b09c2a35ac3157c8410a62d9eb4d89a7530d..0000000000000000000000000000000000000000
--- a/sflphone-common/libs/pjproject/pjmedia/include/pjmedia-codec/config_auto.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* pjmedia/include/pjmedia-codec/config_auto.h.  Generated from config_auto.h.in by configure.  */
-/* $Id: config_auto.h.in 2601 2009-04-15 14:45:41Z nanang $ */
-/*
- * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
- * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
- *
- * 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 2 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#ifndef __PJMEDIA_CODEC_CONFIG_AUTO_H_
-#define __PJMEDIA_CODEC_CONFIG_AUTO_H_
-
-/**
- * @file config_auto.h
- * @brief PJMEDIA-CODEC configuration as set by autoconf script
- */
-
-/*
- * Note:
- *	The configuration in config_site.h overrides any other settings,
- *	including the setting as detected by autoconf. 
- */
- 
-/* L16 codec */
-#ifndef PJMEDIA_HAS_L16_CODEC
-/* #undef PJMEDIA_HAS_L16_CODEC */
-#endif
-
-
-/* GSM codec */
-#ifndef PJMEDIA_HAS_GSM_CODEC
-/* #undef PJMEDIA_HAS_GSM_CODEC */
-#endif
-
-
-/* Speex codec */
-#ifndef PJMEDIA_HAS_SPEEX_CODEC
-/* #undef PJMEDIA_HAS_SPEEX_CODEC */
-#endif
-
-
-/* iLBC codec */
-#ifndef PJMEDIA_HAS_ILBC_CODEC
-/* #undef PJMEDIA_HAS_ILBC_CODEC */
-#endif
-
-
-/* G722 codec */
-#ifndef PJMEDIA_HAS_G722_CODEC
-/* #undef PJMEDIA_HAS_G722_CODEC */
-#endif
-
-/* G7221 codec */
-#ifndef PJMEDIA_HAS_G7221_CODEC
-/* #undef PJMEDIA_HAS_G7221_CODEC */
-#endif
-
-
-#endif	/* __PJMEDIA_CODEC_CONFIG_AUTO_H_ */
-
-
diff --git a/sflphone-common/libs/pjproject/pjnath/bin/pjnath-test-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjnath/bin/pjnath-test-x86_64-unknown-linux-gnu
deleted file mode 100755
index cd07f7392c96e627db5a2a1f1aabb65290962515..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjnath/bin/pjnath-test-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/pjnath/bin/pjturn-client-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjnath/bin/pjturn-client-x86_64-unknown-linux-gnu
deleted file mode 100755
index 9ec5735619ec443be16844aa658e1d783f82ddb5..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjnath/bin/pjturn-client-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/pjnath/bin/pjturn-srv-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjnath/bin/pjturn-srv-x86_64-unknown-linux-gnu
deleted file mode 100755
index 07a6a00a320bbf78102531459fc5d0f125b485a1..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjnath/bin/pjturn-srv-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/pjsip-apps/bin/pjsua-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjsip-apps/bin/pjsua-x86_64-unknown-linux-gnu
deleted file mode 100755
index 8644d3266cbf695c11e7231dfc3c525c5600ce4e..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjsip-apps/bin/pjsua-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/pjsip/bin/pjsip-test-x86_64-unknown-linux-gnu b/sflphone-common/libs/pjproject/pjsip/bin/pjsip-test-x86_64-unknown-linux-gnu
deleted file mode 100755
index 857b37a2e8a777bd35590824cb96b95a36fbbc72..0000000000000000000000000000000000000000
Binary files a/sflphone-common/libs/pjproject/pjsip/bin/pjsip-test-x86_64-unknown-linux-gnu and /dev/null differ
diff --git a/sflphone-common/libs/pjproject/third_party/build/os-auto.mak b/sflphone-common/libs/pjproject/third_party/build/os-auto.mak
deleted file mode 100644
index 066727a6e276c77928a101be1d19ef2df1a01f2c..0000000000000000000000000000000000000000
--- a/sflphone-common/libs/pjproject/third_party/build/os-auto.mak
+++ /dev/null
@@ -1,21 +0,0 @@
-
-ifneq (,1)
-DIRS += gsm
-endif
-
-ifneq (,1)
-DIRS += ilbc
-endif
-
-ifneq (,1)
-DIRS += speex
-endif
-
-ifneq (,1)
-DIRS += g7221
-endif
-
-ifneq ($(findstring pa,pa_unix),)
-DIRS += portaudio
-endif
-
diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp
index ee8ccdaac8cbad640f7a11ae655167162c53c212..bdbc27ed2d8964c1522d7ca58820f0b5cda6065c 100644
--- a/sflphone-common/src/audio/alsa/alsalayer.cpp
+++ b/sflphone-common/src/audio/alsa/alsalayer.cpp
@@ -37,8 +37,8 @@ AlsaLayer::AlsaLayer (ManagerImpl* manager)
         , _is_running_capture (false)
         , _is_open_playback (false)
         , _is_open_capture (false)
-        , _trigger_request (false)	
-	, _audioThread(NULL)
+        , _trigger_request (false)
+        , _audioThread (NULL)
 
 {
     _debug (" Constructor of AlsaLayer called\n");
@@ -56,12 +56,14 @@ AlsaLayer::~AlsaLayer (void)
     _debug ("Destructor of AlsaLayer called\n");
     closeLayer();
 
-    if(_converter) {
-	delete _converter; _converter = NULL;
+    if (_converter) {
+        delete _converter;
+        _converter = NULL;
     }
 
-    if(dcblocker) {
-	delete dcblocker; dcblocker = NULL;
+    if (dcblocker) {
+        delete dcblocker;
+        dcblocker = NULL;
     }
 }
 
@@ -73,7 +75,7 @@ AlsaLayer::closeLayer()
     try {
         /* Stop the audio thread first */
         if (_audioThread) {
-	    _debug("Stop Audio Thread\n");
+            _debug ("Stop Audio Thread\n");
             delete _audioThread;
             _audioThread=NULL;
         }
@@ -115,7 +117,7 @@ AlsaLayer::openDevice (int indexIn, int indexOut, int sampleRate, int frameSize,
 
     _frameSize = frameSize;
 
-    _audioPlugin = std::string(plugin);
+    _audioPlugin = std::string (plugin);
 
     _debugAlsa (" Setting AlsaLayer: device     in=%2d, out=%2d\n", _indexIn, _indexOut);
 
@@ -147,15 +149,16 @@ AlsaLayer::startStream (void)
     std::string pcmp = buildDeviceTopo (_audioPlugin, _indexOut, 0);
     std::string pcmc = buildDeviceTopo (_audioPlugin, _indexIn, 0);
 
-    if(!is_playback_open()){
-	open_device (pcmp, pcmc, SFL_PCM_PLAYBACK);
+    if (!is_playback_open()) {
+        open_device (pcmp, pcmc, SFL_PCM_PLAYBACK);
     }
 
-    if(!is_capture_open()){
-	open_device (pcmp, pcmc, SFL_PCM_CAPTURE);
+    if (!is_capture_open()) {
+        open_device (pcmp, pcmc, SFL_PCM_CAPTURE);
     }
-   
+
     prepareCaptureStream ();
+
     preparePlaybackStream ();
     startCaptureStream ();
     startPlaybackStream ();
@@ -166,14 +169,14 @@ AlsaLayer::startStream (void)
     // getMainBuffer()->flushAllBuffers();
     // getMainBuffer()->flushDefault();
 
-    if(_audioThread == NULL) {
-	try {
-	    _debug("Start Audio Thread\n");
-	    _audioThread = new AudioThread (this);
-	    _audioThread->start();
-	} catch (...) {
-	    _debugException ("Fail to start audio thread\n");
-	}
+    if (_audioThread == NULL) {
+        try {
+            _debug ("Start Audio Thread\n");
+            _audioThread = new AudioThread (this);
+            _audioThread->start();
+        } catch (...) {
+            _debugException ("Fail to start audio thread\n");
+        }
     }
 
 }
@@ -186,7 +189,7 @@ AlsaLayer::stopStream (void)
     try {
         /* Stop the audio thread first */
         if (_audioThread) {
-	    _debug("Stop Audio Thread\n");
+            _debug ("Stop Audio Thread\n");
             delete _audioThread;
             _audioThread=NULL;
         }
@@ -196,6 +199,7 @@ AlsaLayer::stopStream (void)
     }
 
     closeCaptureStream ();
+
     closePlaybackStream ();
 
     /* Flush the ring buffers */
@@ -224,11 +228,12 @@ void AlsaLayer::stopCaptureStream (void)
     int err;
 
     if (_CaptureHandle) {
-	_debug("AlsaLayer:: stop Alsa capture\n");
-        if((err = snd_pcm_drop (_CaptureHandle)) < 0)
-	    _debug("AlsaLayer:: Error stopping ALSA capture: %s\n", snd_strerror(err));
-	else
-	    stop_capture ();
+        _debug ("AlsaLayer:: stop Alsa capture\n");
+
+        if ( (err = snd_pcm_drop (_CaptureHandle)) < 0)
+            _debug ("AlsaLayer:: Error stopping ALSA capture: %s\n", snd_strerror (err));
+        else
+            stop_capture ();
 
     }
 }
@@ -241,11 +246,12 @@ void AlsaLayer::closeCaptureStream (void)
         stopCaptureStream ();
 
     if (is_capture_open()) {
-	_debug("AlsaLayer:: close ALSA capture\n");
-        if ((err = snd_pcm_close (_CaptureHandle)) < 0)
-	    _debug("Error closing ALSA capture: %s\n", snd_strerror(err));
-	else
-	    close_capture ();
+        _debug ("AlsaLayer:: close ALSA capture\n");
+
+        if ( (err = snd_pcm_close (_CaptureHandle)) < 0)
+            _debug ("Error closing ALSA capture: %s\n", snd_strerror (err));
+        else
+            close_capture ();
     }
 }
 
@@ -255,10 +261,11 @@ void AlsaLayer::startCaptureStream (void)
 
     if (_CaptureHandle && !is_capture_running()) {
         _debug ("AlsaLayer:: start ALSA capture\n");
-        if((err = snd_pcm_start (_CaptureHandle)) < 0)
-	    _debug("Error starting ALSA capture: %s\n",  snd_strerror(err));
-	else
-	    start_capture();
+
+        if ( (err = snd_pcm_start (_CaptureHandle)) < 0)
+            _debug ("Error starting ALSA capture: %s\n",  snd_strerror (err));
+        else
+            start_capture();
     }
 }
 
@@ -267,9 +274,10 @@ void AlsaLayer::prepareCaptureStream (void)
     int err;
 
     if (is_capture_open() && !is_capture_prepared()) {
-	_debug("AlsaLayer:: prepare ALSA capture\n");
-        if ((err = snd_pcm_prepare (_CaptureHandle)) < 0)
-            _debug ("Error preparing ALSA capture: %s\n", snd_strerror(err));
+        _debug ("AlsaLayer:: prepare ALSA capture\n");
+
+        if ( (err = snd_pcm_prepare (_CaptureHandle)) < 0)
+            _debug ("Error preparing ALSA capture: %s\n", snd_strerror (err));
         else
             prepare_capture ();
     }
@@ -280,11 +288,12 @@ void AlsaLayer::stopPlaybackStream (void)
     int err;
 
     if (_PlaybackHandle && is_playback_running()) {
-	_debug("AlsaLayer:: stop ALSA playback\n");
-        if((err = snd_pcm_drop (_PlaybackHandle)) < 0)
-	    _debug("Error stopping ALSA playback: %s\n", snd_strerror(err));
-	else
-	    stop_playback ();
+        _debug ("AlsaLayer:: stop ALSA playback\n");
+
+        if ( (err = snd_pcm_drop (_PlaybackHandle)) < 0)
+            _debug ("Error stopping ALSA playback: %s\n", snd_strerror (err));
+        else
+            stop_playback ();
     }
 }
 
@@ -297,11 +306,12 @@ void AlsaLayer::closePlaybackStream (void)
         stopPlaybackStream ();
 
     if (is_playback_open()) {
-	_debug("AlsaLayer:: close ALSA playback\n");
-        if ((err = snd_pcm_close (_PlaybackHandle)) < 0)
-	    _debug("Error closing ALSA playback: %s\n", snd_strerror(err));
+        _debug ("AlsaLayer:: close ALSA playback\n");
+
+        if ( (err = snd_pcm_close (_PlaybackHandle)) < 0)
+            _debug ("Error closing ALSA playback: %s\n", snd_strerror (err));
         else
-	    close_playback ();
+            close_playback ();
     }
 }
 
@@ -310,11 +320,12 @@ void AlsaLayer::startPlaybackStream (void)
     int err;
 
     if (_PlaybackHandle && !is_playback_running()) {
-	_debug ("AlsaLayer:: start ALSA playback\n");
-        if ((err = snd_pcm_start (_PlaybackHandle)) < 0)
-	    _debug("Error starting ALSA playback: %s\n", snd_strerror(err));
-	else
-	    start_playback();
+        _debug ("AlsaLayer:: start ALSA playback\n");
+
+        if ( (err = snd_pcm_start (_PlaybackHandle)) < 0)
+            _debug ("Error starting ALSA playback: %s\n", snd_strerror (err));
+        else
+            start_playback();
     }
 }
 
@@ -323,11 +334,12 @@ void AlsaLayer::preparePlaybackStream (void)
     int err;
 
     if (is_playback_open() && !is_playback_prepared()) {
-	_debug("AlsaLayer:: prepare playback stream\n");
-        if ((err = snd_pcm_prepare (_PlaybackHandle)) < 0)  
-	    _debug ("Error preparing the device: %s\n", snd_strerror(err));
-	else
-	    prepare_playback ();
+        _debug ("AlsaLayer:: prepare playback stream\n");
+
+        if ( (err = snd_pcm_prepare (_PlaybackHandle)) < 0)
+            _debug ("Error preparing the device: %s\n", snd_strerror (err));
+        else
+            prepare_playback ();
     }
 }
 
@@ -491,8 +503,9 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, int flag)
 
     if (flag == SFL_PCM_BOTH || flag == SFL_PCM_PLAYBACK) {
 
-	_debug("AlsaLayer:: open playback device\n");
+        _debug ("AlsaLayer:: open playback device\n");
         // if((err = snd_pcm_open(&_PlaybackHandle, pcm_p.c_str(),  SND_PCM_STREAM_PLAYBACK, 0 )) < 0){
+
         if ( (err = snd_pcm_open (&_PlaybackHandle, pcm_p.c_str(),  SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
             _debugAlsa ("Error while opening playback device %s\n",  pcm_p.c_str());
             setErrorMessage (ALSA_PLAYBACK_DEVICE);
@@ -512,7 +525,8 @@ AlsaLayer::open_device (std::string pcm_p, std::string pcm_c, int flag)
 
     if (flag == SFL_PCM_BOTH || flag == SFL_PCM_CAPTURE) {
 
-	_debug("AlsaLayer:: open capture device\n");
+        _debug ("AlsaLayer:: open capture device\n");
+
         if ( (err = snd_pcm_open (&_CaptureHandle,  pcm_c.c_str(),  SND_PCM_STREAM_CAPTURE, 0)) < 0) {
             _debugAlsa ("Error while opening capture device %s\n",  pcm_c.c_str());
             setErrorMessage (ALSA_CAPTURE_DEVICE);
@@ -576,7 +590,8 @@ AlsaLayer::write (void* buffer, int length)
                 break;
 
             default:
-                _debugAlsa ("Write error unknown - dropping frames **********************************: %s\n", snd_strerror(err));
+                _debugAlsa ("Write error unknown - dropping frames **********************************: %s\n", snd_strerror (err));
+
                 stopPlaybackStream ();
 
                 break;
@@ -635,7 +650,7 @@ AlsaLayer::read (void* buffer, int toCopy)
 void
 AlsaLayer::handle_xrun_capture (void)
 {
-    _debugAlsa("handle_xrun_capture\n");
+    _debugAlsa ("handle_xrun_capture\n");
 
     snd_pcm_status_t* status;
     snd_pcm_status_alloca (&status);
@@ -655,7 +670,7 @@ AlsaLayer::handle_xrun_capture (void)
 void
 AlsaLayer::handle_xrun_playback (void)
 {
-    _debugAlsa("AlsaLayer:: handle_xrun_playback\n");
+    _debugAlsa ("AlsaLayer:: handle_xrun_playback\n");
 
     int state;
     snd_pcm_status_t* status;
@@ -669,7 +684,7 @@ AlsaLayer::handle_xrun_playback (void)
             stopPlaybackStream ();
             preparePlaybackStream ();
 
-	    
+
             _trigger_request = true;
         }
     }
@@ -807,7 +822,7 @@ void AlsaLayer::audioCallback (void)
 
     spkrVolume = _manager->getSpkrVolume();
     micVolume  = _manager->getMicVolume();
-    
+
     /*
     int writeableSize = snd_pcm_avail_update(_PlaybackHandle);
     _debug("writeableSize %i\n", writeableSize);
@@ -816,6 +831,7 @@ void AlsaLayer::audioCallback (void)
     // AvailForGet tell the number of chars inside the buffer
     // framePerBuffer are the number of data for one channel (left)
     urgentAvailBytes = _urgentRingBuffer.AvailForGet();
+
     if (urgentAvailBytes > 0) {
 
         // Urgent data (dtmf, incoming call signal) come first.
@@ -835,7 +851,7 @@ void AlsaLayer::audioCallback (void)
     } else {
 
         tone = _manager->getTelephoneTone();
-	file_tone = _manager->getTelephoneFile();
+        file_tone = _manager->getTelephoneFile();
 
         toGet = framesPerBufferAlsa;
         maxBytes = toGet * sizeof (SFLDataFormat);
@@ -846,92 +862,93 @@ void AlsaLayer::audioCallback (void)
             tone->getNext (out, toGet, spkrVolume);
             write (out , maxBytes);
 
-	    free(out);
-	    out = 0;
+            free (out);
+            out = 0;
 
         } else if (file_tone != 0) {
 
             out = (SFLDataFormat*) malloc (maxBytes * sizeof (SFLDataFormat));
-            file_tone->getNext(out, toGet, spkrVolume);
+            file_tone->getNext (out, toGet, spkrVolume);
             write (out , maxBytes);
 
-	    free(out);
-	    out = 0;
+            free (out);
+            out = 0;
 
         } else {
 
 
-	    // If nothing urgent, play the regular sound samples
-   
-	    int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
-	    int maxNbSamplesToGet = 0;
-	    int maxNbBytesToGet = 0;
+            // If nothing urgent, play the regular sound samples
+
+            int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
+            int maxNbSamplesToGet = 0;
+            int maxNbBytesToGet = 0;
+
+            // Compute maximal value to get into the ring buffer
+
+            if (_mainBufferSampleRate && ( (int) _audioSampleRate != _mainBufferSampleRate)) {
+
+                double upsampleFactor = (double) _audioSampleRate / _mainBufferSampleRate;
 
-	    // Compute maximal value to get into the ring buffer
-	    if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
- 
-		double upsampleFactor = (double) _audioSampleRate / _mainBufferSampleRate;
+                maxNbSamplesToGet = (int) ( (double) framesPerBufferAlsa / upsampleFactor);
 
-		maxNbSamplesToGet = (int) ((double) framesPerBufferAlsa / upsampleFactor);
 
+            } else {
 
-	    } else {
+                maxNbSamplesToGet = framesPerBufferAlsa;
 
-		maxNbSamplesToGet = framesPerBufferAlsa;
+            }
 
-	    }
+            maxNbBytesToGet = maxNbSamplesToGet * sizeof (SFLDataFormat);
 
-	    maxNbBytesToGet = maxNbSamplesToGet * sizeof(SFLDataFormat);
-            
             normalAvailBytes = getMainBuffer()->availForGet();
-            toGet = (normalAvailBytes < (int)maxNbBytesToGet) ? normalAvailBytes : maxNbBytesToGet;
+            toGet = (normalAvailBytes < (int) maxNbBytesToGet) ? normalAvailBytes : maxNbBytesToGet;
 
             out = (SFLDataFormat*) malloc (maxNbBytesToGet);
 
             if (normalAvailBytes) {
 
-                getMainBuffer()->getData(out, toGet, spkrVolume);
+                getMainBuffer()->getData (out, toGet, spkrVolume);
+
+                if (_mainBufferSampleRate && ( (int) _audioSampleRate != _mainBufferSampleRate)) {
 
-		if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
 
+                    rsmpl_out = (SFLDataFormat*) malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
 
-		    rsmpl_out = (SFLDataFormat*) malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
-		    
-		    // Do sample rate conversion
-		    int nb_sample_down = toGet / sizeof(SFLDataFormat);
+                    // Do sample rate conversion
+                    int nb_sample_down = toGet / sizeof (SFLDataFormat);
 
-		    int nbSample = _converter->upsampleData((SFLDataFormat*)out, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_down);
+                    int nbSample = _converter->upsampleData ( (SFLDataFormat*) out, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_down);
 
-		    
 
-		    write (rsmpl_out, nbSample*sizeof(SFLDataFormat));
 
-		    free(rsmpl_out);
-		    rsmpl_out = 0;
-		
-		} else {
+                    write (rsmpl_out, nbSample*sizeof (SFLDataFormat));
 
-		    write (out, toGet);
+                    free (rsmpl_out);
+                    rsmpl_out = 0;
 
-		}
+                } else {
+
+                    write (out, toGet);
+
+                }
 
             } else {
 
-		if((tone == 0) && (file_tone == 0)) {
+                if ( (tone == 0) && (file_tone == 0)) {
 
-		    SFLDataFormat* zeros = (SFLDataFormat*)malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
+                    SFLDataFormat* zeros = (SFLDataFormat*) malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
 
-		    bzero (zeros, framesPerBufferAlsa * sizeof (SFLDataFormat));
-		    write (zeros, framesPerBufferAlsa * sizeof (SFLDataFormat));
+                    bzero (zeros, framesPerBufferAlsa * sizeof (SFLDataFormat));
+                    write (zeros, framesPerBufferAlsa * sizeof (SFLDataFormat));
 
-		    free (zeros);
-		}
+                    free (zeros);
+                }
             }
 
-	    _urgentRingBuffer.Discard (toGet); 
+            _urgentRingBuffer.Discard (toGet);
 
-	    free (out);
-	    out = 0;
+            free (out);
+            out = 0;
 
         }
 
@@ -939,59 +956,62 @@ void AlsaLayer::audioCallback (void)
 
     // Additionally handle the mic's audio stream
     int micAvailBytes;
+
     int micAvailPut;
+
     int toPut;
+
     SFLDataFormat* in;
 
 
     // snd_pcm_sframes_t micAvailAlsa;
     in = 0;
-    if(is_capture_running())
-    {
-	
-        micAvailBytes = snd_pcm_avail_update(_CaptureHandle);
-	// _debug("micAvailBytes %i\n", micAvailBytes);
-	if(micAvailBytes > 0) 
-	{
+
+    if (is_capture_running()) {
+
+        micAvailBytes = snd_pcm_avail_update (_CaptureHandle);
+        // _debug("micAvailBytes %i\n", micAvailBytes);
+
+        if (micAvailBytes > 0) {
             micAvailPut = getMainBuffer()->availForPut();
             toPut = (micAvailBytes <= framesPerBufferAlsa) ? micAvailBytes : framesPerBufferAlsa;
-            in = (SFLDataFormat*)malloc(toPut * sizeof(SFLDataFormat));
-            toPut = read (in, toPut* sizeof(SFLDataFormat));
+            in = (SFLDataFormat*) malloc (toPut * sizeof (SFLDataFormat));
+            toPut = read (in, toPut* sizeof (SFLDataFormat));
+
+            adjustVolume (in, toPut, SFL_PCM_CAPTURE);
+
+            if (in != 0) {
+                int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
 
-	    adjustVolume (in, toPut, SFL_PCM_CAPTURE);
+                if (_mainBufferSampleRate && ( (int) _audioSampleRate != _mainBufferSampleRate)) {
 
-            if (in != 0)
-            {
-		int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
+                    SFLDataFormat* rsmpl_out = (SFLDataFormat*) malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
 
-		if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
+                    int nbSample = toPut / sizeof (SFLDataFormat);
+                    int nb_sample_up = nbSample;
 
-		    SFLDataFormat* rsmpl_out = (SFLDataFormat*) malloc (framesPerBufferAlsa * sizeof (SFLDataFormat));
+                    // _debug("nb_sample_up %i\n", nb_sample_up);
+                    nbSample = _converter->downsampleData ( (SFLDataFormat*) in, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_up);
 
-		    int nbSample = toPut / sizeof(SFLDataFormat);
-		    int nb_sample_up = nbSample;
+                    dcblocker->filter_signal (rsmpl_out, nbSample);
 
-		    // _debug("nb_sample_up %i\n", nb_sample_up);
-		    nbSample = _converter->downsampleData ((SFLDataFormat*)in, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_up);
+                    getMainBuffer()->putData (rsmpl_out, nbSample * sizeof (SFLDataFormat), 100);
 
-		    dcblocker->filter_signal(rsmpl_out, nbSample);
+                    free (rsmpl_out);
+                    rsmpl_out = 0;
 
-		    getMainBuffer()->putData(rsmpl_out, nbSample * sizeof (SFLDataFormat), 100);
+                } else {
+
+                    getMainBuffer()->putData (in, toPut, 100);
+                }
+            }
 
-		    free(rsmpl_out);
-		    rsmpl_out = 0;
-		
-		} else {
+            free (in);
 
-		    getMainBuffer()->putData(in, toPut, 100);
-		}
-	    }
-            free(in); in=0;
+            in=0;
+        } else if (micAvailBytes < 0) {
+            _debug ("AlsaLayer::audioCallback (mic): error: %s\n", snd_strerror (micAvailBytes));
         }
-	else if(micAvailBytes < 0)
-	{
-	    _debug("AlsaLayer::audioCallback (mic): error: %s\n", snd_strerror(micAvailBytes));
-	}
 
     }
 }
diff --git a/sflphone-common/src/audio/audiolayer.cpp b/sflphone-common/src/audio/audiolayer.cpp
index 1e513c7744ab9ff0887890eae8937e2582b05ca1..0687dfa3b4c8e99c8e813ff6bcad52a32c647e21 100644
--- a/sflphone-common/src/audio/audiolayer.cpp
+++ b/sflphone-common/src/audio/audiolayer.cpp
@@ -25,7 +25,8 @@ void AudioLayer::flushMain (void)
 
     // should pass call id
     MainBuffer* mainbuffer = getMainBuffer();
-    if(mainbuffer)
+
+    if (mainbuffer)
         mainbuffer->flushAllBuffers();
 }
 
@@ -39,7 +40,7 @@ void AudioLayer::flushUrgent (void)
 
 int AudioLayer::putUrgent (void* buffer, int toCopy)
 {
-    _debug("------------------- AudioLayer::putUrgent --------------------\n");
+    _debug ("------------------- AudioLayer::putUrgent --------------------\n");
     int a;
 
     ost::MutexLock guard (_mutex);
@@ -59,7 +60,7 @@ int AudioLayer::putMain (void *buffer, int toCopy, CallID call_id)
     int a;
 
     ost::MutexLock guard (_mutex);
-    a = getMainBuffer()->availForPut(call_id);
+    a = getMainBuffer()->availForPut (call_id);
 
     if (a >= toCopy) {
         return getMainBuffer()->putData (buffer, toCopy, _defaultVolume, call_id);
diff --git a/sflphone-common/src/audio/audiortp.cpp b/sflphone-common/src/audio/audiortp.cpp
index 3f6527f3498406e1eee0dfd6ac110e0a48ce2fb8..3887a21f63d18b7f8a5647526fa4efaadef3e942 100644
--- a/sflphone-common/src/audio/audiortp.cpp
+++ b/sflphone-common/src/audio/audiortp.cpp
@@ -55,8 +55,7 @@ AudioRtp::~AudioRtp (void)
 {
     ost::MutexLock m (_rtpMutex);
 
-    if (_RTXThread != _RTXThread)
-    {
+    if (_RTXThread != _RTXThread) {
         delete _RTXThread;
         _RTXThread = 0;
     }
@@ -122,10 +121,10 @@ AudioRtp::closeRtpSession ()
     _debug ("AudioRtp::Stopping rtp session\n");
 
     try {
-	if (_RTXThread != 0) {
+        if (_RTXThread != 0) {
             delete _RTXThread;
             _RTXThread = 0;
-	}
+        }
     } catch (...) {
         _debugException ("! ARTP Exception: when stopping audiortp\n");
         throw;
@@ -190,18 +189,18 @@ AudioRtpRTX::AudioRtpRTX (SIPCall *sipcall, bool sym) : time (new ost::Time()),
     // convert count into string
     std::stringstream out;
     out << count_rtp;
-    
+
     s_input = "/home/alexandresavard/Desktop/buffer_record/rtp_input_";
-    s_input.append(out.str());
+    s_input.append (out.str());
 
     s_output = "/home/alexandresavard/Desktop/buffer_record/rtp_output_";
-    s_output.append(out.str());
+    s_output.append (out.str());
 
     rtp_input_rec = new std::fstream();
     rtp_output_rec = new std::fstream();
 
-    rtp_input_rec->open(s_input.c_str(), std::fstream::out);
-    rtp_output_rec->open(s_output.c_str(), std::fstream::out);
+    rtp_input_rec->open (s_input.c_str(), std::fstream::out);
+    rtp_output_rec->open (s_output.c_str(), std::fstream::out);
 
 }
 
@@ -219,11 +218,12 @@ AudioRtpRTX::~AudioRtpRTX ()
         throw;
     }
 
-    _debug("Remove audio stream for call id %s\n", _ca->getCallId().c_str());
-    _audiolayer->getMainBuffer()->unBindAll(_ca->getCallId());
+    _debug ("Remove audio stream for call id %s\n", _ca->getCallId().c_str());
+
+    _audiolayer->getMainBuffer()->unBindAll (_ca->getCallId());
     // Manager::instance().removeStream(_ca->getCallId());
 
-    _debug("DELETE print micData address %p\n", micData);
+    _debug ("DELETE print micData address %p\n", micData);
     delete [] micData;
     micData = NULL;
     delete [] micDataConverted;
@@ -260,25 +260,25 @@ void
 AudioRtpRTX::initBuffers()
 {
     ost::MutexLock m (_rtpRtxMutex);
-    
-    _debug("AudioRtpRTX::initBuffers Init RTP buffers for %s\n", _ca->getCallId().c_str());
-    
+
+    _debug ("AudioRtpRTX::initBuffers Init RTP buffers for %s\n", _ca->getCallId().c_str());
+
     converter = new SamplerateConverter (_layerSampleRate , _layerFrameSize);
 
     nbSamplesMax = (int) (_layerSampleRate * _layerFrameSize /1000);
 
-    
-    _debug("AudioRtpRTX::initBuffers NBSAMPLEMAX %i\n", nbSamplesMax);
+
+    _debug ("AudioRtpRTX::initBuffers NBSAMPLEMAX %i\n", nbSamplesMax);
 
     micData = new SFLDataFormat[nbSamplesMax];
-    _debug("CREATE print micData address %p\n", micData);
+    _debug ("CREATE print micData address %p\n", micData);
     micDataConverted = new SFLDataFormat[nbSamplesMax];
     micDataEncoded = new unsigned char[nbSamplesMax];
 
     spkrDataConverted = new SFLDataFormat[nbSamplesMax];
     spkrDataDecoded = new SFLDataFormat[nbSamplesMax];
 
-    Manager::instance().addStream(_ca->getCallId());
+    Manager::instance().addStream (_ca->getCallId());
     // _audiolayer->getMainBuffer()->bindCallID(_ca->getCallId());
 }
 
@@ -309,8 +309,9 @@ AudioRtpRTX::setRtpSessionMedia (void)
         return;
     }
 
-    AudioCodecType pl = (AudioCodecType)_ca->getLocalSDP()->get_session_media()->getPayload();
-    _audiocodec = Manager::instance().getCodecDescriptorMap().instantiateCodec(pl);
+    AudioCodecType pl = (AudioCodecType) _ca->getLocalSDP()->get_session_media()->getPayload();
+
+    _audiocodec = Manager::instance().getCodecDescriptorMap().instantiateCodec (pl);
 
     if (_audiocodec == NULL) {
         _debug (" !ARTP: No audiocodec, can't init RTP media\n");
@@ -401,7 +402,7 @@ AudioRtpRTX::processDataEncode()
     int maxBytesToGet = computeNbByteAudioLayer (fixed_codec_framesize);
 
     // available bytes inside ringbuffer
-    int availBytesFromMic = _audiolayer->getMainBuffer()->availForGet(_ca->getCallId());
+    int availBytesFromMic = _audiolayer->getMainBuffer()->availForGet (_ca->getCallId());
 
     // _debug("AudioRtpRTX::processDataEncode() callid: %s availBytesFromMic %i\n", _ca->getCallId().c_str(), availBytesFromMic);
 
@@ -409,14 +410,15 @@ AudioRtpRTX::processDataEncode()
     // set available byte to maxByteToGet
     int bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet;
     // _debug("bytesAvail %i\n", bytesAvail);
+
     if (bytesAvail == 0)
         return 0;
 
     // _debug("AudioRtpRTX::processDataEncode: bytesAvail: %i\n", bytesAvail);
     // Get bytes from micRingBuffer to data_from_mic
-    int nbSample = _audiolayer->getMainBuffer()->getData(micData , bytesAvail, 100, _ca->getCallId()) / sizeof (SFLDataFormat);
+    int nbSample = _audiolayer->getMainBuffer()->getData (micData , bytesAvail, 100, _ca->getCallId()) / sizeof (SFLDataFormat);
 
-    rtp_output_rec->write((char*)micData, bytesAvail);
+    rtp_output_rec->write ( (char*) micData, bytesAvail);
 
     // _debug("AudioRtpRTX::processDataEncode: nbSample: %i\n", nbSample);
 
@@ -464,7 +466,7 @@ AudioRtpRTX::processDataDecode (unsigned char* spkrData, unsigned int size, int&
             int nb_sample_down = nbSample;
             nbSample = reSampleData (spkrDataDecoded, spkrDataConverted, _codecSampleRate, nb_sample_down, UP_SAMPLING);
 
-	    rtp_input_rec->write((char*)spkrDataConverted, nbSample * sizeof (SFLDataFormat));
+            rtp_input_rec->write ( (char*) spkrDataConverted, nbSample * sizeof (SFLDataFormat));
 
             // Store the number of samples for recording
             _nSamplesSpkr = nbSample;
@@ -527,14 +529,16 @@ AudioRtpRTX::sendSessionFromMic (int timestamp)
         return;
     }
 
- 
+
 
     int compSize = processDataEncode();
 
     // putData put the data on RTP queue, sendImmediate bypass this queue
     // _debug("AudioRtpRTX::sendSessionFromMic: timestamp: %i, compsize: %i\n", timestamp, compSize);
-    if((compSize != 0) && (micDataEncoded != NULL))
+
+    if ( (compSize != 0) && (micDataEncoded != NULL))
         _session->putData (timestamp, micDataEncoded, compSize);
+
     // _session->sendImmediate(timestamp, micDataEncoded, compSize);
 
 
@@ -565,10 +569,11 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
 
     // if (is_waiting != 0)
     adu = _session->getData (_session->getFirstTimestamp());
+
     // else
     //   return;
 
-    
+
 
     if (adu == NULL)
         return;
@@ -579,10 +584,9 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
 
     processDataDecode (spkrData, size, countTime);
 
-    if (adu != NULL)
-    {
+    if (adu != NULL) {
         delete adu;
-	adu = NULL;
+        adu = NULL;
     }
 
 }
@@ -628,7 +632,7 @@ AudioRtpRTX::run ()
 
     _audiolayer->startStream();
 
-    _audiolayer->getMainBuffer()->flush(_ca->getCallId());
+    _audiolayer->getMainBuffer()->flush (_ca->getCallId());
 
     _session->startRunning();
 
@@ -639,7 +643,7 @@ AudioRtpRTX::run ()
     while (!testCancel()) {
 
 
-	// _debug("Main while loop for call: %s\n", _ca->getCallId().c_str());
+        // _debug("Main while loop for call: %s\n", _ca->getCallId().c_str());
         // Send session
         sessionWaiting = _session->isWaiting();
 
@@ -652,7 +656,7 @@ AudioRtpRTX::run ()
 
         // Let's wait for the next transmit cycle
 
-	
+
         if (sessionWaiting == 1) {
             // Record mic and speaker during conversation
             _ca->recAudio.recData (spkrDataConverted,micData,_nSamplesSpkr,_nSamplesMic);
@@ -660,15 +664,15 @@ AudioRtpRTX::run ()
             // Record mic only while leaving a message
             _ca->recAudio.recData (micData,_nSamplesMic);
         }
-	
+
 
         // Let's wait for the next transmit cycle
         Thread::sleep (TimerPort::getTimer());
-	
+
 
         // TimerPort::incTimer(20); // 'frameSize' ms
         TimerPort::incTimer (threadSleep);
-	
+
     }
 
     // _audiolayer->stopStream();
diff --git a/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp b/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp
index adfcd25531289ec2275eaf875dcc8e32cf655380..cec4dd3ff75d4d06e74bb157b4b54a4e0a971c60 100644
--- a/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp
+++ b/sflphone-common/src/audio/audiortp/AudioZrtpSession.cpp
@@ -54,14 +54,14 @@ void AudioZrtpSession::initializeZid (void)
 
     std::string xdg_config = std::string (HOMEDIR) + DIR_SEPARATOR_STR + ".cache" + DIR_SEPARATOR_STR + PROGDIR + "/" + _zidFilename;
 
-    _debug("    xdg_config %s\n", xdg_config.c_str());
+    _debug ("    xdg_config %s\n", xdg_config.c_str());
 
     if (XDG_CACHE_HOME != NULL) {
-	std::string xdg_env = std::string (XDG_CACHE_HOME) + _zidFilename;
-	_debug("    xdg_env %s\n", xdg_env.c_str());
-	(xdg_env.length() > 0) ? zidCompleteFilename = xdg_env : zidCompleteFilename = xdg_config;
+        std::string xdg_env = std::string (XDG_CACHE_HOME) + _zidFilename;
+        _debug ("    xdg_env %s\n", xdg_env.c_str());
+        (xdg_env.length() > 0) ? zidCompleteFilename = xdg_env : zidCompleteFilename = xdg_config;
     } else
-	zidCompleteFilename = xdg_config;
+        zidCompleteFilename = xdg_config;
 
 
     if (initialize (zidCompleteFilename.c_str()) >= 0) {
diff --git a/sflphone-common/src/audio/codecs/codecDescriptor.cpp b/sflphone-common/src/audio/codecs/codecDescriptor.cpp
index 3f2a999eaa99a1e92eba7dbeb603882068c6d7cc..8c9ca56006cc214451d3e26381521a933218a833 100644
--- a/sflphone-common/src/audio/codecs/codecDescriptor.cpp
+++ b/sflphone-common/src/audio/codecs/codecDescriptor.cpp
@@ -94,10 +94,12 @@ CodecDescriptor::getCodec (AudioCodecType payload)
     CodecsMap::iterator iter = _CodecsMap.find (payload);
 
     if (iter!=_CodecsMap.end()) {
-	// _debug("Found codec %i _CodecsMap from codec descriptor\n", payload);
+        // _debug("Found codec %i _CodecsMap from codec descriptor\n", payload);
         return (iter->second);
     }
-    _debug("Error cannont found codec %i in _CodecsMap from codec descriptor\n", payload);
+
+    _debug ("Error cannont found codec %i in _CodecsMap from codec descriptor\n", payload);
+
     return NULL;
 }
 
@@ -127,7 +129,7 @@ CodecDescriptor::addCodec (AudioCodecType payload UNUSED)
 double
 CodecDescriptor::getBitRate (AudioCodecType payload)
 {
-    CodecsMap::iterator iter = _CodecsMap.find(payload);
+    CodecsMap::iterator iter = _CodecsMap.find (payload);
 
     if (iter!=_CodecsMap.end())
         return (iter->second->getBitRate());
@@ -252,9 +254,9 @@ CodecDescriptor::loadCodec (std::string path)
 
     AudioCodec* a = createCodec();
 
-    p = CodecHandlePointer(a, codecHandle);
+    p = CodecHandlePointer (a, codecHandle);
 
-    _CodecInMemory.push_back(p);
+    _CodecInMemory.push_back (p);
 
     return a;
 }
@@ -276,28 +278,27 @@ CodecDescriptor::unloadCodec (CodecHandlePointer p)
 }
 
 AudioCodec*
-CodecDescriptor::instantiateCodec(AudioCodecType payload)
+CodecDescriptor::instantiateCodec (AudioCodecType payload)
 {
 
     using std::cerr;
 
     std::vector< CodecHandlePointer >::iterator iter = _CodecInMemory.begin();
-    while(iter != _CodecInMemory.end())
-    {
-	if (iter->first->getPayload() == payload)
-	{
-	    create_t* createCodec = (create_t*) dlsym (iter->second , "create");
 
-	    if (dlerror())
-		cerr << dlerror() << '\n';
+    while (iter != _CodecInMemory.end()) {
+        if (iter->first->getPayload() == payload) {
+            create_t* createCodec = (create_t*) dlsym (iter->second , "create");
 
-	    AudioCodec* a = createCodec();
+            if (dlerror())
+                cerr << dlerror() << '\n';
 
-	    return a;
+            AudioCodec* a = createCodec();
 
-	}
+            return a;
 
-	iter++;
+        }
+
+        iter++;
     }
 
     return NULL;
diff --git a/sflphone-common/src/audio/codecs/speexcodec_nb.cpp b/sflphone-common/src/audio/codecs/speexcodec_nb.cpp
index 4acae5723118ca6e9b4c54335cab02e3f32442a0..fc3784eb9caae24bf4d727a3ef3885252f272a63 100644
--- a/sflphone-common/src/audio/codecs/speexcodec_nb.cpp
+++ b/sflphone-common/src/audio/codecs/speexcodec_nb.cpp
@@ -66,7 +66,7 @@ class Speex : public AudioCodec
 
             speex_decoder_ctl (_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size);
 
-	   
+
 
 #ifdef HAVE_SPEEXDSP_LIB
 
@@ -115,7 +115,7 @@ class Speex : public AudioCodec
             speex_bits_read_from (&_speex_dec_bits, (char*) src, size);
             speex_decode_int (_speex_dec_state, &_speex_dec_bits, dst);
 
-	    // return size in bytes
+            // return size in bytes
             return _frameSize * 2;
         }
 
diff --git a/sflphone-common/src/audio/codecs/speexcodec_wb.cpp b/sflphone-common/src/audio/codecs/speexcodec_wb.cpp
index 3b008a4ca07c841e1feb002f9af9cea64a9b0129..688ad6cf753bf21bbae345828844534cfd1b9eac 100644
--- a/sflphone-common/src/audio/codecs/speexcodec_wb.cpp
+++ b/sflphone-common/src/audio/codecs/speexcodec_wb.cpp
@@ -114,7 +114,7 @@ class Speex : public AudioCodec
             speex_bits_read_from (&_speex_dec_bits, (char*) src, size);
             speex_decode_int (_speex_dec_state, &_speex_dec_bits, dst);
 
-	    // return size in bytes
+            // return size in bytes
             return _frameSize * 2;
         }
 
diff --git a/sflphone-common/src/audio/dcblocker.cpp b/sflphone-common/src/audio/dcblocker.cpp
index c19b3ccc7c1a8db095475b4dffc188594bc3be63..a2122fe42415bb12ee61a48bbb7375fd2dfa57ee 100644
--- a/sflphone-common/src/audio/dcblocker.cpp
+++ b/sflphone-common/src/audio/dcblocker.cpp
@@ -21,7 +21,8 @@
 
 #include "dcblocker.h"
 
-DcBlocker::DcBlocker(){
+DcBlocker::DcBlocker()
+{
 
     y = 0;
     x = 0;
@@ -30,20 +31,21 @@ DcBlocker::DcBlocker(){
 
 }
 
-DcBlocker::~DcBlocker(){
+DcBlocker::~DcBlocker()
+{
+
 
-   
 }
 
-void DcBlocker::filter_signal(SFLDataFormat* audio_data, int length)
+void DcBlocker::filter_signal (SFLDataFormat* audio_data, int length)
 {
     // y(n) = x(n) - x(n-1) + R y(n-1) , R = 0.9999
 
-    for(int i = 0; i < length; i++) {
+    for (int i = 0; i < length; i++) {
 
         x = audio_data[i];
 
-        y = (SFLDataFormat)((float)x - (float)xm1 + 0.9999 * (float)ym1);
+        y = (SFLDataFormat) ( (float) x - (float) xm1 + 0.9999 * (float) ym1);
         xm1 = x;
         ym1 = y;
 
diff --git a/sflphone-common/src/audio/mainbuffer.cpp b/sflphone-common/src/audio/mainbuffer.cpp
index d4745be5f1017158ec70834a934eec5746de10d9..3f2751b6ba8b03eef708411b09ed0d24bd41a874 100644
--- a/sflphone-common/src/audio/mainbuffer.cpp
+++ b/sflphone-common/src/audio/mainbuffer.cpp
@@ -1,18 +1,18 @@
 /*
  *  Copyright (C) 2009 Savoir-Faire Linux inc.
  *  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.
@@ -20,7 +20,7 @@
 
 #include "mainbuffer.h"
 
-MainBuffer::MainBuffer() : _internalSamplingRate(0)
+MainBuffer::MainBuffer() : _internalSamplingRate (0)
 {
     mixBuffer = new SFLDataFormat[STATIC_BUFSIZE];
 }
@@ -34,272 +34,254 @@ MainBuffer::~MainBuffer()
 }
 
 
-void MainBuffer::setInternalSamplingRate(int sr)
+void MainBuffer::setInternalSamplingRate (int sr)
 {
     ost::MutexLock guard (_mutex);
-    
-    if (sr != _internalSamplingRate)
-    {
-	// flushAllBuffers();
-	_internalSamplingRate = sr;
 
-	flushAllBuffers();
+    if (sr != _internalSamplingRate) {
+        // flushAllBuffers();
+        _internalSamplingRate = sr;
+
+        flushAllBuffers();
 
     }
 
     // flushAllBuffers();
 }
 
-CallIDSet* MainBuffer::getCallIDSet(CallID call_id)
+CallIDSet* MainBuffer::getCallIDSet (CallID call_id)
 {
 
-    CallIDMap::iterator iter = _callIDMap.find(call_id);
+    CallIDMap::iterator iter = _callIDMap.find (call_id);
+
     if (iter != _callIDMap.end())
-	return iter->second;
+        return iter->second;
     else
-	return NULL;
+        return NULL;
 
 }
 
-bool MainBuffer::createCallIDSet(CallID set_id)
+bool MainBuffer::createCallIDSet (CallID set_id)
 {
-    _debug("---- MainBuffer::createCallIDSet %s\n", set_id.c_str());
-    
+    _debug ("---- MainBuffer::createCallIDSet %s\n", set_id.c_str());
+
     CallIDSet* newCallIDSet = new CallIDSet;
 
-    _callIDMap.insert(pair<CallID, CallIDSet*>(set_id, newCallIDSet));
+    _callIDMap.insert (pair<CallID, CallIDSet*> (set_id, newCallIDSet));
     // _callIDMap[set_id] = new CallIDSet;
 
     return true;
 
 }
 
-bool MainBuffer::removeCallIDSet(CallID set_id)
+bool MainBuffer::removeCallIDSet (CallID set_id)
 {
 
-    _debug("---- MainBuffer::removeCallIDSet %s\n", set_id.c_str());
+    _debug ("---- MainBuffer::removeCallIDSet %s\n", set_id.c_str());
 
 
-    CallIDSet* callid_set = getCallIDSet(set_id);
+    CallIDSet* callid_set = getCallIDSet (set_id);
 
-    if(callid_set != NULL)
-    {
-        if (_callIDMap.erase(set_id) != 0)
-	{
-	    _debug("          callid set %s erased!\n", set_id.c_str());
-	    return true;
-	}
-        else
-	{
-	    _debug("          error while removing callid set %s!\n", set_id.c_str());
-	    return false;
-	}
-    }
-    else
-    {
-	_debug("          callid set %s does not exist!\n", set_id.c_str());
-	return false;
+    if (callid_set != NULL) {
+        if (_callIDMap.erase (set_id) != 0) {
+            _debug ("          callid set %s erased!\n", set_id.c_str());
+            return true;
+        } else {
+            _debug ("          error while removing callid set %s!\n", set_id.c_str());
+            return false;
+        }
+    } else {
+        _debug ("          callid set %s does not exist!\n", set_id.c_str());
+        return false;
     }
 
 }
 
-void MainBuffer::addCallIDtoSet(CallID set_id, CallID call_id)
+void MainBuffer::addCallIDtoSet (CallID set_id, CallID call_id)
 {
-    _debug("---- MainBuffer::addCallIDtoSet %s in %s\n", set_id.c_str(), call_id.c_str());
+    _debug ("---- MainBuffer::addCallIDtoSet %s in %s\n", set_id.c_str(), call_id.c_str());
 
-    CallIDSet* callid_set = getCallIDSet(set_id);
-    callid_set->insert(call_id);
+    CallIDSet* callid_set = getCallIDSet (set_id);
+    callid_set->insert (call_id);
 
 }
 
-void MainBuffer::removeCallIDfromSet(CallID set_id, CallID call_id)
+void MainBuffer::removeCallIDfromSet (CallID set_id, CallID call_id)
 {
-    _debug("---- MainBuffer::removeCallIDfromSet element %s from %s\n", call_id.c_str(), set_id.c_str());
-
-    CallIDSet* callid_set = getCallIDSet(set_id);
-    if(callid_set != NULL)
-    {
-	if( callid_set->erase(call_id) != 0)
-	{
-	    _debug("          callid %s erased from set %s!\n", call_id.c_str(), set_id.c_str());
-	}
-	else
-	{
-	    _debug("          error while removing callid %s from set %s!\n", call_id.c_str(), set_id.c_str());
-	}
-    }
-    else
-    {
-	    _debug("          callid set %s does not exist!\n", set_id.c_str());
+    _debug ("---- MainBuffer::removeCallIDfromSet element %s from %s\n", call_id.c_str(), set_id.c_str());
+
+    CallIDSet* callid_set = getCallIDSet (set_id);
+
+    if (callid_set != NULL) {
+        if (callid_set->erase (call_id) != 0) {
+            _debug ("          callid %s erased from set %s!\n", call_id.c_str(), set_id.c_str());
+        } else {
+            _debug ("          error while removing callid %s from set %s!\n", call_id.c_str(), set_id.c_str());
+        }
+    } else {
+        _debug ("          callid set %s does not exist!\n", set_id.c_str());
     }
 }
 
 
-RingBuffer* MainBuffer::getRingBuffer(CallID call_id)
+RingBuffer* MainBuffer::getRingBuffer (CallID call_id)
 {
-    
-    RingBufferMap::iterator iter = _ringBufferMap.find(call_id);
-    if (iter == _ringBufferMap.end())
-    {
-	// _debug("ringBuffer with ID: \"%s\" doesn't exist! \n", call_id.c_str());
-	return NULL;
-    }
-    else
-	return iter->second;
+
+    RingBufferMap::iterator iter = _ringBufferMap.find (call_id);
+
+    if (iter == _ringBufferMap.end()) {
+        // _debug("ringBuffer with ID: \"%s\" doesn't exist! \n", call_id.c_str());
+        return NULL;
+    } else
+        return iter->second;
 }
 
 
-RingBuffer* MainBuffer::createRingBuffer(CallID call_id)
+RingBuffer* MainBuffer::createRingBuffer (CallID call_id)
 {
 
-    _debug("---- MainBuffer::createRingBuffer callid %s\n", call_id.c_str());
+    _debug ("---- MainBuffer::createRingBuffer callid %s\n", call_id.c_str());
 
-    RingBuffer* newRingBuffer = new RingBuffer(SIZEBUF, call_id);
+    RingBuffer* newRingBuffer = new RingBuffer (SIZEBUF, call_id);
 
-    _ringBufferMap.insert(pair<CallID, RingBuffer*>(call_id, newRingBuffer));
+    _ringBufferMap.insert (pair<CallID, RingBuffer*> (call_id, newRingBuffer));
 
     return newRingBuffer;
 }
 
 
-bool MainBuffer::removeRingBuffer(CallID call_id)
+bool MainBuffer::removeRingBuffer (CallID call_id)
 {
 
-    _debug("---- MainBuffer::removeRingBuffer call_id %s\n", call_id.c_str());
+    _debug ("---- MainBuffer::removeRingBuffer call_id %s\n", call_id.c_str());
 
-    RingBuffer* ring_buffer = getRingBuffer(call_id);
-    if(ring_buffer != NULL)
-    {
-        if (_ringBufferMap.erase(call_id) != 0)
-	{
-	    _debug("          ringbuffer %s removed!\n", call_id.c_str());
+    RingBuffer* ring_buffer = getRingBuffer (call_id);
+
+    if (ring_buffer != NULL) {
+        if (_ringBufferMap.erase (call_id) != 0) {
+            _debug ("          ringbuffer %s removed!\n", call_id.c_str());
             return true;
-	}
-        else
-	{
-	    _debug("          error while deleting ringbuffer %s!\n", call_id.c_str());
-	    return false;
-	}
-    }
-    else
-    {
-	_debug("          error ringbuffer %s does not exist!\n", call_id.c_str());
-	return true;
+        } else {
+            _debug ("          error while deleting ringbuffer %s!\n", call_id.c_str());
+            return false;
+        }
+    } else {
+        _debug ("          error ringbuffer %s does not exist!\n", call_id.c_str());
+        return true;
     }
 }
 
 
-void MainBuffer::bindCallID(CallID call_id1, CallID call_id2)
+void MainBuffer::bindCallID (CallID call_id1, CallID call_id2)
 {
 
     ost::MutexLock guard (_mutex);
 
-    _debug("---- MainBuffer::bindCallID %s and callid %s\n", call_id1.c_str(), call_id2.c_str());
+    _debug ("---- MainBuffer::bindCallID %s and callid %s\n", call_id1.c_str(), call_id2.c_str());
 
     RingBuffer* ring_buffer;
     CallIDSet* callid_set;
 
-    if((ring_buffer = getRingBuffer(call_id1)) == NULL)
-	createRingBuffer(call_id1);
+    if ( (ring_buffer = getRingBuffer (call_id1)) == NULL)
+        createRingBuffer (call_id1);
+
+    if ( (callid_set = getCallIDSet (call_id1)) == NULL)
+        createCallIDSet (call_id1);
+
+    if ( (ring_buffer = getRingBuffer (call_id2)) == NULL)
+        createRingBuffer (call_id2);
 
-    if((callid_set = getCallIDSet(call_id1)) == NULL)
-	createCallIDSet(call_id1);
+    if ( (callid_set = getCallIDSet (call_id2)) == NULL)
+        createCallIDSet (call_id2);
 
-    if((ring_buffer = getRingBuffer(call_id2)) == NULL)
-	createRingBuffer(call_id2);
+    getRingBuffer (call_id1)->createReadPointer (call_id2);
 
-    if((callid_set = getCallIDSet(call_id2)) == NULL)
-	createCallIDSet(call_id2);
+    getRingBuffer (call_id2)->createReadPointer (call_id1);
 
-    getRingBuffer(call_id1)->createReadPointer(call_id2);
-    getRingBuffer(call_id2)->createReadPointer(call_id1);
+    addCallIDtoSet (call_id1, call_id2);
 
-    addCallIDtoSet(call_id1, call_id2);
-    addCallIDtoSet(call_id2, call_id1);
+    addCallIDtoSet (call_id2, call_id1);
 
 }
 
 
-void MainBuffer::unBindCallID(CallID call_id1, CallID call_id2)
+void MainBuffer::unBindCallID (CallID call_id1, CallID call_id2)
 {
 
     ost::MutexLock guard (_mutex);
 
-    _debug("---- MainBuffer::unBindCallID %s and callid %s\n", call_id1.c_str(), call_id2.c_str());
+    _debug ("---- MainBuffer::unBindCallID %s and callid %s\n", call_id1.c_str(), call_id2.c_str());
 
-    removeCallIDfromSet(call_id1, call_id2);
-    removeCallIDfromSet(call_id2, call_id1);
+    removeCallIDfromSet (call_id1, call_id2);
+    removeCallIDfromSet (call_id2, call_id1);
 
     RingBuffer* ringbuffer;
 
-    ringbuffer = getRingBuffer(call_id2);
-    if(ringbuffer != NULL)
-    {
+    ringbuffer = getRingBuffer (call_id2);
 
-	ringbuffer->removeReadPointer(call_id1);
+    if (ringbuffer != NULL) {
 
-	if(ringbuffer->getNbReadPointer() == 0)
-        {
-	    removeCallIDSet(call_id2);
-	    removeRingBuffer(call_id2);
+        ringbuffer->removeReadPointer (call_id1);
+
+        if (ringbuffer->getNbReadPointer() == 0) {
+            removeCallIDSet (call_id2);
+            removeRingBuffer (call_id2);
         }
 
     }
 
-    ringbuffer = getRingBuffer(call_id1);
-    if(ringbuffer != NULL)
-    {
-	ringbuffer->removeReadPointer(call_id2);
+    ringbuffer = getRingBuffer (call_id1);
+
+    if (ringbuffer != NULL) {
+        ringbuffer->removeReadPointer (call_id2);
 
-        if(ringbuffer->getNbReadPointer() == 0)
-        {
-	    removeCallIDSet(call_id1);
-	    removeRingBuffer(call_id1);
+        if (ringbuffer->getNbReadPointer() == 0) {
+            removeCallIDSet (call_id1);
+            removeRingBuffer (call_id1);
         }
     }
 
 
 }
 
-void MainBuffer::unBindAll(CallID call_id)
+void MainBuffer::unBindAll (CallID call_id)
 {
 
     ost::MutexLock guard (_mutex);
 
-    CallIDSet* callid_set = getCallIDSet(call_id);
+    CallIDSet* callid_set = getCallIDSet (call_id);
 
     if (callid_set == NULL)
-	return;
+        return;
 
     if (callid_set->empty())
-	return;
-    
+        return;
+
     CallIDSet temp_set = *callid_set;
- 
+
     CallIDSet::iterator iter_set = temp_set.begin();
 
-    _debug("MainBuffer::unBindAll\n");
-    while (iter_set != temp_set.end())
-    {
-	CallID call_id_in_set = *iter_set;
-	unBindCallID(call_id, call_id_in_set);
+    _debug ("MainBuffer::unBindAll\n");
+
+    while (iter_set != temp_set.end()) {
+        CallID call_id_in_set = *iter_set;
+        unBindCallID (call_id, call_id_in_set);
 
-	iter_set++;
+        iter_set++;
     }
 
 }
 
 
-int MainBuffer::putData(void *buffer, int toCopy, unsigned short volume, CallID call_id)
+int MainBuffer::putData (void *buffer, int toCopy, unsigned short volume, CallID call_id)
 {
 
     ost::MutexLock guard (_mutex);
 
-    RingBuffer* ring_buffer = getRingBuffer(call_id);
+    RingBuffer* ring_buffer = getRingBuffer (call_id);
 
-    if (ring_buffer == NULL)
-    {
-	return 0;
+    if (ring_buffer == NULL) {
+        return 0;
     }
 
     int a;
@@ -318,92 +300,82 @@ int MainBuffer::putData(void *buffer, int toCopy, unsigned short volume, CallID
 
 }
 
-int MainBuffer::availForPut(CallID call_id)
+int MainBuffer::availForPut (CallID call_id)
 {
 
     ost::MutexLock guard (_mutex);
 
-    RingBuffer* ringbuffer = getRingBuffer(call_id);
+    RingBuffer* ringbuffer = getRingBuffer (call_id);
 
     if (ringbuffer == NULL)
-	return 0;
+        return 0;
     else
-	return ringbuffer->AvailForPut();
-    
+        return ringbuffer->AvailForPut();
+
 }
 
 
-int MainBuffer::getData(void *buffer, int toCopy, unsigned short volume, CallID call_id)
+int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, CallID call_id)
 {
     ost::MutexLock guard (_mutex);
 
-    CallIDSet* callid_set = getCallIDSet(call_id);
+    CallIDSet* callid_set = getCallIDSet (call_id);
 
-    int nbSmplToCopy = toCopy / sizeof(SFLDataFormat);
+    int nbSmplToCopy = toCopy / sizeof (SFLDataFormat);
 
-    if(callid_set == NULL)
-	return 0;
+    if (callid_set == NULL)
+        return 0;
 
-    if(callid_set->empty())
-    {
-	return 0;
-    }
-    
-    if (callid_set->size() == 1)
-    {
-
-	CallIDSet::iterator iter_id = callid_set->begin();
-
-	if (iter_id != callid_set->end())
-	{
-	    return getDataByID(buffer, toCopy, volume, *iter_id, call_id);
-	}
-	else 
-	    return 0;
+    if (callid_set->empty()) {
+        return 0;
     }
-    else
-    {
-
-	for (int k = 0; k < nbSmplToCopy; k++)
-	{
-	    ((SFLDataFormat*)(buffer))[k] = 0;
-	}
-
-	int size = 0;
-
-	CallIDSet::iterator iter_id = callid_set->begin();
-	while(iter_id != callid_set->end())
-	{
-	    
-	    size = getDataByID(mixBuffer, toCopy, volume, (CallID)(*iter_id), call_id);
-	    
-	    if (size > 0)
-	    {
-	        for (int k = 0; k < nbSmplToCopy; k++)
-	        {
-		    ((SFLDataFormat*)(buffer))[k] += mixBuffer[k];
-	        }
-	    }
-
-	    iter_id++;
-	}
-
-	return size;
+
+    if (callid_set->size() == 1) {
+
+        CallIDSet::iterator iter_id = callid_set->begin();
+
+        if (iter_id != callid_set->end()) {
+            return getDataByID (buffer, toCopy, volume, *iter_id, call_id);
+        } else
+            return 0;
+    } else {
+
+        for (int k = 0; k < nbSmplToCopy; k++) {
+            ( (SFLDataFormat*) (buffer)) [k] = 0;
+        }
+
+        int size = 0;
+
+        CallIDSet::iterator iter_id = callid_set->begin();
+
+        while (iter_id != callid_set->end()) {
+
+            size = getDataByID (mixBuffer, toCopy, volume, (CallID) (*iter_id), call_id);
+
+            if (size > 0) {
+                for (int k = 0; k < nbSmplToCopy; k++) {
+                    ( (SFLDataFormat*) (buffer)) [k] += mixBuffer[k];
+                }
+            }
+
+            iter_id++;
+        }
+
+        return size;
     }
 }
 
 
-int MainBuffer::getDataByID(void *buffer, int toCopy, unsigned short volume, CallID call_id, CallID reader_id)
+int MainBuffer::getDataByID (void *buffer, int toCopy, unsigned short volume, CallID call_id, CallID reader_id)
 {
 
     // _debug("MainBuffer::getDataByID in buffer %s by %s \n", call_id.c_str(), reader_id.c_str());
 
-    RingBuffer* ring_buffer = getRingBuffer(call_id);
+    RingBuffer* ring_buffer = getRingBuffer (call_id);
 
-    if (ring_buffer == NULL)
-    {
-	// _debug("Output RingBuffer ID: \"%s\" does not exist!\n", call_id.c_str());
-	return 0;
+    if (ring_buffer == NULL) {
+        // _debug("Output RingBuffer ID: \"%s\" does not exist!\n", call_id.c_str());
+        return 0;
     }
 
     return ring_buffer->Get (buffer, toCopy, volume, reader_id);
@@ -413,154 +385,143 @@ int MainBuffer::getDataByID(void *buffer, int toCopy, unsigned short volume, Cal
 }
 
 
-int MainBuffer::availForGet(CallID call_id)
+int MainBuffer::availForGet (CallID call_id)
 {
 
     ost::MutexLock guard (_mutex);
 
-    CallIDSet* callid_set = getCallIDSet(call_id);
+    CallIDSet* callid_set = getCallIDSet (call_id);
 
     if (callid_set == NULL)
-	return 0;
+        return 0;
 
-    if (callid_set->empty())
-    {
-	_debug("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
-	return 0;
+    if (callid_set->empty()) {
+        _debug ("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
+        return 0;
     }
 
-    if (callid_set->size() == 1)
-    {
-	CallIDSet::iterator iter_id = callid_set->begin();
-	// _debug("MainBuffer::availForGet availForGetByID(%s,%s)\n", (*iter_id).c_str(), call_id.c_str());
-	if((call_id != default_id) && (*iter_id == call_id))
-	{
-	  _debug("This problem should not occur since we have %i element\n", (int)callid_set->size());
-	}
-	// else
-	return availForGetByID(*iter_id, call_id);
-    }
-    else
-    {
-	// _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
-	int avail_bytes = 99999;
-	int nb_bytes;
-	CallIDSet::iterator iter_id = callid_set->begin();
-	for(iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++)
-	{
-	    nb_bytes = availForGetByID(*iter_id, call_id);
-	    if ((nb_bytes != 0) && (nb_bytes < avail_bytes))
-		avail_bytes = nb_bytes;
-	}
-	return avail_bytes != 99999 ? avail_bytes : 0;
+    if (callid_set->size() == 1) {
+        CallIDSet::iterator iter_id = callid_set->begin();
+        // _debug("MainBuffer::availForGet availForGetByID(%s,%s)\n", (*iter_id).c_str(), call_id.c_str());
+
+        if ( (call_id != default_id) && (*iter_id == call_id)) {
+            _debug ("This problem should not occur since we have %i element\n", (int) callid_set->size());
+        }
+
+        // else
+        return availForGetByID (*iter_id, call_id);
+    } else {
+        // _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
+        int avail_bytes = 99999;
+        int nb_bytes;
+        CallIDSet::iterator iter_id = callid_set->begin();
+
+        for (iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++) {
+            nb_bytes = availForGetByID (*iter_id, call_id);
+
+            if ( (nb_bytes != 0) && (nb_bytes < avail_bytes))
+                avail_bytes = nb_bytes;
+        }
+
+        return avail_bytes != 99999 ? avail_bytes : 0;
     }
 
 }
 
 
-int MainBuffer::availForGetByID(CallID call_id, CallID reader_id)
+int MainBuffer::availForGetByID (CallID call_id, CallID reader_id)
 {
 
-    if((call_id != default_id) && (reader_id == call_id))
-    {
-	_debug("**********************************************************************\n");
-	_debug("Error an RTP session ring buffer is not supposed to have a readpointer on tiself\n");
+    if ( (call_id != default_id) && (reader_id == call_id)) {
+        _debug ("**********************************************************************\n");
+        _debug ("Error an RTP session ring buffer is not supposed to have a readpointer on tiself\n");
     }
 
-    RingBuffer* ringbuffer = getRingBuffer(call_id);
-    
-    if (ringbuffer == NULL)
-    {
-	_debug("Error: ring buffer does not exist\n");
-	return 0;
-    }
-    else
-	return ringbuffer->AvailForGet(reader_id);
+    RingBuffer* ringbuffer = getRingBuffer (call_id);
+
+    if (ringbuffer == NULL) {
+        _debug ("Error: ring buffer does not exist\n");
+        return 0;
+    } else
+        return ringbuffer->AvailForGet (reader_id);
 
 }
 
 
-int MainBuffer::discard(int toDiscard, CallID call_id)
+int MainBuffer::discard (int toDiscard, CallID call_id)
 {
     // _debug("MainBuffer::discard\n");
 
     ost::MutexLock guard (_mutex);
 
-    CallIDSet* callid_set = getCallIDSet(call_id);
+    CallIDSet* callid_set = getCallIDSet (call_id);
 
     if (callid_set == NULL)
-	return 0;
+        return 0;
 
-    if(callid_set->empty())
-    {
-	// _debug("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
-	return 0;
+    if (callid_set->empty()) {
+        // _debug("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
+        return 0;
     }
 
 
-    if (callid_set->size() == 1)
-    {
-	CallIDSet::iterator iter_id = callid_set->begin();
-	// _debug("Discard Data in \"%s\" RingBuffer for \"%s\" ReaderPointer\n",(*iter_id).c_str(),call_id.c_str());
-	return discardByID(toDiscard, *iter_id, call_id);
-    }
-    else
-    {
-	// _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
-	CallIDSet::iterator iter_id;
-	for(iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++)
-	{
-	    discardByID(toDiscard, *iter_id, call_id);
-	}
-	return toDiscard;
+    if (callid_set->size() == 1) {
+        CallIDSet::iterator iter_id = callid_set->begin();
+        // _debug("Discard Data in \"%s\" RingBuffer for \"%s\" ReaderPointer\n",(*iter_id).c_str(),call_id.c_str());
+        return discardByID (toDiscard, *iter_id, call_id);
+    } else {
+        // _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
+        CallIDSet::iterator iter_id;
+
+        for (iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++) {
+            discardByID (toDiscard, *iter_id, call_id);
+        }
+
+        return toDiscard;
     }
 
 }
 
 
-int MainBuffer::discardByID(int toDiscard, CallID call_id, CallID reader_id)
+int MainBuffer::discardByID (int toDiscard, CallID call_id, CallID reader_id)
 {
 
-    RingBuffer* ringbuffer = getRingBuffer(call_id);
-    
-    if(ringbuffer == NULL)
-	return 0;
+    RingBuffer* ringbuffer = getRingBuffer (call_id);
+
+    if (ringbuffer == NULL)
+        return 0;
     else
-	return ringbuffer->Discard(toDiscard, reader_id);
+        return ringbuffer->Discard (toDiscard, reader_id);
 
 }
 
 
 
-void MainBuffer::flush(CallID call_id)
+void MainBuffer::flush (CallID call_id)
 {
     ost::MutexLock guard (_mutex);
 
     // _debug("MainBuffer::flush\n");
 
-    CallIDSet* callid_set = getCallIDSet(call_id);
+    CallIDSet* callid_set = getCallIDSet (call_id);
 
     if (callid_set == NULL)
-	return;
+        return;
 
-    if(callid_set->empty())
-    {
-	// _debug("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
+    if (callid_set->empty()) {
+        // _debug("CallIDSet with ID: \"%s\" is empty!\n", call_id.c_str());
     }
 
-    if (callid_set->size() == 1)
-    {
-	CallIDSet::iterator iter_id = callid_set->begin();
-	flushByID(*iter_id, call_id);
-    }
-    else
-    {
-	// _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
-	CallIDSet::iterator iter_id;
-	for(iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++)
-	{
-	    flushByID(*iter_id, call_id);
-	}
+    if (callid_set->size() == 1) {
+        CallIDSet::iterator iter_id = callid_set->begin();
+        flushByID (*iter_id, call_id);
+    } else {
+        // _debug("CallIDSet with ID: \"%s\" is a conference!\n", call_id.c_str());
+        CallIDSet::iterator iter_id;
+
+        for (iter_id = callid_set->begin(); iter_id != callid_set->end(); iter_id++) {
+            flushByID (*iter_id, call_id);
+        }
     }
 
 }
@@ -569,67 +530,63 @@ void MainBuffer::flushDefault()
 {
     ost::MutexLock guard (_mutex);
 
-    flushByID(default_id, default_id);
+    flushByID (default_id, default_id);
 
 }
 
 
-void MainBuffer::flushByID(CallID call_id, CallID reader_id)
+void MainBuffer::flushByID (CallID call_id, CallID reader_id)
 {
 
-    RingBuffer* ringbuffer = getRingBuffer(call_id);
+    RingBuffer* ringbuffer = getRingBuffer (call_id);
 
-    if(ringbuffer != NULL)
-	ringbuffer->flush(reader_id);
+    if (ringbuffer != NULL)
+        ringbuffer->flush (reader_id);
 }
 
 
 void MainBuffer::flushAllBuffers()
 {
 
-  // _debug("-------------------------- flushAllBuffers()\n");
+    // _debug("-------------------------- flushAllBuffers()\n");
 
     RingBufferMap::iterator iter_buffer = _ringBufferMap.begin();
 
-    while(iter_buffer != _ringBufferMap.end())
-    {
-      // _debug("--------------------------    flushing: %s\n",iter_buffer->second->getBufferId().c_str());
+    while (iter_buffer != _ringBufferMap.end()) {
+        // _debug("--------------------------    flushing: %s\n",iter_buffer->second->getBufferId().c_str());
 
-	iter_buffer->second->flushAll();
+        iter_buffer->second->flushAll();
 
-	iter_buffer++;
+        iter_buffer++;
     }
 }
 
 
 void MainBuffer::stateInfo()
 {
-    _debug("MainBuffer state info\n");
+    _debug ("MainBuffer state info\n");
 
     CallIDMap::iterator iter_map = _callIDMap.begin();
 
-    while(iter_map != _callIDMap.end())
-    {
-	CallIDSet* id_set = getCallIDSet(iter_map->first);
+    while (iter_map != _callIDMap.end()) {
+        CallIDSet* id_set = getCallIDSet (iter_map->first);
 
-	std::string dbg_str("    Buffer: ");
+        std::string dbg_str ("    Buffer: ");
 
-	dbg_str.append(string(iter_map->first.c_str()));
-	dbg_str.append(string(" bound to "));
+        dbg_str.append (string (iter_map->first.c_str()));
+        dbg_str.append (string (" bound to "));
 
-	if(id_set != NULL)
-	{
-	    CallIDSet::iterator iter_set = id_set->begin();
+        if (id_set != NULL) {
+            CallIDSet::iterator iter_set = id_set->begin();
+
+            while (iter_set != id_set->end()) {
+                dbg_str.append (string (iter_set->c_str()));
+                dbg_str.append (string (", "));
+            }
+        }
 
-	    while(iter_set != id_set->end())
-	    {
-	        dbg_str.append(string(iter_set->c_str()));
-		dbg_str.append(string(", "));
-	    }
-	}
+        _debug ("%s\n", dbg_str.c_str());
 
-	_debug("%s\n", dbg_str.c_str());
-	
-	iter_map++;
+        iter_map++;
     }
 }
diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
index 565ef8b78349b8a2d5f303e4a59166c05cc61cd2..89986506eede7627bdde82ca37928eca99300d41 100644
--- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp
+++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
@@ -32,7 +32,7 @@ AudioStream::AudioStream (PulseLayerType * driver)
         _volume(),
         flag (PA_STREAM_AUTO_TIMING_UPDATE),
         sample_spec(),
-	_mainloop (driver->mainloop)
+        _mainloop (driver->mainloop)
 {
     sample_spec.format = PA_SAMPLE_S16LE;
     // sample_spec.format = PA_SAMPLE_FLOAT32LE;
@@ -177,7 +177,7 @@ AudioStream::createStream (pa_context* c)
     // ss.format = PA_SAMPLE_S16LE;
     // ss.rate = 44100;
     // ss.channels = 1;
-    
+
 
     assert (pa_sample_spec_valid (&sample_spec));
     assert (pa_channel_map_valid (&channel_map));
@@ -190,29 +190,29 @@ AudioStream::createStream (pa_context* c)
     assert (s);
 
     // parameters are defined as number of bytes
-    // 2048 bytes (1024 int16) is 20 ms at 44100 Hz 
+    // 2048 bytes (1024 int16) is 20 ms at 44100 Hz
     if (_streamType == PLAYBACK_STREAM) {
 
-	// 20 ms framesize TODO: take framesize value from config
+        // 20 ms framesize TODO: take framesize value from config
         attributes->maxlength = (uint32_t) -1;
-        attributes->tlength = pa_usec_to_bytes(50 * PA_USEC_PER_MSEC, &sample_spec);
-        attributes->prebuf = (uint32_t) -1;      
+        attributes->tlength = pa_usec_to_bytes (50 * PA_USEC_PER_MSEC, &sample_spec);
+        attributes->prebuf = (uint32_t) -1;
         attributes->minreq = (uint32_t) -1;
         attributes->fragsize = (uint32_t) -1;
-	
-	pa_stream_connect_playback( s , NULL , attributes, PA_STREAM_ADJUST_LATENCY, &_volume, NULL);
+
+        pa_stream_connect_playback (s , NULL , attributes, PA_STREAM_ADJUST_LATENCY, &_volume, NULL);
     } else if (_streamType == CAPTURE_STREAM) {
 
-	// 20 ms framesize TODO: take framesize value from config
+        // 20 ms framesize TODO: take framesize value from config
         attributes->maxlength = (uint32_t) -1;
         attributes->tlength = (uint32_t) -1;
         attributes->prebuf = (uint32_t) -1;
         attributes->minreq = (uint32_t) -1;
-        attributes->fragsize = pa_usec_to_bytes(50 * PA_USEC_PER_MSEC, &sample_spec);
-	
-	
+        attributes->fragsize = pa_usec_to_bytes (50 * PA_USEC_PER_MSEC, &sample_spec);
+
+
 
-	pa_stream_connect_record( s, NULL, attributes, (pa_stream_flags_t)(PA_STREAM_PEAK_DETECT|PA_STREAM_ADJUST_LATENCY));
+        pa_stream_connect_record (s, NULL, attributes, (pa_stream_flags_t) (PA_STREAM_PEAK_DETECT|PA_STREAM_ADJUST_LATENCY));
     } else if (_streamType == UPLOAD_STREAM) {
         pa_stream_connect_upload (s , 1024);
     } else {
diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
index 2a7c11fdc83e5f36a58ea6b658fd4941f3b88e33..8f5b94c5a0b96f0045417116322fc0f96841e15f 100644
--- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
+++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
@@ -37,8 +37,8 @@ static void capture_callback (pa_stream* s, size_t bytes, void* userdata)
 {
     // _debug("capture_callback\n");
 
-    assert(s && bytes);
-    assert(bytes > 0);
+    assert (s && bytes);
+    assert (bytes > 0);
     static_cast<PulseLayer*> (userdata)->processCaptureData();
     // static_cast<PulseLayer*> (userdata)->processData();
 }
@@ -65,19 +65,19 @@ static void playback_underflow_callback (pa_stream* s,  void* userdata UNUSED)
     // _debug("         pa write_index_corupt (if not 0): %i\n",  info->write_index_corrupt);
     // _debug("         pa read_index: %l\n", (long)(info->read_index));
     // _debug("         pa read_index_corrupt (if not 0): %i\n", info->read_index_corrupt);
-    
 
-    // fill in audio buffer twice the prebuffering value to restart playback 
-    pa_stream_writable_size(s);
+
+    // fill in audio buffer twice the prebuffering value to restart playback
+    pa_stream_writable_size (s);
     pa_stream_trigger (s, NULL, NULL);
-    
+
 
 }
 
 
 static void playback_overflow_callback (pa_stream* s UNUSED, void* userdata UNUSED)
 {
-    _debug("PulseLayer::Buffer OverFlow\n");
+    _debug ("PulseLayer::Buffer OverFlow\n");
     //PulseLayer* pulse = (PulseLayer*) userdata;
     // pa_stream_drop (s);
     // pa_stream_trigger (s, NULL, NULL);
@@ -104,10 +104,13 @@ PulseLayer::~PulseLayer (void)
     closeLayer ();
 
     if (_converter) {
-	delete _converter; _converter = NULL;
+        delete _converter;
+        _converter = NULL;
     }
 
-    delete dcblocker; dcblocker = NULL;
+    delete dcblocker;
+
+    dcblocker = NULL;
 }
 
 bool
@@ -152,7 +155,7 @@ PulseLayer::connectPulseAudioServer (void)
 {
     _debug ("PulseLayer::connectPulseAudioServer \n");
 
-    setenv("PULSE_PROP_media.role", "phone", 1);
+    setenv ("PULSE_PROP_media.role", "phone", 1);
 
     pa_context_flags_t flag = PA_CONTEXT_NOAUTOSPAWN ;
 
@@ -219,7 +222,7 @@ bool PulseLayer::disconnectAudioStream (void)
     _debug (" PulseLayer::disconnectAudioStream( void ) \n");
 
     closePlaybackStream();
-    
+
     closeCaptureStream();
 
     if (!playback && !record)
@@ -242,9 +245,9 @@ bool PulseLayer::createStreams (pa_context* c)
 
     playback = new AudioStream (playbackParam);
     playback->connectStream();
-    pa_stream_set_write_callback(playback->pulseStream(), playback_callback, this);
-    pa_stream_set_overflow_callback(playback->pulseStream(), playback_overflow_callback, this);
-    pa_stream_set_underflow_callback(playback->pulseStream(), playback_underflow_callback, this);
+    pa_stream_set_write_callback (playback->pulseStream(), playback_callback, this);
+    pa_stream_set_overflow_callback (playback->pulseStream(), playback_overflow_callback, this);
+    pa_stream_set_underflow_callback (playback->pulseStream(), playback_underflow_callback, this);
     // pa_stream_set_suspended_callback(playback->pulseStream(), stream_suspended_callback, this);
     // pa_stream_set_moved_callback(playback->pulseStream(), stream_moved_callback, this);
     delete playbackParam;
@@ -291,10 +294,10 @@ void PulseLayer::closeCaptureStream (void)
 {
     if (record) {
 
-	pa_threaded_mainloop_lock (m);
-	delete record;
-	pa_threaded_mainloop_unlock (m);
-	record=NULL;
+        pa_threaded_mainloop_lock (m);
+        delete record;
+        pa_threaded_mainloop_unlock (m);
+        record=NULL;
     }
 }
 
@@ -302,10 +305,10 @@ void PulseLayer::closePlaybackStream (void)
 {
     if (playback) {
 
-	pa_threaded_mainloop_lock (m);
-	delete playback;
-	pa_threaded_mainloop_unlock (m);
-	playback=NULL;
+        pa_threaded_mainloop_lock (m);
+        delete playback;
+        pa_threaded_mainloop_unlock (m);
+        playback=NULL;
     }
 }
 
@@ -329,42 +332,45 @@ void PulseLayer::startStream (void)
 {
     // connectPulseAudioServer();
 
-    if(!is_started) {
+    if (!is_started) {
+
+        _debug ("PulseLayer::Start Stream\n");
+
+        if (!m) {
 
-	_debug ("PulseLayer::Start Stream\n");
+            _debug ("Creating PulseAudio MainLoop\n");
+            m = pa_threaded_mainloop_new();
+            assert (m);
 
-	if (!m) {
+            if (pa_threaded_mainloop_start (m) < 0) {
+                _debug ("Failed starting the mainloop\n");
+            }
+        }
 
-	    _debug("Creating PulseAudio MainLoop\n");
-	    m = pa_threaded_mainloop_new();
-	    assert (m);
-	
-	    if (pa_threaded_mainloop_start (m) < 0) {
-		_debug ("Failed starting the mainloop\n");
-	    }
-	}
+        if (!context) {
 
-	if (!context) {
+            _debug ("Creating new PulseAudio Context\n");
+            pa_threaded_mainloop_lock (m);
+            // Instanciate a context
 
-	    _debug("Creating new PulseAudio Context\n");
-	    pa_threaded_mainloop_lock (m);
-	    // Instanciate a context
-	    if (! (context = pa_context_new (pa_threaded_mainloop_get_api (m) , "SFLphone")))
-		_debug ("Error while creating the context\n");
-	    pa_threaded_mainloop_unlock (m);
-	    
-	    assert (context);
-	}
+            if (! (context = pa_context_new (pa_threaded_mainloop_get_api (m) , "SFLphone")))
+                _debug ("Error while creating the context\n");
 
-	// Create Streams
-	connectPulseAudioServer();
+            pa_threaded_mainloop_unlock (m);
 
-	is_started = true;
+            assert (context);
+        }
+
+        // Create Streams
+        connectPulseAudioServer();
+
+        is_started = true;
     }
 
-    // Flush outside the if statement: every time start stream is 
+    // Flush outside the if statement: every time start stream is
     // called is to notify a new event
     flushUrgent();
+
     flushMain();
 
 }
@@ -373,38 +379,38 @@ void
 PulseLayer::stopStream (void)
 {
 
-    if(is_started) {
+    if (is_started) {
 
-	_debug ("PulseLayer::Stop Audio Stream\n");
-	pa_stream_flush (playback->pulseStream(), NULL, NULL);
-	pa_stream_flush (record->pulseStream(), NULL, NULL);
+        _debug ("PulseLayer::Stop Audio Stream\n");
+        pa_stream_flush (playback->pulseStream(), NULL, NULL);
+        pa_stream_flush (record->pulseStream(), NULL, NULL);
 
-	if (m) {
-	    pa_threaded_mainloop_stop (m);
-	}
+        if (m) {
+            pa_threaded_mainloop_stop (m);
+        }
 
-	disconnectAudioStream();
+        disconnectAudioStream();
 
-	_debug("Disconnecting PulseAudio context\n");
+        _debug ("Disconnecting PulseAudio context\n");
 
-	if (context) {
+        if (context) {
 
-	    pa_threaded_mainloop_lock (m);
-	    pa_context_disconnect (context);
-	    pa_context_unref (context);
-	    pa_threaded_mainloop_unlock (m);
-	    context = NULL;
-	}
+            pa_threaded_mainloop_lock (m);
+            pa_context_disconnect (context);
+            pa_context_unref (context);
+            pa_threaded_mainloop_unlock (m);
+            context = NULL;
+        }
+
+        _debug ("Freeing Pulseaudio mainloop\n");
 
-	_debug("Freeing Pulseaudio mainloop\n");
+        if (m) {
+            pa_threaded_mainloop_free (m);
+            m = NULL;
+        }
 
-	if (m) {
-	    pa_threaded_mainloop_free (m);
-	    m = NULL;
-	}
-	
 
-	is_started = false;
+        is_started = false;
 
     }
 
@@ -430,9 +436,9 @@ void PulseLayer::overflow (pa_stream* s, void* userdata UNUSED)
 void PulseLayer::processPlaybackData (void)
 {
     // Handle the data for the speakers
-    if ( playback &&(playback->pulseStream()) && (pa_stream_get_state (playback->pulseStream()) == PA_STREAM_READY)) {
+    if (playback && (playback->pulseStream()) && (pa_stream_get_state (playback->pulseStream()) == PA_STREAM_READY)) {
 
-	// _debug("PulseLayer::processPlaybackData()\n");
+        // _debug("PulseLayer::processPlaybackData()\n");
 
         // If the playback buffer is full, we don't overflow it; wait for it to have free space
         if (pa_stream_writable_size (playback->pulseStream()) == 0)
@@ -444,24 +450,24 @@ void PulseLayer::processPlaybackData (void)
 }
 
 
-void PulseLayer::processCaptureData(void)
+void PulseLayer::processCaptureData (void)
 {
 
     // Handle the mic
     // We check if the stream is ready
-    if ( record &&(record->pulseStream()) && (pa_stream_get_state (record->pulseStream()) == PA_STREAM_READY))
+    if (record && (record->pulseStream()) && (pa_stream_get_state (record->pulseStream()) == PA_STREAM_READY))
         readFromMic();
-    
+
 }
 
 
-void PulseLayer::processData(void)
+void PulseLayer::processData (void)
 {
 
     // Handle the data for the speakers
-    if ( playback &&(playback->pulseStream()) && (pa_stream_get_state (playback->pulseStream()) == PA_STREAM_READY)) {
+    if (playback && (playback->pulseStream()) && (pa_stream_get_state (playback->pulseStream()) == PA_STREAM_READY)) {
 
-	// _debug("PulseLayer::processPlaybackData()\n");
+        // _debug("PulseLayer::processPlaybackData()\n");
 
         // If the playback buffer is full, we don't overflow it; wait for it to have free space
         if (pa_stream_writable_size (playback->pulseStream()) == 0)
@@ -472,7 +478,7 @@ void PulseLayer::processData(void)
 
     // Handle the mic
     // We check if the stream is ready
-    if ( record &&(record->pulseStream()) && (pa_stream_get_state (record->pulseStream()) == PA_STREAM_READY))
+    if (record && (record->pulseStream()) && (pa_stream_get_state (record->pulseStream()) == PA_STREAM_READY))
         readFromMic();
 
 }
@@ -490,13 +496,13 @@ void PulseLayer::writeToSpeaker (void)
 
     SFLDataFormat* out;// = (SFLDataFormat*)pa_xmalloc(framesPerBuffer);
     urgentAvailBytes = _urgentRingBuffer.AvailForGet();
-    
 
-    int writeableSize = pa_stream_writable_size(playback->pulseStream());
+
+    int writeableSize = pa_stream_writable_size (playback->pulseStream());
     // _debug("PulseLayer writablesize : %i\n", writeableSize);
 
-    if(writeableSize < 0)
-	_debug("PulseLayer playback error : %s\n", pa_strerror(writeableSize));
+    if (writeableSize < 0)
+        _debug ("PulseLayer playback error : %s\n", pa_strerror (writeableSize));
 
 
     if (urgentAvailBytes > writeableSize) {
@@ -505,13 +511,13 @@ void PulseLayer::writeToSpeaker (void)
 
         // _debug("Play Urgent!\n");
 
-	out = (SFLDataFormat*) pa_xmalloc (writeableSize);
+        out = (SFLDataFormat*) pa_xmalloc (writeableSize);
         _urgentRingBuffer.Get (out, writeableSize, 100);
-	// pa_threaded_mainloop_lock (m);
+        // pa_threaded_mainloop_lock (m);
         pa_stream_write (playback->pulseStream(), out, writeableSize, NULL, 0, PA_SEEK_RELATIVE);
-	// pa_threaded_mainloop_unlock (m);
+        // pa_threaded_mainloop_unlock (m);
 
-	pa_xfree(out);
+        pa_xfree (out);
 
         // Consume the regular one as well (same amount of bytes)
         getMainBuffer()->discard (writeableSize);
@@ -520,129 +526,129 @@ void PulseLayer::writeToSpeaker (void)
     } else {
 
         AudioLoop* tone = _manager->getTelephoneTone();
-	AudioLoop* file_tone = _manager->getTelephoneFile();
+        AudioLoop* file_tone = _manager->getTelephoneFile();
 
-	// flush remaining samples in _urgentRingBuffer
-	flushUrgent();
+        // flush remaining samples in _urgentRingBuffer
+        flushUrgent();
 
         if (tone != 0) {
 
-	    // _debug("PlayTone writeableSize: %i\n", writeableSize);
+            // _debug("PlayTone writeableSize: %i\n", writeableSize);
 
-	    if (playback->getStreamState() == PA_STREAM_READY)
-	    {
+            if (playback->getStreamState() == PA_STREAM_READY) {
 
-	        // _debug("Play Sine Tone!\n");
+                // _debug("Play Sine Tone!\n");
 
-		out = (SFLDataFormat*) pa_xmalloc (writeableSize);
-		int copied = tone->getNext (out, writeableSize / sizeof (SFLDataFormat), 100);
-		// pa_threaded_mainloop_lock (m);
-		pa_stream_write (playback->pulseStream(), out, copied * sizeof(SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
-		// pa_threaded_mainloop_unlock (m);
+                out = (SFLDataFormat*) pa_xmalloc (writeableSize);
+                int copied = tone->getNext (out, writeableSize / sizeof (SFLDataFormat), 100);
+                // pa_threaded_mainloop_lock (m);
+                pa_stream_write (playback->pulseStream(), out, copied * sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
+                // pa_threaded_mainloop_unlock (m);
 
-		pa_xfree(out);
+                pa_xfree (out);
 
-	    }
+            }
         }
 
         else if (file_tone != 0) {
 
-	    if (playback->getStreamState() == PA_STREAM_READY)
-	    {
-	        // _debug("Play File Tone!\n");
-		
-		out = (SFLDataFormat*) pa_xmalloc (writeableSize);
-		int copied = file_tone->getNext(out, writeableSize / sizeof(SFLDataFormat), 100);
-		// pa_threaded_mainloop_lock (m);
-		pa_stream_write (playback->pulseStream(), out, copied * sizeof(SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
+            if (playback->getStreamState() == PA_STREAM_READY) {
+                // _debug("Play File Tone!\n");
 
-		pa_xfree(out);
-		// pa_threaded_mainloop_unlock (m);
+                out = (SFLDataFormat*) pa_xmalloc (writeableSize);
+                int copied = file_tone->getNext (out, writeableSize / sizeof (SFLDataFormat), 100);
+                // pa_threaded_mainloop_lock (m);
+                pa_stream_write (playback->pulseStream(), out, copied * sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
 
-	    }
+                pa_xfree (out);
+                // pa_threaded_mainloop_unlock (m);
+
+            }
 
         } else {
 
-	    int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
+            int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
 
-	    int maxNbBytesToGet = 0;
+            int maxNbBytesToGet = 0;
 
 
-	    // test if audio resampling is needed
-	    if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
- 
-		// upsamplefactor is used to compute the number of bytes to get in the ring buffer 
-		double upsampleFactor = (double) _mainBufferSampleRate / _audioSampleRate;
+            // test if audio resampling is needed
 
-		maxNbBytesToGet = ((double) writeableSize * upsampleFactor);
+            if (_mainBufferSampleRate && ( (int) _audioSampleRate != _mainBufferSampleRate)) {
 
-	    } else {
+                // upsamplefactor is used to compute the number of bytes to get in the ring buffer
+                double upsampleFactor = (double) _mainBufferSampleRate / _audioSampleRate;
 
-		// maxNbSamplesToGet = framesPerBuffer;
-		maxNbBytesToGet = writeableSize;
+                maxNbBytesToGet = ( (double) writeableSize * upsampleFactor);
 
-	    }
+            } else {
+
+                // maxNbSamplesToGet = framesPerBuffer;
+                maxNbBytesToGet = writeableSize;
+
+            }
 
             normalAvailBytes = getMainBuffer()->availForGet();
-	    
-            byteToGet = (normalAvailBytes < (int)(maxNbBytesToGet)) ? normalAvailBytes : maxNbBytesToGet;
+
+            byteToGet = (normalAvailBytes < (int) (maxNbBytesToGet)) ? normalAvailBytes : maxNbBytesToGet;
 
             if (byteToGet) {
 
-		// Sending an odd number of byte breaks the audio!
-		// TODO, find out where the problem occurs to get rid of this hack
-		if( (byteToGet%2) != 0 )
-		    byteToGet = byteToGet-1;
+                // Sending an odd number of byte breaks the audio!
+                // TODO, find out where the problem occurs to get rid of this hack
+                if ( (byteToGet%2) != 0)
+                    byteToGet = byteToGet-1;
 
-		out = (SFLDataFormat*) pa_xmalloc (maxNbBytesToGet);
+                out = (SFLDataFormat*) pa_xmalloc (maxNbBytesToGet);
 
                 getMainBuffer()->getData (out, byteToGet, 100);
 
-		// test if resampling is required
-		if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
+                // test if resampling is required
+                if (_mainBufferSampleRate && ( (int) _audioSampleRate != _mainBufferSampleRate)) {
 
-		    SFLDataFormat* rsmpl_out = (SFLDataFormat*) pa_xmalloc (writeableSize);
-		    
-		    // Do sample rate conversion
-		    int nb_sample_down = byteToGet / sizeof(SFLDataFormat);
+                    SFLDataFormat* rsmpl_out = (SFLDataFormat*) pa_xmalloc (writeableSize);
 
-		    int nbSample = _converter->upsampleData((SFLDataFormat*)out, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_down);
+                    // Do sample rate conversion
+                    int nb_sample_down = byteToGet / sizeof (SFLDataFormat);
 
-		    if((nbSample*sizeof(SFLDataFormat)) > (unsigned int)writeableSize)
-			_debug("Error: nbsbyte exceed buffer length\n");
+                    int nbSample = _converter->upsampleData ( (SFLDataFormat*) out, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_down);
 
-		    // pa_threaded_mainloop_lock (m);
-		    pa_stream_write (playback->pulseStream(), rsmpl_out, nbSample*sizeof(SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
-		    // pa_threaded_mainloop_unlock (m);
-		    pa_xfree(rsmpl_out);
+                    if ( (nbSample*sizeof (SFLDataFormat)) > (unsigned int) writeableSize)
+                        _debug ("Error: nbsbyte exceed buffer length\n");
 
-		} else {
+                    // pa_threaded_mainloop_lock (m);
+                    pa_stream_write (playback->pulseStream(), rsmpl_out, nbSample*sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
 
-		    pa_stream_write (playback->pulseStream(), out, byteToGet, NULL, 0, PA_SEEK_RELATIVE);
+                    // pa_threaded_mainloop_unlock (m);
+                    pa_xfree (rsmpl_out);
 
-		}
+                } else {
 
-		pa_xfree(out);
+                    pa_stream_write (playback->pulseStream(), out, byteToGet, NULL, 0, PA_SEEK_RELATIVE);
+
+                }
+
+                pa_xfree (out);
 
             } else {
 
-		if((tone == 0) && (file_tone == 0)) {
-		    
-		    SFLDataFormat* zeros = (SFLDataFormat*)pa_xmalloc (writeableSize);
-  
-		    bzero (zeros, writeableSize);
+                if ( (tone == 0) && (file_tone == 0)) {
+
+                    SFLDataFormat* zeros = (SFLDataFormat*) pa_xmalloc (writeableSize);
 
-		    // pa_threaded_mainloop_lock (m);
-		    pa_stream_write(playback->pulseStream(), zeros, writeableSize, NULL, 0, PA_SEEK_RELATIVE);
-		    // pa_threaded_mainloop_unlock (m);
+                    bzero (zeros, writeableSize);
 
-		    pa_xfree(zeros);
+                    // pa_threaded_mainloop_lock (m);
+                    pa_stream_write (playback->pulseStream(), zeros, writeableSize, NULL, 0, PA_SEEK_RELATIVE);
+                    // pa_threaded_mainloop_unlock (m);
 
-		}
+                    pa_xfree (zeros);
+
+                }
             }
 
-	    
-	    _urgentRingBuffer.Discard(byteToGet);
+
+            _urgentRingBuffer.Discard (byteToGet);
 
         }
 
@@ -658,38 +664,39 @@ void PulseLayer::readFromMic (void)
     // if (record->getStreamState()
     // pa_threaded_mainloop_lock (m);
 
-    int readableSize = pa_stream_readable_size(record->pulseStream());
+    int readableSize = pa_stream_readable_size (record->pulseStream());
 
     // _debug("readableSize: %i\n", readableSize);
 
     if (pa_stream_peek (record->pulseStream() , (const void**) &data , &r) < 0 || !data) {
-        _debug("pa_stream_peek() failed: %s\n" , pa_strerror( pa_context_errno( context) ));
+        _debug ("pa_stream_peek() failed: %s\n" , pa_strerror (pa_context_errno (context)));
     }
 
     if (data != 0) {
 
-	int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
+        int _mainBufferSampleRate = getMainBuffer()->getInternalSamplingRate();
 
-	// test if resampling is required
-        if (_mainBufferSampleRate && ((int)_audioSampleRate != _mainBufferSampleRate)) {
+        // test if resampling is required
 
+        if (_mainBufferSampleRate && ( (int) _audioSampleRate != _mainBufferSampleRate)) {
 
 
-	    SFLDataFormat* rsmpl_out = (SFLDataFormat*) pa_xmalloc (readableSize);
-	    // _debug("Byte read: %i\n", r);
-	    int nbSample = r / sizeof(SFLDataFormat);
- 
+
+            SFLDataFormat* rsmpl_out = (SFLDataFormat*) pa_xmalloc (readableSize);
+            // _debug("Byte read: %i\n", r);
+            int nbSample = r / sizeof (SFLDataFormat);
+
             int nb_sample_up = nbSample;
 
-            
-            nbSample = _converter->downsampleData ((SFLDataFormat*)data, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_up);
 
-	    // remove dc offset
-	    dcblocker->filter_signal( rsmpl_out, nbSample );
+            nbSample = _converter->downsampleData ( (SFLDataFormat*) data, rsmpl_out, _mainBufferSampleRate, _audioSampleRate, nb_sample_up);
 
-	    getMainBuffer()->putData ( (void*) rsmpl_out, nbSample*sizeof(SFLDataFormat), 100);
+            // remove dc offset
+            dcblocker->filter_signal (rsmpl_out, nbSample);
 
-	    pa_xfree (rsmpl_out);
+            getMainBuffer()->putData ( (void*) rsmpl_out, nbSample*sizeof (SFLDataFormat), 100);
+
+            pa_xfree (rsmpl_out);
 
         } else {
 
@@ -698,7 +705,7 @@ void PulseLayer::readFromMic (void)
         }
 
 
-	
+
     }
 
     if (pa_stream_drop (record->pulseStream()) < 0) {
diff --git a/sflphone-common/src/audio/recordable.cpp b/sflphone-common/src/audio/recordable.cpp
index 0660a7c81245a2f3ef4ef55901a36dfadab8f76a..69e2d7d773caae411ceb74a3693ab690c8554c3e 100644
--- a/sflphone-common/src/audio/recordable.cpp
+++ b/sflphone-common/src/audio/recordable.cpp
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 2004-2008 Savoir-Faire Linux inc.
  *  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
@@ -10,7 +10,7 @@
  *  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.
@@ -44,9 +44,9 @@ void Recordable::initRecFileName()
 }
 
 
-void Recordable::setRecordingSmplRate(int smplRate)
+void Recordable::setRecordingSmplRate (int smplRate)
 {
 
-    recAudio.setSndSamplingRate(smplRate);
+    recAudio.setSndSamplingRate (smplRate);
 
 }
diff --git a/sflphone-common/src/audio/ringbuffer.cpp b/sflphone-common/src/audio/ringbuffer.cpp
index f8420187e8cba33490687b192f8d37924c60fd47..0eb146f397cb03b7d377aa39b2122466ff18cb6c 100644
--- a/sflphone-common/src/audio/ringbuffer.cpp
+++ b/sflphone-common/src/audio/ringbuffer.cpp
@@ -36,12 +36,12 @@ int RingBuffer::count_rb = 0;
 RingBuffer::RingBuffer (int size, CallID call_id) : mEnd (0)
         , mBufferSize (size > MIN_BUFFER_SIZE ? size : MIN_BUFFER_SIZE)
         , mBuffer (NULL)
-	, buffer_id(call_id)
+        , buffer_id (call_id)
 {
     mBuffer = new unsigned char[mBufferSize];
     assert (mBuffer != NULL);
 
-    count_rb++;    
+    count_rb++;
 }
 
 // Free memory on object deletion
@@ -54,8 +54,8 @@ RingBuffer::~RingBuffer()
 void
 RingBuffer::flush (CallID call_id)
 {
-    _debug("flush: reinit \"%s\" readpointer in \"%s\" ringbuffer\n", call_id.c_str(), buffer_id.c_str());
-    storeReadPointer(mEnd, call_id);
+    _debug ("flush: reinit \"%s\" readpointer in \"%s\" ringbuffer\n", call_id.c_str(), buffer_id.c_str());
+    storeReadPointer (mEnd, call_id);
 }
 
 
@@ -67,12 +67,12 @@ RingBuffer::flushAll ()
     // _debug("------------------------------ flushAll() in \"%s\" ringbuffer\n", buffer_id.c_str());
 
     ReadPointer::iterator iter_pointer = _readpointer.begin();
-    while(iter_pointer != _readpointer.end())
-    {	
-      // _debug("------------------------------     reinit readpointer %s\n", iter_pointer->first.c_str());
-	iter_pointer->second = mEnd;
 
-	iter_pointer++;
+    while (iter_pointer != _readpointer.end()) {
+        // _debug("------------------------------     reinit readpointer %s\n", iter_pointer->first.c_str());
+        iter_pointer->second = mEnd;
+
+        iter_pointer++;
     }
 }
 
@@ -81,26 +81,24 @@ RingBuffer::putLen()
 {
     int mStart;
 
-    if(_readpointer.size() >= 1)
-    {
-	mStart = getSmallestReadPointer();
-    }
-    else
-    {
+    if (_readpointer.size() >= 1) {
+        mStart = getSmallestReadPointer();
+    } else {
         mStart = 0;
     }
 
     int length = (mEnd + mBufferSize - mStart) % mBufferSize;
+
     // _debug("RingBuffer::putLen length %i\n", length);
     // _debug("    *RingBuffer::putLen: buffer_id %s, mStart %i, mEnd %i, length %i, buffersie %i\n", buffer_id.c_str(), mStart, mEnd, length, mBufferSize);
     return length;
 }
 
 int
-RingBuffer::getLen(CallID call_id)
+RingBuffer::getLen (CallID call_id)
 {
 
-    int mStart = getReadPointer(call_id);
+    int mStart = getReadPointer (call_id);
 
     int length = (mEnd + mBufferSize - mStart) % mBufferSize;
     // _debug("    *RingBuffer::getLen: buffer_id %s, call_id %s, mStart %i, mEnd %i, length %i, buffersie %i\n", buffer_id.c_str(), call_id.c_str(), mStart, mEnd, length, mBufferSize);
@@ -117,106 +115,101 @@ RingBuffer::debug()
 }
 
 int
-RingBuffer::getReadPointer(CallID call_id)
+RingBuffer::getReadPointer (CallID call_id)
 {
 
-    if(getNbReadPointer() == 0)
-	return 0;
+    if (getNbReadPointer() == 0)
+        return 0;
 
     // _debug("RingBuffer::getReadPointer() id %s\n", call_id.c_str());
-    
-    ReadPointer::iterator iter = _readpointer.find(call_id);
-    if (iter == _readpointer.end())
-    {
-	// _debug("                RingBuffer::getReadPointer Error read pointer size: %i\n", _readpointer.size());
-	// _debug("                RingBuffer::getReadPointer Error read pointer \"%s\" is null\n", call_id.c_str());
-	ReadPointer::iterator iter2;
-	for( iter2 = _readpointer.begin(); iter2 != _readpointer.end(); iter2++)
-	{
-	    // x_debug("                RingBuffer::getReadPointer list avail pointer \"%s\"\n", iter2->first.c_str());
-	}
-	return 0;
-    }
-    else
-    {
+
+    ReadPointer::iterator iter = _readpointer.find (call_id);
+
+    if (iter == _readpointer.end()) {
+        // _debug("                RingBuffer::getReadPointer Error read pointer size: %i\n", _readpointer.size());
+        // _debug("                RingBuffer::getReadPointer Error read pointer \"%s\" is null\n", call_id.c_str());
+        ReadPointer::iterator iter2;
+
+        for (iter2 = _readpointer.begin(); iter2 != _readpointer.end(); iter2++) {
+            // x_debug("                RingBuffer::getReadPointer list avail pointer \"%s\"\n", iter2->first.c_str());
+        }
+
+        return 0;
+    } else {
         return iter->second;
     }
-    
+
 }
 
 int
 RingBuffer::getSmallestReadPointer()
 {
     if (getNbReadPointer() == 0)
-	return 0;
+        return 0;
 
-    int smallest = mBufferSize;	
+    int smallest = mBufferSize;
 
     ReadPointer::iterator iter = _readpointer.begin();
-    while (iter != _readpointer.end())
-    {
-	if(iter->second < smallest)
-	    smallest = iter->second;
 
-	iter++;
+    while (iter != _readpointer.end()) {
+        if (iter->second < smallest)
+            smallest = iter->second;
+
+        iter++;
     }
 
     return smallest;
 }
 
 void
-RingBuffer::storeReadPointer(int pointer_value, CallID call_id)
+RingBuffer::storeReadPointer (int pointer_value, CallID call_id)
 {
 
-    ReadPointer::iterator iter = _readpointer.find(call_id);
-    if(iter != _readpointer.end())
-    {	
-	iter->second = pointer_value;
-	// _debug("store read pointer call_id %s, size: %i \n",call_id.c_str(), _readpointer.size());
-    }
-    else
-    {
-	_debug("storeReadPointer: Cannot find \"%s\" readPointer in \"%s\" ringbuffer\n", call_id.c_str(), buffer_id.c_str());
+    ReadPointer::iterator iter = _readpointer.find (call_id);
+
+    if (iter != _readpointer.end()) {
+        iter->second = pointer_value;
+        // _debug("store read pointer call_id %s, size: %i \n",call_id.c_str(), _readpointer.size());
+    } else {
+        _debug ("storeReadPointer: Cannot find \"%s\" readPointer in \"%s\" ringbuffer\n", call_id.c_str(), buffer_id.c_str());
     }
 
 }
 
 
 void
-RingBuffer::createReadPointer(CallID call_id)
+RingBuffer::createReadPointer (CallID call_id)
 {
 
-    _debug("---- createReadPointer ringbuffer_id %s, call_id %s\n", buffer_id.c_str(), call_id.c_str());
- 
-    _readpointer.insert(pair<CallID, int>(call_id, mEnd));
-    _debug("---- createReadPointer ringbuffer_id %s, size %i\n", buffer_id.c_str(), (int)_readpointer.size());
+    _debug ("---- createReadPointer ringbuffer_id %s, call_id %s\n", buffer_id.c_str(), call_id.c_str());
+
+    _readpointer.insert (pair<CallID, int> (call_id, mEnd));
+    _debug ("---- createReadPointer ringbuffer_id %s, size %i\n", buffer_id.c_str(), (int) _readpointer.size());
 
 }
 
 
 void
-RingBuffer::removeReadPointer(CallID call_id)
+RingBuffer::removeReadPointer (CallID call_id)
 {
 
-    _debug("---- removeReadPointer ringbuffer_id %s, call_id %s\n", buffer_id.c_str(), call_id.c_str());
+    _debug ("---- removeReadPointer ringbuffer_id %s, call_id %s\n", buffer_id.c_str(), call_id.c_str());
 
-    _readpointer.erase(call_id);
-    _debug("---- removeReadPointer ringbuffer_id %s, size %i\n", buffer_id.c_str(), (int)_readpointer.size());
+    _readpointer.erase (call_id);
+    _debug ("---- removeReadPointer ringbuffer_id %s, size %i\n", buffer_id.c_str(), (int) _readpointer.size());
 
 }
 
 
 bool
-RingBuffer::hasThisReadPointer(CallID call_id)
+RingBuffer::hasThisReadPointer (CallID call_id)
 {
-    ReadPointer::iterator iter = _readpointer.find(call_id);
-    if(iter == _readpointer.end())
-    {
-	return false;
-    }
-    else
-    {
-	return true;
+    ReadPointer::iterator iter = _readpointer.find (call_id);
+
+    if (iter == _readpointer.end()) {
+        return false;
+    } else {
+        return true;
     }
 }
 
@@ -306,11 +299,11 @@ RingBuffer::Put (void* buffer, int toCopy, unsigned short volume)
 //
 
 int
-RingBuffer::AvailForGet(CallID call_id)
+RingBuffer::AvailForGet (CallID call_id)
 {
     // Used space
     // _debug("RingBuffer::AvailForGet buffer_id %s, call_id %s --------------------\n", buffer_id.c_str(), call_id.c_str());
-    return getLen(call_id);
+    return getLen (call_id);
 }
 
 // Get will move 'toCopy' bytes from the internal FIFO to 'buffer'
@@ -318,17 +311,21 @@ int
 RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, CallID call_id)
 {
 
-    if(getNbReadPointer() == 0)
+    if (getNbReadPointer() == 0)
         return 0;
 
-    if(!hasThisReadPointer(call_id))
-	return 0;
+    if (!hasThisReadPointer (call_id))
+        return 0;
 
     samplePtr dest;
+
     int block;
+
     int copied;
+
     // _debug("RingBuffer::Get buffer_id %s, call_id %s --------------------\n", buffer_id.c_str(), call_id.c_str());
-    int len = getLen(call_id);
+    int len = getLen (call_id);
+
     // _debug("    RingBuffer::Get bufferid %s, getlen %i\n", buffer_id.c_str(), len);
 
     if (toCopy > len)
@@ -338,7 +335,7 @@ RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, CallID call_id
 
     copied = 0;
 
-    int mStart = getReadPointer(call_id);
+    int mStart = getReadPointer (call_id);
 
     //fprintf(stderr, "G");
     while (toCopy) {
@@ -369,7 +366,7 @@ RingBuffer::Get (void *buffer, int toCopy, unsigned short volume, CallID call_id
         copied += block;
     }
 
-    storeReadPointer(mStart, call_id);
+    storeReadPointer (mStart, call_id);
 
     return copied;
 }
@@ -379,16 +376,16 @@ int
 RingBuffer::Discard (int toDiscard, CallID call_id)
 {
     // _debug("RingBuffer::Discard buffer_id %s, call_id %s --------------------\n", buffer_id.c_str(), call_id.c_str());
-    int len = getLen(call_id);
+    int len = getLen (call_id);
 
-    int mStart = getReadPointer(call_id);
+    int mStart = getReadPointer (call_id);
 
     if (toDiscard > len)
         toDiscard = len;
 
     mStart = (mStart + toDiscard) % mBufferSize;
 
-    storeReadPointer(mStart, call_id);
+    storeReadPointer (mStart, call_id);
 
     return toDiscard;
 }
diff --git a/sflphone-common/src/call.cpp b/sflphone-common/src/call.cpp
index 94a7e79519cfd3294692ec3d5077734147f32041..95f69605224ced9ccf54e88389adaec43f70e7b0 100644
--- a/sflphone-common/src/call.cpp
+++ b/sflphone-common/src/call.cpp
@@ -27,7 +27,7 @@ Call::Call (const CallID& id, Call::CallType type)
         , _localAudioPort (0)
         , _localExternalAudioPort (0)
         , _id (id)
-	, _confID ("")
+        , _confID ("")
         , _type (type)
         , _connectionState (Call::Disconnected)
         , _callState (Call::Inactive)
@@ -129,8 +129,8 @@ Call::getStateStr ()
             break;
 
         case Conferencing:
-	    state_str = "CONFERENCING";
-	    break;
+            state_str = "CONFERENCING";
+            break;
 
         case Refused:
 
diff --git a/sflphone-common/src/conference.cpp b/sflphone-common/src/conference.cpp
index 563dff49037ee6fb20d8f76c952820d4305903cb..6266a30323c8d47f695e03eccd57c774634290cd 100644
--- a/sflphone-common/src/conference.cpp
+++ b/sflphone-common/src/conference.cpp
@@ -1,18 +1,18 @@
 /*
  *  Copyright (C) 2009 Savoir-Faire Linux inc.
  *  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.
@@ -32,7 +32,7 @@ Conference::Conference()
 
     ++count;
 
-    std::string conf("conf_");
+    std::string conf ("conf_");
 
     // convert count into string
     std::string s;
@@ -41,9 +41,9 @@ Conference::Conference()
     s = out.str();
 
     _nbParticipant = 0;
-    _id = conf.append(s);
+    _id = conf.append (s);
+
 
-    
 
 }
 
@@ -51,7 +51,7 @@ Conference::Conference()
 Conference::~Conference()
 {
 
-    
+
 
 }
 
@@ -62,55 +62,56 @@ int Conference::getState()
 }
 
 
-void Conference::setState(ConferenceState state)
+void Conference::setState (ConferenceState state)
 {
     _confState = state;
 }
 
 
-void Conference::add(CallID participant_id)
+void Conference::add (CallID participant_id)
 {
 
-    _debug("---- Conference:: add participant %s\n", participant_id.c_str());
+    _debug ("---- Conference:: add participant %s\n", participant_id.c_str());
 
-    _participants.insert(participant_id);
+    _participants.insert (participant_id);
 
     _nbParticipant++;
 }
 
 
-void Conference::remove(CallID participant_id)
+void Conference::remove (CallID participant_id)
 {
 
-    _debug("---- Conference::remove participant %s\n", participant_id.c_str());
+    _debug ("---- Conference::remove participant %s\n", participant_id.c_str());
+
+    _participants.erase (participant_id);
 
-    _participants.erase(participant_id);
-    
     _nbParticipant--;
 
 }
 
-void Conference::bindParticipant(CallID participant_id)
+void Conference::bindParticipant (CallID participant_id)
 {
 
-    if(_nbParticipant >= 1) {
-	ParticipantSet::iterator iter = _participants.begin();
+    if (_nbParticipant >= 1) {
+        ParticipantSet::iterator iter = _participants.begin();
 
-	while (iter != _participants.end()) {
+        while (iter != _participants.end()) {
 
-	    if (participant_id != (*iter)) {
+            if (participant_id != (*iter)) {
 
-	        _debug("---- Conference:: bind callid %s with %s in conference add\n", participant_id.c_str(), (*iter).c_str());
-	        Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID(participant_id, *iter);
-	    }
-	    iter++;
-	}
+                _debug ("---- Conference:: bind callid %s with %s in conference add\n", participant_id.c_str(), (*iter).c_str());
+                Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID (participant_id, *iter);
+            }
+
+            iter++;
+        }
 
     }
 
-    _debug("---- Conference::bind callid %s with default_id in conference add\n", participant_id.c_str());
+    _debug ("---- Conference::bind callid %s with default_id in conference add\n", participant_id.c_str());
 
-    Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID(participant_id);
+    Manager::instance().getAudioDriver()->getMainBuffer()->bindCallID (participant_id);
 
 }
 
@@ -120,22 +121,22 @@ std::string Conference::getStateStr()
 
     std::string state_str;
 
-    switch(_confState) {
+    switch (_confState) {
 
         case Active_Atached:
-	    state_str = "ACTIVE_ATACHED";
-	    break;
+            state_str = "ACTIVE_ATACHED";
+            break;
+
+        case Active_Detached:
+            state_str = "ACTIVE_DETACHED";
+            break;
 
-	case Active_Detached:
-	    state_str = "ACTIVE_DETACHED";
-	    break;
-	   
         case Hold:
-	    state_str = "HOLD";
-	    break;
+            state_str = "HOLD";
+            break;
 
         default:
-	    break;
+            break;
     }
 
     return state_str;
@@ -144,6 +145,6 @@ std::string Conference::getStateStr()
 
 ParticipantSet Conference::getParticipantList()
 {
-    return _participants;   
+    return _participants;
 }
 
diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp
index b069cd2150be2759bf232f259d385ba87f81ed05..b57968d698c24761351eb5d7627a275b832e9c27 100644
--- a/sflphone-common/src/dbus/callmanager.cpp
+++ b/sflphone-common/src/dbus/callmanager.cpp
@@ -135,49 +135,49 @@ void
 CallManager::joinParticipant (const std::string& sel_callID, const std::string& drag_callID)
 {
     _debug ("CallManager::joinParticipant received %s, %s\n", sel_callID.c_str(), drag_callID.c_str());
-    Manager::instance().joinParticipant(sel_callID, drag_callID);
+    Manager::instance().joinParticipant (sel_callID, drag_callID);
 }
 
 void
 CallManager::addParticipant (const std::string& callID, const std::string& confID)
 {
     _debug ("CallManager::addParticipant received %s, %s\n", callID.c_str(), confID.c_str());
-    Manager::instance().addParticipant(callID, confID);
+    Manager::instance().addParticipant (callID, confID);
 }
 
 void
 CallManager::addMainParticipant (const std::string& confID)
 {
     _debug ("CallManager::addMainParticipant received %s\n", confID.c_str());
-    Manager::instance().addMainParticipant(confID);
+    Manager::instance().addMainParticipant (confID);
 }
 
 void
 CallManager::detachParticipant (const std::string& callID)
 {
     _debug ("CallManager::detachParticipant received %s\n", callID.c_str());
-    Manager::instance().detachParticipant(callID, "");
+    Manager::instance().detachParticipant (callID, "");
 }
 
 void
 CallManager::joinConference (const std::string& sel_confID, const std::string& drag_confID)
 {
     _debug ("CallManager::joinConference received %s, %s\n", sel_confID.c_str(), drag_confID.c_str());
-    Manager::instance().joinConference(sel_confID, drag_confID);
+    Manager::instance().joinConference (sel_confID, drag_confID);
 }
 
 void
 CallManager::holdConference (const std::string& confID)
 {
     _debug ("CallManager::holdConference received %s\n", confID.c_str());
-    Manager::instance().holdConference(confID);
+    Manager::instance().holdConference (confID);
 }
 
 void
 CallManager::unholdConference (const std::string& confID)
 {
     _debug ("CallManager::unHoldConference received %s\n", confID.c_str());
-    Manager::instance().unHoldConference(confID);
+    Manager::instance().unHoldConference (confID);
 }
 
 std::map< std::string, std::string >
@@ -190,14 +190,14 @@ CallManager::getConferenceDetails (const std::string& callID)
 std::vector< std::string >
 CallManager::getConferenceList (void)
 {
-    _debug("CallManager::getConferenceList\n");
+    _debug ("CallManager::getConferenceList\n");
     return Manager::instance().getConferenceList();
 }
 
 std::vector< std::string >
 CallManager::getParticipantList (const std::string& confID)
 {
-    return Manager::instance().getParticipantList(confID);
+    return Manager::instance().getParticipantList (confID);
 }
 
 void
@@ -265,7 +265,7 @@ CallManager::startTone (const int32_t& start , const int32_t& type)
 // for conferencing in order to get
 // the right pointer for the given
 // callID.
-sfl::AudioZrtpSession * CallManager::getAudioZrtpSession(const std::string& callID)
+sfl::AudioZrtpSession * CallManager::getAudioZrtpSession (const std::string& callID)
 {
     SIPVoIPLink * link = NULL;
     link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink (AccountNULL));
@@ -275,10 +275,11 @@ sfl::AudioZrtpSession * CallManager::getAudioZrtpSession(const std::string& call
         throw CallManagerException();
     }
 
-    SIPCall *call = link->getSIPCall(callID);
-    
+    SIPCall *call = link->getSIPCall (callID);
+
     sfl::AudioRtpFactory * audioRtp = NULL;
     audioRtp = call->getAudioRtp();
+
     if (audioRtp == NULL) {
         _debug ("Failed to get AudioRtpFactory\n");
         throw CallManagerException();
@@ -303,7 +304,7 @@ CallManager::setSASVerified (const std::string& callID)
 
     try {
         sfl::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);        
+        zSession = getAudioZrtpSession (callID);
         zSession->SASVerified();
     } catch (...) {
         throw;
@@ -318,7 +319,7 @@ CallManager::resetSASVerified (const std::string& callID)
 
     try {
         sfl::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);        
+        zSession = getAudioZrtpSession (callID);
         zSession->resetSASVerified();
     } catch (...) {
         throw;
@@ -333,7 +334,7 @@ CallManager::setConfirmGoClear (const std::string& callID)
 
     try {
         sfl::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);        
+        zSession = getAudioZrtpSession (callID);
         zSession->goClearOk();
     } catch (...) {
         throw;
@@ -348,7 +349,7 @@ CallManager::requestGoClear (const std::string& callID)
 
     try {
         sfl::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);        
+        zSession = getAudioZrtpSession (callID);
         zSession->requestGoClear();
     } catch (...) {
         throw;
@@ -364,8 +365,8 @@ CallManager::acceptEnrollment (const std::string& callID, const bool& accepted)
 
     try {
         sfl::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);        
-        zSession->acceptEnrollment(accepted);
+        zSession = getAudioZrtpSession (callID);
+        zSession->acceptEnrollment (accepted);
     } catch (...) {
         throw;
     }
@@ -380,8 +381,8 @@ CallManager::setPBXEnrollment (const std::string& callID, const bool& yesNo)
 
     try {
         sfl::AudioZrtpSession * zSession;
-        zSession = getAudioZrtpSession(callID);        
-        zSession->setPBXEnrollment(yesNo);
+        zSession = getAudioZrtpSession (callID);
+        zSession->setPBXEnrollment (yesNo);
     } catch (...) {
         throw;
     }
diff --git a/sflphone-common/src/iax/iaxcall.cpp b/sflphone-common/src/iax/iaxcall.cpp
index 3c69e9b67a30bd40ae4b3a4355ee83e2bd2a7680..93ecdcdfdb26cc88876e73f06360ba0b817323b1 100644
--- a/sflphone-common/src/iax/iaxcall.cpp
+++ b/sflphone-common/src/iax/iaxcall.cpp
@@ -35,52 +35,53 @@ IAXCall::setFormat (int format)
 {
     _format = format;
 
-    _debug("IAX set supported format: ");
+    _debug ("IAX set supported format: ");
 
     switch (format) {
 
         case AST_FORMAT_ULAW:
-	    printf("PCMU\n");
+            printf ("PCMU\n");
             setAudioCodec (PAYLOAD_CODEC_ULAW);
             break;
 
         case AST_FORMAT_GSM:
-	    printf("GSM\n");
+            printf ("GSM\n");
             setAudioCodec (PAYLOAD_CODEC_GSM);
             break;
 
         case AST_FORMAT_ALAW:
-	    printf("ALAW\n");
+            printf ("ALAW\n");
             setAudioCodec (PAYLOAD_CODEC_ALAW);
             break;
 
         case AST_FORMAT_ILBC:
-	    printf("ILBC\n");
+            printf ("ILBC\n");
             setAudioCodec (PAYLOAD_CODEC_ILBC_20);
             break;
 
         case AST_FORMAT_SPEEX:
-	    printf("SPEEX\n");
+            printf ("SPEEX\n");
             setAudioCodec (PAYLOAD_CODEC_SPEEX_8000);
             break;
 
         default:
-	    printf("Error audio codec type %i not supported!\n", format);
+            printf ("Error audio codec type %i not supported!\n", format);
             setAudioCodec ( (AudioCodecType) -1);
             break;
     }
-    printf("\n");
+
+    printf ("\n");
 }
 
 
 int
- IAXCall::getSupportedFormat()
+IAXCall::getSupportedFormat()
 {
     CodecOrder map;
     int format = 0;
     unsigned int iter;
 
-    _debug("IAX get supported format: ");
+    _debug ("IAX get supported format: ");
 
     map = getCodecMap().getActiveCodecs();
 
@@ -88,27 +89,27 @@ int
         switch (map[iter]) {
 
             case PAYLOAD_CODEC_ULAW:
-		printf("PCMU ");
+                printf ("PCMU ");
                 format |= AST_FORMAT_ULAW;
                 break;
 
             case PAYLOAD_CODEC_GSM:
-		printf("GSM ");
+                printf ("GSM ");
                 format |= AST_FORMAT_GSM;
                 break;
 
             case PAYLOAD_CODEC_ALAW:
-		printf("PCMA ");
+                printf ("PCMA ");
                 format |= AST_FORMAT_ALAW;
                 break;
 
             case PAYLOAD_CODEC_ILBC_20:
-		printf("ILBC ");
+                printf ("ILBC ");
                 format |= AST_FORMAT_ILBC;
                 break;
 
             case PAYLOAD_CODEC_SPEEX_8000:
-		printf("SPEEX ");
+                printf ("SPEEX ");
                 format |= AST_FORMAT_SPEEX;
                 break;
 
@@ -117,7 +118,7 @@ int
         }
     }
 
-    printf("\n");
+    printf ("\n");
 
     return format;
 
@@ -130,33 +131,33 @@ IAXCall::getFirstMatchingFormat (int needles)
     int format = 0;
     unsigned int iter;
 
-    _debug("IAX get first matching codec: ");
+    _debug ("IAX get first matching codec: ");
 
     for (iter=0 ; iter < map.size() ; iter++) {
         switch (map[iter]) {
 
             case PAYLOAD_CODEC_ULAW:
-		printf("PCMU\n");
+                printf ("PCMU\n");
                 format = AST_FORMAT_ULAW;
                 break;
 
             case PAYLOAD_CODEC_GSM:
-		printf("GSM\n");
+                printf ("GSM\n");
                 format = AST_FORMAT_GSM;
                 break;
 
             case PAYLOAD_CODEC_ALAW:
-		printf("PCMA\n");
+                printf ("PCMA\n");
                 format = AST_FORMAT_ALAW;
                 break;
 
             case PAYLOAD_CODEC_ILBC_20:
-		printf("ILBC\n");
+                printf ("ILBC\n");
                 format = AST_FORMAT_ILBC;
                 break;
 
             case PAYLOAD_CODEC_SPEEX_8000:
-		printf("SPEEX\n");
+                printf ("SPEEX\n");
                 format = AST_FORMAT_SPEEX;
                 break;
 
@@ -169,7 +170,8 @@ IAXCall::getFirstMatchingFormat (int needles)
             return format;
 
     }
-    printf("\n");
+
+    printf ("\n");
 
     return 0;
 }
diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp
index 920eb6a87338bdbdfaa46c9544e61338d8f6b6df..fd486a14fe6f61801732d57916205c5ab612a71b 100644
--- a/sflphone-common/src/iax/iaxvoiplink.cpp
+++ b/sflphone-common/src/iax/iaxvoiplink.cpp
@@ -40,245 +40,246 @@
 #define CHK_VALID_CALL   if (call == NULL) { _debug("IAX: Call doesn't exists\n"); \
 	return false; }
 
-	IAXVoIPLink::IAXVoIPLink (const AccountID& accountID)
-: VoIPLink (accountID)
+IAXVoIPLink::IAXVoIPLink (const AccountID& accountID)
+        : VoIPLink (accountID)
 {
-	// _debug("IAXVoIPLink::IAXVoIPLink : creating eventhread \n ");
-	_evThread = new EventThread (this);
-	_regSession = NULL;
-	_nextRefreshStamp = 0;
-	countTime = 0;
+    // _debug("IAXVoIPLink::IAXVoIPLink : creating eventhread \n ");
+    _evThread = new EventThread (this);
+    _regSession = NULL;
+    _nextRefreshStamp = 0;
+    countTime = 0;
 
-	// to get random number for RANDOM_PORT
-	srand (time (NULL));
+    // to get random number for RANDOM_PORT
+    srand (time (NULL));
 
-	audiolayer = NULL;
+    audiolayer = NULL;
 
-	converter = new SamplerateConverter();
+    converter = new SamplerateConverter();
 
-	int nbSamplesMax = (int) (converter->getFrequence() * converter->getFramesize() / 1000);
+    int nbSamplesMax = (int) (converter->getFrequence() * converter->getFramesize() / 1000);
 
-	micData = new SFLDataFormat[nbSamplesMax];
-	micDataConverted = new SFLDataFormat[nbSamplesMax];
-	micDataEncoded = new unsigned char[nbSamplesMax];
+    micData = new SFLDataFormat[nbSamplesMax];
+    micDataConverted = new SFLDataFormat[nbSamplesMax];
+    micDataEncoded = new unsigned char[nbSamplesMax];
 
-	spkrDataConverted = new SFLDataFormat[nbSamplesMax];
-	spkrDataDecoded = new SFLDataFormat[nbSamplesMax];
+    spkrDataConverted = new SFLDataFormat[nbSamplesMax];
+    spkrDataDecoded = new SFLDataFormat[nbSamplesMax];
 
-	urlhook = new UrlHook ();
+    urlhook = new UrlHook ();
 }
 
 
 IAXVoIPLink::~IAXVoIPLink()
 {
-	delete _evThread;
-	_evThread = NULL;
-	_regSession = NULL; // shall not delete it
-	terminate();
-
-	audiolayer = NULL;
-
-	delete converter;
-
-	delete [] micData;
-	micData = NULL;
-	delete [] micDataConverted;
-	micDataConverted = NULL;
-	delete [] micDataEncoded;
-	micDataEncoded = NULL;
-
-	delete [] spkrDataDecoded;
-	spkrDataDecoded = NULL;
-	delete [] spkrDataConverted;
-	spkrDataConverted = NULL;
+    delete _evThread;
+    _evThread = NULL;
+    _regSession = NULL; // shall not delete it
+    terminate();
+
+    audiolayer = NULL;
+
+    delete converter;
+
+    delete [] micData;
+    micData = NULL;
+    delete [] micDataConverted;
+    micDataConverted = NULL;
+    delete [] micDataEncoded;
+    micDataEncoded = NULL;
+
+    delete [] spkrDataDecoded;
+    spkrDataDecoded = NULL;
+    delete [] spkrDataConverted;
+    spkrDataConverted = NULL;
 }
 
-	bool
+bool
 IAXVoIPLink::init()
 {
-	// If it was done, don't do it again, until we call terminate()
-	if (initDone())
-		return false;
+    // If it was done, don't do it again, until we call terminate()
+    if (initDone())
+        return false;
 
-	bool returnValue = false;
+    bool returnValue = false;
 
-	// _localAddress = "127.0.0.1";
-	// port 0 is default
-	//  iax_enable_debug(); have to enable debug when compiling iax...
-	int port = IAX_DEFAULT_PORTNO;
+    // _localAddress = "127.0.0.1";
+    // port 0 is default
+    //  iax_enable_debug(); have to enable debug when compiling iax...
+    int port = IAX_DEFAULT_PORTNO;
 
-	int last_port = 0;
+    int last_port = 0;
 
-	int nbTry = 3;
+    int nbTry = 3;
 
-	while (port != IAX_FAILURE && nbTry) {
-		last_port = port;
-		port = iax_init (port);
+    while (port != IAX_FAILURE && nbTry) {
+        last_port = port;
+        port = iax_init (port);
 
-		if (port < 0) {
-			_debug ("IAX Warning: already initialize on port %d\n", last_port);
-			port = RANDOM_IAX_PORT;
-		} else if (port == IAX_FAILURE) {
-			_debug ("IAX Fail to start on port %d", last_port);
-			port = RANDOM_IAX_PORT;
-		} else {
-			_debug ("IAX Info: listening on port %d\n", last_port);
-			_localPort = last_port;
-			returnValue = true;
-			_evThread->start();
+        if (port < 0) {
+            _debug ("IAX Warning: already initialize on port %d\n", last_port);
+            port = RANDOM_IAX_PORT;
+        } else if (port == IAX_FAILURE) {
+            _debug ("IAX Fail to start on port %d", last_port);
+            port = RANDOM_IAX_PORT;
+        } else {
+            _debug ("IAX Info: listening on port %d\n", last_port);
+            _localPort = last_port;
+            returnValue = true;
+            _evThread->start();
 
-			audiolayer = Manager::instance().getAudioDriver();
+            audiolayer = Manager::instance().getAudioDriver();
 
-			// may be different than one already setted
-			converterSamplingRate = audiolayer->getMainBuffer()->getInternalSamplingRate();
+            // may be different than one already setted
+            converterSamplingRate = audiolayer->getMainBuffer()->getInternalSamplingRate();
 
-			break;
-		}
+            break;
+        }
 
-		nbTry--;
+        nbTry--;
 
-		initDone (true);
-	}
+        initDone (true);
+    }
 
-	if (port == IAX_FAILURE || nbTry==0) {
-		_debug ("Fail to initialize iax\n");
+    if (port == IAX_FAILURE || nbTry==0) {
+        _debug ("Fail to initialize iax\n");
 
-		initDone (false);
-	}
+        initDone (false);
+    }
 
-	return returnValue;
+    return returnValue;
 }
 
-	void
+void
 IAXVoIPLink::terminate()
 {
-	// If it was done, don't do it again, until we call init()
-	if (!initDone())
-		return;
+    // If it was done, don't do it again, until we call init()
+    if (!initDone())
+        return;
 
-	// iaxc_shutdown();
+    // iaxc_shutdown();
 
-	// Hangup all calls
-	terminateIAXCall();
+    // Hangup all calls
+    terminateIAXCall();
 
-	initDone (false);
+    initDone (false);
 }
 
-	void
+void
 IAXVoIPLink::terminateIAXCall()
 {
-	std::string reason = "Dumped Call";
-	ost::MutexLock m (_callMapMutex);
-	CallMap::iterator iter = _callMap.begin();
-	IAXCall *call;
-
-	while (iter != _callMap.end()) {
-		call = dynamic_cast<IAXCall*> (iter->second);
-
-		if (call) {
-			_mutexIAX.enterMutex();
-			iax_hangup (call->getSession(), (char*) reason.c_str());
-			_mutexIAX.leaveMutex();
-			call->setSession (NULL);
-			delete call;
-			call = NULL;
-		}
-
-		iter++;
-	}
-
-	_callMap.clear();
+    std::string reason = "Dumped Call";
+    ost::MutexLock m (_callMapMutex);
+    CallMap::iterator iter = _callMap.begin();
+    IAXCall *call;
+
+    while (iter != _callMap.end()) {
+        call = dynamic_cast<IAXCall*> (iter->second);
+
+        if (call) {
+            _mutexIAX.enterMutex();
+            iax_hangup (call->getSession(), (char*) reason.c_str());
+            _mutexIAX.leaveMutex();
+            call->setSession (NULL);
+            delete call;
+            call = NULL;
+        }
+
+        iter++;
+    }
+
+    _callMap.clear();
 }
 
 void IAXVoIPLink::terminateOneCall (const CallID& id)
 {
-	IAXCall* call = getIAXCall (id);
+    IAXCall* call = getIAXCall (id);
 
-	if (call) {
-		_debug ("IAXVoIPLink::terminateOneCall()::the call is deleted, should close recording file \n");
-		delete call;
-		call = 0;
-	}
+    if (call) {
+        _debug ("IAXVoIPLink::terminateOneCall()::the call is deleted, should close recording file \n");
+        delete call;
+        call = 0;
+    }
 }
 
 
 
-	void
+void
 IAXVoIPLink::getEvent()
 {
-	IAXCall* call = NULL;
+    IAXCall* call = NULL;
 
-	// lock iax_ stuff..
-	_mutexIAX.enterMutex();
-	iax_event* event = NULL;
+    // lock iax_ stuff..
+    _mutexIAX.enterMutex();
+    iax_event* event = NULL;
 
-	while ( (event = iax_get_event (IAX_NONBLOCKING)) != NULL) {
-		// If we received an 'ACK', libiax2 tells apps to ignore them.
-		if (event->etype == IAX_EVENT_NULL) {
-			continue;
-		}
+    while ( (event = iax_get_event (IAX_NONBLOCKING)) != NULL) {
+        // If we received an 'ACK', libiax2 tells apps to ignore them.
+        if (event->etype == IAX_EVENT_NULL) {
+            continue;
+        }
 
-		//_debug ("Receive IAX Event: %d (0x%x)\n", event->etype, event->etype);
+        //_debug ("Receive IAX Event: %d (0x%x)\n", event->etype, event->etype);
 
-		call = iaxFindCallBySession (event->session);
+        call = iaxFindCallBySession (event->session);
 
-		if (call) {
-			// We know that call, deal with it
-			iaxHandleCallEvent (event, call);
-			//_audiocodec = Manager::instance().getCodecDescriptorMap().getCodec( call -> getAudioCodec() );
-		} else if (event->session && event->session == _regSession) {
-			// This is a registration session, deal with it
-			iaxHandleRegReply (event);
-		} else {
-			// We've got an event before it's associated with any call
-			iaxHandlePrecallEvent (event);
-		}
+        if (call) {
+            // We know that call, deal with it
+            iaxHandleCallEvent (event, call);
+            //_audiocodec = Manager::instance().getCodecDescriptorMap().getCodec( call -> getAudioCodec() );
+        } else if (event->session && event->session == _regSession) {
+            // This is a registration session, deal with it
+            iaxHandleRegReply (event);
+        } else {
+            // We've got an event before it's associated with any call
+            iaxHandlePrecallEvent (event);
+        }
 
-		// _debug("IAXVoIPLink::getEvent() : timestamp %i \n",event->ts);
+        // _debug("IAXVoIPLink::getEvent() : timestamp %i \n",event->ts);
 
-		iax_event_free (event);
-	}
+        iax_event_free (event);
+    }
 
-	_mutexIAX.leaveMutex();
+    _mutexIAX.leaveMutex();
 
-	sendAudioFromMic();
+    sendAudioFromMic();
 
-	if (call) {
-		call->recAudio.recData (spkrDataDecoded, micData, nbSampleForRec_, nbSampleForRec_);
+    if (call) {
+        call->recAudio.recData (spkrDataDecoded, micData, nbSampleForRec_, nbSampleForRec_);
 
-		// Do the doodle-moodle to send audio from the microphone to the IAX channel.
-	}
-	
-	// Do the doodle-moodle to send audio from the microphone to the IAX channel.
-	// sendAudioFromMic();
+        // Do the doodle-moodle to send audio from the microphone to the IAX channel.
+    }
 
-	// Refresh registration.
-	if (_nextRefreshStamp && _nextRefreshStamp - 2 < time (NULL)) {
-		sendRegister ("");
-	}
+    // Do the doodle-moodle to send audio from the microphone to the IAX channel.
+    // sendAudioFromMic();
 
-	// Notify (with a beep) an incoming call when there is already a call
-        countTime += 3;
+    // Refresh registration.
+    if (_nextRefreshStamp && _nextRefreshStamp - 2 < time (NULL)) {
+        sendRegister ("");
+    }
+
+    // Notify (with a beep) an incoming call when there is already a call
+    countTime += 3;
+
+    if ( (Manager::instance().incomingCallWaiting() > 0) && Manager::instance().hasCurrentCall()) {
 
-	if((Manager::instance().incomingCallWaiting() > 0) && Manager::instance().hasCurrentCall()) {
+        int countTime_modulo = countTime % 4000;
+        // _debug("countTime: %i\n", countTime);
+        // _debug("countTime_modulo: %i\n", countTime_modulo);
 
-	    int countTime_modulo = countTime % 4000;
-	    // _debug("countTime: %i\n", countTime);
-	    // _debug("countTime_modulo: %i\n", countTime_modulo);
-	    if ((countTime_modulo - countTime) < 0) {
-	      Manager::instance().notificationIncomingCall();
-	    }
+        if ( (countTime_modulo - countTime) < 0) {
+            Manager::instance().notificationIncomingCall();
+        }
 
-	    countTime = countTime_modulo;
-	}
+        countTime = countTime_modulo;
+    }
 
-	// thread wait 3 millisecond
-	_evThread->sleep (3);
+    // thread wait 3 millisecond
+    _evThread->sleep (3);
 
-	free (event);
+    free (event);
 }
 
-	void
+void
 IAXVoIPLink::sendAudioFromMic (void)
 {
 
@@ -294,871 +295,877 @@ IAXVoIPLink::sendAudioFromMic (void)
     // currentCall = getIAXCall (Manager::instance().getCurrentCallId());
 
     CallMap::iterator iter_call = _callMap.begin();
-    while(iter_call != _callMap.end()) {
 
-        currentCall = (IAXCall*)iter_call->second;
+    while (iter_call != _callMap.end()) {
+
+        currentCall = (IAXCall*) iter_call->second;
+
+        iter_call++;
 
-	iter_call++;
+        if (currentCall) {
 
-	if (currentCall) {
+            bool sessionIsConnected = (currentCall->getConnectionState() == Call::Connected);
+            bool callIsActive = (currentCall->getState() == Call::Active);
 
-	    bool sessionIsConnected = (currentCall->getConnectionState() == Call::Connected);
-	    bool callIsActive = (currentCall->getState() == Call::Active);
+            // if (sessionIsConnected || callIsActive) {
 
-	    // if (sessionIsConnected || callIsActive) {
-	    if (callIsActive) {
-		    
-	        ac = currentCall->getCodecMap().getCodec(currentCall->getAudioCodec());
+            if (callIsActive) {
 
-		// Send sound here
-		if (ac && audiolayer) {
+                ac = currentCall->getCodecMap().getCodec (currentCall->getAudioCodec());
 
-		    // _debug("Send sound\n");
-		    // audiolayer->getMainBuffer()->flush(currentCall->getCallId());
+                // Send sound here
 
-		    audiolayer->getMainBuffer()->setInternalSamplingRate(ac->getClockRate());
+                if (ac && audiolayer) {
 
-		    int _mainBufferSampleRate = audiolayer->getMainBuffer()->getInternalSamplingRate();
+                    // _debug("Send sound\n");
+                    // audiolayer->getMainBuffer()->flush(currentCall->getCallId());
 
-		    // we have to get 20ms of data from the mic *20/1000 = /50
-		    // rate/50 shall be lower than IAX__20S_48KHZ_MAX
-		    maxBytesToGet = _mainBufferSampleRate * audiolayer->getFrameSize() / 1000 * sizeof (SFLDataFormat);
+                    audiolayer->getMainBuffer()->setInternalSamplingRate (ac->getClockRate());
 
-		    // available bytes inside ringbuffer
-		    availBytesFromMic = audiolayer->getMainBuffer()->availForGet(currentCall->getCallId());
-		    // We need packets full! 
-		    if (availBytesFromMic > maxBytesToGet) {
+                    int _mainBufferSampleRate = audiolayer->getMainBuffer()->getInternalSamplingRate();
 
-		        // take the lowest
-		        bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet;
+                    // we have to get 20ms of data from the mic *20/1000 = /50
+                    // rate/50 shall be lower than IAX__20S_48KHZ_MAX
+                    maxBytesToGet = _mainBufferSampleRate * audiolayer->getFrameSize() / 1000 * sizeof (SFLDataFormat);
 
-			// Get bytes from micRingBuffer to data_from_mic
-			nbSample_ = audiolayer->getMainBuffer()->getData (micData, bytesAvail, 100, currentCall->getCallId()) / sizeof (SFLDataFormat);
+                    // available bytes inside ringbuffer
+                    availBytesFromMic = audiolayer->getMainBuffer()->availForGet (currentCall->getCallId());
+                    // We need packets full!
 
+                    if (availBytesFromMic > maxBytesToGet) {
 
-			// Store the number of samples for recording
-			nbSampleForRec_ = nbSample_;
+                        // take the lowest
+                        bytesAvail = (availBytesFromMic < maxBytesToGet) ? availBytesFromMic : maxBytesToGet;
 
+                        // Get bytes from micRingBuffer to data_from_mic
+                        nbSample_ = audiolayer->getMainBuffer()->getData (micData, bytesAvail, 100, currentCall->getCallId()) / sizeof (SFLDataFormat);
 
-			if (ac->getClockRate() && (ac->getClockRate() != _mainBufferSampleRate)) {
 
-			    // resample
-			    nbSample_ = converter->downsampleData (micData , micDataConverted , (int) ac->getClockRate(), _mainBufferSampleRate, nbSample_);
+                        // Store the number of samples for recording
+                        nbSampleForRec_ = nbSample_;
 
-			    // for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16)
-			    compSize = ac->codecEncode (micDataEncoded, micDataConverted , nbSample_*sizeof (int16));
 
-			} else {
+                        if (ac->getClockRate() && (ac->getClockRate() != _mainBufferSampleRate)) {
 
-			    // for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16)
-			    compSize = ac->codecEncode (micDataEncoded, micData, nbSample_*sizeof (int16));
-			    
-			}
+                            // resample
+                            nbSample_ = converter->downsampleData (micData , micDataConverted , (int) ac->getClockRate(), _mainBufferSampleRate, nbSample_);
 
-			// Send it out!
-			_mutexIAX.enterMutex();
+                            // for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16)
+                            compSize = ac->codecEncode (micDataEncoded, micDataConverted , nbSample_*sizeof (int16));
 
-			// Make sure the session and the call still exists.
-			if (currentCall->getSession() && micDataEncoded != NULL) {
-			    if (iax_send_voice (currentCall->getSession(), currentCall->getFormat(), micDataEncoded, compSize, nbSample_) == -1) {
-			        _debug ("IAX: Error sending voice data.\n");
-			    }
-			} 
+                        } else {
 
-			_mutexIAX.leaveMutex();
+                            // for the mono: range = 0 to IAX_FRAME2SEND * sizeof(int16)
+                            compSize = ac->codecEncode (micDataEncoded, micData, nbSample_*sizeof (int16));
+
+                        }
+
+                        // Send it out!
+                        _mutexIAX.enterMutex();
+
+                        // Make sure the session and the call still exists.
+                        if (currentCall->getSession() && micDataEncoded != NULL) {
+                            if (iax_send_voice (currentCall->getSession(), currentCall->getFormat(), micDataEncoded, compSize, nbSample_) == -1) {
+                                _debug ("IAX: Error sending voice data.\n");
+                            }
+                        }
+
+                        _mutexIAX.leaveMutex();
+
+                    }
+                }
+
+            }
+
+        }
 
-		    }
-		}
-		
-	    }
-	    
-	}
-	
     }
 }
 
 
-	IAXCall*
+IAXCall*
 IAXVoIPLink::getIAXCall (const CallID& id)
 {
-	Call* call = getCall (id);
+    Call* call = getCall (id);
 
-	if (call) {
-		return dynamic_cast<IAXCall*> (call);
-	}
+    if (call) {
+        return dynamic_cast<IAXCall*> (call);
+    }
 
-	return NULL;
+    return NULL;
 }
 
 
-	int
+int
 IAXVoIPLink::sendRegister (AccountID id)
 {
-	IAXAccount *account;
-	bool result;
+    IAXAccount *account;
+    bool result;
 
-	result = false;
-	account = dynamic_cast<IAXAccount *> (getAccountPtr());
+    result = false;
+    account = dynamic_cast<IAXAccount *> (getAccountPtr());
 
-	if (account->getHostname().empty()) {
-		return false;
-	}
+    if (account->getHostname().empty()) {
+        return false;
+    }
 
-	if (account->getUsername().empty()) {
-		return false;
-	}
+    if (account->getUsername().empty()) {
+        return false;
+    }
 
-	// lock
-	_mutexIAX.enterMutex();
+    // lock
+    _mutexIAX.enterMutex();
 
-	// Always use a brand new session
-	if (_regSession) {
-		iax_destroy (_regSession);
-	}
+    // Always use a brand new session
+    if (_regSession) {
+        iax_destroy (_regSession);
+    }
 
-	_regSession = iax_session_new();
+    _regSession = iax_session_new();
 
-	if (!_regSession) {
-		_debug ("Error when generating new session for register");
-	} else {
-		_debug ("IAX Sending registration to %s with user %s\n", account->getHostname().c_str() , account->getUsername().c_str());
-		int val = iax_register (_regSession, account->getHostname().data(), account->getUsername().data(), account->getPassword().data(), 120);
-		_debug ("Return value: %d\n", val);
-		// set the time-out to 15 seconds, after that, resend a registration request.
-		// until we unregister.
-		_nextRefreshStamp = time (NULL) + 10;
-		result = true;
+    if (!_regSession) {
+        _debug ("Error when generating new session for register");
+    } else {
+        _debug ("IAX Sending registration to %s with user %s\n", account->getHostname().c_str() , account->getUsername().c_str());
+        int val = iax_register (_regSession, account->getHostname().data(), account->getUsername().data(), account->getPassword().data(), 120);
+        _debug ("Return value: %d\n", val);
+        // set the time-out to 15 seconds, after that, resend a registration request.
+        // until we unregister.
+        _nextRefreshStamp = time (NULL) + 10;
+        result = true;
 
-		account->setRegistrationState (Trying);
-	}
+        account->setRegistrationState (Trying);
+    }
 
-	// unlock
-	_mutexIAX.leaveMutex();
+    // unlock
+    _mutexIAX.leaveMutex();
 
-	return result;
+    return result;
 }
 
-	int
+int
 IAXVoIPLink::sendUnregister (AccountID id)
 {
-	IAXAccount *account;
+    IAXAccount *account;
 
-	account = dynamic_cast<IAXAccount*> (getAccountPtr());
+    account = dynamic_cast<IAXAccount*> (getAccountPtr());
 
-	if (!account)
-		return 1;
+    if (!account)
+        return 1;
 
-	_mutexIAX.enterMutex();
+    _mutexIAX.enterMutex();
 
-	if (_regSession) {
-		/** @todo Should send a REGREL in sendUnregister()... */
-		//iax_send_regrel(); doesn't exist yet :)
-		iax_destroy (_regSession);
-		_regSession = NULL;
-	}
+    if (_regSession) {
+        /** @todo Should send a REGREL in sendUnregister()... */
+        //iax_send_regrel(); doesn't exist yet :)
+        iax_destroy (_regSession);
+        _regSession = NULL;
+    }
 
-	_mutexIAX.leaveMutex();
+    _mutexIAX.leaveMutex();
 
-	_nextRefreshStamp = 0;
+    _nextRefreshStamp = 0;
 
-	_debug ("IAX2 send unregister\n");
-	account->setRegistrationState (Unregistered);
+    _debug ("IAX2 send unregister\n");
+    account->setRegistrationState (Unregistered);
 
-	return SUCCESS;
+    return SUCCESS;
 }
 
-	Call*
+Call*
 IAXVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl)
 {
-	IAXCall* call = new IAXCall (id, Call::Outgoing);
-	call->setCodecMap (Manager::instance().getCodecDescriptorMap());
-
-	if (call) {
-		call->setPeerNumber (toUrl);
-		call->initRecFileName();
-
-		if (iaxOutgoingInvite (call)) {
-			call->setConnectionState (Call::Progressing);
-			call->setState (Call::Active);
-			addCall (call);
-		} else {
-			delete call;
-			call = NULL;
-		}
-	}
-
-	return call;
+    IAXCall* call = new IAXCall (id, Call::Outgoing);
+    call->setCodecMap (Manager::instance().getCodecDescriptorMap());
+
+    if (call) {
+        call->setPeerNumber (toUrl);
+        call->initRecFileName();
+
+        if (iaxOutgoingInvite (call)) {
+            call->setConnectionState (Call::Progressing);
+            call->setState (Call::Active);
+            addCall (call);
+        } else {
+            delete call;
+            call = NULL;
+        }
+    }
+
+    return call;
 }
 
 
-	bool
+bool
 IAXVoIPLink::answer (const CallID& id)
 {
-	IAXCall* call = getIAXCall (id);
-	call->setCodecMap (Manager::instance().getCodecDescriptorMap());
+    IAXCall* call = getIAXCall (id);
+    call->setCodecMap (Manager::instance().getCodecDescriptorMap());
 
-	Manager::instance().addStream(call->getCallId());
+    Manager::instance().addStream (call->getCallId());
 
-	CHK_VALID_CALL;
+    CHK_VALID_CALL;
 
-	_mutexIAX.enterMutex();
-	iax_answer (call->getSession());
-	_mutexIAX.leaveMutex();
+    _mutexIAX.enterMutex();
+    iax_answer (call->getSession());
+    _mutexIAX.leaveMutex();
 
-	call->setState (Call::Active);
-	call->setConnectionState (Call::Connected);
+    call->setState (Call::Active);
+    call->setConnectionState (Call::Connected);
 
-	// Flush main buffer
-	audiolayer->flushMain();
+    // Flush main buffer
+    audiolayer->flushMain();
 
-	return true;
+    return true;
 }
 
-	bool
+bool
 IAXVoIPLink::hangup (const CallID& id)
 {
-	_debug ("IAXVoIPLink::hangup() : function called once hangup \n");
-	IAXCall* call = getIAXCall (id);
-	std::string reason = "Dumped Call";
-	CHK_VALID_CALL;
+    _debug ("IAXVoIPLink::hangup() : function called once hangup \n");
+    IAXCall* call = getIAXCall (id);
+    std::string reason = "Dumped Call";
+    CHK_VALID_CALL;
 
-	audiolayer->getMainBuffer()->unBindAll(call->getCallId());
+    audiolayer->getMainBuffer()->unBindAll (call->getCallId());
 
-	_mutexIAX.enterMutex();
+    _mutexIAX.enterMutex();
 
-	iax_hangup (call->getSession(), (char*) reason.c_str());
-	_mutexIAX.leaveMutex();
-	call->setSession (NULL);
+    iax_hangup (call->getSession(), (char*) reason.c_str());
+    _mutexIAX.leaveMutex();
+    call->setSession (NULL);
 
-	if (Manager::instance().isCurrentCall (id)) {
-		// stop audio
-		// audiolayer->stopStream();
-	}
+    if (Manager::instance().isCurrentCall (id)) {
+        // stop audio
+        // audiolayer->stopStream();
+    }
 
-	terminateOneCall (id);
+    terminateOneCall (id);
 
-	removeCall (id);
-	return true;
+    removeCall (id);
+    return true;
 }
 
 
-	bool
+bool
 IAXVoIPLink::peerHungup (const CallID& id)
 {
-	_debug ("IAXVoIPLink::peerHangup() : function called once hangup \n");
-	IAXCall* call = getIAXCall (id);
-	std::string reason = "Dumped Call";
-	CHK_VALID_CALL;
+    _debug ("IAXVoIPLink::peerHangup() : function called once hangup \n");
+    IAXCall* call = getIAXCall (id);
+    std::string reason = "Dumped Call";
+    CHK_VALID_CALL;
 
-	audiolayer->getMainBuffer()->unBindAll(call->getCallId());
+    audiolayer->getMainBuffer()->unBindAll (call->getCallId());
 
-	_mutexIAX.enterMutex();
+    _mutexIAX.enterMutex();
 
-	_mutexIAX.leaveMutex();
-	call->setSession (NULL);
+    _mutexIAX.leaveMutex();
+    call->setSession (NULL);
 
-	if (Manager::instance().isCurrentCall (id)) {
-		// stop audio
-		// audiolayer->stopStream();
-	}
+    if (Manager::instance().isCurrentCall (id)) {
+        // stop audio
+        // audiolayer->stopStream();
+    }
 
-	terminateOneCall (id);
+    terminateOneCall (id);
 
-	removeCall (id);
-	return true;
+    removeCall (id);
+    return true;
 }
 
 
 
-	bool
+bool
 IAXVoIPLink::onhold (const CallID& id)
 {
-	IAXCall* call = getIAXCall (id);
+    IAXCall* call = getIAXCall (id);
 
-	CHK_VALID_CALL;
+    CHK_VALID_CALL;
 
-	audiolayer->getMainBuffer()->unBindAll(call->getCallId());
+    audiolayer->getMainBuffer()->unBindAll (call->getCallId());
 
-	//if (call->getState() == Call::Hold) { _debug("Call is already on hold\n"); return false; }
+    //if (call->getState() == Call::Hold) { _debug("Call is already on hold\n"); return false; }
 
-	_mutexIAX.enterMutex();
-	iax_quelch_moh (call->getSession() , MUSIC_ONHOLD);
-	_mutexIAX.leaveMutex();
+    _mutexIAX.enterMutex();
+    iax_quelch_moh (call->getSession() , MUSIC_ONHOLD);
+    _mutexIAX.leaveMutex();
 
-	call->setState (Call::Hold);
-	return true;
+    call->setState (Call::Hold);
+    return true;
 }
 
-	bool
+bool
 IAXVoIPLink::offhold (const CallID& id)
 {
-	IAXCall* call = getIAXCall (id);
+    IAXCall* call = getIAXCall (id);
 
-	CHK_VALID_CALL;
+    CHK_VALID_CALL;
 
-	Manager::instance().addStream(call->getCallId());
+    Manager::instance().addStream (call->getCallId());
 
-	//if (call->getState() == Call::Active) { _debug("Call is already active\n"); return false; }
-	_mutexIAX.enterMutex();
-	iax_unquelch (call->getSession());
-	_mutexIAX.leaveMutex();
-	audiolayer->startStream();
-	call->setState (Call::Active);
-	return true;
+    //if (call->getState() == Call::Active) { _debug("Call is already active\n"); return false; }
+    _mutexIAX.enterMutex();
+    iax_unquelch (call->getSession());
+    _mutexIAX.leaveMutex();
+    audiolayer->startStream();
+    call->setState (Call::Active);
+    return true;
 }
 
-	bool
+bool
 IAXVoIPLink::transfer (const CallID& id, const std::string& to)
 {
-	IAXCall* call = getIAXCall (id);
+    IAXCall* call = getIAXCall (id);
 
-	CHK_VALID_CALL;
+    CHK_VALID_CALL;
 
-	char callto[to.length() +1];
-	strcpy (callto, to.c_str());
+    char callto[to.length() +1];
+    strcpy (callto, to.c_str());
 
-	_mutexIAX.enterMutex();
-	iax_transfer (call->getSession(), callto);
-	_mutexIAX.leaveMutex();
+    _mutexIAX.enterMutex();
+    iax_transfer (call->getSession(), callto);
+    _mutexIAX.leaveMutex();
 
-	return true;
+    return true;
 
-	// should we remove it?
-	// removeCall(id);
+    // should we remove it?
+    // removeCall(id);
 }
 
-	bool
+bool
 IAXVoIPLink::refuse (const CallID& id)
 {
-	IAXCall* call = getIAXCall (id);
-	std::string reason = "Call rejected manually.";
+    IAXCall* call = getIAXCall (id);
+    std::string reason = "Call rejected manually.";
 
-	CHK_VALID_CALL;
+    CHK_VALID_CALL;
 
-	_mutexIAX.enterMutex();
-	iax_reject (call->getSession(), (char*) reason.c_str());
-	_mutexIAX.leaveMutex();
+    _mutexIAX.enterMutex();
+    iax_reject (call->getSession(), (char*) reason.c_str());
+    _mutexIAX.leaveMutex();
 
 
-	// terminateOneCall(id);
-	removeCall (id);
+    // terminateOneCall(id);
+    removeCall (id);
 
-	return true;
+    return true;
 }
 
 
-	bool
+bool
 IAXVoIPLink::carryingDTMFdigits (const CallID& id, char code)
 {
-	IAXCall* call = getIAXCall (id);
+    IAXCall* call = getIAXCall (id);
 
-	CHK_VALID_CALL;
+    CHK_VALID_CALL;
 
-	_mutexIAX.enterMutex();
-	iax_send_dtmf (call->getSession(), code);
-	_mutexIAX.leaveMutex();
+    _mutexIAX.enterMutex();
+    iax_send_dtmf (call->getSession(), code);
+    _mutexIAX.leaveMutex();
 
-	return true;
+    return true;
 }
 
 
-	std::string
+std::string
 IAXVoIPLink::getCurrentCodecName()
 {
-	IAXCall *call = NULL;
-	AudioCodec *ac = NULL;
-	std::string name = "";
+    IAXCall *call = NULL;
+    AudioCodec *ac = NULL;
+    std::string name = "";
 
-	call = getIAXCall (Manager::instance().getCurrentCallId());
+    call = getIAXCall (Manager::instance().getCurrentCallId());
 
-	if(call)
-		ac = call->getCodecMap().getCodec (call->getAudioCodec());
+    if (call)
+        ac = call->getCodecMap().getCodec (call->getAudioCodec());
 
-	if(ac)
-		name = ac->getCodecName();
+    if (ac)
+        name = ac->getCodecName();
 
-	return name;
+    return name;
 }
 
 
-	bool
+bool
 IAXVoIPLink::iaxOutgoingInvite (IAXCall* call)
 {
 
-	struct iax_session *newsession;
-	ost::MutexLock m (_mutexIAX);
-	std::string username, strNum;
-	char *lang=NULL;
-	int wait, audio_format_preferred, audio_format_capability;
-	IAXAccount *account;
+    struct iax_session *newsession;
+    ost::MutexLock m (_mutexIAX);
+    std::string username, strNum;
+    char *lang=NULL;
+    int wait, audio_format_preferred, audio_format_capability;
+    IAXAccount *account;
 
-	newsession = iax_session_new();
+    newsession = iax_session_new();
 
-	if (!newsession) {
-		_debug ("IAX Error: Can't make new session for a new call\n");
-		return false;
-	}
+    if (!newsession) {
+        _debug ("IAX Error: Can't make new session for a new call\n");
+        return false;
+    }
 
-	call->setSession (newsession);
+    call->setSession (newsession);
 
-	account = dynamic_cast<IAXAccount*> (getAccountPtr());
-	username = account->getUsername();
-	strNum = username + ":" + account->getPassword() + "@" + account->getHostname() + "/" + call->getPeerNumber();
+    account = dynamic_cast<IAXAccount*> (getAccountPtr());
+    username = account->getUsername();
+    strNum = username + ":" + account->getPassword() + "@" + account->getHostname() + "/" + call->getPeerNumber();
 
-	wait = 0;
-	/** @todo Make preference dynamic, and configurable */
-	audio_format_preferred =  call->getFirstMatchingFormat (call->getSupportedFormat());
-	audio_format_capability = call->getSupportedFormat();
+    wait = 0;
+    /** @todo Make preference dynamic, and configurable */
+    audio_format_preferred =  call->getFirstMatchingFormat (call->getSupportedFormat());
+    audio_format_capability = call->getSupportedFormat();
 
-	_debug ("IAX New call: %s\n", strNum.c_str());
-	iax_call (newsession, username.c_str(), username.c_str(), strNum.c_str(), lang, wait, audio_format_preferred, audio_format_capability);
+    _debug ("IAX New call: %s\n", strNum.c_str());
+    iax_call (newsession, username.c_str(), username.c_str(), strNum.c_str(), lang, wait, audio_format_preferred, audio_format_capability);
 
-	return true;
+    return true;
 }
 
 
-	IAXCall*
+IAXCall*
 IAXVoIPLink::iaxFindCallBySession (struct iax_session* session)
 {
-	// access to callMap shoud use that
-	// the code below is like findSIPCallWithCid()
-	ost::MutexLock m (_callMapMutex);
-	IAXCall* call = NULL;
-	CallMap::iterator iter = _callMap.begin();
+    // access to callMap shoud use that
+    // the code below is like findSIPCallWithCid()
+    ost::MutexLock m (_callMapMutex);
+    IAXCall* call = NULL;
+    CallMap::iterator iter = _callMap.begin();
 
-	while (iter != _callMap.end()) {
-		call = dynamic_cast<IAXCall*> (iter->second);
+    while (iter != _callMap.end()) {
+        call = dynamic_cast<IAXCall*> (iter->second);
 
-		if (call && call->getSession() == session) {
-			return call;
-		}
+        if (call && call->getSession() == session) {
+            return call;
+        }
 
-		iter++;
-	}
+        iter++;
+    }
 
-	return NULL; // not found
+    return NULL; // not found
 }
 
-	void
+void
 IAXVoIPLink::iaxHandleCallEvent (iax_event* event, IAXCall* call)
 {
-	// call should not be 0
-	// note activity?
-	//
-	CallID id = call->getCallId();
-
-	switch (event->etype) {
-
-		case IAX_EVENT_HANGUP:
-
-			if (Manager::instance().isCurrentCall (id)) {
-				// stop audio
-				// audiolayer->stopStream();
-			}
-
-			Manager::instance().peerHungupCall (id);
-
-			/*
-			   _debug("IAXVoIPLink::iaxHandleCallEvent, peer hangup have been called");
-			   std::string reason = "Dumped Call";
-			   _mutexIAX.enterMutex();
-			   iax_hangup(call->getSession(), (char*)reason.c_str());
-			   _mutexIAX.leaveMutex();
-			   call->setSession(NULL);
-			   audiolayer->stopStream();
-			   terminateOneCall(id);
-			 */
-			removeCall (id);
-			break;
-
-		case IAX_EVENT_REJECT:
-			//Manager::instance().peerHungupCall(id);
-
-			if (Manager::instance().isCurrentCall (id)) {
-				// stop audio
-				// audiolayer->stopStream();
-			}
+    // call should not be 0
+    // note activity?
+    //
+    CallID id = call->getCallId();
+
+    switch (event->etype) {
+
+        case IAX_EVENT_HANGUP:
+
+            if (Manager::instance().isCurrentCall (id)) {
+                // stop audio
+                // audiolayer->stopStream();
+            }
+
+            Manager::instance().peerHungupCall (id);
+
+            /*
+               _debug("IAXVoIPLink::iaxHandleCallEvent, peer hangup have been called");
+               std::string reason = "Dumped Call";
+               _mutexIAX.enterMutex();
+               iax_hangup(call->getSession(), (char*)reason.c_str());
+               _mutexIAX.leaveMutex();
+               call->setSession(NULL);
+               audiolayer->stopStream();
+               terminateOneCall(id);
+             */
+            removeCall (id);
+            break;
+
+        case IAX_EVENT_REJECT:
+            //Manager::instance().peerHungupCall(id);
+
+            if (Manager::instance().isCurrentCall (id)) {
+                // stop audio
+                // audiolayer->stopStream();
+            }
+
+            call->setConnectionState (Call::Connected);
+
+            call->setState (Call::Error);
+            Manager::instance().callFailure (id);
+            // terminateOneCall(id);
+            removeCall (id);
+            break;
 
-			call->setConnectionState (Call::Connected);
+        case IAX_EVENT_ACCEPT:
 
-			call->setState (Call::Error);
-			Manager::instance().callFailure (id);
-			// terminateOneCall(id);
-			removeCall (id);
-			break;
+            // Call accepted over there by the computer, not the user yet.
+            _debug ("IAX_EVENT_ACCEPT: codec format: ");
 
-		case IAX_EVENT_ACCEPT:
+            if (event->ies.format) {
+                printf ("%i\n", event->ies.format);
+                call->setFormat (event->ies.format);
+            } else {
+                printf ("no codec format\n");
+            }
 
-			// Call accepted over there by the computer, not the user yet.
-			_debug("IAX_EVENT_ACCEPT: codec format: ");
+            break;
 
-			if (event->ies.format) {
-				printf("%i\n", event->ies.format);
-				call->setFormat (event->ies.format);
-			}
-			else{
-				printf("no codec format\n");
-			}
+        case IAX_EVENT_ANSWER:
 
-			break;
+            if (call->getConnectionState() != Call::Connected) {
 
-		case IAX_EVENT_ANSWER:
+                Manager::instance().addStream (call->getCallId());
 
-			if (call->getConnectionState() != Call::Connected) {
+                call->setConnectionState (Call::Connected);
+                call->setState (Call::Active);
+                // audiolayer->startStream();
 
-				Manager::instance().addStream(call->getCallId());
+                _debug ("IAX_EVENT_ANSWER: codec format: ");
 
-				call->setConnectionState (Call::Connected);
-				call->setState (Call::Active);
-				// audiolayer->startStream();
+                if (event->ies.format) {
+                    // Should not get here, should have been set in EVENT_ACCEPT
+                    printf ("%i\n", event->ies.format);
+                    call->setFormat (event->ies.format);
+                }
 
-				_debug("IAX_EVENT_ANSWER: codec format: ");
+                {
+                    printf ("no codec format\n");
+                }
 
-				if (event->ies.format) {
-					// Should not get here, should have been set in EVENT_ACCEPT
-					printf("%i\n", event->ies.format);
-					call->setFormat (event->ies.format);
-				}
-				{
-					printf("no codec format\n");
-				}
+                Manager::instance().peerAnsweredCall (id);
 
-				Manager::instance().peerAnsweredCall (id);
+                // start audio here?
+                audiolayer->flushMain();
+            } else {
+                // deja connecté ?
+            }
 
-				// start audio here?
-				audiolayer->flushMain();
-			} else {
-				// deja connecté ?
-			}
+            break;
 
-			break;
+        case IAX_EVENT_BUSY:
+            call->setConnectionState (Call::Connected);
+            call->setState (Call::Busy);
+            Manager::instance().callBusy (id);
+            // terminateOneCall(id);
+            removeCall (id);
+            break;
 
-		case IAX_EVENT_BUSY:
-			call->setConnectionState (Call::Connected);
-			call->setState (Call::Busy);
-			Manager::instance().callBusy (id);
-			// terminateOneCall(id);
-			removeCall (id);
-			break;
+        case IAX_EVENT_VOICE:
+            //if (!audiolayer->isCaptureActive ())
+            //  audiolayer->startStream ();
+            // _debug("IAX_EVENT_VOICE: \n");
+            iaxHandleVoiceEvent (event, call);
+            break;
 
-		case IAX_EVENT_VOICE:
-			//if (!audiolayer->isCaptureActive ())
-			//  audiolayer->startStream ();
-			// _debug("IAX_EVENT_VOICE: \n");
-			iaxHandleVoiceEvent (event, call);
-			break;
+        case IAX_EVENT_TEXT:
+            break;
 
-		case IAX_EVENT_TEXT:
-			break;
+        case IAX_EVENT_RINGA:
+            call->setConnectionState (Call::Ringing);
+            Manager::instance().peerRingingCall (call->getCallId());
+            break;
 
-		case IAX_EVENT_RINGA:
-			call->setConnectionState (Call::Ringing);
-			Manager::instance().peerRingingCall (call->getCallId());
-			break;
+        case IAX_IE_MSGCOUNT:
+            break;
 
-		case IAX_IE_MSGCOUNT:
-			break;
-
-		case IAX_EVENT_PONG:
-			break;
+        case IAX_EVENT_PONG:
+            break;
 
-		case IAX_EVENT_URL:
+        case IAX_EVENT_URL:
 
-			if (Manager::instance().getConfigString (HOOKS, URLHOOK_IAX2_ENABLED) == "1") {
-				if (strcmp ( (char*) event->data, "") != 0) {
-					_debug ("> IAX_EVENT_URL received: %s\n", event->data);
-					urlhook->addAction ( (char*) event->data, Manager::instance().getConfigString (HOOKS, URLHOOK_COMMAND));
-				}
-			}
+            if (Manager::instance().getConfigString (HOOKS, URLHOOK_IAX2_ENABLED) == "1") {
+                if (strcmp ( (char*) event->data, "") != 0) {
+                    _debug ("> IAX_EVENT_URL received: %s\n", event->data);
+                    urlhook->addAction ( (char*) event->data, Manager::instance().getConfigString (HOOKS, URLHOOK_COMMAND));
+                }
+            }
 
-			break;
+            break;
 
-		case IAX_EVENT_TIMEOUT:
-			break;
+        case IAX_EVENT_TIMEOUT:
+            break;
 
-		case IAX_EVENT_TRANSFER:
-			break;
+        case IAX_EVENT_TRANSFER:
+            break;
 
-		default:
-			_debug ("iaxHandleCallEvent: Unknown event type (in call event): %d\n", event->etype);
+        default:
+            _debug ("iaxHandleCallEvent: Unknown event type (in call event): %d\n", event->etype);
 
-	}
+    }
 }
 
 
 /* Handle audio event, VOICE packet received */
-	void
+void
 IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call)
 {
 
-	unsigned char *data;
-	unsigned int size, max, nbInt16;
-	int expandedSize, nbSample_;
-	AudioCodec *ac;
+    unsigned char *data;
+    unsigned int size, max, nbInt16;
+    int expandedSize, nbSample_;
+    AudioCodec *ac;
+
+    if (!call)
+        return;
 
-	if (!call)
-		return;
+    if (!event->datalen) {
+        // Skip this empty packet.
+        //_debug("IAX: Skipping empty jitter-buffer interpolated packet\n");
+        return;
+    }
+
+    ac = call->getCodecMap ().getCodec (call->getAudioCodec ());
 
-	if (!event->datalen) {
-		// Skip this empty packet.
-		//_debug("IAX: Skipping empty jitter-buffer interpolated packet\n");
-		return;
-	}
+    if (!ac)
+        return;
 
-	ac = call->getCodecMap ().getCodec (call->getAudioCodec ());
+    if (audiolayer) {
 
-	if (!ac)
-		return;
+        audiolayer->getMainBuffer ()->setInternalSamplingRate (ac->getClockRate ());
 
-	if (audiolayer) {
+        // If we receive datalen == 0, some things of the jitter buffer in libiax2/iax.c
+        // were triggered
 
-		audiolayer->getMainBuffer ()->setInternalSamplingRate (ac->getClockRate ());
+        int _mainBufferSampleRate = audiolayer->getMainBuffer()->getInternalSamplingRate();
 
-		// If we receive datalen == 0, some things of the jitter buffer in libiax2/iax.c
-		// were triggered
+        // On-the-fly codec changing (normally, when we receive a full packet)
+        // as per http://tools.ietf.org/id/draft-guy-iax-03.txt
+        // - subclass holds the voiceformat property.
 
-		int _mainBufferSampleRate = audiolayer->getMainBuffer()->getInternalSamplingRate();
+        if (event->subclass && event->subclass != call->getFormat()) {
+            _debug ("iaxHandleVoiceEvent: no format found in call setting it to %i\n", event->subclass);
+            call->setFormat (event->subclass);
+        }
 
-		// On-the-fly codec changing (normally, when we receive a full packet)
-		// as per http://tools.ietf.org/id/draft-guy-iax-03.txt
-		// - subclass holds the voiceformat property.
-		if (event->subclass && event->subclass != call->getFormat()) {
-			_debug("iaxHandleVoiceEvent: no format found in call setting it to %i\n", event->subclass);
-			call->setFormat (event->subclass);
-		}
+        //_debug("Receive: len=%d, format=%d, _receiveDataDecoded=%p\n", event->datalen, call->getFormat(), _receiveDataDecoded);
+        // ac = call->getCodecMap().getCodec (call -> getAudioCodec());
 
-		//_debug("Receive: len=%d, format=%d, _receiveDataDecoded=%p\n", event->datalen, call->getFormat(), _receiveDataDecoded);
-		// ac = call->getCodecMap().getCodec (call -> getAudioCodec());
+        data = (unsigned char*) event->data;
 
-		data = (unsigned char*) event->data;
+        size   = event->datalen;
 
-		size   = event->datalen;
+        // Decode data with relevant codec
+        max = (int) (ac->getClockRate() * audiolayer->getFrameSize() / 1000);
 
-		// Decode data with relevant codec
-		max = (int) (ac->getClockRate() * audiolayer->getFrameSize() / 1000);
+        if (size > max) {
+            _debug ("The size %d is bigger than expected %d. Packet cropped. Ouch!\n", size, max);
+            size = max;
+        }
 
-		if (size > max) {
-			_debug ("The size %d is bigger than expected %d. Packet cropped. Ouch!\n", size, max);
-			size = max;
-		}
+        expandedSize = ac->codecDecode (spkrDataDecoded , data , size);
 
-		expandedSize = ac->codecDecode (spkrDataDecoded , data , size);
+        nbInt16      = expandedSize/sizeof (int16);
 
-		nbInt16      = expandedSize/sizeof (int16);
+        if (nbInt16 > max) {
+            _debug ("We have decoded an IAX VOICE packet larger than expected: %i VS %i. Cropping.\n", nbInt16, max);
+            nbInt16 = max;
+        }
 
-		if (nbInt16 > max) {
-			_debug ("We have decoded an IAX VOICE packet larger than expected: %i VS %i. Cropping.\n", nbInt16, max);
-			nbInt16 = max;
-		}
+        nbSample_ = nbInt16;
 
-		nbSample_ = nbInt16;
+        // test if resampling is required
 
-		// test if resampling is required
-		if (ac->getClockRate() && (ac->getClockRate() != _mainBufferSampleRate)) {
+        if (ac->getClockRate() && (ac->getClockRate() != _mainBufferSampleRate)) {
 
-			// resample
-			nbInt16 = converter->upsampleData (spkrDataDecoded, spkrDataConverted, ac->getClockRate(), _mainBufferSampleRate, nbSample_);
+            // resample
+            nbInt16 = converter->upsampleData (spkrDataDecoded, spkrDataConverted, ac->getClockRate(), _mainBufferSampleRate, nbSample_);
 
-			/* Write the data to the mic ring buffer */
-			audiolayer->getMainBuffer()->putData (spkrDataConverted, nbInt16 * sizeof (SFLDataFormat), 100, call->getCallId());
+            /* Write the data to the mic ring buffer */
+            audiolayer->getMainBuffer()->putData (spkrDataConverted, nbInt16 * sizeof (SFLDataFormat), 100, call->getCallId());
 
-		} else {
+        } else {
 
-			/* Write the data to the mic ring buffer */
-			audiolayer->getMainBuffer()->putData (spkrDataDecoded, nbInt16 * sizeof (SFLDataFormat), 100, call->getCallId());
+            /* Write the data to the mic ring buffer */
+            audiolayer->getMainBuffer()->putData (spkrDataDecoded, nbInt16 * sizeof (SFLDataFormat), 100, call->getCallId());
 
-		}
+        }
 
-	} else {
-		_debug ("IAX: incoming audio, but no sound card open");
-	}
+    } else {
+        _debug ("IAX: incoming audio, but no sound card open");
+    }
 
 }
 
 /**
  * Handle the registration process
  */
-	void
+void
 IAXVoIPLink::iaxHandleRegReply (iax_event* event)
 {
 
-	std::string account_id;
-	IAXAccount *account;
-
-	account_id = getAccountID();
-	account = dynamic_cast<IAXAccount *> (Manager::instance().getAccount (account_id));
-
-	if (event->etype == IAX_EVENT_REGREJ) {
-		/* Authentication failed! */
-		_mutexIAX.enterMutex();
-		iax_destroy (_regSession);
-		_mutexIAX.leaveMutex();
-		_regSession = NULL;
-		// Update the account registration state
-		account->setRegistrationState (ErrorAuth);
-	}
-
-	else if (event->etype == IAX_EVENT_REGACK) {
-		/* Authentication succeeded */
-		_mutexIAX.enterMutex();
-
-		// Looking for the voicemail information
-		//if( event->ies != 0 )
-		//new_voicemails = processIAXMsgCount(event->ies.msgcount);
-		//_debug("iax voicemail number notification: %i\n", new_voicemails);
-		// Notify the client if new voicemail waiting for the current account
-		//account_id = getAccountID();
-		//Manager::instance().startVoiceMessageNotification(account_id.c_str(), new_voicemails);
-
-		iax_destroy (_regSession);
-		_mutexIAX.leaveMutex();
-		_regSession = NULL;
-
-		// I mean, save the timestamp, so that we re-register again in the REFRESH time.
-		// Defaults to 60, as per draft-guy-iax-03.
-		_nextRefreshStamp = time (NULL) + (event->ies.refresh ? event->ies.refresh : 60);
-		account->setRegistrationState (Registered);
-	}
+    std::string account_id;
+    IAXAccount *account;
+
+    account_id = getAccountID();
+    account = dynamic_cast<IAXAccount *> (Manager::instance().getAccount (account_id));
+
+    if (event->etype == IAX_EVENT_REGREJ) {
+        /* Authentication failed! */
+        _mutexIAX.enterMutex();
+        iax_destroy (_regSession);
+        _mutexIAX.leaveMutex();
+        _regSession = NULL;
+        // Update the account registration state
+        account->setRegistrationState (ErrorAuth);
+    }
+
+    else if (event->etype == IAX_EVENT_REGACK) {
+        /* Authentication succeeded */
+        _mutexIAX.enterMutex();
+
+        // Looking for the voicemail information
+        //if( event->ies != 0 )
+        //new_voicemails = processIAXMsgCount(event->ies.msgcount);
+        //_debug("iax voicemail number notification: %i\n", new_voicemails);
+        // Notify the client if new voicemail waiting for the current account
+        //account_id = getAccountID();
+        //Manager::instance().startVoiceMessageNotification(account_id.c_str(), new_voicemails);
+
+        iax_destroy (_regSession);
+        _mutexIAX.leaveMutex();
+        _regSession = NULL;
+
+        // I mean, save the timestamp, so that we re-register again in the REFRESH time.
+        // Defaults to 60, as per draft-guy-iax-03.
+        _nextRefreshStamp = time (NULL) + (event->ies.refresh ? event->ies.refresh : 60);
+        account->setRegistrationState (Registered);
+    }
 }
 
 int IAXVoIPLink::processIAXMsgCount (int msgcount)
 {
 
-	// IAX sends the message count under a specific format:
-	//                       1
-	//  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
-	//  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	//  |      0x18     |      0x02     |
-	//  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-	//  |  Old messages |  New messages |
-	//  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+    // IAX sends the message count under a specific format:
+    //                       1
+    //  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+    //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+    //  |      0x18     |      0x02     |
+    //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+    //  |  Old messages |  New messages |
+    //  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
-	// For now we just need the new messages informations.
-	// Thus:
-	// 0 <= msgcount <= 255   => msgcount new messages, 0 old messages
-	// msgcount >= 256        => msgcount/256 old messages , msgcount%256 new messages (RULES)
+    // For now we just need the new messages informations.
+    // Thus:
+    // 0 <= msgcount <= 255   => msgcount new messages, 0 old messages
+    // msgcount >= 256        => msgcount/256 old messages , msgcount%256 new messages (RULES)
 
-	return msgcount%256;
+    return msgcount%256;
 
 }
 
 
-	void
+void
 IAXVoIPLink::iaxHandlePrecallEvent (iax_event* event)
 {
-	IAXCall* call = NULL;
-	CallID   id;
-	std::string reason = "Error ringing user.";
+    IAXCall* call = NULL;
+    CallID   id;
+    std::string reason = "Error ringing user.";
 
-	switch (event->etype) {
+    switch (event->etype) {
 
-		case IAX_EVENT_REGACK:
+        case IAX_EVENT_REGACK:
 
-		case IAX_EVENT_REGREJ:
-			_debug ("IAX Registration Event in a pre-call setup\n");
-			break;
+        case IAX_EVENT_REGREJ:
+            _debug ("IAX Registration Event in a pre-call setup\n");
+            break;
 
-		case IAX_EVENT_REGREQ:
-			// Received when someone wants to register to us!?!
-			// Asterisk receives and answers to that, not us, we're a phone.
-			_debug ("Registration by a peer, don't allow it\n");
-			break;
+        case IAX_EVENT_REGREQ:
+            // Received when someone wants to register to us!?!
+            // Asterisk receives and answers to that, not us, we're a phone.
+            _debug ("Registration by a peer, don't allow it\n");
+            break;
 
-		case IAX_EVENT_CONNECT:
-			// We've got an incoming call! Yikes!
-			_debug ("> IAX_EVENT_CONNECT (receive)\n");
+        case IAX_EVENT_CONNECT:
+            // We've got an incoming call! Yikes!
+            _debug ("> IAX_EVENT_CONNECT (receive)\n");
 
-			id = Manager::instance().getNewCallID();
+            id = Manager::instance().getNewCallID();
 
-			call = new IAXCall (id, Call::Incoming);
+            call = new IAXCall (id, Call::Incoming);
 
-			if (!call) {
-				_debug ("! IAX Failure: unable to create an incoming call");
-				return;
-			}
+            if (!call) {
+                _debug ("! IAX Failure: unable to create an incoming call");
+                return;
+            }
 
-			// Setup the new IAXCall
-			// Associate the call to the session.
-			call->setSession (event->session);
+            // Setup the new IAXCall
+            // Associate the call to the session.
+            call->setSession (event->session);
 
-			// setCallAudioLocal(call);
-			call->setCodecMap (Manager::instance().getCodecDescriptorMap());
+            // setCallAudioLocal(call);
+            call->setCodecMap (Manager::instance().getCodecDescriptorMap());
 
-			call->setConnectionState (Call::Progressing);
+            call->setConnectionState (Call::Progressing);
 
 
-			if (event->ies.calling_number)
-				call->setPeerNumber (std::string (event->ies.calling_number));
+            if (event->ies.calling_number)
+                call->setPeerNumber (std::string (event->ies.calling_number));
 
-			if (event->ies.calling_name)
-				call->setPeerName (std::string (event->ies.calling_name));
+            if (event->ies.calling_name)
+                call->setPeerName (std::string (event->ies.calling_name));
 
-			// if peerNumber exist append it to the name string
-			call->initRecFileName();
+            // if peerNumber exist append it to the name string
+            call->initRecFileName();
 
-			if (Manager::instance().incomingCall (call, getAccountID())) {
-				/** @todo Faudra considérer éventuellement le champ CODEC PREFS pour
-				 * l'établissement du codec de transmission */
+            if (Manager::instance().incomingCall (call, getAccountID())) {
+                /** @todo Faudra considérer éventuellement le champ CODEC PREFS pour
+                 * l'établissement du codec de transmission */
 
-				// Remote lists its capabilities
-				int format = call->getFirstMatchingFormat (event->ies.capability);
-				// Remote asks for preferred codec voiceformat
-				int pref_format = call->getFirstMatchingFormat (event->ies.format);
+                // Remote lists its capabilities
+                int format = call->getFirstMatchingFormat (event->ies.capability);
+                // Remote asks for preferred codec voiceformat
+                int pref_format = call->getFirstMatchingFormat (event->ies.format);
 
-				// Priority to remote's suggestion. In case it's a forwarding, no transcoding
-				// will be needed from the server, thus less latency.
+                // Priority to remote's suggestion. In case it's a forwarding, no transcoding
+                // will be needed from the server, thus less latency.
 
-				if (pref_format)
-					format = pref_format;
+                if (pref_format)
+                    format = pref_format;
 
-				iax_accept (event->session, format);
+                iax_accept (event->session, format);
 
-				iax_ring_announce (event->session);
+                iax_ring_announce (event->session);
 
-				addCall (call);
+                addCall (call);
 
-				// Set the audio codec now, to avoid non-set codec problem later
-				call->setFormat (format);
+                // Set the audio codec now, to avoid non-set codec problem later
+                call->setFormat (format);
 
-			} else {
-				// reject call, unable to add it
-				iax_reject (event->session, (char*) reason.c_str());
+            } else {
+                // reject call, unable to add it
+                iax_reject (event->session, (char*) reason.c_str());
 
-				delete call;
-				call = NULL;
-			}
+                delete call;
+                call = NULL;
+            }
 
-			break;
+            break;
 
-		case IAX_EVENT_HANGUP:
-			// Remote peer hung up
-			call = iaxFindCallBySession (event->session);
-			id = call->getCallId();
-			_debug ("IAXVoIPLink::hungup::iaxHandlePrecallEvent");
-			Manager::instance().peerHungupCall (id);
-			// terminateOneCall(id);
-			removeCall (id);
-			break;
+        case IAX_EVENT_HANGUP:
+            // Remote peer hung up
+            call = iaxFindCallBySession (event->session);
+            id = call->getCallId();
+            _debug ("IAXVoIPLink::hungup::iaxHandlePrecallEvent");
+            Manager::instance().peerHungupCall (id);
+            // terminateOneCall(id);
+            removeCall (id);
+            break;
 
-		case IAX_EVENT_TIMEOUT: // timeout for an unknown session
+        case IAX_EVENT_TIMEOUT: // timeout for an unknown session
 
-			break;
+            break;
 
-		case IAX_IE_MSGCOUNT:
-			//_debug("messssssssssssssssssssssssssssssssssssssssssssssssages\n");
-			break;
+        case IAX_IE_MSGCOUNT:
+            //_debug("messssssssssssssssssssssssssssssssssssssssssssssssages\n");
+            break;
 
-		default:
-			_debug ("IAXVoIPLink::iaxHandlePrecallEvent: Unknown event type (in precall): %d\n", event->etype);
-	}
+        default:
+            _debug ("IAXVoIPLink::iaxHandlePrecallEvent: Unknown event type (in precall): %d\n", event->etype);
+    }
 
 }
 
 void IAXVoIPLink::updateAudiolayer (void)
 {
-	_mutexIAX.enterMutex();
-	audiolayer = NULL;
-	audiolayer = Manager::instance().getAudioDriver();
-	_mutexIAX.leaveMutex();
+    _mutexIAX.enterMutex();
+    audiolayer = NULL;
+    audiolayer = Manager::instance().getAudioDriver();
+    _mutexIAX.leaveMutex();
 }
 
diff --git a/sflphone-common/src/main.cpp b/sflphone-common/src/main.cpp
index 48975876a924eabe49f52ac1f72d0047d3c52de5..d023997021f9fc7d892ce88346a161ce1b940622 100644
--- a/sflphone-common/src/main.cpp
+++ b/sflphone-common/src/main.cpp
@@ -73,7 +73,8 @@ main (int argc, char **argv)
 
         sprintf (sfldir, "%s", path.c_str ());
 
-		path  = path + "sflphone";	
+        path  = path + "sflphone";
+
         sprintf (homepid, "%s/%s", path.c_str (), PIDFILE);
 
         if ( (fp = fopen (homepid,"r")) == NULL) {
@@ -88,15 +89,16 @@ main (int argc, char **argv)
                 }
             }
 
-			// Then create the sflphone directory inside the $XDG_CACHE_HOME dir
-			sprintf (sfldir, "%s", path.c_str ());
-			if ( (dir = opendir (sfldir)) == NULL) {
-				//Create it
-				if (mkdir (sfldir, 0755) != 0) {
-					fprintf (stderr, "Creating directory %s failed. Exited.\n", sfldir);
-					exit (-1);
-				}
-			}
+            // Then create the sflphone directory inside the $XDG_CACHE_HOME dir
+            sprintf (sfldir, "%s", path.c_str ());
+
+            if ( (dir = opendir (sfldir)) == NULL) {
+                //Create it
+                if (mkdir (sfldir, 0755) != 0) {
+                    fprintf (stderr, "Creating directory %s failed. Exited.\n", sfldir);
+                    exit (-1);
+                }
+            }
 
             // PID file doesn't exists, create and write pid in it
             if ( (fp = fopen (homepid,"w")) == NULL) {
diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 5b2f288e8e00caf92058d5f0aa8e0556887678d1..3e93b7642cea610f6016b3ad06534aaf44772ce9 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -265,7 +265,7 @@ ManagerImpl::outgoingCall (const std::string& account_id, const CallID& call_id,
         _cleaner->set_phone_number_prefix (getConfigString (HOOKS, PHONE_NUMBER_HOOK_ADD_PREFIX));
     else
         _cleaner->set_phone_number_prefix ("");
- 
+
     to_cleaned = _cleaner->clean (to);
 
     /* Check what kind of call we are dealing with */
@@ -382,7 +382,7 @@ ManagerImpl::answerCall (const CallID& call_id)
 
     // if it was waiting, it's waiting no more
     if (_dbus) _dbus->getCallManager()->callStateChanged (call_id, "CURRENT");
-        
+
     // std::string codecName = Manager::instance().getCurrentCodecName (call_id);
     // if (_dbus) _dbus->getCallManager()->currentSelectedCodec (call_id, codecName.c_str());
 
@@ -1728,22 +1728,23 @@ ManagerImpl::incomingCall (Call* call, const AccountID& accountId)
     associateCallToAccount (call->getCallId(), accountId);
 
     // If account is null it is an ip to ip call
+
     if (accountId==AccountNULL) {
-        
+
         associateConfigToCall (call->getCallId(), Call::IPtoIP);
-    }
-    else {
-        // strip sip: which is not required and bring confusion with ip to ip calls 
+    } else {
+        // strip sip: which is not required and bring confusion with ip to ip calls
         // when placing new call from history (if call is IAX, do nothing)
         std::string peerNumber = call->getPeerNumber();
 
-        int startIndex = peerNumber.find("sip:");
+        int startIndex = peerNumber.find ("sip:");
 
-	// if "sip:" is found => it is not an IAX call
-	if(startIndex != (int)string::npos) {
-	    std::string strippedPeerNumber = peerNumber.substr(startIndex+4);
-	    call->setPeerNumber(strippedPeerNumber);
-	}
+        // if "sip:" is found => it is not an IAX call
+
+        if (startIndex != (int) string::npos) {
+            std::string strippedPeerNumber = peerNumber.substr (startIndex+4);
+            call->setPeerNumber (strippedPeerNumber);
+        }
 
     }
 
@@ -3232,6 +3233,9 @@ void ManagerImpl::setSipPort (int port)
 
 int ManagerImpl::getSipPort (void)
 {
+	int port;
+
+	// port = getConfigInt (IP2IP , CONFIG_SIP_PORT)
     return getConfigInt (PREFERENCES , CONFIG_SIP_PORT);
 }
 
@@ -3669,7 +3673,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
     std::string authenticationName;
     std::string password;
     std::string realm;
-	std::string voicemail_count;
+    std::string voicemail_count;
 
     if ( (iter = map_cpy.find (AUTHENTICATION_USERNAME)) != map_cpy.end()) {
         authenticationName = iter->second;
@@ -3686,8 +3690,9 @@ void ManagerImpl::setAccountDetails (const std::string& accountID, const std::ma
     if ( (iter = map_cpy.find (REALM)) != map_cpy.end()) {
         realm = iter->second;
     }
-    
+
     setConfig (accountID, REALM, realm);
+
     setConfig (accountID, USERNAME, username);
     setConfig (accountID, AUTHENTICATION_USERNAME, authenticationName);
 
@@ -4151,6 +4156,14 @@ ManagerImpl::loadAccountMap()
 
     TokenList::iterator iter = sections.begin();
 
+	// Those calls that are placed to an uri that cannot be
+    // associated to an account are using that special account.
+    // An account, that is not account, in the sense of
+    // registration. This is useful since the Account object
+    // provides a handful of method that simplifies URI creation
+    // and loading of various settings.
+    _directIpAccount = AccountCreator::createAccount (AccountCreator::SIP_DIRECT_IP_ACCOUNT, "");
+
     while (iter != sections.end()) {
         // Check if it starts with "Account:" (SIP and IAX pour le moment)
         if ( (int) (iter->find ("Account:")) != 0) {
@@ -4181,20 +4194,13 @@ ManagerImpl::loadAccountMap()
         iter++;
     }
 
-    // Those calls that are placed to an uri that cannot be
-    // associated to an account are using that special account.
-    // An account, that is not account, in the sense of
-    // registration. This is useful since the Account object
-    // provides a handful of method that simplifies URI creation
-    // and loading of various settings.
-    _directIpAccount = AccountCreator::createAccount (AccountCreator::SIP_DIRECT_IP_ACCOUNT, "");
-
     if (_directIpAccount == NULL) {
         _debug ("Failed to create direct ip calls \"account\"\n");
     } else {
         // Force the options to be loaded
         // No registration in the sense of
         // the REGISTER method is performed.
+        _debug ("Succeed to create direct ip calls \"account\"\n");
         _directIpAccount->registerVoIPLink();
     }
 
@@ -4239,6 +4245,7 @@ ManagerImpl::getAccount (const AccountID& accountID)
     // In our definition,
     // this is the "direct ip calls account"
     if (accountID == AccountNULL) {
+		_debug ("Returns the direct IP account\n");
         return _directIpAccount;
     }
 
diff --git a/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp b/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp
index dee07b35b5edb96ac231477a014b9a627b4a881d..9b265de0ee33c9f53f73026cb14c676f949948a4 100644
--- a/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp
+++ b/sflphone-common/src/plug-in/audiorecorder/audiorecord.cpp
@@ -477,7 +477,7 @@ void AudioRecord::recData (SFLDataFormat* buffer, int nSamples)
 
 
         if (sndFormat_ == INT16) {   // TODO change INT16 to SINT16
-            if (fwrite (buffer, sizeof (SFLDataFormat), nSamples, fp) != (unsigned int)nSamples)
+            if (fwrite (buffer, sizeof (SFLDataFormat), nSamples, fp) != (unsigned int) nSamples)
                 _debug ("AudioRecord: Could not record data! \n");
             else {
                 fflush (fp);
diff --git a/sflphone-common/src/sip/SdesNegotiator.cpp b/sflphone-common/src/sip/SdesNegotiator.cpp
index eaf0219cb042e6d1cf975c6e0346260ea16e7e3d..74442abafee1aa5ca51b69cfec6e85c31f308b73 100644
--- a/sflphone-common/src/sip/SdesNegotiator.cpp
+++ b/sflphone-common/src/sip/SdesNegotiator.cpp
@@ -23,168 +23,173 @@
 #include <iostream>
 #include <sstream>
 #include <algorithm>
-#include <stdexcept> 
+#include <stdexcept>
 
 using namespace sfl::util;
 
 struct CryptoAttribute {
-	std::string tag;
-	std::string cryptoSuite;
-	std::string keyParams;
-	std::string sessionParams;
+    std::string tag;
+    std::string cryptoSuite;
+    std::string keyParams;
+    std::string sessionParams;
 };
 
-SdesNegotiator::SdesNegotiator(const std::vector<CryptoSuiteDefinition>& localCapabilites, 
-							   const std::vector<std::string>& remoteAttribute) :
-_remoteAttribute(remoteAttribute),
-_localCapabilities(localCapabilites)
+SdesNegotiator::SdesNegotiator (const std::vector<CryptoSuiteDefinition>& localCapabilites,
+                                const std::vector<std::string>& remoteAttribute) :
+        _remoteAttribute (remoteAttribute),
+        _localCapabilities (localCapabilites)
 {
 
 }
 
-void SdesNegotiator::parse(void)
-{       
-	// The patterns below try to follow
-	// the ABNF grammar rules described in 
-	// RFC4568 section 9.2 with the general
-	// syntax :
-	//a=crypto:tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param)
-
-	Pattern
-	* generalSyntaxPattern,
-	* tagPattern, 
-	* cryptoSuitePattern, 
-	* keyParamsPattern, 
-	* sessionParamPattern;
-		
-	try {
-		generalSyntaxPattern = new Pattern("[\x20\x09]+", "g");
-		
-		tagPattern = new Pattern("^a=crypto:(?P<tag>[0-9]{1,9})");
-
-		cryptoSuitePattern = new Pattern(
-		"(?P<cryptoSuite>AES_CM_128_HMAC_SHA1_80|" \
-		"AES_CM_128_HMAC_SHA1_32|" \
-		"F8_128_HMAC_SHA1_80|" \
-		"[A-Za-z0-9_]+)"); // srtp-crypto-suite-ext
-
-		keyParamsPattern = new Pattern(
-		"(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \
-		"(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)\\|" \
-		"2\\^(?P<lifetime>[0-9]+)\\|" \
-		"(?P<mkiValue>[0-9]+)\\:" \
-		"(?P<mkiLength>[0-9]{1,3})\\;?", "g");
-
-		sessionParamPattern = new Pattern(
-		"(?P<sessionParam>(kdr\\=[0-9]{1,2}|" \
-		"UNENCRYPTED_SRTP|" \
-		"UNENCRYPTED_SRTCP|" \
-		"UNAUTHENTICATED_SRTP|" \
-		"FEC_ORDER=(?P<fecOrder>FEC_SRTP|SRTP_FEC)|" \
-		"FEC_KEY=(?P<fecKey>" + keyParamsPattern.getPattern() + ")|" \
-		"WSH=(?P<wsh>[0-9]{1,2})|" \
-		"(?<!\\-)[[:graph:]]+))*", "g"); // srtp-session-extension
-							  
-	} catch(compile_error& exception) {
-		throw parse_error("A compile exception occured on a pattern.");
-		
-	}
-
-	// Take each line from the vector
-	// and parse its content		
-	
-	std::vector<std::string>::iterator iter;    
-	for (iter = _remoteAttribute.begin(); iter != _remoteAttribute.end(); iter++) {
-
-		std::cout << (*iter) << std::endl;
-		
-		// Split the line into its component 
-		// that we will analyze further down.
-		
-		generalSyntaxPattern << (*iter);
-		std::vector<std::string> sdesLine;
-		
-		try {
-			sdesLine = generalSyntaxPattern.split();
-			if (sdesLine.size() < 3) {
-				throw parse_error("Missing components in SDES line");
-			}
-		} 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);
-		try {
-			std::string tag = tagPattern.group("tag");
-			std::cout << "tag = " << tag << std::endl;
-		} catch (match_error& exception) {
-			throw parse_error("Error while parsing the tag field");
-		}
-		
-		// Check if the crypto suite is valid and retreive
-		// its value.
-		cryptoSuitePattern << sdesLine.at(1);
-		try {
-			std::string cryptoSuite 
-			cryptoSuite = cryptoSuitePattern.group("cryptoSuite");
-			std::cout << "crypto-suite = " << cryptoSuite << std::endl;
-		} catch (match_error& exception) {
-			throw parse_error("Error while parsing the crypto-suite field");
-		}
-		
-		// Parse one or more key-params field.
-		keyParamsPattern << sdesLine.at(2);
-		try {
-			while (keyParamsPattern.matches()) {
-				std::string srtpKeyMethod;
-				srtpKeyMethod = keyParamsMatched.group("srtpKeyMethod");
-				std::cout << "srtp-key-method = " << srtpKeyMethod << std::endl;
-				
-				std::string srtpKeyInfo;
-				srtpKeyInfo = keyParamsPattern.group("srtpKeyInfo");
-				std::cout << "srtp-key-info = " << srtpKeyInfo << std::endl;
-				
-				std::string lifetime;
-				lifetime = keyParamsPattern.group("lifetime");
-				std::cout << "lifetime = " << lifetime << std::endl;
-				
-				std::string mkiValue
-				mkiValue = keyParamsPattern.group("mkiValue");
-				std::cout << "mkiValue = " << mkiValue << std::endl;
-				
-				std::string mkiLength;
-				mkiLength = keyParamsPattern.group("mkiLength");
-				std::cout << "mkiLength = " << mkiLength << std::endl;                 
-			}			
-		} catch (match_error& exception) {
-			throw parse_error("Error while parsing the key-params field");
-		}
-		
-		/**
-		 *  Parse the optional session-param fields
-		 * @todo Implement this !
-		 */
-		/*
-		if (sdesLine.size() == 3) continue;
-		
-		int i;
-		for (i = 3; i < sdesLine.size(); i++) {
-			sessionParamPattern << sdesLine.at(i); 
-			while (sessionpParamPattern.matches()) {
-					
-				} catch (match_error& exception) {
-					throw parse_error("Error while parsing the crypto-suite field");
-				}                                  
-			}
-		} */
-	}
-   
+void SdesNegotiator::parse (void)
+{
+    // The patterns below try to follow
+    // the ABNF grammar rules described in
+    // RFC4568 section 9.2 with the general
+    // syntax :
+    //a=crypto:tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param)
+
+    Pattern
+    * generalSyntaxPattern,
+    * tagPattern,
+    * cryptoSuitePattern,
+    * keyParamsPattern,
+    * sessionParamPattern;
+
+    try {
+        generalSyntaxPattern = new Pattern ("[\x20\x09]+", "g");
+
+        tagPattern = new Pattern ("^a=crypto:(?P<tag>[0-9]{1,9})");
+
+        cryptoSuitePattern = new Pattern (
+            "(?P<cryptoSuite>AES_CM_128_HMAC_SHA1_80|" \
+            "AES_CM_128_HMAC_SHA1_32|" \
+            "F8_128_HMAC_SHA1_80|" \
+            "[A-Za-z0-9_]+)"); // srtp-crypto-suite-ext
+
+        keyParamsPattern = new Pattern (
+            "(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \
+            "(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)\\|" \
+            "2\\^(?P<lifetime>[0-9]+)\\|" \
+            "(?P<mkiValue>[0-9]+)\\:" \
+            "(?P<mkiLength>[0-9]{1,3})\\;?", "g");
+
+        sessionParamPattern = new Pattern (
+            "(?P<sessionParam>(kdr\\=[0-9]{1,2}|" \
+            "UNENCRYPTED_SRTP|" \
+            "UNENCRYPTED_SRTCP|" \
+            "UNAUTHENTICATED_SRTP|" \
+            "FEC_ORDER=(?P<fecOrder>FEC_SRTP|SRTP_FEC)|" \
+            "FEC_KEY=(?P<fecKey>" + keyParamsPattern.getPattern() + ")|" \
+            "WSH=(?P<wsh>[0-9]{1,2})|" \
+            "(?<!\\-)[[:graph:]]+))*", "g"); // srtp-session-extension
+
+    } catch (compile_error& exception) {
+        throw parse_error ("A compile exception occured on a pattern.");
+
+    }
+
+    // Take each line from the vector
+    // and parse its content
+
+    std::vector<std::string>::iterator iter;
+
+    for (iter = _remoteAttribute.begin(); iter != _remoteAttribute.end(); iter++) {
+
+        std::cout << (*iter) << std::endl;
+
+        // Split the line into its component
+        // that we will analyze further down.
+
+        generalSyntaxPattern << (*iter);
+        std::vector<std::string> sdesLine;
+
+        try {
+            sdesLine = generalSyntaxPattern.split();
+
+            if (sdesLine.size() < 3) {
+                throw parse_error ("Missing components in SDES line");
+            }
+        } 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);
+
+        try {
+            std::string tag = tagPattern.group ("tag");
+            std::cout << "tag = " << tag << std::endl;
+        } catch (match_error& exception) {
+            throw parse_error ("Error while parsing the tag field");
+        }
+
+        // Check if the crypto suite is valid and retreive
+        // its value.
+        cryptoSuitePattern << sdesLine.at (1);
+
+        try {
+            std::string cryptoSuite
+            cryptoSuite = cryptoSuitePattern.group ("cryptoSuite");
+            std::cout << "crypto-suite = " << cryptoSuite << std::endl;
+        } catch (match_error& exception) {
+            throw parse_error ("Error while parsing the crypto-suite field");
+        }
+
+        // Parse one or more key-params field.
+        keyParamsPattern << sdesLine.at (2);
+
+        try {
+            while (keyParamsPattern.matches()) {
+                std::string srtpKeyMethod;
+                srtpKeyMethod = keyParamsMatched.group ("srtpKeyMethod");
+                std::cout << "srtp-key-method = " << srtpKeyMethod << std::endl;
+
+                std::string srtpKeyInfo;
+                srtpKeyInfo = keyParamsPattern.group ("srtpKeyInfo");
+                std::cout << "srtp-key-info = " << srtpKeyInfo << std::endl;
+
+                std::string lifetime;
+                lifetime = keyParamsPattern.group ("lifetime");
+                std::cout << "lifetime = " << lifetime << std::endl;
+
+                std::string mkiValue
+                mkiValue = keyParamsPattern.group ("mkiValue");
+                std::cout << "mkiValue = " << mkiValue << std::endl;
+
+                std::string mkiLength;
+                mkiLength = keyParamsPattern.group ("mkiLength");
+                std::cout << "mkiLength = " << mkiLength << std::endl;
+            }
+        } catch (match_error& exception) {
+            throw parse_error ("Error while parsing the key-params field");
+        }
+
+        /**
+         *  Parse the optional session-param fields
+         * @todo Implement this !
+         */
+        /*
+        if (sdesLine.size() == 3) continue;
+
+        int i;
+        for (i = 3; i < sdesLine.size(); i++) {
+        	sessionParamPattern << sdesLine.at(i);
+        	while (sessionpParamPattern.matches()) {
+
+        		} catch (match_error& exception) {
+        			throw parse_error("Error while parsing the crypto-suite field");
+        		}
+        	}
+        } */
+    }
+
 
 }
 
-bool SdesNegotiator::negotiate(void)
+bool SdesNegotiator::negotiate (void)
 {
-	parse();
+    parse();
 }
diff --git a/sflphone-common/src/sip/sdp.cpp b/sflphone-common/src/sip/sdp.cpp
index 489e042cf606ad688825c63e90ce59c1f3febdb0..116d2df867c4b7622decbccbaf19de71f1d9ed0a 100644
--- a/sflphone-common/src/sip/sdp.cpp
+++ b/sflphone-common/src/sip/sdp.cpp
@@ -177,7 +177,7 @@ int Sdp::create_initial_offer()
     status = create_local_offer();
 
     if (status != PJ_SUCCESS) {
-	_debug ("    Error: Failled to create initial offer\n");
+        _debug ("    Error: Failled to create initial offer\n");
         return status;
     }
 
@@ -185,7 +185,7 @@ int Sdp::create_initial_offer()
     status = pjmedia_sdp_neg_create_w_local_offer (_pool, get_local_sdp_session(), &_negociator);
 
     if (status != PJ_SUCCESS) {
-	_debug ("    Error: Failled to create an initial SDP negociator\n");
+        _debug ("    Error: Failled to create an initial SDP negociator\n");
         return status;
     }
 
diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp
index 30f73b47058ee70e114d66ca331709de4ae7b0a3..297985f2ed6bbeae6bcd8406ef4626d8627bd1d6 100644
--- a/sflphone-common/src/sip/sipaccount.cpp
+++ b/sflphone-common/src/sip/sipaccount.cpp
@@ -45,119 +45,119 @@ SIPAccount::SIPAccount (const AccountID& accountID)
 	, _tlsSetting (NULL)
 	, _displayName ("")
 {
-/* SIPVoIPlink is used as a singleton, because we want to have only one link for all the SIP accounts created */
-/* So instead of creating a new instance, we just fetch the static instance, or create one if it is not yet */
-/* The SIP library initialization is done in the SIPVoIPLink constructor */
-/* The SIP voip link is now independant of the account ID as it can manage several SIP accounts */
-_link = SIPVoIPLink::instance ("");
+    /* SIPVoIPlink is used as a singleton, because we want to have only one link for all the SIP accounts created */
+    /* So instead of creating a new instance, we just fetch the static instance, or create one if it is not yet */
+    /* The SIP library initialization is done in the SIPVoIPLink constructor */
+    /* The SIP voip link is now independant of the account ID as it can manage several SIP accounts */
+    _link = SIPVoIPLink::instance ("");
 
-/* Represents the number of SIP accounts connected the same link */
-dynamic_cast<SIPVoIPLink*> (_link)->incrementClients();
+    /* Represents the number of SIP accounts connected the same link */
+    dynamic_cast<SIPVoIPLink*> (_link)->incrementClients();
 
 }
 
 SIPAccount::~SIPAccount()
 {
-/* One SIP account less connected to the sip voiplink */
-dynamic_cast<SIPVoIPLink*> (_link)->decrementClients();
-/* Delete accounts-related information */
-_regc = NULL;
-free (_cred);
-free (_tlsSetting);
+    /* One SIP account less connected to the sip voiplink */
+    dynamic_cast<SIPVoIPLink*> (_link)->decrementClients();
+    /* Delete accounts-related information */
+    _regc = NULL;
+    free (_cred);
+    free (_tlsSetting);
 }
 
 int SIPAccount::initCredential (void)
 {
-int credentialCount = 0;
-credentialCount = Manager::instance().getConfigInt (_accountID, CONFIG_CREDENTIAL_NUMBER);
-credentialCount += 1;
+    int credentialCount = 0;
+    credentialCount = Manager::instance().getConfigInt (_accountID, CONFIG_CREDENTIAL_NUMBER);
+    credentialCount += 1;
 
-bool md5HashingEnabled = false;
-int dataType = 0;
-md5HashingEnabled = Manager::instance().getConfigBool (PREFERENCES, CONFIG_MD5HASH);
-std::string digest;
+    bool md5HashingEnabled = false;
+    int dataType = 0;
+    md5HashingEnabled = Manager::instance().getConfigBool (PREFERENCES, CONFIG_MD5HASH);
+    std::string digest;
 
 // Create the credential array
-pjsip_cred_info * cred_info = (pjsip_cred_info *) malloc (sizeof (pjsip_cred_info) * (credentialCount));
+    pjsip_cred_info * cred_info = (pjsip_cred_info *) malloc (sizeof (pjsip_cred_info) * (credentialCount));
 
-if (cred_info == NULL) {
-	_debug ("Failed to set cred_info for account %s\n", _accountID.c_str());
-	return !SUCCESS;
-}
+    if (cred_info == NULL) {
+        _debug ("Failed to set cred_info for account %s\n", _accountID.c_str());
+        return !SUCCESS;
+    }
 
-pj_bzero (cred_info, sizeof (pjsip_cred_info) *credentialCount);
+    pj_bzero (cred_info, sizeof (pjsip_cred_info) *credentialCount);
 
 // Use authentication username if provided
 
-if (!_authenticationUsername.empty()) {
-	cred_info[0].username = pj_str (strdup (_authenticationUsername.c_str()));
-} else {
-	cred_info[0].username = pj_str (strdup (_username.c_str()));
-}
+    if (!_authenticationUsername.empty()) {
+        cred_info[0].username = pj_str (strdup (_authenticationUsername.c_str()));
+    } else {
+        cred_info[0].username = pj_str (strdup (_username.c_str()));
+    }
 
 // Set password
-cred_info[0].data =  pj_str (strdup (_password.c_str()));
+    cred_info[0].data =  pj_str (strdup (_password.c_str()));
 
 // Set realm for that credential. * by default.
-cred_info[0].realm = pj_str (strdup (_realm.c_str()));
+    cred_info[0].realm = pj_str (strdup (_realm.c_str()));
 
 // We want to make sure that the password is really
 // 32 characters long. Otherwise, pjsip will fail
 // on an assertion.
-if (md5HashingEnabled && _password.length() == 32) {
-	dataType = PJSIP_CRED_DATA_DIGEST;
-	_debug ("Setting digest \n");
-} else {
-	dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
-}
+    if (md5HashingEnabled && _password.length() == 32) {
+        dataType = PJSIP_CRED_DATA_DIGEST;
+        _debug ("Setting digest \n");
+    } else {
+        dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
+    }
 
 // Set the datatype
-cred_info[0].data_type = dataType;
+    cred_info[0].data_type = dataType;
 
 // Set the secheme
-cred_info[0].scheme = pj_str ( (char*)"digest");
+    cred_info[0].scheme = pj_str ( (char*) "digest");
 
-int i;
+    int i;
 
-for (i = 1; i < credentialCount; i++) {
-	std::string credentialIndex;
-	std::stringstream streamOut;
-	streamOut << i - 1;
-	credentialIndex = streamOut.str();
+    for (i = 1; i < credentialCount; i++) {
+        std::string credentialIndex;
+        std::stringstream streamOut;
+        streamOut << i - 1;
+        credentialIndex = streamOut.str();
 
-	std::string section = std::string ("Credential") + std::string (":") + _accountID + std::string (":") + credentialIndex;
+        std::string section = std::string ("Credential") + std::string (":") + _accountID + std::string (":") + credentialIndex;
 
-	std::string username = Manager::instance().getConfigString (section, USERNAME);
-	std::string password = Manager::instance().getConfigString (section, PASSWORD);
-	std::string realm = Manager::instance().getConfigString (section, REALM);
+        std::string username = Manager::instance().getConfigString (section, USERNAME);
+        std::string password = Manager::instance().getConfigString (section, PASSWORD);
+        std::string realm = Manager::instance().getConfigString (section, REALM);
 
-	cred_info[i].username = pj_str (strdup (username.c_str()));
-	cred_info[i].data = pj_str (strdup (password.c_str()));
-	cred_info[i].realm = pj_str (strdup (realm.c_str()));
+        cred_info[i].username = pj_str (strdup (username.c_str()));
+        cred_info[i].data = pj_str (strdup (password.c_str()));
+        cred_info[i].realm = pj_str (strdup (realm.c_str()));
 
-	// We want to make sure that the password is really
-	// 32 characters long. Otherwise, pjsip will fail
-	// on an assertion.
+        // We want to make sure that the password is really
+        // 32 characters long. Otherwise, pjsip will fail
+        // on an assertion.
 
-	if (md5HashingEnabled && _password.length() == 32) {
-		dataType = PJSIP_CRED_DATA_DIGEST;
-		_debug ("Setting digest \n");
-	} else {
-		dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
-	}
+        if (md5HashingEnabled && _password.length() == 32) {
+            dataType = PJSIP_CRED_DATA_DIGEST;
+            _debug ("Setting digest \n");
+        } else {
+            dataType = PJSIP_CRED_DATA_PLAIN_PASSWD;
+        }
 
-	cred_info[i].data_type = dataType;
+        cred_info[i].data_type = dataType;
 
-	cred_info[i].scheme = pj_str ( (char*)"digest");
+        cred_info[i].scheme = pj_str ( (char*) "digest");
 
-	_debug ("Setting credential %d realm = %s passwd = %s username = %s data_type = %d\n", i, realm.c_str(), password.c_str(), username.c_str(), cred_info[i].data_type);
-}
+        _debug ("Setting credential %d realm = %s passwd = %s username = %s data_type = %d\n", i, realm.c_str(), password.c_str(), username.c_str(), cred_info[i].data_type);
+    }
 
-_credentialCount = credentialCount;
+    _credentialCount = credentialCount;
 
-_cred = cred_info;
+    _cred = cred_info;
 
-return SUCCESS;
+    return SUCCESS;
 }
 
 
@@ -167,7 +167,7 @@ int SIPAccount::registerVoIPLink()
     loadConfig();
 
     if (_hostname.length() >= PJ_MAX_HOSTNAME) {
-	return !SUCCESS;
+        return !SUCCESS;
     }
 
     // Init set of additional credentials, if supplied by the user
@@ -177,24 +177,24 @@ int SIPAccount::registerVoIPLink()
     bool tlsEnabled = Manager::instance().getConfigBool (_accountID, TLS_ENABLE);
 
     if (tlsEnabled) {
-	_transportType = PJSIP_TRANSPORT_TLS;
-	initTlsConfiguration();
+        _transportType = PJSIP_TRANSPORT_TLS;
+        initTlsConfiguration();
     }
 
     // Init STUN settings for this account if the user selected it
     bool stunEnabled = Manager::instance().getConfigBool (_accountID, STUN_ENABLE);
 
     if (stunEnabled) {
-	_transportType = PJSIP_TRANSPORT_START_OTHER;
-	initStunConfiguration ();
+        _transportType = PJSIP_TRANSPORT_START_OTHER;
+        initStunConfiguration ();
     }
 
     // In our definition of the
     // ip2ip profile (aka Direct IP Calls),
     // no registration should be performed
     if (_accountID != IP2IP_PROFILE) {
-	int status = _link->sendRegister (_accountID);
-	ASSERT (status , SUCCESS);
+        int status = _link->sendRegister (_accountID);
+        ASSERT (status , SUCCESS);
     }
 
     return SUCCESS;
@@ -203,42 +203,42 @@ int SIPAccount::registerVoIPLink()
 int SIPAccount::unregisterVoIPLink()
 {
     _debug ("Unregister account %s\n" , getAccountID().c_str());
-    
+
     if (_accountID == IP2IP_PROFILE) {
-	return true;
+        return true;
     }
-    
+
     if (_link->sendUnregister (_accountID)) {
-		setRegistrationInfo (NULL);
-		return true;
+        setRegistrationInfo (NULL);
+        return true;
     } else
-		return false;
+        return false;
 
 }
 
 pjsip_ssl_method SIPAccount::sslMethodStringToPjEnum (const std::string& method)
 {
-if (method == "Default") {
-	return PJSIP_SSL_UNSPECIFIED_METHOD;
-}
+    if (method == "Default") {
+        return PJSIP_SSL_UNSPECIFIED_METHOD;
+    }
 
-if (method == "TLSv1") {
-	return PJSIP_TLSV1_METHOD;
-}
+    if (method == "TLSv1") {
+        return PJSIP_TLSV1_METHOD;
+    }
 
-if (method == "SSLv2") {
-	return PJSIP_SSLV2_METHOD;
-}
+    if (method == "SSLv2") {
+        return PJSIP_SSLV2_METHOD;
+    }
 
-if (method == "SSLv3") {
-	return PJSIP_SSLV3_METHOD;
-}
+    if (method == "SSLv3") {
+        return PJSIP_SSLV3_METHOD;
+    }
 
-if (method == "SSLv23") {
-	return PJSIP_SSLV23_METHOD;
-}
+    if (method == "SSLv23") {
+        return PJSIP_SSLV23_METHOD;
+    }
 
-return PJSIP_SSL_UNSPECIFIED_METHOD;
+    return PJSIP_SSL_UNSPECIFIED_METHOD;
 }
 
 void SIPAccount::initTlsConfiguration (void)
@@ -246,10 +246,10 @@ void SIPAccount::initTlsConfiguration (void)
     /*
      * Initialize structure to zero
      */
-    if(_tlsSetting){
-	free (_tlsSetting);
-	_tlsSetting = NULL;
-    } 
+    if (_tlsSetting) {
+        free (_tlsSetting);
+        _tlsSetting = NULL;
+    }
 
     _tlsSetting = (pjsip_tls_setting *) malloc (sizeof (pjsip_tls_setting));
 
@@ -287,27 +287,27 @@ void SIPAccount::initTlsConfiguration (void)
 
 }
 
-void SIPAccount::initStunConfiguration (void) 
+void SIPAccount::initStunConfiguration (void)
 {
-	size_t pos;
-	std::string stunServer, serverName, serverPort;
-	
-	stunServer = Manager::instance().getConfigString (_accountID, STUN_SERVER);
+    size_t pos;
+    std::string stunServer, serverName, serverPort;
 
-	// Init STUN socket
+    stunServer = Manager::instance().getConfigString (_accountID, STUN_SERVER);
+
+    // Init STUN socket
     pos = stunServer.find (':');
 
     if (pos == std::string::npos) {
-        _stunServerName = pj_str ( (char*)stunServer.data());
-		_stunPort = PJ_STUN_PORT;
+        _stunServerName = pj_str ( (char*) stunServer.data());
+        _stunPort = PJ_STUN_PORT;
         //stun_status = pj_sockaddr_in_init (&stun_srv.ipv4, &stun_adr, (pj_uint16_t) 3478);
     } else {
         serverName = stunServer.substr (0, pos);
         serverPort = stunServer.substr (pos + 1);
         _stunPort = atoi (serverPort.data());
-        _stunServerName = pj_str ( (char*)serverName.data());
+        _stunServerName = pj_str ( (char*) serverName.data());
         //stun_status = pj_sockaddr_in_init (&stun_srv.ipv4, &stun_adr, (pj_uint16_t) nPort);
-    }	
+    }
 }
 
 void SIPAccount::loadConfig()
@@ -329,31 +329,25 @@ void SIPAccount::loadConfig()
     }
 
     // Load network settings
+	// Local parameters
     std::string localPort = Manager::instance().getConfigString (_accountID, LOCAL_PORT);
+    setLocalPort (atoi (localPort.c_str()));
+    setLocalAddress (Manager::instance().getConfigString (_accountID, LOCAL_ADDRESS));
 
+	// Published parameters
     std::string publishedPort = Manager::instance().getConfigString (_accountID, PUBLISHED_PORT);
-
-    _localPort = atoi (localPort.c_str());
-    _actualSessionPort = _localPort;
-
-    _publishedPort = atoi (publishedPort.c_str());
-
-    _localIpAddress = Manager::instance().getConfigString (_accountID, LOCAL_ADDRESS);
-	_actualSessionAddress = _localIpAddress;
-
-    _publishedIpAddress = Manager::instance().getConfigString (_accountID, PUBLISHED_ADDRESS);
+    setPublishedPort (atoi (publishedPort.c_str()));
+    setPublishedAddress (Manager::instance().getConfigString (_accountID, PUBLISHED_ADDRESS));
 
     // Init TLS settings if the user wants to use TLS
     bool tlsEnabled = Manager::instance().getConfigBool (_accountID, TLS_ENABLE);
 
     if (tlsEnabled) {
-	_debug("---------------------------- TLS Enabled\n");
-	initTlsConfiguration();
-	_transportType = PJSIP_TRANSPORT_TLS;
-    }
-    else
-    {
-	_transportType = PJSIP_TRANSPORT_UDP;
+        _debug ("---------------------------- TLS Enabled\n");
+        initTlsConfiguration();
+        _transportType = PJSIP_TRANSPORT_TLS;
+    } else {
+        _transportType = PJSIP_TRANSPORT_UDP;
     }
 
     // Account generic
@@ -531,9 +525,9 @@ std::string SIPAccount::getContactHeader (const std::string& address, const std:
         transport = "";
     }
 
-    _displayName = Manager::instance().getConfigString(_accountID, DISPLAY_NAME);
+    _displayName = Manager::instance().getConfigString (_accountID, DISPLAY_NAME);
 
-    _debug("Display Name: %s\n", _displayName.c_str());
+    _debug ("Display Name: %s\n", _displayName.c_str());
 
     int len = pj_ansi_snprintf (contact, PJSIP_MAX_URL_SIZE,
 
diff --git a/sflphone-common/src/sip/sipaccount.h b/sflphone-common/src/sip/sipaccount.h
index 093decb97f92cc53655ded7f2d6c121cb7cca13a..50fe17d8f1637d623cc047d7635793a9e2536847 100644
--- a/sflphone-common/src/sip/sipaccount.h
+++ b/sflphone-common/src/sip/sipaccount.h
@@ -340,7 +340,7 @@ class SIPAccount : public Account
         
         pjsip_transport_type_e _transportType;
 
-	pjsip_transport* _transport;
+		pjsip_transport* _transport;
 
         // Special hack that is not here to stay
         // See #1852
@@ -359,15 +359,16 @@ class SIPAccount : public Account
         // The STUN server name, if applicable
         pj_str_t _stunServerName;	                                                  
 
-	// The STUN server port, if applicable
-	pj_uint16_t _stunPort;
+		// The STUN server port, if applicable
+		pj_uint16_t _stunPort;
         
         // Display Name that can be used in  SIP URI.        
         std::string _displayName;        
 
-	// The actual address we use in the SDP to be contacted
-	// it needs to be per account, otherwise the same address is used for every account
-	std::string _actualSessionAddress;
+		// The actual address we use in the SDP to be contacted
+		// it needs to be per account, otherwise the same address is used for every account
+		// TODO Use the published address or the local address
+		std::string _actualSessionAddress;
         pj_uint16_t _actualSessionPort;
 };
 
diff --git a/sflphone-common/src/sip/sipcall.cpp b/sflphone-common/src/sip/sipcall.cpp
index 81451d591362ba448aacd0428734d5f58165eefe..60680c779a8cf3f0e0b8dbf505b17e7e06f5ba97 100644
--- a/sflphone-common/src/sip/sipcall.cpp
+++ b/sflphone-common/src/sip/sipcall.cpp
@@ -28,7 +28,7 @@ SIPCall::SIPCall (const CallID& id, Call::CallType type, pj_pool_t *pool) : Call
         , _cid (0)
         , _did (0)
         , _tid (0)
-	, _audiortp (new sfl::AudioRtpFactory())
+        , _audiortp (new sfl::AudioRtpFactory())
         , _xferSub (NULL)
         , _invSession (NULL)
         , _local_sdp (0)
diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp
index 6fb1b24947398574d2a30c76340704df2efb7b1e..e49b33cf07c660e5dc8ff5df29d102fa0ce103e0 100644
--- a/sflphone-common/src/sip/sipvoiplink.cpp
+++ b/sflphone-common/src/sip/sipvoiplink.cpp
@@ -248,6 +248,7 @@ SIPVoIPLink* SIPVoIPLink::instance (const AccountID& id)
 {
 
     if (!_instance) {
+		_debug ("Create new SIPVoIPLink instance\n");
         _instance = new SIPVoIPLink (id);
     }
 
@@ -269,6 +270,8 @@ bool SIPVoIPLink::init()
     if (initDone())
         return false;
 
+	// TODO This port should be the one configured for the IP profile
+	// and not the global one
     _regPort = Manager::instance().getSipPort();
 
     /* Instanciate the C++ thread */
@@ -394,7 +397,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     pjsip_generic_string_hdr *h;
     pjsip_hdr hdr_list;
 
-    _debug("SIPVoIPLink::sendRegister()\n");
+    _debug ("SIPVoIPLink::sendRegister()\n");
 
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
@@ -449,7 +452,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     if (account->isTlsEnabled()) {
         pj_status_t status;
 
-	_debug("    sendRegister: createTlsTransport\n");
+        _debug ("    sendRegister: createTlsTransport\n");
         status = createTlsTransportRetryOnFailure (id);
 
         if (status != PJ_SUCCESS) {
@@ -457,32 +460,30 @@ int SIPVoIPLink::sendRegister (AccountID id)
         }
     }
 
-	else
-	{
-		// Launch a new UDP listener/transport, using the published address
-		if (account->isStunEnabled ()) {
-			pj_status_t status;
-
-			_debug("    sendRegister: createAlternateUdpTransport\n");
-			status = createAlternateUdpTransport (id);
-		
-			if (status != PJ_SUCCESS) {
-				_debug ("Failed to initialize UDP transport with an extern published address for account %s\n", id.c_str());
-			}
-		}
-		else
-		{
-	
-			status = createUDPServer (id);
-			if (status != PJ_SUCCESS) {
-			_debug ("Failed to initialize UDP transport with a local address for account %s\n. Try to use the local UDP transport", id.c_str());
-			account->setAccountTransport (_localUDPTransport);
-			}
-		}
-	}
+    else {
+        // Launch a new UDP listener/transport, using the published address
+        if (account->isStunEnabled ()) {
+            pj_status_t status;
+
+            _debug ("    sendRegister: createAlternateUdpTransport\n");
+            status = createAlternateUdpTransport (id);
+
+            if (status != PJ_SUCCESS) {
+                _debug ("Failed to initialize UDP transport with an extern published address for account %s\n", id.c_str());
+            }
+        } else {
+
+            status = createUDPServer (id);
+
+            if (status != PJ_SUCCESS) {
+                _debug ("Use the local UDP transport", id.c_str());
+                account->setAccountTransport (_localUDPTransport);
+            }
+        }
+    }
 
     _mutexSIP.enterMutex();
-    
+
     // Get the client registration information for this particular account
     regc = account->getRegistrationInfo();
     account->setRegister (true);
@@ -584,16 +585,16 @@ int SIPVoIPLink::sendRegister (AccountID id)
         _mutexSIP.leaveMutex();
         return false;
     }
-    
+
     // pjsip_tpselector *tp;
 
     // init_transport_selector (account->getAccountTransport (), &tp);
     // status = pjsip_regc_set_transport (regc, tp);
-    
+
     if (status != PJ_SUCCESS) {
-	_debug ("UserAgent: Unable to set transport.\n");
-	_mutexSIP.leaveMutex ();
-	return false;
+        _debug ("UserAgent: Unable to set transport.\n");
+        _mutexSIP.leaveMutex ();
+        return false;
     }
 
     // Send registration request
@@ -608,7 +609,7 @@ int SIPVoIPLink::sendRegister (AccountID id)
     _mutexSIP.leaveMutex();
 
     account->setRegistrationInfo (regc);
-    _debug("ok\n");
+    _debug ("ok\n");
     return true;
 }
 
@@ -658,7 +659,7 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl)
 {
     SIPAccount * account = NULL;
     pj_status_t status;
-	std::string localAddr;
+    std::string localAddr;
 
     SIPCall* call = new SIPCall (id, Call::Outgoing, _pool);
 
@@ -678,8 +679,9 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl)
 
         call->setPeerNumber (toUri);
 
-		localAddr = account->getSessionAddress ();
-        setCallAudioLocal (call, call->getLocalIp());
+		// TODO May use the published address as well
+        localAddr = account->getLocalAddress ();
+        setCallAudioLocal (call, localAddr);
 
         try {
             _debug ("Creating new rtp session in newOutgoingCall\n");
@@ -692,7 +694,7 @@ SIPVoIPLink::newOutgoingCall (const CallID& id, const std::string& toUrl)
 
         _debug ("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data());
         // Building the local SDP offer
-		// localAddr = getLocalAddressAssociatedToAccount (account->getAccountID());
+        // localAddr = getLocalAddressAssociatedToAccount (account->getAccountID());
         call->getLocalSDP()->set_ip_address (localAddr);
         status = call->getLocalSDP()->create_initial_offer();
 
@@ -769,11 +771,14 @@ SIPVoIPLink::answer (const CallID& id)
 
         // Terminate the call
         _debug ("SIPVoIPLink::answer: fail terminate call %s \n",call->getCallId().c_str());
-	if(call->getAudioRtp())
-	    call->getAudioRtp()->stop ();
+
+        if (call->getAudioRtp())
+            call->getAudioRtp()->stop ();
 
         terminateOneCall (call->getCallId());
+
         removeCall (call->getCallId());
+
         return false;
     }
 }
@@ -1075,7 +1080,7 @@ SIPVoIPLink::transfer (const CallID& id, const std::string& to)
     return true;
 }
 
-bool SIPVoIPLink::transferStep2(SIPCall* call)
+bool SIPVoIPLink::transferStep2 (SIPCall* call)
 {
     call->getAudioRtp()->stop();
     return true;
@@ -1314,15 +1319,15 @@ SIPVoIPLink::SIPStartCall (SIPCall* call, const std::string& subject UNUSED)
     // Associate current invite session in the call
     call->setInvSession (inv);
 
-	// Set the appropriate transport
-	// pjsip_tpselector *tp;
-	// init_transport_selector (account->getAccountTransport (), &tp);
-	// status = pjsip_dlg_set_transport (dialog, tp);
+    // Set the appropriate transport
+    // pjsip_tpselector *tp;
+    // init_transport_selector (account->getAccountTransport (), &tp);
+    // status = pjsip_dlg_set_transport (dialog, tp);
 
     status = pjsip_inv_send_msg (inv, tdata);
 
     if (status != PJ_SUCCESS) {
-	_debug("    SIPStartCall: failed to send invite\n");
+        _debug ("    SIPStartCall: failed to send invite\n");
         return false;
     }
 
@@ -1338,8 +1343,9 @@ SIPVoIPLink::SIPCallServerFailure (SIPCall *call)
         Manager::instance().callFailure (id);
         terminateOneCall (id);
         removeCall (id);
-	if (call->getAudioRtp ())
-	    call->getAudioRtp()->stop();
+
+        if (call->getAudioRtp ())
+            call->getAudioRtp()->stop();
     }
 }
 
@@ -1427,13 +1433,13 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
     pjsip_dialog *dialog;
     pjsip_inv_session *inv;
     pjsip_tx_data *tdata;
+	std::string localAddress;
 
     /* Create the call */
     call = new SIPCall (id, Call::Outgoing, _pool);
 
     if (call) {
         call->setCallConfiguration (Call::IPtoIP);
-        setCallAudioLocal (call, getLocalIPAddress());
         call->initRecFileName();
 
         AccountID accountId = Manager::instance().getAccountFromCall (id);
@@ -1444,6 +1450,14 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
             _debug ("Account is null. Returning\n");
             return !PJ_SUCCESS;
         }
+        
+		// Set SDP parameters
+		localAddress = account->getLocalAddress ();
+		if (localAddress == "0.0.0.0"){
+			_debug ("Here is the local address: %s\n", localAddress.c_str ());
+			loadSIPLocalIP (&localAddress);	
+		}
+		setCallAudioLocal (call, localAddress);
 
         _debug ("toUri received in new_ip_to_ip call %s\n", to.c_str());
 
@@ -1451,7 +1465,7 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
         call->setPeerNumber (toUri);
         _debug ("toUri in new_ip_to_ip call %s\n", toUri.c_str());
         // Building the local SDP offer
-        call->getLocalSDP()->set_ip_address (getLocalIPAddress ());
+        call->getLocalSDP()->set_ip_address (localAddress);
         call->getLocalSDP()->create_initial_offer();
 
         try {
@@ -1509,15 +1523,17 @@ bool SIPVoIPLink::new_ip_to_ip_call (const CallID& id, const std::string& to)
 
         PJ_ASSERT_RETURN (status == PJ_SUCCESS, false);
 
-		// Set the appropriate transport
-		pjsip_tpselector *tp;
-		init_transport_selector (_localUDPTransport, &tp);
-		status = pjsip_dlg_set_transport (dialog, tp);
+        // Set the appropriate transport
+        pjsip_tpselector *tp;
 
-		if (status != PJ_SUCCESS) {
-			_debug ("Failed to set the transport for an IP call\n");
-			return status;
-		}
+        init_transport_selector (_localUDPTransport, &tp);
+
+        status = pjsip_dlg_set_transport (dialog, tp);
+
+        if (status != PJ_SUCCESS) {
+            _debug ("Failed to set the transport for an IP call\n");
+            return status;
+        }
 
         // Associate current call in the invite session
         inv->mod_data[getModId() ] = call;
@@ -1643,6 +1659,7 @@ bool SIPVoIPLink::pjsip_init()
     pj_str_t accepted;
     std::string name_mod;
     pj_dns_resolver *p_resv;
+	std::string addr;
 
     name_mod = "sflphone";
 
@@ -1678,16 +1695,13 @@ bool SIPVoIPLink::pjsip_init()
 
     PJ_ASSERT_RETURN (status == PJ_SUCCESS, 1);
 
-    // Start resolving STUN server
-    // if we useStun and we failed to receive something on port 5060, we try a random port
-    // If use STUN server, firewall address setup
-    if (!loadSIPLocalIP()) {
+    if (!loadSIPLocalIP (&addr)) {
         _debug ("UserAgent: Unable to determine network capabilities\n");
         return false;
     }
 
     port = _regPort;
-    _localPort = port;
+    // _localPort = port;
 
     // Retrieve Direct IP Calls settings.
     // This corresponds to the accountID set to
@@ -1702,8 +1716,9 @@ bool SIPVoIPLink::pjsip_init()
         directIpCallsTlsEnabled = account->isTlsEnabled();
     }
 
-    _localExternAddress = _localIPAddress;
-    _localExternPort = _localPort;
+    //_localExternAddress = _localIPAddress;
+
+    //_localExternPort = _localPort;
     // Create a UDP listener meant for all accounts
     // for which TLS was not enabled
     errPjsip = createUDPServer();
@@ -1711,6 +1726,7 @@ bool SIPVoIPLink::pjsip_init()
     // If the above UDP server
     // could not be created, then give it another try
     // on a random sip port
+
     if (errPjsip != PJ_SUCCESS) {
         _debug ("UserAgent: Could not initialize SIP listener on port %d\n", _localExternPort);
         _localExternPort = _localPort = RANDOM_SIP_PORT;
@@ -1833,54 +1849,58 @@ bool SIPVoIPLink::pjsip_init()
 pj_status_t SIPVoIPLink::stunServerResolve (AccountID id)
 {
     pj_str_t stunServer;
-	pj_uint16_t stunPort;
-	pj_stun_sock_cb stun_sock_cb;
-	pj_stun_sock *stun_sock;
+    pj_uint16_t stunPort;
+    pj_stun_sock_cb stun_sock_cb;
+    pj_stun_sock *stun_sock;
     pj_stun_config stunCfg;
     pj_status_t status;
 
-	// Fetch the account information from the config file
-	SIPAccount * account = NULL;
-	account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
+    // Fetch the account information from the config file
+    SIPAccount * account = NULL;
+    account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
-	if (account == NULL) {
-		_debug ("stunServerResolve: Account is null. Returning\n");
-		return !PJ_SUCCESS;
-	}
-	// Get the STUN server name and port
+    if (account == NULL) {
+        _debug ("stunServerResolve: Account is null. Returning\n");
+        return !PJ_SUCCESS;
+    }
+
+    // Get the STUN server name and port
     stunServer = account->getStunServerName ();
-	stunPort = account->getStunPort ();
+
+    stunPort = account->getStunPort ();
 
     // Initialize STUN configuration
     pj_stun_config_init (&stunCfg, &_cp.factory, 0, pjsip_endpt_get_ioqueue (_endpt), pjsip_endpt_get_timer_heap (_endpt));
 
     status = PJ_EPENDING;
 
-	pj_bzero (&stun_sock_cb, sizeof(stun_sock_cb));
-	stun_sock_cb.on_rx_data = &stun_sock_on_rx_data;
-	stun_sock_cb.on_status = &stun_sock_on_status;
+    pj_bzero (&stun_sock_cb, sizeof (stun_sock_cb));
 
-	status = pj_stun_sock_create (&stunCfg, "stunresolve", pj_AF_INET(), &stun_sock_cb, NULL, NULL, &stun_sock);
+    stun_sock_cb.on_rx_data = &stun_sock_on_rx_data;
 
-	if (status != PJ_SUCCESS) {
-		char errmsg[PJ_ERR_MSG_SIZE];
-        pj_strerror (status, errmsg, sizeof(errmsg));
-		_debug ("Error creating STUN socket for %.*s: %s", (int)stunServer.slen, stunServer.ptr, errmsg);
-		return status;
-	}
+    stun_sock_cb.on_status = &stun_sock_on_status;
 
-	status = pj_stun_sock_start (stun_sock, &stunServer, stunPort, NULL);
+    status = pj_stun_sock_create (&stunCfg, "stunresolve", pj_AF_INET(), &stun_sock_cb, NULL, NULL, &stun_sock);
 
-	if (status != PJ_SUCCESS) {
-		char errmsg[PJ_ERR_MSG_SIZE];
-        pj_strerror (status, errmsg, sizeof(errmsg));
-		_debug ("Error starting STUN socket for %.*s: %s", (int)stunServer.slen, stunServer.ptr, errmsg);
-		pj_stun_sock_destroy (stun_sock);
+    if (status != PJ_SUCCESS) {
+        char errmsg[PJ_ERR_MSG_SIZE];
+        pj_strerror (status, errmsg, sizeof (errmsg));
+        _debug ("Error creating STUN socket for %.*s: %s", (int) stunServer.slen, stunServer.ptr, errmsg);
+        return status;
+    }
+
+    status = pj_stun_sock_start (stun_sock, &stunServer, stunPort, NULL);
+
+    if (status != PJ_SUCCESS) {
+        char errmsg[PJ_ERR_MSG_SIZE];
+        pj_strerror (status, errmsg, sizeof (errmsg));
+        _debug ("Error starting STUN socket for %.*s: %s", (int) stunServer.slen, stunServer.ptr, errmsg);
+        pj_stun_sock_destroy (stun_sock);
         stun_sock = NULL;
-		return status;
-	}
+        return status;
+    }
 
-	return status;
+    return status;
 }
 
 int SIPVoIPLink::createUDPServer (AccountID id)
@@ -1891,42 +1911,51 @@ int SIPVoIPLink::createUDPServer (AccountID id)
     pjsip_host_port a_name;
     char tmpIP[32];
     pjsip_transport *transport;
+	std::string listeningAddress = "127.0.0.1";
+	int listeningPort = _regPort;
 
+	/* Use my local address as default value */
+	if (!loadSIPLocalIP (&listeningAddress))
+		return !PJ_SUCCESS;
 
-    /* 
+    /*
      * Retrieve the account information
      */
     SIPAccount * account = NULL;
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
 
     // Set information to the local address and port
+
     if (account == NULL) {
-    // We are trying to initialize a UDP transport available for all local accounts and direct IP calls
-	_debug ("Account is null in createUDPServer.\n");
-	_localExternAddress = _localIPAddress;
-	_localExternPort = _localPort;
-    }
-    else
-    {
-	_localExternAddress = account->getSessionAddress ();
-	_localExternPort = account->getSessionPort ();
+        _debug ("Account is null in createUDPServer.\n");
+    } else {
+        // We are trying to initialize a UDP transport available for all local accounts and direct IP calls
+		if (account->getLocalAddress () != "0.0.0.0"){
+			listeningAddress = account->getLocalAddress ();
+			_debug ("**************************************** lsitening -%s-\n", listeningAddress.data());
+		}
+		listeningPort = account->getLocalPort ();
     }
 
     // Init bound address to ANY
     pj_memset (&bound_addr, 0, sizeof (bound_addr));
-       
+
     bound_addr.sin_addr.s_addr = pj_htonl (PJ_INADDR_ANY);
-    bound_addr.sin_port = pj_htons ( (pj_uint16_t) _localPort);
+
+    bound_addr.sin_port = pj_htons ( (pj_uint16_t) listeningPort);
+
     bound_addr.sin_family = PJ_AF_INET;
+
     pj_bzero (bound_addr.sin_zero, sizeof (bound_addr.sin_zero));
-	
+
     // Create UDP-Server (default port: 5060)
-    strcpy (tmpIP, _localExternAddress.data());
+    strcpy (tmpIP, listeningAddress.data());
+
     pj_strdup2 (_pool, &a_name.host, tmpIP);
-    a_name.port = (pj_uint16_t) _localExternPort;
-    
+
+    a_name.port = (pj_uint16_t) listeningPort;
+
     status = pjsip_udp_transport_start (_endpt, &bound_addr, &a_name, 1, &transport);
-    
 
     // Get the transport manager associated with
     // this endpoint
@@ -1934,35 +1963,36 @@ int SIPVoIPLink::createUDPServer (AccountID id)
 
     tpmgr = pjsip_endpt_get_tpmgr (_endpt);
 
-    _debug("number of transport: %i\n", pjsip_tpmgr_get_transport_count(tpmgr));
-    pjsip_tpmgr_dump_transports(tpmgr);
+    _debug ("number of transport: %i\n", pjsip_tpmgr_get_transport_count (tpmgr));
+
+    pjsip_tpmgr_dump_transports (tpmgr);
 
     if (status != PJ_SUCCESS) {
         _debug ("UserAgent: (%d) Unable to start UDP transport!\n", status);
-		// Try to acquire an existing one
-		// pjsip_tpmgr_acquire_transport ()
+        // Try to acquire an existing one
+        // pjsip_tpmgr_acquire_transport ()
         return status;
     } else {
-        _debug ("UserAgent: UDP server listening on port %d\n", _localExternPort);
-		if (account == NULL) 
-			_localUDPTransport = transport;
-		else
+        _debug ("UserAgent: UDP server listening on port %d\n", listeningPort);
+
+        if (account == NULL)
+            _localUDPTransport = transport;
+        else
 			account->setAccountTransport (transport);
     }
 
-    _debug ("Transport initialized successfully! \n");
-	
+    _debug ("Transport initialized successfully on %s:%i\n", listeningAddress.c_str (), listeningPort);
 
     return PJ_SUCCESS;
 }
 
-std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_transport *transport)
+std::string SIPVoIPLink::findLocalAddressFromUri (const std::string& uri, pjsip_transport *transport)
 {
     pj_str_t localAddress;
     pjsip_transport_type_e transportType;
     pjsip_tpselector *tp_sel;
 
-    _debug("SIPVoIPLink::findLocalAddressFromUri\n");
+    _debug ("SIPVoIPLink::findLocalAddressFromUri\n");
 
     // Find the transport that must be used with the given uri
     pj_str_t tmp;
@@ -1991,10 +2021,11 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t
     if (PJSIP_URI_SCHEME_IS_SIPS (sip_uri)) {
         transportType = PJSIP_TRANSPORT_TLS;
     } else {
-		if (transport == NULL) {
-			_debug ("transport is NULL in findLocalAddressFromUri\n. Try the local UDP transport");
-			transport = _localUDPTransport;
-		}
+        if (transport == NULL) {
+            _debug ("transport is NULL in findLocalAddressFromUri\n. Try the local UDP transport");
+            transport = _localUDPTransport;
+        }
+
         transportType = PJSIP_TRANSPORT_UDP;
     }
 
@@ -2002,7 +2033,7 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t
     // this endpoint
     pjsip_tpmgr * tpmgr = NULL;
 
-    tpmgr = pjsip_endpt_get_tpmgr (_endpt); 	
+    tpmgr = pjsip_endpt_get_tpmgr (_endpt);
 
     if (tpmgr == NULL) {
         _debug ("Unexpected: Cannot get tpmgr from endpoint.\n");
@@ -2014,44 +2045,43 @@ std::string SIPVoIPLink::findLocalAddressFromUri(const std::string& uri, pjsip_t
     int port;
 
     pj_status_t status;
-	/* Init the transport selector */
-	//_debug ("Transport ID: %s\n", transport->obj_name);
-	if (transportType == PJSIP_TRANSPORT_UDP)
-	{
-		status = init_transport_selector (transport, &tp_sel);
 
-		if (status == PJ_SUCCESS)
-			status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port);
-		else
-			status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
-	}
-	else
-		status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
+    /* Init the transport selector */
+    //_debug ("Transport ID: %s\n", transport->obj_name);
+    if (transportType == PJSIP_TRANSPORT_UDP) {
+        status = init_transport_selector (transport, &tp_sel);
+
+        if (status == PJ_SUCCESS)
+            status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port);
+        else
+            status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
+    } else
+        status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
 
     if (status != PJ_SUCCESS) {
         _debug ("Failed to find local address from transport\n");
         return machineName;
     }
 
-    // _debug ("Local ADdress From URI: %s\n", localAddress.ptr);
+	_debug ("Local address discovered from attached transport: %s\n", localAddress.ptr);
     return std::string (localAddress.ptr, localAddress.slen);
 }
 
 pj_status_t SIPVoIPLink::init_transport_selector (pjsip_transport *transport, pjsip_tpselector **tp_sel)
 {
-	pjsip_tpselector *tp;
+    pjsip_tpselector *tp;
 
-	if (transport != NULL)
-	{
-		tp = (pjsip_tpselector *)pj_pool_zalloc (_pool, sizeof (pjsip_tpselector));
-		tp->type = PJSIP_TPSELECTOR_TRANSPORT;
-		tp->u.transport = transport;
-		
-		*tp_sel = tp;
+    if (transport != NULL) {
+        tp = (pjsip_tpselector *) pj_pool_zalloc (_pool, sizeof (pjsip_tpselector));
+        tp->type = PJSIP_TPSELECTOR_TRANSPORT;
+        tp->u.transport = transport;
 
-		return PJ_SUCCESS;
-	}
-	return !PJ_SUCCESS;
+        *tp_sel = tp;
+
+        return PJ_SUCCESS;
+    }
+
+    return !PJ_SUCCESS;
 }
 
 int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *transport)
@@ -2059,7 +2089,7 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
     pj_str_t localAddress;
     pjsip_transport_type_e transportType;
     int port;
-	pjsip_tpselector *tp_sel;
+    pjsip_tpselector *tp_sel;
 
     // Find the transport that must be used with the given uri
     pj_str_t tmp;
@@ -2085,12 +2115,13 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
         transportType = PJSIP_TRANSPORT_TLS;
         port = atoi (DEFAULT_SIP_TLS_PORT);
     } else {
-		if (transport == NULL) {
-			_debug ("transport is NULL in findLocalPortFromUri - Try the local UDP transport\n");
-			transport = _localUDPTransport;
-		}
+        if (transport == NULL) {
+            _debug ("transport is NULL in findLocalPortFromUri - Try the local UDP transport\n");
+            transport = _localUDPTransport;
+        }
 
         transportType = PJSIP_TRANSPORT_UDP;
+
         port = atoi (DEFAULT_SIP_PORT);
     }
 
@@ -2107,28 +2138,28 @@ int SIPVoIPLink::findLocalPortFromUri (const std::string& uri, pjsip_transport *
 
     // Find the local address (and port) based on the registered
     // transports and the transport type
-    
+
     /* Init the transport selector */
-	pj_status_t status;
-	if (transportType == PJSIP_TRANSPORT_UDP)
-	{
-		_debug ("Transport ID: %s\n", transport->obj_name);
+    pj_status_t status;
 
-		status = init_transport_selector (transport, &tp_sel);
+    if (transportType == PJSIP_TRANSPORT_UDP) {
+        _debug ("Transport ID: %s\n", transport->obj_name);
+
+        status = init_transport_selector (transport, &tp_sel);
+
+        if (status == PJ_SUCCESS)
+            status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port);
+        else
+            status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
+    } else
+        status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
 
-		if (status == PJ_SUCCESS)
-			status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, tp_sel, &localAddress, &port);
-		else
-			status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
-	}
-	else
-		status = pjsip_tpmgr_find_local_addr (tpmgr, _pool, transportType, NULL, &localAddress, &port);
-		
 
     if (status != PJ_SUCCESS) {
         _debug ("Failed to find local address from transport\n");
     }
 
+	_debug ("Local port discovered from attached transport: %i\n", port);
     return port;
 }
 
@@ -2177,13 +2208,13 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id)
     pj_sockaddr_in boundAddr;
     pjsip_host_port a_name;
     pj_status_t status;
-	pj_str_t stunServer;
-	pj_uint16_t stunPort;
-	pj_sockaddr_in pub_addr;
-	pj_sock_t sock;
+    pj_str_t stunServer;
+    pj_uint16_t stunPort;
+    pj_sockaddr_in pub_addr;
+    pj_sock_t sock;
 
-    /* 
-	 * Retrieve the account information
+    /*
+     * Retrieve the account information
      */
     SIPAccount * account = NULL;
     account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
@@ -2193,67 +2224,73 @@ pj_status_t SIPVoIPLink::createAlternateUdpTransport (AccountID id)
         return !PJ_SUCCESS;
     }
 
-	stunServer = account->getStunServerName ();
-	stunPort = account->getStunPort ();
-	
-	status = stunServerResolve (id);
-		
-	if (status != PJ_SUCCESS) {
-		_debug ("Error resolving STUN server: %i\n", status);
-		return status;
-	}
+    stunServer = account->getStunServerName ();
 
-	// Init socket
-	sock = PJ_INVALID_SOCKET;
+    stunPort = account->getStunPort ();
 
-	_debug ("Initializing IPv4 socket on %s:%i\n", stunServer.ptr, stunPort);
-	status = pj_sockaddr_in_init (&boundAddr, &stunServer, 0);
-	if (status != PJ_SUCCESS) {
-		_debug ("Error when initializing IPv4 socket on %s:%i\n", stunServer.ptr, stunPort);
-		return status;
-	}
+    status = stunServerResolve (id);
+
+    if (status != PJ_SUCCESS) {
+        _debug ("Error resolving STUN server: %i\n", status);
+        return status;
+    }
+
+    // Init socket
+    sock = PJ_INVALID_SOCKET;
+
+    _debug ("Initializing IPv4 socket on %s:%i\n", stunServer.ptr, stunPort);
+
+    status = pj_sockaddr_in_init (&boundAddr, &stunServer, 0);
 
-	// Create and bind the socket
-	status = pj_sock_socket (pj_AF_INET(), pj_SOCK_DGRAM(), 0, &sock);
     if (status != PJ_SUCCESS) {
-    	_debug ("Socket() error (%d)\n", status);
-    	return status;
+        _debug ("Error when initializing IPv4 socket on %s:%i\n", stunServer.ptr, stunPort);
+        return status;
     }
 
-	// Query the mapped IP address and port on the 'outside' of the NAT
-	status = pjstun_get_mapped_addr (&_cp.factory, 1, &sock, &stunServer, stunPort, &stunServer, stunPort, &pub_addr);
-	
-	if (status != PJ_SUCCESS) {
+    // Create and bind the socket
+    status = pj_sock_socket (pj_AF_INET(), pj_SOCK_DGRAM(), 0, &sock);
+
+    if (status != PJ_SUCCESS) {
+        _debug ("Socket() error (%d)\n", status);
+        return status;
+    }
+
+    // Query the mapped IP address and port on the 'outside' of the NAT
+    status = pjstun_get_mapped_addr (&_cp.factory, 1, &sock, &stunServer, stunPort, &stunServer, stunPort, &pub_addr);
+
+    if (status != PJ_SUCCESS) {
         _debug ("Error contacting STUN server (%d)", status);
-        pj_sock_close(sock);
+        pj_sock_close (sock);
         return status;
     }
 
-	_debug ( "Firewall address : %s:%d",
-              pj_inet_ntoa (pub_addr.sin_addr),
-              pj_ntohs(pub_addr.sin_port));
+    _debug ("Firewall address : %s:%d",
+
+            pj_inet_ntoa (pub_addr.sin_addr),
+            pj_ntohs (pub_addr.sin_port));
 
-	a_name.host = pj_str (pj_inet_ntoa (pub_addr.sin_addr));
-    a_name.port = pj_ntohs(pub_addr.sin_port);
+    a_name.host = pj_str (pj_inet_ntoa (pub_addr.sin_addr));
+    a_name.port = pj_ntohs (pub_addr.sin_port);
 
-	_localExternAddress = std::string (a_name.host.ptr);
-	_localExternPort =  (int)a_name.port;
+    _localExternAddress = std::string (a_name.host.ptr);
+    _localExternPort = (int) a_name.port;
 
-	// Set the address to be used in SDP
-	account->setSessionAddress (_localExternAddress);
-	account->setSessionPort (_localExternPort);
+    // Set the address to be used in SDP
+    account->setSessionAddress (_localExternAddress);
+    account->setSessionPort (_localExternPort);
 
-	//account->setStunServerName (a_name.host);
-	//account->setStunPort (a_name.port);
+    //account->setStunServerName (a_name.host);
+    //account->setStunPort (a_name.port);
+
+    // Create the UDP transport
+    pjsip_transport *transport;
+    status = pjsip_udp_transport_attach2 (_endpt, PJSIP_TRANSPORT_UDP, sock, &a_name, 1, &transport);
 
-	// Create the UDP transport
-	pjsip_transport *transport;
-	status = pjsip_udp_transport_attach2 (_endpt, PJSIP_TRANSPORT_UDP, sock, &a_name, 1, &transport);
     if (status != PJ_SUCCESS) {
         _debug ("Error creating alternate SIP UDP listener (%d)\n", status);
     }
 
-	account->setAccountTransport (transport);
+    account->setAccountTransport (transport);
 
     return PJ_SUCCESS;
 }
@@ -2323,7 +2360,7 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id)
             (int) a_name.host.slen, a_name.host.ptr,
             (int) a_name.port, localAddress.c_str(), (int) localTlsPort);
 
-    
+
 
     status = pjsip_tls_transport_start (_endpt, tls_setting, &local_addr, &a_name, 1, &tls);
 
@@ -2334,24 +2371,23 @@ pj_status_t SIPVoIPLink::createTlsTransport (AccountID id)
     return PJ_SUCCESS;
 }
 
-bool SIPVoIPLink::loadSIPLocalIP()
+bool SIPVoIPLink::loadSIPLocalIP (std::string *addr)
 {
 
     bool returnValue = true;
+	std::string localAddress = "127.0.0.1";
+    pj_sockaddr ip_addr;
 
-    if (_localIPAddress == "127.0.0.1") {
-        pj_sockaddr ip_addr;
-
-        if (pj_gethostip (pj_AF_INET(), &ip_addr) != PJ_SUCCESS) {
-            // Update the registration state if no network capabilities found
-            _debug ("UserAgent: Get host ip failed!\n");
-            returnValue = false;
-        } else {
-            _localIPAddress = std::string (pj_inet_ntoa (ip_addr.ipv4.sin_addr));
-            _debug ("UserAgent: Checking network, setting local IP address to: %s\n", _localIPAddress.data());
-        }
+    if (pj_gethostip (pj_AF_INET(), &ip_addr) != PJ_SUCCESS) {
+		// Update the registration state if no network capabilities found
+        _debug ("UserAgent: Get host ip failed!\n");
+        returnValue = false;
+    } else {
+        localAddress = std::string (pj_inet_ntoa (ip_addr.ipv4.sin_addr));
+        _debug ("UserAgent: Checking network, setting local IP address to: %s\n", localAddress.data());
     }
 
+	*addr = localAddress;
     return returnValue;
 }
 
@@ -2498,11 +2534,9 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
     if (call == NULL) {
         _debug ("Call is NULL in call_on_state_changed");
         return;
-    }
-    else
-    {
-	// _debug("    call_on_state_changed: call id %s\n", call->getCallId().c_str());
-	// _debug("    call_on_state_changed: call state %s\n", invitationStateMap[call->getInvSession()->state]);
+    } else {
+        // _debug("    call_on_state_changed: call id %s\n", call->getCallId().c_str());
+        // _debug("    call_on_state_changed: call state %s\n", invitationStateMap[call->getInvSession()->state]);
     }
 
     //Retrieve the body message
@@ -2533,7 +2567,7 @@ void call_on_state_changed (pjsip_inv_session *inv, pjsip_event *e)
         pjsip_evsub_state ev_state = PJSIP_EVSUB_STATE_ACTIVE;
 
         switch (call->getInvSession()->state) {
-	// switch (inv->state) {
+                // switch (inv->state) {
 
             case PJSIP_INV_STATE_NULL:
 
@@ -2712,10 +2746,10 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
         return;
     }
 
-    if(!inv->neg)
-    {
-	return;
+    if (!inv->neg) {
+        return;
     }
+
     // Get the new sdp, result of the negotiation
     pjmedia_sdp_neg_get_active_local (inv->neg, &local_sdp);
 
@@ -2734,9 +2768,9 @@ void call_on_media_update (pjsip_inv_session *inv, pj_status_t status)
 
     try {
         call->setAudioStart (true);
-        call->getAudioRtp()->start();        
-    } catch(exception& rtpException) {
-        _debug("%s\n", rtpException.what());
+        call->getAudioRtp()->start();
+    } catch (exception& rtpException) {
+        _debug ("%s\n", rtpException.what());
     }
 
 }
@@ -2842,7 +2876,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
     CallID id;
     SIPCall* call;
     pjsip_inv_session *inv;
-	SIPAccount *account;
+    SIPAccount *account;
     pjmedia_sdp_session *r_sdp;
 
     // pjsip_generic_string_hdr* hdr;
@@ -2885,20 +2919,20 @@ mod_on_rx_request (pjsip_rx_data *rdata)
         return false;
     }
 
-    
-    char* from_header = strstr(rdata->msg_info.msg_buf, "From: ");
+
+    char* from_header = strstr (rdata->msg_info.msg_buf, "From: ");
+
     // _debug("------------------------------ thefromheader: %s\n", from_header);
 
-    if(from_header) {
+    if (from_header) {
 
-        std::string temp(from_header);
-	int begin_displayName = temp.find("\"") + 1;
-	int end_displayName = temp.rfind("\"");
-	// _debug("The display name start at %i, end at %i\n", begin_displayName, end_displayName);
-	displayName = temp.substr(begin_displayName, end_displayName - begin_displayName);//display_name);
-    }
-    else {
-        displayName = std::string("");
+        std::string temp (from_header);
+        int begin_displayName = temp.find ("\"") + 1;
+        int end_displayName = temp.rfind ("\"");
+        // _debug("The display name start at %i, end at %i\n", begin_displayName, end_displayName);
+        displayName = temp.substr (begin_displayName, end_displayName - begin_displayName);//display_name);
+    } else {
+        displayName = std::string ("");
     }
 
     _debug ("UserAgent: The receiver is : %s@%s\n", userName.data(), server.data());
@@ -2999,23 +3033,23 @@ mod_on_rx_request (pjsip_rx_data *rdata)
         return false;
     }
 
-	std::string addrToUse;
-	account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (account_id));
+    std::string addrToUse;
 
-	if (account != NULL) {
-		if (account_id == AccountNULL)
-			addrToUse = link->getLocalIPAddress();
-		else
-			addrToUse = account->getSessionAddress ();
-	}
-	else {
-		addrToUse = link->getLocalIPAddress();
-	}
+    account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (account_id));
 
+    if (account != NULL) {
+		// TODO May use the published address as well
+		addrToUse = account->getLocalAddress ();
+    }
+
+	if (addrToUse == "0.0.0.0")
+	{
+		link->loadSIPLocalIP (&addrToUse);
+	}
 
-    // Have to do some stuff with the SDP
-    // Set the codec map, IP, peer number and so on... for the SIPCall object
-    setCallAudioLocal (call, link->getLocalIPAddress());
+	// Have to do some stuff with the SDP
+	// Set the codec map, IP, peer number and so on... for the SIPCall object
+	setCallAudioLocal (call, addrToUse);
 
     // We retrieve the remote sdp offer in the rdata struct to begin the negociation
     call->getLocalSDP()->set_ip_address (addrToUse);
@@ -3034,7 +3068,7 @@ mod_on_rx_request (pjsip_rx_data *rdata)
 
     call->setPeerNumber (peerNumber);
 
-    call->setDisplayName(displayName);
+    call->setDisplayName (displayName);
 
     call->initRecFileName();
 
@@ -3422,7 +3456,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
             status_line.reason = *pjsip_get_status_text (500);
         }
 
-	// Get current call
+        // Get current call
         SIPCall *call = dynamic_cast<SIPCall *> (link->getCall (Manager::instance().getCurrentCallId()));
 
         if (!call) {
@@ -3436,7 +3470,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
 
             if ( (int) request.find (noresource) != -1) {
                 _debug ("UserAgent: NORESOURCE for transfer!\n");
-                link->transferStep2(call);
+                link->transferStep2 (call);
                 pjsip_evsub_terminate (sub, PJ_TRUE);
 
                 Manager::instance().transferFailed();
@@ -3445,7 +3479,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
 
             if ( (int) request.find (ringing) != -1) {
                 _debug ("UserAgent: transfered call RINGING!\n");
-                link->transferStep2(call);
+                link->transferStep2 (call);
                 pjsip_evsub_terminate (sub, PJ_TRUE);
 
                 Manager::instance().transferSucceded();
@@ -3475,7 +3509,7 @@ void xfer_func_cb (pjsip_evsub *sub, pjsip_event *event)
                     _debug ("UserAgent: Fail to send end session msg!\n");
             }
 
-            link->transferStep2(call);
+            link->transferStep2 (call);
 
             cont = PJ_FALSE;
         }
@@ -3606,37 +3640,38 @@ void handle_incoming_options (pjsip_rx_data *rdata)
 
 bool setCallAudioLocal (SIPCall* call, std::string localIP)
 {
-	SIPAccount *account = NULL;
+    SIPAccount *account = NULL;
 
-	if (call) {
+    if (call) {
         account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (Manager::instance().getAccountFromCall (call->getCallId ())));
 
-    	// Setting Audio
-    	unsigned int callLocalAudioPort = RANDOM_LOCAL_PORT;
-    	unsigned int callLocalExternAudioPort = callLocalAudioPort;
+        // Setting Audio
+        unsigned int callLocalAudioPort = RANDOM_LOCAL_PORT;
+        unsigned int callLocalExternAudioPort = callLocalAudioPort;
 
-    	if (account->isStunEnabled ()) {
-        	// If use Stun server
-        	//if (Manager::instance().isBehindNat (std::string (account->getStunServerName ().ptr), callLocalAudioPort)) {
-            	callLocalExternAudioPort = account->getStunPort ();//localExternPort; //Manager::instance().getFirewallPort();
-        	//}
-    	}
+        if (account->isStunEnabled ()) {
+            // If use Stun server
+            //if (Manager::instance().isBehindNat (std::string (account->getStunServerName ().ptr), callLocalAudioPort)) {
+            callLocalExternAudioPort = account->getStunPort ();//localExternPort; //Manager::instance().getFirewallPort();
+            //}
+        }
 
-	_debug ("            Setting local ip address: %s\n", localIP.c_str());
-    	_debug ("            Setting local audio port to: %d\n", callLocalAudioPort);
-    	_debug ("            Setting local audio port (external) to: %d\n", callLocalExternAudioPort);
+        _debug ("            Setting local ip address: %s\n", localIP.c_str());
 
-    	// Set local audio port for SIPCall(id)
-    	call->setLocalIp (localIP);
-    	call->setLocalAudioPort (callLocalAudioPort);
-    	call->setLocalExternAudioPort (callLocalExternAudioPort);
+        _debug ("            Setting local audio port to: %d\n", callLocalAudioPort);
+        _debug ("            Setting local audio port (external) to: %d\n", callLocalExternAudioPort);
 
-    	call->getLocalSDP()->attribute_port_to_all_media (callLocalExternAudioPort);
+        // Set local audio port for SIPCall(id)
+        call->setLocalIp (localIP);
+        call->setLocalAudioPort (callLocalAudioPort);
+        call->setLocalExternAudioPort (callLocalExternAudioPort);
 
-    	return true;
-	}
-	
-	return false;
+        call->getLocalSDP()->attribute_port_to_all_media (callLocalExternAudioPort);
+
+        return true;
+    }
+
+    return false;
 }
 
 std::string fetch_header_value (pjsip_msg *msg, std::string field)
@@ -3688,7 +3723,7 @@ std::vector<std::string> SIPVoIPLink::getAllIpInterface (void)
 
     int i;
 
-    for (i = 0; i < (int)addrCnt; i++) {
+    for (i = 0; i < (int) addrCnt; i++) {
         char tmpAddr[PJ_INET_ADDRSTRLEN];
         pj_sockaddr_print (&addrList[i], tmpAddr, sizeof (tmpAddr), 0);
         ifaceList.push_back (std::string (tmpAddr));
@@ -3701,51 +3736,51 @@ std::vector<std::string> SIPVoIPLink::getAllIpInterface (void)
 
 pj_bool_t stun_sock_on_status (pj_stun_sock *stun_sock, pj_stun_sock_op op, pj_status_t status)
 {
-	if (status == PJ_SUCCESS)
-		return PJ_TRUE;
-	else
-		return PJ_FALSE;
+    if (status == PJ_SUCCESS)
+        return PJ_TRUE;
+    else
+        return PJ_FALSE;
 }
 
 pj_bool_t stun_sock_on_rx_data (pj_stun_sock *stun_sock, void *pkt, unsigned pkt_len, const pj_sockaddr_t *src_addr, unsigned addr_len)
 {
-	return PJ_TRUE;
+    return PJ_TRUE;
 }
 
 
 std::string getLocalAddressAssociatedToAccount (AccountID id)
 {
-	SIPAccount *account = NULL;
-	pj_sockaddr_in local_addr_ipv4;
-	pjsip_transport *tspt;
-	std::string localAddr;
-	pj_str_t tmp;
-	
-	account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
-
-	// Set the local address
-	if (account != NULL) {
-		tspt = account->getAccountTransport ();
-		if (tspt != NULL) {
-			local_addr_ipv4 = tspt->local_addr.ipv4;
-		}
-		else {
-			_debug ("In getLocalAddressAssociatedToAccount: transport is null");
-			local_addr_ipv4 = _localUDPTransport->local_addr.ipv4;
-		}
-	}
-	else {
-			_debug ("In getLocalAddressAssociatedToAccount: account is null");
-			local_addr_ipv4 = _localUDPTransport->local_addr.ipv4;
-	}
+    SIPAccount *account = NULL;
+    pj_sockaddr_in local_addr_ipv4;
+    pjsip_transport *tspt;
+    std::string localAddr;
+    pj_str_t tmp;
+
+    account = dynamic_cast<SIPAccount *> (Manager::instance().getAccount (id));
+
+    // Set the local address
+
+    if (account != NULL) {
+        tspt = account->getAccountTransport ();
+
+        if (tspt != NULL) {
+            local_addr_ipv4 = tspt->local_addr.ipv4;
+        } else {
+            _debug ("In getLocalAddressAssociatedToAccount: transport is null");
+            local_addr_ipv4 = _localUDPTransport->local_addr.ipv4;
+        }
+    } else {
+        _debug ("In getLocalAddressAssociatedToAccount: account is null");
+        local_addr_ipv4 = _localUDPTransport->local_addr.ipv4;
+    }
 
-	_debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %i\n", local_addr_ipv4.sin_addr.s_addr);
+    _debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %i\n", local_addr_ipv4.sin_addr.s_addr);
 
-	tmp = pj_str (pj_inet_ntoa (local_addr_ipv4.sin_addr));
-	localAddr = std::string (tmp.ptr);
+    tmp = pj_str (pj_inet_ntoa (local_addr_ipv4.sin_addr));
+    localAddr = std::string (tmp.ptr);
 
-	_debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %s\n", localAddr.c_str());
+    _debug ("slbvasjklbvaskbvaskvbaskvaskvbsdfk: %s\n", localAddr.c_str());
 
-	return localAddr;
+    return localAddr;
 
 }
diff --git a/sflphone-common/src/sip/sipvoiplink.h b/sflphone-common/src/sip/sipvoiplink.h
index 6d437d4bf78354c2d4f5e0a925b49d633be54b0a..f29bf679e080ed6e49986c7c008120c830aeaa9e 100644
--- a/sflphone-common/src/sip/sipvoiplink.h
+++ b/sflphone-common/src/sip/sipvoiplink.h
@@ -295,6 +295,8 @@ class SIPVoIPLink : public VoIPLink
 		 */
 		pj_status_t init_transport_selector (pjsip_transport *transport, pjsip_tpselector **tp_sel);
 
+        bool loadSIPLocalIP (std::string *addr);
+
     private:
         /**
          * Constructor
@@ -364,16 +366,8 @@ class SIPVoIPLink : public VoIPLink
 
 		pj_status_t createAlternateUdpTransport (AccountID id);
         
-        bool loadSIPLocalIP();
-
         std::string getLocalIP() {return _localExternAddress;}
 
-        /* Flag to check if the STUN server is valid or not */
-        bool validStunServer;
-
-        /** The current STUN server address */
-        std::string _stunServer;
-
         /** Local Extern Address is the IP address seen by peers for SIP listener */
         std::string _localExternAddress;
 
@@ -383,9 +377,6 @@ class SIPVoIPLink : public VoIPLink
         /** For registration use only */
         int _regPort;
 
-        /** Do we use stun? */
-        bool _useStun;
-
         /** Threading object */
         EventThread* _evThread;
         ost::Mutex _mutexSIP;
diff --git a/sflphone-common/src/util/Pattern.cpp b/sflphone-common/src/util/Pattern.cpp
index b88c286bfd54c2bd21efb678519fe56fceb5d034..85cb60392bb6356e5e380e6396eb6b38bc8cee7c 100644
--- a/sflphone-common/src/util/Pattern.cpp
+++ b/sflphone-common/src/util/Pattern.cpp
@@ -10,286 +10,305 @@
  *  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.
  */
- 
+
 #include "Pattern.h"
 #include <sstream>
 #include <cstdio>
-namespace sfl  {
+
+namespace sfl
+{
+
 namespace util {
-    Pattern::Pattern(const std::string& pattern, const std::string& options = ""):
-    _pattern(pattern),
-    _ovector(NULL),
-	_ovectorSize(0),
-    _re(NULL),
-	_count(0),
-	_options(0)
-    {   
-		// Set offsets
-		_offset[0] = _offset[1] = 0;
-		
-		// Set options.
-		_optionsDescription = options;
-		
-		 for(unsigned int i = 0; i < options.length(); i++) {
-			switch(options.at(i)) {
-				case 'i': 
-					_options |= PCRE_CASELESS;
-					break;
-				case 'm': 
-					_options |= PCRE_MULTILINE;                  
-					break;
-				case 's': 
-					_options |= PCRE_DOTALL;                     
-					break;
-				case 'x': 
-					_options |= PCRE_EXTENDED;                   
-					break;
-			}
-		}
-		
-		// Compile the pattern.
-        compile();
+Pattern::Pattern (const std::string& pattern, const std::string& options = "") :
+        _pattern (pattern),
+        _ovector (NULL),
+        _ovectorSize (0),
+        _re (NULL),
+        _count (0),
+        _options (0)
+{
+    // Set offsets
+    _offset[0] = _offset[1] = 0;
+
+    // Set options.
+    _optionsDescription = options;
+
+    for (unsigned int i = 0; i < options.length(); i++) {
+        switch (options.at (i)) {
+
+            case 'i':
+                _options |= PCRE_CASELESS;
+                break;
+
+            case 'm':
+                _options |= PCRE_MULTILINE;
+                break;
+
+            case 's':
+                _options |= PCRE_DOTALL;
+                break;
+
+            case 'x':
+                _options |= PCRE_EXTENDED;
+                break;
+        }
+    }
+
+    // Compile the pattern.
+    compile();
+}
+
+Pattern::~Pattern()
+{
+    if (_re != NULL) {
+        pcre_free (_re);
+    }
+
+    delete[] _ovector;
+}
+
+void Pattern::compile (void)
+{
+    // Compile the pattern
+    int offset;
+    const char * error;
+
+    _re = pcre_compile (_pattern.c_str(), 0, &error, &offset, NULL);
+
+    if (_re == NULL) {
+        std::string offsetStr;
+        std::stringstream ss;
+        ss << offset;
+        offsetStr = ss.str();
+
+        std::string msg ("PCRE compiling failed at offset " + offsetStr);
+
+        throw compile_error (msg);
+    }
+
+    // Allocate an appropriate amount
+    // of memory for the output vector.
+    int captureCount;
+
+    pcre_fullinfo (_re, NULL, PCRE_INFO_CAPTURECOUNT, &captureCount);
+
+    delete[] _ovector;
+
+    _ovector = new int[ (captureCount + 1) *3];
+
+    _ovectorSize = (captureCount + 1) * 3;
+}
+
+unsigned int Pattern::getCaptureGroupCount (void)
+{
+    int captureCount;
+    pcre_fullinfo (_re, NULL, PCRE_INFO_CAPTURECOUNT, &captureCount);
+    return captureCount;
+}
+
+std::vector<std::string> Pattern::groups (void)
+{
+    const char ** stringList;
+
+    pcre_get_substring_list (_subject.c_str(),
+                             _ovector,
+                             _count,
+                             &stringList);
+
+    std::vector<std::string> matchedSubstrings;
+    int i = 1;
+
+    while (stringList[i] != NULL) {
+        matchedSubstrings.push_back (stringList[i]);
+        printf ("Substr: <start>%s<end>\n", stringList[i]);
+        i++;
     }
-    
-    Pattern::~Pattern() 
-    {
-        if (_re != NULL) {
-            pcre_free(_re);
+
+    pcre_free_substring_list (stringList);
+
+    return matchedSubstrings;
+}
+
+std::string Pattern::group (int groupNumber)
+{
+    const char * stringPtr;
+
+    int rc = pcre_get_substring (
+                 _subject.substr (_offset[0]).c_str(),
+                 _ovector,
+                 _count,
+                 groupNumber,
+                 &stringPtr);
+
+    if (rc < 0) {
+        switch (rc) {
+
+            case PCRE_ERROR_NOSUBSTRING:
+                throw std::out_of_range ("Invalid group reference.");
+
+            case PCRE_ERROR_NOMEMORY:
+                throw match_error ("Memory exhausted.");
+
+            default:
+                throw match_error ("Failed to get named substring.");
         }
-		
-		delete[] _ovector;
     }
-		
-	void Pattern::compile(void)
-    {
-        // Compile the pattern
-        int offset;
-        const char * error;
-        
-        _re = pcre_compile(_pattern.c_str(), 0, &error, &offset, NULL);
-        
-        if (_re == NULL) {
-            std::string offsetStr;
-            std::stringstream ss;
-            ss << offset;
-            offsetStr = ss.str();
-            
-            std::string msg("PCRE compiling failed at offset " + offsetStr);
-
-            throw compile_error(msg);
-        }  
-		
-		// Allocate an appropriate amount 
-		// of memory for the output vector.
-		int captureCount;
-		pcre_fullinfo(_re, NULL, PCRE_INFO_CAPTURECOUNT, &captureCount);
-		
-		delete[] _ovector;
-		_ovector = new int[(captureCount + 1)*3];
-		_ovectorSize = (captureCount + 1) * 3;	
+
+    std::string matchedStr (stringPtr);
+
+    pcre_free_substring (stringPtr);
+
+    return matchedStr;
+}
+
+std::string Pattern::group (const std::string& groupName)
+{
+    const char * stringPtr = NULL;
+
+    int rc = pcre_get_named_substring (
+                 _re,
+                 _subject.substr (_offset[0]).c_str(),
+                 _ovector,
+                 _count,
+                 groupName.c_str(),
+                 &stringPtr);
+
+    if (rc < 0) {
+        switch (rc) {
+
+            case PCRE_ERROR_NOSUBSTRING:
+                throw std::out_of_range ("Invalid group reference.");
+
+            case PCRE_ERROR_NOMEMORY:
+                throw match_error ("Memory exhausted.");
+
+            default:
+                throw match_error ("Failed to get named substring.");
+        }
+    }
+
+    std::string matchedStr (stringPtr);
+
+    pcre_free_substring (stringPtr);
+
+    return matchedStr;
+}
+
+size_t Pattern::start (const std::string& groupName) const
+{
+    int index = pcre_get_stringnumber (_re, groupName.c_str());
+    start (index);
+}
+
+size_t Pattern::start (unsigned int groupNumber) const
+{
+    if (groupNumber <= _count) {
+        return _ovector[ (groupNumber + 1) * 2];
+    } else {
+        throw std::out_of_range ("Invalid group reference.");
+    }
+}
+
+size_t Pattern::start (void) const
+{
+    return _ovector[0] + _offset[0];
+}
+
+size_t Pattern::end (const std::string& groupName) const
+{
+    int index = pcre_get_stringnumber (_re, groupName.c_str());
+    end (index);
+}
+
+size_t Pattern::end (unsigned int groupNumber) const
+{
+    if (groupNumber <= _count) {
+        return _ovector[ ( (groupNumber + 1) * 2) + 1 ] - 1;
+    } else {
+        throw std::out_of_range ("Invalid group reference.");
     }
+}
 
-	unsigned int Pattern::getCaptureGroupCount(void)
-	{
-		int captureCount;
-		pcre_fullinfo(_re, NULL, PCRE_INFO_CAPTURECOUNT, &captureCount);
-		return captureCount;
-	}
-	
-	std::vector<std::string> Pattern::groups(void)
-	{
-		const char ** stringList;
-		
-		pcre_get_substring_list(_subject.c_str(), 
-								_ovector, 
-								_count, 
-								&stringList);
-								
-		std::vector<std::string> matchedSubstrings;
-		int i = 1;
-		while(stringList[i] != NULL) {
-			matchedSubstrings.push_back(stringList[i]);
-			printf("Substr: <start>%s<end>\n", stringList[i]);
-			i++;
-		}
-		
-		pcre_free_substring_list(stringList);
-		
-		return matchedSubstrings;
-	}
-	
-	std::string Pattern::group(int groupNumber)
-	{
-		const char * stringPtr;
-		
-		int rc = pcre_get_substring(
-					_subject.substr(_offset[0]).c_str(), 
-					_ovector,
-					_count, 
-					groupNumber,
-					&stringPtr);
-		
-		if (rc < 0) {
-			switch (rc) {
-				case PCRE_ERROR_NOSUBSTRING:
-					throw std::out_of_range("Invalid group reference.");
-				case PCRE_ERROR_NOMEMORY:
-					throw match_error("Memory exhausted.");
-				default:
-					throw match_error("Failed to get named substring.");
-			}
-		}	
-		
-		std::string matchedStr(stringPtr);
-		
-		pcre_free_substring(stringPtr);
-			
-		return matchedStr;
-	}
-	
-	std::string Pattern::group(const std::string& groupName)
-	{
-		const char * stringPtr = NULL;
-		
-		int rc = pcre_get_named_substring(
-					_re, 
-					_subject.substr(_offset[0]).c_str(), 
-					_ovector,
-					_count,
-					groupName.c_str(),
-					&stringPtr);
-		
-		if (rc < 0) {
-			switch (rc) {
-				case PCRE_ERROR_NOSUBSTRING:
-					throw std::out_of_range("Invalid group reference.");
-				case PCRE_ERROR_NOMEMORY:
-					throw match_error("Memory exhausted.");
-				default:
-					throw match_error("Failed to get named substring.");
-			}
-		}
-					
-		std::string matchedStr(stringPtr);
-		
-		pcre_free_substring(stringPtr);
-			
-		return matchedStr;
-	}
-	
-	size_t Pattern::start(const std::string& groupName) const
-	{
-		int index = pcre_get_stringnumber(_re, groupName.c_str());
-		start(index);
-	}
-	
-	size_t Pattern::start(unsigned int groupNumber) const
-	{
-		if(groupNumber <= _count) {
-			return _ovector[(groupNumber + 1) * 2];
-		} else {
-			throw std::out_of_range("Invalid group reference.");
-		}  		
-	}
-	
-	size_t Pattern::start(void) const 
-	{
-		return _ovector[0] + _offset[0];
-	}
-	
-	size_t Pattern::end(const std::string& groupName) const 
-	{
-		int index = pcre_get_stringnumber(_re, groupName.c_str());
-		end(index);
-	}
-	
-	size_t Pattern::end(unsigned int groupNumber) const
-	{
-		if(groupNumber <= _count) {
-			return _ovector[ ((groupNumber + 1) * 2) + 1 ] - 1;
-		} else {
-			throw std::out_of_range("Invalid group reference.");
-		}
-	}
-	
-	size_t Pattern::end(void) const 
-	{
-		return (_ovector[1] - 1) + _offset[0];
-	}
-	
-	bool Pattern::matches(void) throw(match_error)
-	{
-		matches(_subject);
-	}
-	
-	bool Pattern::matches(const std::string& subject) throw(match_error)
-	{	
-		//printf("\n\n\nCurrent offset: %d, old offset: %d\n", _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(
-				_re,
-				NULL,
-				subject.substr(_offset[1]).c_str(),
-				subject.length() - _offset[1],
-				0,
-				_options,
-				_ovector,
-				_ovectorSize);
-		
-		// Matching failed.
-		if (rc < 0) {
-			_offset[0] = _offset[1] = 0;
-			//printf("Matching failed with %d\n", rc);
-			return false;
-		}
-		
-		// Handle the case if matching should be done globally					
-		if (_optionsDescription.find("g") != std::string::npos) {
-			_offset[0] = _offset[1];
-			// New offset is old offset + end of relative offset
-			_offset[1] =  _ovector[1] + _offset[0]; 
-		}
-
-		//printf("Matching succeeded with %d to %d\n", (int) start(), (int) end());
-		
-		// Matching succeded but not enough space.
-		if (rc == 0) {
-			throw match_error("No space to store all substrings.");
-			// @TODO figure out something more clever to do in that case.
-		}
-				
-		// Matching succeeded. Keep the number of substrings for 
-		// subsequent calls to group().
-		_count = rc;
-		
-		return true;
-	}
-
-	std::vector<std::string> Pattern::split(void) 
-	{
-		size_t tokenEnd = -1;
-		size_t tokenStart = 0;
-		
-		std::vector<std::string> substringSplitted;
-		
-		while(matches()) {			
-			tokenStart = start();
-			substringSplitted.push_back(_subject.substr(tokenEnd + 1, 
-										tokenStart - tokenEnd - 1));
-			tokenEnd = end();
-		}
-		
-		substringSplitted.push_back(_subject.substr(tokenEnd + 1, 
-										tokenStart - tokenEnd - 1));
-		return substringSplitted;
-	}
+size_t Pattern::end (void) const
+{
+    return (_ovector[1] - 1) + _offset[0];
+}
+
+bool Pattern::matches (void) throw (match_error)
+{
+    matches (_subject);
+}
+
+bool Pattern::matches (const std::string& subject) throw (match_error)
+{
+    //printf("\n\n\nCurrent offset: %d, old offset: %d\n", _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 (
+                 _re,
+                 NULL,
+                 subject.substr (_offset[1]).c_str(),
+                 subject.length() - _offset[1],
+                 0,
+                 _options,
+                 _ovector,
+                 _ovectorSize);
+
+    // Matching failed.
+
+    if (rc < 0) {
+        _offset[0] = _offset[1] = 0;
+        //printf("Matching failed with %d\n", rc);
+        return false;
+    }
+
+    // Handle the case if matching should be done globally
+    if (_optionsDescription.find ("g") != std::string::npos) {
+        _offset[0] = _offset[1];
+        // New offset is old offset + end of relative offset
+        _offset[1] =  _ovector[1] + _offset[0];
+    }
+
+    //printf("Matching succeeded with %d to %d\n", (int) start(), (int) end());
+
+    // Matching succeded but not enough space.
+    if (rc == 0) {
+        throw match_error ("No space to store all substrings.");
+        // @TODO figure out something more clever to do in that case.
+    }
+
+    // Matching succeeded. Keep the number of substrings for
+    // subsequent calls to group().
+    _count = rc;
+
+    return true;
+}
+
+std::vector<std::string> Pattern::split (void)
+{
+    size_t tokenEnd = -1;
+    size_t tokenStart = 0;
+
+    std::vector<std::string> substringSplitted;
+
+    while (matches()) {
+        tokenStart = start();
+        substringSplitted.push_back (_subject.substr (tokenEnd + 1,
+                                     tokenStart - tokenEnd - 1));
+        tokenEnd = end();
+    }
+
+    substringSplitted.push_back (_subject.substr (tokenEnd + 1,
+
+                                 tokenStart - tokenEnd - 1));
+    return substringSplitted;
+}
 }
 }
 
diff --git a/sflphone-common/src/voiplink.cpp b/sflphone-common/src/voiplink.cpp
index 9bf46226d3d6509d7df3c40d786d92c5852bd7e0..2ebc8d6723a6c9e5062dc7cfbe18310e5429c635 100644
--- a/sflphone-common/src/voiplink.cpp
+++ b/sflphone-common/src/voiplink.cpp
@@ -24,7 +24,7 @@
 #include "voiplink.h"
 #include "manager.h"
 
-VoIPLink::VoIPLink (const AccountID& accountID) : _accountID (accountID), _localIPAddress ("127.0.0.1"), _localPort (0),  _initDone (false)
+VoIPLink::VoIPLink (const AccountID& accountID) : _accountID (accountID), _localPort (0),  _initDone (false)
 {
 }
 
diff --git a/sflphone-common/src/voiplink.h b/sflphone-common/src/voiplink.h
index 09ea20b3c2708f63a6b0a38053a214755843c5fa..16de9afdae71cee6a9a0f146434206f9f0e943f1 100644
--- a/sflphone-common/src/voiplink.h
+++ b/sflphone-common/src/voiplink.h
@@ -181,8 +181,6 @@ class VoIPLink {
         bool initDone (void) { return _initDone; }
         void initDone (bool state) { _initDone = state; }
 
-        std::string getLocalIPAddress (void) { return _localIPAddress; }
-
         /** Add a call to the call map (protected by mutex)
          * @param call A call pointer with a unique pointer
          * @return bool True if the call was unique and added
@@ -233,9 +231,6 @@ class VoIPLink {
         /** Mutex to protect call map */
         ost::Mutex _callMapMutex;
 
-        /** Get Local IP Address (ie: 127.0.0.1, 192.168.0.1, ...) */
-        std::string _localIPAddress;
-
         /** Get local listening port (5060 for SIP, ...) */
         unsigned int _localPort;
 
diff --git a/sflphone-common/test/mainbufferTest.cpp b/sflphone-common/test/mainbufferTest.cpp
index d3cdfa6515db33982fa4561f692d40291c234e74..63c9fa2f4d7cffdbdb5a95bfc3f05aa1c8053c50 100644
--- a/sflphone-common/test/mainbufferTest.cpp
+++ b/sflphone-common/test/mainbufferTest.cpp
@@ -41,7 +41,7 @@ using std::endl;
 void MainBufferTest::setUp()
 {
 
-    
+
 }
 
 
@@ -53,7 +53,7 @@ void MainBufferTest::tearDown()
 
 void MainBufferTest::testRingBufferCreation()
 {
-    _debug("MainBufferTest::testRingBufferCreation()\n");
+    _debug ("MainBufferTest::testRingBufferCreation()\n");
 
     CallID test_id = "1234";
     CallID null_id = "null id";
@@ -62,45 +62,45 @@ void MainBufferTest::testRingBufferCreation()
     RingBufferMap::iterator iter;
 
     // test mainbuffer ringbuffer map size
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    test_ring_buffer = _mainbuffer.createRingBuffer(test_id);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 1);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    test_ring_buffer = _mainbuffer.createRingBuffer (test_id);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 1);
 
     // test _mainbuffer.getRingBuffer method
-    CPPUNIT_ASSERT(test_ring_buffer != NULL);
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(null_id) == NULL);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 1);
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(test_id) == test_ring_buffer);
+    CPPUNIT_ASSERT (test_ring_buffer != NULL);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (null_id) == NULL);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 1);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (test_id) == test_ring_buffer);
 
     // test _mainbuffer _ringBufferMap
-    iter = _mainbuffer._ringBufferMap.find(null_id);
-    CPPUNIT_ASSERT(iter == _mainbuffer._ringBufferMap.end());
-    iter = _mainbuffer._ringBufferMap.find(test_id);
-    CPPUNIT_ASSERT(iter->first == test_id);
-    CPPUNIT_ASSERT(iter->second == test_ring_buffer);
-    CPPUNIT_ASSERT(iter->second == _mainbuffer.getRingBuffer(test_id));
+    iter = _mainbuffer._ringBufferMap.find (null_id);
+    CPPUNIT_ASSERT (iter == _mainbuffer._ringBufferMap.end());
+    iter = _mainbuffer._ringBufferMap.find (test_id);
+    CPPUNIT_ASSERT (iter->first == test_id);
+    CPPUNIT_ASSERT (iter->second == test_ring_buffer);
+    CPPUNIT_ASSERT (iter->second == _mainbuffer.getRingBuffer (test_id));
 
     // test creating twice a buffer (should not create it)
-    _mainbuffer.createRingBuffer(test_id);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 1);
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(test_id) == test_ring_buffer);
+    _mainbuffer.createRingBuffer (test_id);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 1);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (test_id) == test_ring_buffer);
 
     // test remove ring buffer
-    CPPUNIT_ASSERT(_mainbuffer.removeRingBuffer(null_id) == true);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 1);
-    CPPUNIT_ASSERT(_mainbuffer.removeRingBuffer(test_id) == true);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(test_id) == NULL);
-
-    iter = _mainbuffer._ringBufferMap.find(test_id);
-    CPPUNIT_ASSERT(iter == _mainbuffer._ringBufferMap.end());
-    
+    CPPUNIT_ASSERT (_mainbuffer.removeRingBuffer (null_id) == true);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 1);
+    CPPUNIT_ASSERT (_mainbuffer.removeRingBuffer (test_id) == true);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (test_id) == NULL);
+
+    iter = _mainbuffer._ringBufferMap.find (test_id);
+    CPPUNIT_ASSERT (iter == _mainbuffer._ringBufferMap.end());
+
 }
 
 
 void MainBufferTest::testRingBufferReadPointer()
 {
-    _debug("MainBufferTest::testRingBufferReadPointer()\n");
+    _debug ("MainBufferTest::testRingBufferReadPointer()\n");
 
     CallID call_id = "call id";
     CallID read_id = "read id";
@@ -110,44 +110,44 @@ void MainBufferTest::testRingBufferReadPointer()
     RingBuffer* test_ring_buffer;
 
     // test ring buffer read pointers (one per participant)
-    test_ring_buffer = _mainbuffer.createRingBuffer(call_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(read_id) == (int)NULL);
+    test_ring_buffer = _mainbuffer.createRingBuffer (call_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (read_id) == (int) NULL);
 
     // create a read pointer
-    test_ring_buffer->createReadPointer(read_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(null_id) == (int)NULL);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(read_id) == 0);
+    test_ring_buffer->createReadPointer (read_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (null_id) == (int) NULL);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (read_id) == 0);
 
     // store read pointer
-    test_ring_buffer->storeReadPointer(4, read_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(read_id) == 4);
+    test_ring_buffer->storeReadPointer (4, read_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (read_id) == 4);
 
     // recreate the same read pointer (should not add a pointer neither chage its value)
-    test_ring_buffer->createReadPointer(read_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    test_ring_buffer->storeReadPointer(8, read_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(read_id) == 8);
+    test_ring_buffer->createReadPointer (read_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    test_ring_buffer->storeReadPointer (8, read_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (read_id) == 8);
 
     // test getSmallest read pointer (to get the length available to put data in the buffer)
-    test_ring_buffer->createReadPointer(other_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 2);
-    test_ring_buffer->storeReadPointer(4, other_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getSmallestReadPointer() == 4);
+    test_ring_buffer->createReadPointer (other_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 2);
+    test_ring_buffer->storeReadPointer (4, other_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getSmallestReadPointer() == 4);
 
     // remove read pointers
-    test_ring_buffer->removeReadPointer(other_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    test_ring_buffer->removeReadPointer(read_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 0);    
+    test_ring_buffer->removeReadPointer (other_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    test_ring_buffer->removeReadPointer (read_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 0);
 }
 
 
 void MainBufferTest::testCallIDSet()
 {
-    _debug("MainBufferTest::testCallIDSet()\n");
+    _debug ("MainBufferTest::testCallIDSet()\n");
 
     CallID test_id = "set id";
     CallID false_id = "false set id";
@@ -160,310 +160,310 @@ void MainBufferTest::testCallIDSet()
     CallID call_id_2 = "call id 2";
 
     // test initial settings
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 0);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map ==_mainbuffer._callIDMap.end());
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map ==_mainbuffer._callIDMap.end());
 
     // test callidset creation
-    CPPUNIT_ASSERT(_mainbuffer.createCallIDSet(test_id) == true);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 1);
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map->first == test_id);
-    CPPUNIT_ASSERT(iter_map->second == _mainbuffer.getCallIDSet(test_id));
+    CPPUNIT_ASSERT (_mainbuffer.createCallIDSet (test_id) == true);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 1);
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map->first == test_id);
+    CPPUNIT_ASSERT (iter_map->second == _mainbuffer.getCallIDSet (test_id));
 
-    CPPUNIT_ASSERT(_mainbuffer.getCallIDSet(false_id) == NULL);
-    CPPUNIT_ASSERT(_mainbuffer.getCallIDSet(test_id) != NULL);
+    CPPUNIT_ASSERT (_mainbuffer.getCallIDSet (false_id) == NULL);
+    CPPUNIT_ASSERT (_mainbuffer.getCallIDSet (test_id) != NULL);
 
 
     // Test callIDSet add call_ids
-    _mainbuffer.addCallIDtoSet(test_id, call_id_1);
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map->second->size() == 1);
-    iter_set = iter_map->second->find(call_id_1);
-    CPPUNIT_ASSERT(*iter_set == call_id_1);
+    _mainbuffer.addCallIDtoSet (test_id, call_id_1);
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map->second->size() == 1);
+    iter_set = iter_map->second->find (call_id_1);
+    CPPUNIT_ASSERT (*iter_set == call_id_1);
 
     // test add second call id to set
-    _mainbuffer.addCallIDtoSet(test_id, call_id_2);
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map->second->size() == 2);
-    iter_set = iter_map->second->find(call_id_2);
-    CPPUNIT_ASSERT(*iter_set == call_id_2);
-
-    // test add a call id twice 
-    _mainbuffer.addCallIDtoSet(test_id, call_id_2);
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map->second->size() == 2);
-    iter_set = iter_map->second->find(call_id_2);
-    CPPUNIT_ASSERT(*iter_set == call_id_2);
+    _mainbuffer.addCallIDtoSet (test_id, call_id_2);
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map->second->size() == 2);
+    iter_set = iter_map->second->find (call_id_2);
+    CPPUNIT_ASSERT (*iter_set == call_id_2);
+
+    // test add a call id twice
+    _mainbuffer.addCallIDtoSet (test_id, call_id_2);
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map->second->size() == 2);
+    iter_set = iter_map->second->find (call_id_2);
+    CPPUNIT_ASSERT (*iter_set == call_id_2);
 
     // test remove a call id
-    _mainbuffer.removeCallIDfromSet(test_id, call_id_2);
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map->second->size() == 1);
-    iter_set = iter_map->second->find(call_id_1);
-    CPPUNIT_ASSERT(*iter_set == call_id_1);
-    iter_set = iter_map->second->find(call_id_2);
-    CPPUNIT_ASSERT(iter_set == iter_map->second->end());
+    _mainbuffer.removeCallIDfromSet (test_id, call_id_2);
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map->second->size() == 1);
+    iter_set = iter_map->second->find (call_id_1);
+    CPPUNIT_ASSERT (*iter_set == call_id_1);
+    iter_set = iter_map->second->find (call_id_2);
+    CPPUNIT_ASSERT (iter_set == iter_map->second->end());
 
     // test remove a call id twice
-    _mainbuffer.removeCallIDfromSet(test_id, call_id_2);
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map->second->size() == 1);
-    iter_set = iter_map->second->find(call_id_1);
-    CPPUNIT_ASSERT(*iter_set == call_id_1);
-    iter_set = iter_map->second->find(call_id_2);
-    CPPUNIT_ASSERT(iter_set == iter_map->second->end());
+    _mainbuffer.removeCallIDfromSet (test_id, call_id_2);
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map->second->size() == 1);
+    iter_set = iter_map->second->find (call_id_1);
+    CPPUNIT_ASSERT (*iter_set == call_id_1);
+    iter_set = iter_map->second->find (call_id_2);
+    CPPUNIT_ASSERT (iter_set == iter_map->second->end());
 
     // Test removeCallIDSet
-    CPPUNIT_ASSERT(_mainbuffer.removeCallIDSet(false_id) == false);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 1);
-    CPPUNIT_ASSERT(_mainbuffer.removeCallIDSet(test_id) == true);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer.removeCallIDSet (false_id) == false);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 1);
+    CPPUNIT_ASSERT (_mainbuffer.removeCallIDSet (test_id) == true);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
+
+    iter_map = _mainbuffer._callIDMap.find (test_id);
+    CPPUNIT_ASSERT (iter_map ==_mainbuffer._callIDMap.end());
 
-    iter_map = _mainbuffer._callIDMap.find(test_id);
-    CPPUNIT_ASSERT(iter_map ==_mainbuffer._callIDMap.end());
 
-    
 }
 
 
 void MainBufferTest::testRingBufferInt()
 {
 
-    _debug("MainBufferTest::testRingbufferInt()\n");
+    _debug ("MainBufferTest::testRingbufferInt()\n");
 
     // CallID test_id = "test_int";
-    
+
     int testint1 = 12;
     int testint2 = 13;
     int init_put_size;
 
 
     // test with default ring buffer
-    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer(default_id);
+    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer (default_id);
 
     // initial state
     init_put_size = test_ring_buffer->AvailForPut();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 0);
 
     // add some data
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 0);
 
     // add some other data
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint2, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - 2*(int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint2, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - 2* (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 0);
 
-    int testget = (int)NULL;
+    int testget = (int) NULL;
 
     // get some data (without any read pointers)
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(int)) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == 2*sizeof(int));
-    CPPUNIT_ASSERT(testget == (int)NULL);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - 2*(int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testget, sizeof (int)) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == 2*sizeof (int));
+    CPPUNIT_ASSERT (testget == (int) NULL);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - 2* (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 0);
 
     // get some data (with a read pointer)
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 0);
-    test_ring_buffer->createReadPointer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 0);
+    test_ring_buffer->createReadPointer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == 0);
 
     // add some data
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 2*sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 2*sizeof (int));
 
     // add some other data
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint2, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - 2*(int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 2*sizeof(int));
-
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(int), 100, default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == sizeof(int));
-    CPPUNIT_ASSERT(testget == testint1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 3*sizeof(int));
-
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(testget == testint2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 4*sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint2, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - 2* (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 2*sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testget, sizeof (int), 100, default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == sizeof (int));
+    CPPUNIT_ASSERT (testget == testint1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 3*sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testget, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (testget == testint2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_size);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 4*sizeof (int));
 
 
     // test flush data
     init_put_size = test_ring_buffer->AvailForPut();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == sizeof (int));
 
 
     test_ring_buffer->flush();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 5*sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_size);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 5*sizeof (int));
 
     // test flush data
     init_put_size = test_ring_buffer->AvailForPut();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 5*sizeof(int));
-
-    test_ring_buffer->Discard(sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 6*sizeof(int));
-
-    
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 5*sizeof (int));
+
+    test_ring_buffer->Discard (sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_size);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 6*sizeof (int));
+
+
 }
 
 
 void MainBufferTest::testRingBufferNonDefaultID()
 {
 
-    _debug("MainBufferTest::testRingBufferNonDefaultID()\n");
+    _debug ("MainBufferTest::testRingBufferNonDefaultID()\n");
 
     CallID test_id = "test_int";
-    
+
     int testint1 = 12;
     int testint2 = 13;
     int init_put_size;
 
-    
+
     // test putData, getData with arbitrary read pointer id
-    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer(default_id);
-    test_ring_buffer->createReadPointer(test_id);
+    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer (default_id);
+    test_ring_buffer->createReadPointer (test_id);
 
     init_put_size = test_ring_buffer->AvailForPut();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(default_id) == 0); 
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (default_id) == 0);
 
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (default_id) == 0);
 
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint2, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - 2*(int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint2, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - 2* (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (default_id) == 0);
 
     int testget;
 
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id) == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_id) == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(int), 100,  test_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_id) == sizeof(int));
-    CPPUNIT_ASSERT(testget == testint1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id) == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_id) == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testget, sizeof (int), 100,  test_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_id) == sizeof (int));
+    CPPUNIT_ASSERT (testget == testint1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == sizeof (int));
 
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(int), 100, test_id) == sizeof(int));
-    CPPUNIT_ASSERT(testget == testint2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == 2*sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testget, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (testget == testint2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_size);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == 2*sizeof (int));
 
 
     // test flush data
     init_put_size = test_ring_buffer->AvailForPut();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_id) == sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_id) == sizeof (int));
 
 
-    test_ring_buffer->flush(test_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == 3*sizeof(int));
+    test_ring_buffer->flush (test_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_size);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == 3*sizeof (int));
 
     // test flush data
     init_put_size = test_ring_buffer->AvailForPut();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (init_put_size - (int)sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == 3*sizeof(int));
-
-    test_ring_buffer->Discard(sizeof(int), test_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_size);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == 4*sizeof(int));
-
-    test_ring_buffer->removeReadPointer(test_id);
-    
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (init_put_size - (int) sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == 3*sizeof (int));
+
+    test_ring_buffer->Discard (sizeof (int), test_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_size);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == 4*sizeof (int));
+
+    test_ring_buffer->removeReadPointer (test_id);
+
 }
 
 
 void MainBufferTest::testRingBufferFloat()
 {
 
-    _debug("MainBufferTest::testRingBufferFloat()\n");
+    _debug ("MainBufferTest::testRingBufferFloat()\n");
 
     float testfloat1 = 12.5;
     float testfloat2 = 13.4;
 
-    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer(default_id);
-    test_ring_buffer->createReadPointer(default_id);
-    
+    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer (default_id);
+    test_ring_buffer->createReadPointer (default_id);
 
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testfloat1, sizeof(float)) == sizeof(float));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(float));
 
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testfloat2, sizeof(float)) == sizeof(float));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 2*sizeof(float));
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testfloat1, sizeof (float)) == sizeof (float));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (float));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testfloat2, sizeof (float)) == sizeof (float));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 2*sizeof (float));
 
     float testget;
 
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(float)) == sizeof(float));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == sizeof(float));
-    CPPUNIT_ASSERT(testget == testfloat1);
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testget, sizeof (float)) == sizeof (float));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == sizeof (float));
+    CPPUNIT_ASSERT (testget == testfloat1);
 
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testget, sizeof(float)) == sizeof(float));
-    CPPUNIT_ASSERT(testget == testfloat2);
-    CPPUNIT_ASSERT(test_ring_buffer->getLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testget, sizeof (float)) == sizeof (float));
+    CPPUNIT_ASSERT (testget == testfloat2);
+    CPPUNIT_ASSERT (test_ring_buffer->getLen() == 0);
 
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testfloat1, sizeof(float)) == sizeof(float));
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testfloat1, sizeof (float)) == sizeof (float));
     test_ring_buffer->flush();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
 
 }
 
@@ -471,27 +471,27 @@ void MainBufferTest::testRingBufferFloat()
 void MainBufferTest::testTwoPointer()
 {
 
-    _debug("MainBufferTest::testTwoPointer()\n");
+    _debug ("MainBufferTest::testTwoPointer()\n");
+
 
-    
-    RingBuffer* input_buffer = _mainbuffer.createRingBuffer(default_id);
-    input_buffer->createReadPointer(default_id);
-    RingBuffer* output_buffer = _mainbuffer.getRingBuffer(default_id);
+    RingBuffer* input_buffer = _mainbuffer.createRingBuffer (default_id);
+    input_buffer->createReadPointer (default_id);
+    RingBuffer* output_buffer = _mainbuffer.getRingBuffer (default_id);
 
     int test_input = 12;
     int test_output;
 
-    CPPUNIT_ASSERT(input_buffer->Put(&test_input, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(output_buffer->Get(&test_output, sizeof(float)) == sizeof(float));
-    CPPUNIT_ASSERT(test_input == test_output);
+    CPPUNIT_ASSERT (input_buffer->Put (&test_input, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (output_buffer->Get (&test_output, sizeof (float)) == sizeof (float));
+    CPPUNIT_ASSERT (test_input == test_output);
 
 }
 
 void MainBufferTest::testBindUnbindBuffer()
 {
 
-    _debug("MainBufferTest::testBindUnbindBuffer()\n");
-    
+    _debug ("MainBufferTest::testBindUnbindBuffer()\n");
+
     CallID test_id1 = "bind unbind 1";
     CallID test_id2 = "bind unbind 2";
 
@@ -504,398 +504,398 @@ void MainBufferTest::testBindUnbindBuffer()
     RingBuffer* ringbuffer;
 
     // test initial state with no ring brffer created
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
 
-    iter_buffer = _mainbuffer._ringBufferMap.find(default_id);
-    CPPUNIT_ASSERT(iter_buffer == _mainbuffer._ringBufferMap.end());
-    iter_idset = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_idset == _mainbuffer._callIDMap.end());
+    iter_buffer = _mainbuffer._ringBufferMap.find (default_id);
+    CPPUNIT_ASSERT (iter_buffer == _mainbuffer._ringBufferMap.end());
+    iter_idset = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_idset == _mainbuffer._callIDMap.end());
 
     // bind test_id1 with default_id (both buffer not already created)
-    _mainbuffer.bindCallID(test_id1);
+    _mainbuffer.bindCallID (test_id1);
 
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 2);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 2);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 2);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 2);
 
-    iter_buffer = _mainbuffer._ringBufferMap.find(default_id);
-    CPPUNIT_ASSERT(iter_buffer->first == default_id);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(default_id));
+    iter_buffer = _mainbuffer._ringBufferMap.find (default_id);
+    CPPUNIT_ASSERT (iter_buffer->first == default_id);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (default_id));
 
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id1);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id1));
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id1);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id1));
 
-    iter_idset = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_id == test_id1);
+    iter_idset = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_id == test_id1);
 
-    iter_idset = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
+    iter_idset = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
 
-    ringbuffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
+    ringbuffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
 
-    ringbuffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
+    ringbuffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
 
 
-    // unbind test_id1 with default_id 
-    _mainbuffer.unBindCallID(test_id1);
+    // unbind test_id1 with default_id
+    _mainbuffer.unBindCallID (test_id1);
 
-    _debug("%i\n", _mainbuffer._ringBufferMap.size());
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 0);
+    _debug ("%i\n", _mainbuffer._ringBufferMap.size());
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
+
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (default_id) == NULL);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (test_id1) == NULL);
 
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(default_id) == NULL);
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(test_id1) == NULL);
-    
 
     // bind test_id2 with default_id (default_id already created)
     // calling it twice not supposed to break anything
-    _mainbuffer.bindCallID(test_id1, default_id);
-    _mainbuffer.bindCallID(test_id1, default_id);
-
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 2);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 2);
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_buffer == _mainbuffer._ringBufferMap.end());
-    iter_idset = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_idset == _mainbuffer._callIDMap.end());
-
-    _mainbuffer.bindCallID(test_id2, default_id);
-    _mainbuffer.bindCallID(test_id2, default_id);
-
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 3);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 3);
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(default_id);
-    CPPUNIT_ASSERT(iter_buffer->first == default_id);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(default_id));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id1);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id1));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id2);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id2));
-
-    iter_idset = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 2);
-    iter_id = iter_idset->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_id == test_id1);
-    iter_id = iter_idset->second->find(test_id2);
-    CPPUNIT_ASSERT(*iter_id == test_id2);
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
-
-    ringbuffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 2);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-
-    ringbuffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-
-    ringbuffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
+    _mainbuffer.bindCallID (test_id1, default_id);
+    _mainbuffer.bindCallID (test_id1, default_id);
+
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 2);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 2);
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_buffer == _mainbuffer._ringBufferMap.end());
+    iter_idset = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_idset == _mainbuffer._callIDMap.end());
+
+    _mainbuffer.bindCallID (test_id2, default_id);
+    _mainbuffer.bindCallID (test_id2, default_id);
+
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 3);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 3);
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (default_id);
+    CPPUNIT_ASSERT (iter_buffer->first == default_id);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (default_id));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id1);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id1));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id2);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id2));
+
+    iter_idset = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 2);
+    iter_id = iter_idset->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_id == test_id1);
+    iter_id = iter_idset->second->find (test_id2);
+    CPPUNIT_ASSERT (*iter_id == test_id2);
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
+
+    ringbuffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 2);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+
+    ringbuffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+
+    ringbuffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
 
     // bind test_id1 with test_id2 (both testid1 and test_id2 already created)
     // calling it twice not supposed to break anything
-    _mainbuffer.bindCallID(test_id1, test_id2);
-    _mainbuffer.bindCallID(test_id1, test_id2);
-    
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 3);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 3);
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(default_id);
-    CPPUNIT_ASSERT(iter_buffer->first == default_id);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(default_id));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id1);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id1));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id2);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id2));
-
-    iter_idset = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 2);
-    iter_id = iter_idset->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_id == test_id1);
-    iter_id = iter_idset->second->find(test_id2);
-    CPPUNIT_ASSERT(*iter_id == test_id2);
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 2);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
-    iter_id = iter_idset->second->find(test_id2);
-    CPPUNIT_ASSERT(*iter_id == test_id2);
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 2);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
-    iter_id = iter_idset->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_id == test_id1);
-
-    ringbuffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 2);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-
-    ringbuffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 2);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-
-    ringbuffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 2);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
+    _mainbuffer.bindCallID (test_id1, test_id2);
+    _mainbuffer.bindCallID (test_id1, test_id2);
+
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 3);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 3);
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (default_id);
+    CPPUNIT_ASSERT (iter_buffer->first == default_id);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (default_id));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id1);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id1));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id2);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id2));
+
+    iter_idset = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 2);
+    iter_id = iter_idset->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_id == test_id1);
+    iter_id = iter_idset->second->find (test_id2);
+    CPPUNIT_ASSERT (*iter_id == test_id2);
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 2);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
+    iter_id = iter_idset->second->find (test_id2);
+    CPPUNIT_ASSERT (*iter_id == test_id2);
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 2);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
+    iter_id = iter_idset->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_id == test_id1);
+
+    ringbuffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 2);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+
+    ringbuffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 2);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+
+    ringbuffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 2);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
 
     // unbind test_id1 with test_id2
     // calling it twice not supposed to break anything
-    _mainbuffer.unBindCallID(test_id1, test_id2);
-    _mainbuffer.unBindCallID(test_id1, test_id2);
-
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 3);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 3);
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(default_id);
-    CPPUNIT_ASSERT(iter_buffer->first == default_id);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(default_id));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id1);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id1));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id2);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id2));
-
-    iter_idset = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 2);
-    iter_id = iter_idset->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_id == test_id1);
-    iter_id = iter_idset->second->find(test_id2);
-    CPPUNIT_ASSERT(*iter_id == test_id2);
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
-
-    ringbuffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 2);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-
-    ringbuffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-
-    ringbuffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-
-
-    _debug("ok1\n");
-    
+    _mainbuffer.unBindCallID (test_id1, test_id2);
+    _mainbuffer.unBindCallID (test_id1, test_id2);
+
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 3);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 3);
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (default_id);
+    CPPUNIT_ASSERT (iter_buffer->first == default_id);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (default_id));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id1);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id1));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id2);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id2));
+
+    iter_idset = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 2);
+    iter_id = iter_idset->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_id == test_id1);
+    iter_id = iter_idset->second->find (test_id2);
+    CPPUNIT_ASSERT (*iter_id == test_id2);
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
+
+    ringbuffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 2);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+
+    ringbuffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+
+    ringbuffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+
+
+    _debug ("ok1\n");
+
     // unbind test_id1 with test_id2
     // calling it twice not supposed to break anything
-    _mainbuffer.unBindCallID(default_id, test_id2);
-    _mainbuffer.unBindCallID(default_id, test_id2);
+    _mainbuffer.unBindCallID (default_id, test_id2);
+    _mainbuffer.unBindCallID (default_id, test_id2);
 
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 2);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 2);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 2);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 2);
 
-    iter_buffer = _mainbuffer._ringBufferMap.find(default_id);
-    CPPUNIT_ASSERT(iter_buffer->first == default_id);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(default_id));
+    iter_buffer = _mainbuffer._ringBufferMap.find (default_id);
+    CPPUNIT_ASSERT (iter_buffer->first == default_id);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (default_id));
 
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id1);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id1));
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id1);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id1));
 
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_buffer == _mainbuffer._ringBufferMap.end());
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_buffer == _mainbuffer._ringBufferMap.end());
 
-    iter_idset = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_id == test_id1);
-    iter_id = iter_idset->second->find(test_id2);
-    CPPUNIT_ASSERT(iter_id == iter_idset->second->end());
+    iter_idset = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_id == test_id1);
+    iter_id = iter_idset->second->find (test_id2);
+    CPPUNIT_ASSERT (iter_id == iter_idset->second->end());
 
-    iter_idset = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
+    iter_idset = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
 
-    iter_idset = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_idset == _mainbuffer._callIDMap.end());
+    iter_idset = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_idset == _mainbuffer._callIDMap.end());
 
-    ringbuffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer == ringbuffer->_readpointer.end());
+    ringbuffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer == ringbuffer->_readpointer.end());
 
-    ringbuffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer == ringbuffer->_readpointer.end());
+    ringbuffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer == ringbuffer->_readpointer.end());
 
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(test_id2) == NULL);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (test_id2) == NULL);
 
 
-    _mainbuffer.unBindCallID(default_id, test_id1);
+    _mainbuffer.unBindCallID (default_id, test_id1);
 
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
 
     // test unbind all function
-    _mainbuffer.bindCallID(default_id, test_id1);
-    _mainbuffer.bindCallID(default_id, test_id2);
-    _mainbuffer.bindCallID(test_id1, test_id2);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 3);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 3);
-
-    _mainbuffer.unBindAll(test_id2);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 2);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 2);
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(default_id);
-    CPPUNIT_ASSERT(iter_buffer->first == default_id);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(default_id));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_buffer->first == test_id1);
-    CPPUNIT_ASSERT(iter_buffer->second == _mainbuffer.getRingBuffer(test_id1));
-
-    iter_buffer = _mainbuffer._ringBufferMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_buffer == _mainbuffer._ringBufferMap.end());
-
-    iter_idset = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_id == test_id1);
-    iter_id = iter_idset->second->find(test_id2);
-    CPPUNIT_ASSERT(iter_id == iter_idset->second->end());
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_idset->second->size() == 1);
-    iter_id = iter_idset->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_id == default_id);
-
-    iter_idset = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_idset == _mainbuffer._callIDMap.end());
-
-    ringbuffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer == ringbuffer->_readpointer.end());
-
-    ringbuffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(ringbuffer != NULL);
-    CPPUNIT_ASSERT(ringbuffer->getNbReadPointer() == 1);
-    iter_readpointer = ringbuffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = ringbuffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer == ringbuffer->_readpointer.end());
-    
-    
+    _mainbuffer.bindCallID (default_id, test_id1);
+    _mainbuffer.bindCallID (default_id, test_id2);
+    _mainbuffer.bindCallID (test_id1, test_id2);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 3);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 3);
+
+    _mainbuffer.unBindAll (test_id2);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 2);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 2);
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (default_id);
+    CPPUNIT_ASSERT (iter_buffer->first == default_id);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (default_id));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_buffer->first == test_id1);
+    CPPUNIT_ASSERT (iter_buffer->second == _mainbuffer.getRingBuffer (test_id1));
+
+    iter_buffer = _mainbuffer._ringBufferMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_buffer == _mainbuffer._ringBufferMap.end());
+
+    iter_idset = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_id == test_id1);
+    iter_id = iter_idset->second->find (test_id2);
+    CPPUNIT_ASSERT (iter_id == iter_idset->second->end());
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_idset->second->size() == 1);
+    iter_id = iter_idset->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_id == default_id);
+
+    iter_idset = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_idset == _mainbuffer._callIDMap.end());
+
+    ringbuffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer == ringbuffer->_readpointer.end());
+
+    ringbuffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (ringbuffer != NULL);
+    CPPUNIT_ASSERT (ringbuffer->getNbReadPointer() == 1);
+    iter_readpointer = ringbuffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = ringbuffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer == ringbuffer->_readpointer.end());
+
+
 }
 
 void MainBufferTest::testGetPutDataByID()
 {
 
-    _debug("MainBufferTest::testGetPutData()\n");
-    
+    _debug ("MainBufferTest::testGetPutData()\n");
+
     CallID test_id = "getData putData";
     CallID false_id = "false id";
-    
-    _mainbuffer.bindCallID(test_id);
+
+    _mainbuffer.bindCallID (test_id);
 
     int test_input1 = 12;
     int test_input2 = 13;
@@ -906,38 +906,38 @@ void MainBufferTest::testGetPutDataByID()
 
     // put by default_id get by test_id without preleminary put
     avail_for_put_defaultid = _mainbuffer.availForPut();
-    CPPUNIT_ASSERT(_mainbuffer.availForGetByID(default_id, test_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getDataByID(&test_output, sizeof(int), 100, default_id, test_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGetByID (default_id, test_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_output, sizeof (int), 100, default_id, test_id) == 0);
 
     // put by default_id, get by test_id
-    CPPUNIT_ASSERT(_mainbuffer.availForPut() == avail_for_put_defaultid);
-    CPPUNIT_ASSERT(_mainbuffer.putData(&test_input1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForPut() == (avail_for_put_defaultid - (int)sizeof(int)));
-    CPPUNIT_ASSERT(_mainbuffer.availForGetByID(default_id, test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.getDataByID(&test_output, sizeof(int), 100, default_id, test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGetByID(default_id, test_id) == 0);
-    CPPUNIT_ASSERT(test_input1 == test_output);
+    CPPUNIT_ASSERT (_mainbuffer.availForPut() == avail_for_put_defaultid);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForPut() == (avail_for_put_defaultid - (int) sizeof (int)));
+    CPPUNIT_ASSERT (_mainbuffer.availForGetByID (default_id, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_output, sizeof (int), 100, default_id, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGetByID (default_id, test_id) == 0);
+    CPPUNIT_ASSERT (test_input1 == test_output);
 
     // get by default_id without preliminary input
-    avail_for_put_testid = _mainbuffer.availForPut(test_id);
-    CPPUNIT_ASSERT(_mainbuffer.availForGetByID(test_id, default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getDataByID(&test_output, sizeof(int), 100, test_id, default_id) == 0);
-    
+    avail_for_put_testid = _mainbuffer.availForPut (test_id);
+    CPPUNIT_ASSERT (_mainbuffer.availForGetByID (test_id, default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_output, sizeof (int), 100, test_id, default_id) == 0);
+
     // pu by test_id get by test_id
-    CPPUNIT_ASSERT(_mainbuffer.availForPut(test_id) == avail_for_put_defaultid);
-    CPPUNIT_ASSERT(_mainbuffer.putData(&test_input2, sizeof(int), 100, test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGetByID(test_id, default_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.getDataByID(&test_output, sizeof(int), 100, test_id, default_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGetByID(test_id, default_id) == 0);
-    CPPUNIT_ASSERT(test_input2 == test_output);
+    CPPUNIT_ASSERT (_mainbuffer.availForPut (test_id) == avail_for_put_defaultid);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGetByID (test_id, default_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_output, sizeof (int), 100, test_id, default_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGetByID (test_id, default_id) == 0);
+    CPPUNIT_ASSERT (test_input2 == test_output);
 
     // put/get by false id
-    CPPUNIT_ASSERT(_mainbuffer.putData(&test_input2, sizeof(int), 100, false_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getDataByID(&test_input2, sizeof(int), 100, false_id, false_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getDataByID(&test_input2, sizeof(int), 100, default_id, false_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getDataByID(&test_input2, sizeof(int), 100, false_id, default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), 100, false_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_input2, sizeof (int), 100, false_id, false_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_input2, sizeof (int), 100, default_id, false_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getDataByID (&test_input2, sizeof (int), 100, false_id, default_id) == 0);
 
-    _mainbuffer.unBindCallID(test_id);
+    _mainbuffer.unBindCallID (test_id);
 
 }
 
@@ -946,11 +946,11 @@ void MainBufferTest::testGetPutDataByID()
 void MainBufferTest::testGetPutData()
 {
 
-    _debug("MainBufferTest::testGetDataAndCallID()\n");
-    
+    _debug ("MainBufferTest::testGetDataAndCallID()\n");
+
     CallID test_id = "incoming rtp session";
 
-    _mainbuffer.bindCallID(test_id);
+    _mainbuffer.bindCallID (test_id);
 
     int test_input1 = 12;
     int test_input2 = 13;
@@ -961,33 +961,33 @@ void MainBufferTest::testGetPutData()
 
     // get by test_id without preleminary put
     avail_for_put_defaultid = _mainbuffer.availForPut();
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getData(&test_output, sizeof(int), 100,  test_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100,  test_id) == 0);
 
     // put by default_id, get by test_id
-    CPPUNIT_ASSERT(_mainbuffer.availForPut() == avail_for_put_defaultid);
-    CPPUNIT_ASSERT(_mainbuffer.putData(&test_input1, sizeof(int), 100) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForPut() == (avail_for_put_defaultid - (int)sizeof(int)));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.getData(&test_output, sizeof(int), 100, test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id) == 0);
-    CPPUNIT_ASSERT(test_input1 == test_output);
+    CPPUNIT_ASSERT (_mainbuffer.availForPut() == avail_for_put_defaultid);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int), 100) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForPut() == (avail_for_put_defaultid - (int) sizeof (int)));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == 0);
+    CPPUNIT_ASSERT (test_input1 == test_output);
 
     // get by default_id without preleminary put
-    avail_for_put_testid = _mainbuffer.availForPut(test_id);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet() == 0);
-    CPPUNIT_ASSERT(_mainbuffer.getData(&test_output, sizeof(int)) == 0);
+    avail_for_put_testid = _mainbuffer.availForPut (test_id);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet() == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int)) == 0);
 
     // put by test_id, get by default_id
-    CPPUNIT_ASSERT(_mainbuffer.availForPut(test_id) == avail_for_put_testid);
-    CPPUNIT_ASSERT(_mainbuffer.putData(&test_input2, sizeof(int), 100, test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForPut(test_id) == (avail_for_put_testid - (int)sizeof(int)));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet() == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.getData(&test_output, sizeof(int), 100) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet() == 0);
-    CPPUNIT_ASSERT(test_input2 == test_output);
+    CPPUNIT_ASSERT (_mainbuffer.availForPut (test_id) == avail_for_put_testid);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input2, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForPut (test_id) == (avail_for_put_testid - (int) sizeof (int)));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet() == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet() == 0);
+    CPPUNIT_ASSERT (test_input2 == test_output);
 
-    _mainbuffer.unBindCallID(test_id);
+    _mainbuffer.unBindCallID (test_id);
 
 }
 
@@ -995,42 +995,42 @@ void MainBufferTest::testGetPutData()
 void MainBufferTest::testDiscardFlush()
 {
 
-    _debug("MainBufferTest::testDiscardFlush()\n");
+    _debug ("MainBufferTest::testDiscardFlush()\n");
 
     CallID test_id = "flush discard";
     // _mainbuffer.createRingBuffer(test_id);
-    _mainbuffer.bindCallID(test_id);
+    _mainbuffer.bindCallID (test_id);
 
     int test_input1 = 12;
     // int test_output_size;
     // int init_size;
 
-    CPPUNIT_ASSERT(_mainbuffer.putData(&test_input1, sizeof(int), 100, test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet() == sizeof(int));
-    _mainbuffer.discard(sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet() == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int), 100, test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet() == sizeof (int));
+    _mainbuffer.discard (sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet() == 0);
+
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == 0);
+    _mainbuffer.discard (sizeof (int), test_id);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == 0);
 
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id) == 0);
-    _mainbuffer.discard(sizeof(int), test_id);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (test_id)->getReadPointer (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (test_id)->getReadPointer (test_id) == 0);
 
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(test_id)->getReadPointer(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(test_id)->getReadPointer(test_id) == 0);
 
-    
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(default_id)->getReadPointer(test_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.putData(&test_input1, sizeof(int), 100) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(default_id)->getReadPointer(test_id) == 0);
-    
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (default_id)->getReadPointer (test_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&test_input1, sizeof (int), 100) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (default_id)->getReadPointer (test_id) == 0);
 
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(default_id)->getReadPointer(test_id) == 0);
-    _mainbuffer.discard(sizeof(int), test_id);
-    CPPUNIT_ASSERT(_mainbuffer.getRingBuffer(default_id)->getReadPointer(test_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == sizeof (int));
+
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (default_id)->getReadPointer (test_id) == 0);
+    _mainbuffer.discard (sizeof (int), test_id);
+    CPPUNIT_ASSERT (_mainbuffer.getRingBuffer (default_id)->getReadPointer (test_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id) == 0);
 
     // _mainbuffer.removeRingBuffer(test_id);
-    _mainbuffer.unBindCallID(test_id);
+    _mainbuffer.unBindCallID (test_id);
 
 }
 
@@ -1038,45 +1038,45 @@ void MainBufferTest::testDiscardFlush()
 void MainBufferTest::testReadPointerInit()
 {
 
-    _debug("MainBufferTest::testReadPointerInit()\n");
+    _debug ("MainBufferTest::testReadPointerInit()\n");
 
     CallID test_id = "test read pointer init";
     // RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer(test_id);
 
-    _mainbuffer.bindCallID(test_id);
+    _mainbuffer.bindCallID (test_id);
 
-    RingBuffer* test_ring_buffer = _mainbuffer.getRingBuffer(test_id);
+    RingBuffer* test_ring_buffer = _mainbuffer.getRingBuffer (test_id);
 
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 0);
-    test_ring_buffer->storeReadPointer(30);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer() == 30);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 0);
+    test_ring_buffer->storeReadPointer (30);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer() == 30);
 
-    test_ring_buffer->createReadPointer(test_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == 0);
-    test_ring_buffer->storeReadPointer(10, test_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == 10);
-    test_ring_buffer->removeReadPointer(test_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getReadPointer(test_id) == (int)NULL);
-    test_ring_buffer->removeReadPointer("false id");
+    test_ring_buffer->createReadPointer (test_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == 0);
+    test_ring_buffer->storeReadPointer (10, test_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == 10);
+    test_ring_buffer->removeReadPointer (test_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getReadPointer (test_id) == (int) NULL);
+    test_ring_buffer->removeReadPointer ("false id");
 
     // _mainbuffer.removeRingBuffer(test_id);
-    _mainbuffer.unBindCallID(test_id);
+    _mainbuffer.unBindCallID (test_id);
 }
 
 
 void MainBufferTest::testRingBufferSeveralPointers()
 {
 
-    _debug("MainBufferTest::testRingBufferSeveralPointers\n");
+    _debug ("MainBufferTest::testRingBufferSeveralPointers\n");
 
     CallID test_id = "test multiple read pointer";
-    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer(test_id);
+    RingBuffer* test_ring_buffer = _mainbuffer.createRingBuffer (test_id);
 
     CallID test_pointer1 = "test pointer 1";
     CallID test_pointer2 = "test pointer 2";
 
-    test_ring_buffer->createReadPointer(test_pointer1);
-    test_ring_buffer->createReadPointer(test_pointer2);
+    test_ring_buffer->createReadPointer (test_pointer1);
+    test_ring_buffer->createReadPointer (test_pointer2);
 
     int testint1 = 12;
     int testint2 = 13;
@@ -1087,93 +1087,93 @@ void MainBufferTest::testRingBufferSeveralPointers()
 
     int initPutLen = test_ring_buffer->AvailForPut();
 
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint1, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - (int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer2) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == sizeof(int));
-
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint2, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 2*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer1) == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer2) == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 2*sizeof(int));
-
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint3, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 3*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 3*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer1) == 3*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer2) == 3*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == 3*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 3*sizeof(int));
-
-    CPPUNIT_ASSERT(test_ring_buffer->Put(&testint4, sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 4*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 4*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer1) == 4*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->getLen(test_pointer2) == 4*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == 4*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 4*sizeof(int));
-
-
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testoutput, sizeof(int), 100, test_pointer1) == sizeof(int));
-    CPPUNIT_ASSERT(testoutput == testint1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 4*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == 3*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 4*sizeof(int));
-
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testoutput, sizeof(int), 100, test_pointer2) == sizeof(int));
-    CPPUNIT_ASSERT(testoutput == testint1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 3*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == 3*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 3*sizeof(int));
-    
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint1, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer2) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint2, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 2* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer1) == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer2) == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 2*sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint3, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 3*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 3* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer1) == 3*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer2) == 3*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == 3*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 3*sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Put (&testint4, sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 4*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 4* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer1) == 4*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->getLen (test_pointer2) == 4*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == 4*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 4*sizeof (int));
+
+
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testoutput, sizeof (int), 100, test_pointer1) == sizeof (int));
+    CPPUNIT_ASSERT (testoutput == testint1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 4* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == 3*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 4*sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testoutput, sizeof (int), 100, test_pointer2) == sizeof (int));
+    CPPUNIT_ASSERT (testoutput == testint1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 3* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == 3*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 3*sizeof (int));
+
     // AvailForPut() is ok but AvailForGet(default_id) is not ok
-    // However, we should no be alowed to read in our own ring buffer 
+    // However, we should no be alowed to read in our own ring buffer
     // if we are either an AudioLayer or and RTP session
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 4*sizeof(int));
-    
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testoutput, sizeof(int), 100, test_pointer1) == sizeof(int));
-    CPPUNIT_ASSERT(testoutput == testint2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 3*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 3*sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 4*sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testoutput, sizeof (int), 100, test_pointer1) == sizeof (int));
+    CPPUNIT_ASSERT (testoutput == testint2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 3* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 3*sizeof (int));
 
     // AvailForPut() is ok but AvailForGet(default_id) is not ok
-    // However, we should no be alowed to read in our own ring buffer 
+    // However, we should no be alowed to read in our own ring buffer
     // if we are either an AudioLayer or and RTP session
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 4*sizeof(int));
-
-    CPPUNIT_ASSERT(test_ring_buffer->Get(&testoutput, sizeof(int), 100, test_pointer2) == sizeof(int));
-    CPPUNIT_ASSERT(testoutput == testint2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 2*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == 2*sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 2*sizeof(int));
-    
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 4*sizeof (int));
+
+    CPPUNIT_ASSERT (test_ring_buffer->Get (&testoutput, sizeof (int), 100, test_pointer2) == sizeof (int));
+    CPPUNIT_ASSERT (testoutput == testint2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 2* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == 2*sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 2*sizeof (int));
+
     // AvailForPut() is ok but AvailForGet(default_id) is not ok
-    // However, we should no be alowed to read in our own ring buffer 
+    // However, we should no be alowed to read in our own ring buffer
     // if we are either an AudioLayer or and RTP session
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet() == 4*sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet() == 4*sizeof (int));
 
-    CPPUNIT_ASSERT(test_ring_buffer->Discard(sizeof(int), test_pointer1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - 2*(int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == 2*sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->Discard (sizeof (int), test_pointer1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - 2* (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == 2*sizeof (int));
 
-    CPPUNIT_ASSERT(test_ring_buffer->Discard(sizeof(int), test_pointer2) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == initPutLen - (int)sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_pointer2) == sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->Discard (sizeof (int), test_pointer2) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == initPutLen - (int) sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_pointer2) == sizeof (int));
 
 
-    test_ring_buffer->removeReadPointer(test_pointer1);
-    test_ring_buffer->removeReadPointer(test_pointer2);
+    test_ring_buffer->removeReadPointer (test_pointer1);
+    test_ring_buffer->removeReadPointer (test_pointer2);
 
-    _mainbuffer.removeRingBuffer(test_id);
+    _mainbuffer.removeRingBuffer (test_id);
 }
 
 
@@ -1181,7 +1181,7 @@ void MainBufferTest::testRingBufferSeveralPointers()
 void MainBufferTest::testConference()
 {
 
-    _debug("MainBufferTest::testConference()\n");
+    _debug ("MainBufferTest::testConference()\n");
 
     CallID test_id1 = "participant A";
     CallID test_id2 = "participant B";
@@ -1192,142 +1192,142 @@ void MainBufferTest::testConference()
     CallIDMap::iterator iter_callidmap;
     CallIDSet::iterator iter_callidset;
 
-    
+
 
     // test initial setup
     // ringbuffers
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer == NULL);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer == NULL);
 
     // callidmap
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 0);
-    iter_callidmap = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_callidmap == _mainbuffer._callIDMap.end());
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
+    iter_callidmap = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_callidmap == _mainbuffer._callIDMap.end());
 
 
-    // test bind Participant A with default 
-    _mainbuffer.bindCallID(test_id1);
+    // test bind Participant A with default
+    _mainbuffer.bindCallID (test_id1);
     // ringbuffers
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 2);
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    iter_readpointer = test_ring_buffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    iter_readpointer = test_ring_buffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 2);
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    iter_readpointer = test_ring_buffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    iter_readpointer = test_ring_buffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
     // callidmap
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 2);
-    iter_callidmap = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_callidmap->first == default_id);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 1);
-    iter_callidset = iter_callidmap->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_callidset == test_id1);
-    iter_callidmap = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_callidmap->first == test_id1);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 1);
-    iter_callidset = iter_callidmap->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_callidset == default_id);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 2);
+    iter_callidmap = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_callidmap->first == default_id);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 1);
+    iter_callidset = iter_callidmap->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_callidset == test_id1);
+    iter_callidmap = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_callidmap->first == test_id1);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 1);
+    iter_callidset = iter_callidmap->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_callidset == default_id);
 
     // test bind Participant B with default
-    _mainbuffer.bindCallID(test_id2);
+    _mainbuffer.bindCallID (test_id2);
     // ringbuffers
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 3);
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 2);
-    iter_readpointer = test_ring_buffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = test_ring_buffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    iter_readpointer = test_ring_buffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 1);
-    iter_readpointer = test_ring_buffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 3);
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 2);
+    iter_readpointer = test_ring_buffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = test_ring_buffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    iter_readpointer = test_ring_buffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 1);
+    iter_readpointer = test_ring_buffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
     // callidmap
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 3);
-    iter_callidmap = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_callidmap->first == default_id);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 2);
-    iter_callidset = iter_callidmap->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_callidset == test_id1);
-    iter_callidset = iter_callidmap->second->find(test_id2);
-    CPPUNIT_ASSERT(*iter_callidset == test_id2);
-    iter_callidmap = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_callidmap->first == test_id1);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 1);
-    iter_callidset = iter_callidmap->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_callidset == default_id);
-    iter_callidmap = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_callidmap->first == test_id2);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 1);
-    iter_callidset = iter_callidmap->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_callidset == default_id);
-    
-    
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 3);
+    iter_callidmap = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_callidmap->first == default_id);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 2);
+    iter_callidset = iter_callidmap->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_callidset == test_id1);
+    iter_callidset = iter_callidmap->second->find (test_id2);
+    CPPUNIT_ASSERT (*iter_callidset == test_id2);
+    iter_callidmap = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_callidmap->first == test_id1);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 1);
+    iter_callidset = iter_callidmap->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_callidset == default_id);
+    iter_callidmap = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_callidmap->first == test_id2);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 1);
+    iter_callidset = iter_callidmap->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_callidset == default_id);
+
+
     // test bind Participant A with Participant B
-    _mainbuffer.bindCallID(test_id1, test_id2);
+    _mainbuffer.bindCallID (test_id1, test_id2);
     // ringbuffers
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 3);
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 2);
-    iter_readpointer = test_ring_buffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = test_ring_buffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 2);
-    iter_readpointer = test_ring_buffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = test_ring_buffer->_readpointer.find(test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id2);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->getNbReadPointer() == 2);
-    iter_readpointer = test_ring_buffer->_readpointer.find(default_id);
-    CPPUNIT_ASSERT(iter_readpointer->first == default_id);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
-    iter_readpointer = test_ring_buffer->_readpointer.find(test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->first == test_id1);
-    CPPUNIT_ASSERT(iter_readpointer->second == 0);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 3);
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 2);
+    iter_readpointer = test_ring_buffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = test_ring_buffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 2);
+    iter_readpointer = test_ring_buffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = test_ring_buffer->_readpointer.find (test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id2);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->getNbReadPointer() == 2);
+    iter_readpointer = test_ring_buffer->_readpointer.find (default_id);
+    CPPUNIT_ASSERT (iter_readpointer->first == default_id);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
+    iter_readpointer = test_ring_buffer->_readpointer.find (test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->first == test_id1);
+    CPPUNIT_ASSERT (iter_readpointer->second == 0);
     // callidmap
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 3);
-    iter_callidmap = _mainbuffer._callIDMap.find(default_id);
-    CPPUNIT_ASSERT(iter_callidmap->first == default_id);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 2);
-    iter_callidset = iter_callidmap->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_callidset == test_id1);
-    iter_callidset = iter_callidmap->second->find(test_id2);
-    CPPUNIT_ASSERT(*iter_callidset == test_id2);
-    iter_callidmap = _mainbuffer._callIDMap.find(test_id1);
-    CPPUNIT_ASSERT(iter_callidmap->first == test_id1);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 2);
-    iter_callidset = iter_callidmap->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_callidset == default_id);
-    iter_callidset = iter_callidmap->second->find(test_id2);
-    CPPUNIT_ASSERT(*iter_callidset == test_id2);
-    iter_callidmap = _mainbuffer._callIDMap.find(test_id2);
-    CPPUNIT_ASSERT(iter_callidmap->first == test_id2);
-    CPPUNIT_ASSERT(iter_callidmap->second->size() == 2);
-    iter_callidset = iter_callidmap->second->find(default_id);
-    CPPUNIT_ASSERT(*iter_callidset == default_id);
-    iter_callidset = iter_callidmap->second->find(test_id1);
-    CPPUNIT_ASSERT(*iter_callidset == test_id1);
-    
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 3);
+    iter_callidmap = _mainbuffer._callIDMap.find (default_id);
+    CPPUNIT_ASSERT (iter_callidmap->first == default_id);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 2);
+    iter_callidset = iter_callidmap->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_callidset == test_id1);
+    iter_callidset = iter_callidmap->second->find (test_id2);
+    CPPUNIT_ASSERT (*iter_callidset == test_id2);
+    iter_callidmap = _mainbuffer._callIDMap.find (test_id1);
+    CPPUNIT_ASSERT (iter_callidmap->first == test_id1);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 2);
+    iter_callidset = iter_callidmap->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_callidset == default_id);
+    iter_callidset = iter_callidmap->second->find (test_id2);
+    CPPUNIT_ASSERT (*iter_callidset == test_id2);
+    iter_callidmap = _mainbuffer._callIDMap.find (test_id2);
+    CPPUNIT_ASSERT (iter_callidmap->first == test_id2);
+    CPPUNIT_ASSERT (iter_callidmap->second->size() == 2);
+    iter_callidset = iter_callidmap->second->find (default_id);
+    CPPUNIT_ASSERT (*iter_callidset == default_id);
+    iter_callidset = iter_callidmap->second->find (test_id1);
+    CPPUNIT_ASSERT (*iter_callidset == test_id1);
+
 
     // test putData default
     int testint = 12;
@@ -1335,438 +1335,438 @@ void MainBufferTest::testConference()
     int init_put_id1;
     int init_put_id2;
 
-    init_put_defaultid = _mainbuffer.getRingBuffer(default_id)->AvailForPut();
-    init_put_id1 = _mainbuffer.getRingBuffer(test_id1)->AvailForPut();
-    init_put_id2 = _mainbuffer.getRingBuffer(test_id2)->AvailForPut();
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    init_put_defaultid = _mainbuffer.getRingBuffer (default_id)->AvailForPut();
+    init_put_id1 = _mainbuffer.getRingBuffer (test_id1)->AvailForPut();
+    init_put_id2 = _mainbuffer.getRingBuffer (test_id2)->AvailForPut();
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
     // put data test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
     //putdata test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100, test_id1) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     //putdata test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100, test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id2 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id2 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
 
 
     int test_output;
 
     // test getData default id (audio layer)
-    CPPUNIT_ASSERT(_mainbuffer.getData(&test_output, sizeof(int), 100) == sizeof(int));
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id2 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100) == sizeof (int));
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id2 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     // test getData test_id1 (audio layer)
-    CPPUNIT_ASSERT(_mainbuffer.getData(&test_output, sizeof(int), 100, test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id); 
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100, test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     // test getData test_id2 (audio layer)
-    CPPUNIT_ASSERT(_mainbuffer.getData(&test_output, sizeof(int), 100, test_id2) == sizeof(int));
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_defaultid);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.getData (&test_output, sizeof (int), 100, test_id2) == sizeof (int));
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_defaultid);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
 
 
     // test putData default (for discarting)
-    init_put_defaultid = _mainbuffer.getRingBuffer(default_id)->AvailForPut();
-    init_put_id1 = _mainbuffer.getRingBuffer(test_id1)->AvailForPut();
-    init_put_id2 = _mainbuffer.getRingBuffer(test_id2)->AvailForPut();
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    init_put_defaultid = _mainbuffer.getRingBuffer (default_id)->AvailForPut();
+    init_put_id1 = _mainbuffer.getRingBuffer (test_id1)->AvailForPut();
+    init_put_id2 = _mainbuffer.getRingBuffer (test_id2)->AvailForPut();
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
     // put data test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
     //putdata test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100, test_id1) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     //putdata test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100, test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id2 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id2 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
-    
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
+
     // test discardData default id (audio layer)
-    CPPUNIT_ASSERT(_mainbuffer.discard(sizeof(int)) == sizeof(int));
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id2 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.discard (sizeof (int)) == sizeof (int));
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id2 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     // test discardData test_id1 (audio layer)
-    CPPUNIT_ASSERT(_mainbuffer.discard(sizeof(int), test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id); 
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.discard (sizeof (int), test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     // test discardData test_id2 (audio layer)
-    CPPUNIT_ASSERT(_mainbuffer.discard(sizeof(int), test_id2) == sizeof(int));
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_defaultid);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.discard (sizeof (int), test_id2) == sizeof (int));
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_defaultid);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
+
 
-    
     // test putData default (for flushing)
-    init_put_defaultid = _mainbuffer.getRingBuffer(default_id)->AvailForPut();
-    init_put_id1 = _mainbuffer.getRingBuffer(test_id1)->AvailForPut();
-    init_put_id2 = _mainbuffer.getRingBuffer(test_id2)->AvailForPut();
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    init_put_defaultid = _mainbuffer.getRingBuffer (default_id)->AvailForPut();
+    init_put_id1 = _mainbuffer.getRingBuffer (test_id1)->AvailForPut();
+    init_put_id2 = _mainbuffer.getRingBuffer (test_id2)->AvailForPut();
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
     // put data test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
     //putdata test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100, test_id1) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id1) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     //putdata test ring buffers
-    CPPUNIT_ASSERT(_mainbuffer.putData(&testint, sizeof(int), 100, test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id2 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.putData (&testint, sizeof (int), 100, test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id2 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
 
     // test flush default id (audio layer)
     _mainbuffer.flush();
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    _debug("%i\n", test_ring_buffer->putLen());
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    _debug ("%i\n", test_ring_buffer->putLen());
     test_ring_buffer->debug();
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id2 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == sizeof(int));
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id2 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == sizeof (int));
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == sizeof(int));
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == sizeof (int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     // test flush test_id1 (audio layer)
-    _mainbuffer.flush(test_id1);
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id); 
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_defaultid - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == sizeof(int));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == (int)(init_put_id1 - sizeof(int)));
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == sizeof(int));
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    _mainbuffer.flush (test_id1);
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_defaultid - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == sizeof (int));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == (int) (init_put_id1 - sizeof (int)));
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == sizeof (int));
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == sizeof(int));
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == sizeof (int));
     // test flush test_id2 (audio layer)
-    _mainbuffer.flush(test_id2);
-    CPPUNIT_ASSERT(test_output == (testint + testint));
-    test_ring_buffer = _mainbuffer.getRingBuffer(default_id);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_defaultid);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id1);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id2) == 0);
-    test_ring_buffer = _mainbuffer.getRingBuffer(test_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->putLen() == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForPut() == init_put_id2);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(default_id) == 0);
-    CPPUNIT_ASSERT(test_ring_buffer->AvailForGet(test_id1) == 0);
+    _mainbuffer.flush (test_id2);
+    CPPUNIT_ASSERT (test_output == (testint + testint));
+    test_ring_buffer = _mainbuffer.getRingBuffer (default_id);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_defaultid);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id1);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id2) == 0);
+    test_ring_buffer = _mainbuffer.getRingBuffer (test_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->putLen() == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForPut() == init_put_id2);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (default_id) == 0);
+    CPPUNIT_ASSERT (test_ring_buffer->AvailForGet (test_id1) == 0);
     // test mainbuffer availforget
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(default_id) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id1) == 0);
-    CPPUNIT_ASSERT(_mainbuffer.availForGet(test_id2) == 0);
-    
-
-    _mainbuffer.unBindCallID(test_id1, test_id2);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 3);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 3);
-
-    _mainbuffer.unBindCallID(test_id1);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 2);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 2);
-
-    _mainbuffer.unBindCallID(test_id2);
-    CPPUNIT_ASSERT(_mainbuffer._ringBufferMap.size() == 0);
-    CPPUNIT_ASSERT(_mainbuffer._callIDMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (default_id) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id1) == 0);
+    CPPUNIT_ASSERT (_mainbuffer.availForGet (test_id2) == 0);
+
+
+    _mainbuffer.unBindCallID (test_id1, test_id2);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 3);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 3);
+
+    _mainbuffer.unBindCallID (test_id1);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 2);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 2);
+
+    _mainbuffer.unBindCallID (test_id2);
+    CPPUNIT_ASSERT (_mainbuffer._ringBufferMap.size() == 0);
+    CPPUNIT_ASSERT (_mainbuffer._callIDMap.size() == 0);
 
 
 }
diff --git a/tools/build-system/build-osc.sh b/tools/build-system/build-osc.sh
index 1cdccc19c53be745f0fc1a44635f2995c71f5a25..30fb9ab3c0e319730d6104fbf53f42d62c684fdc 100755
--- a/tools/build-system/build-osc.sh
+++ b/tools/build-system/build-osc.sh
@@ -18,11 +18,12 @@ WORKING_DIR="${ROOT_DIR}/sflphone-build-repository/tools/build-system"
 OSC_DIR="${WORKING_DIR}/osc"
 
 LAUNCHPAD_PACKAGES=( "sflphone-client-gnome" "sflphone-common" )
-LAUNCHPAD_PACKAGES=( "sflphone-client-gnome" )
+#LAUNCHPAD_PACKAGES=( "sflphone-client-gnome" )
+#LAUNCHPAD_PACKAGES=( "sflphone-common" )
 
 REFERENCE_REPOSITORY="${ROOT_DIR}/sflphone-source-repository"
 
-SOFTWARE_VERSION="0.9.8~beta"
+SOFTWARE_VERSION="0.9.7.beta"
 
 VERSION_INDEX=1
 
@@ -36,7 +37,7 @@ do
 
 	cp -r ${REFERENCE_REPOSITORY}/${LAUNCHPAD_PACKAGE} ${LAUNCHPAD_PACKAGE}-${SOFTWARE_VERSION}
 
-	cp ${OSC_DIR}/${LAUNCHPAD_PACKAGE}.spec .
+	cp ${OSC_DIR}/${LAUNCHPAD_PACKAGE}* .
 
 	sed -i -e "s/VERSION_INDEX/${VERSION_INDEX}/g" -e "s/VERSION/${SOFTWARE_VERSION}/g" ${LAUNCHPAD_PACKAGE}.spec
 
@@ -45,6 +46,8 @@ do
 	rm -rf ${LAUNCHPAD_PACKAGE}-${SOFTWARE_VERSION} 
 	
 	osc add ${LAUNCHPAD_PACKAGE}-${SOFTWARE_VERSION}.tar.gz
+	osc add *.patch
+
 	yes | osc commit --force -m "Version ${SOFTWARE_VERSION}"
 done
 
diff --git a/tools/build-system/osc/sflphone-client-gnome.spec b/tools/build-system/osc/sflphone-client-gnome.spec
index 7c5be61a37e9d7065267dfbc8a46633df3206e83..794dc7784e837ebecbf98a18f77336f8a4850701 100644
--- a/tools/build-system/osc/sflphone-client-gnome.spec
+++ b/tools/build-system/osc/sflphone-client-gnome.spec
@@ -64,10 +64,18 @@ Requires:	dbus-1-glib
 Requires:	gtk2
 Requires:	glib2
 Requires:	libnotify
+Requires:	libsexy
+
+%if %{defined suse_version}
 Requires:	librsvg
 Requires:	liblog4c3
-Requires:	libsexy
-# gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
+%endif
+
+%if %{defined fedora_version}
+Requires:	librsvg2
+Requires:	log4c
+%endif
+
 Conflicts:	sflphone
 Prefix:		%{_prefix}
 
diff --git a/tools/build-system/osc/sflphone-common-dbus-service-in-libdir.patch b/tools/build-system/osc/sflphone-common-dbus-service-in-libdir.patch
new file mode 100644
index 0000000000000000000000000000000000000000..72d23454fb73ad3a87f1b83cdf9cc809a844d50a
--- /dev/null
+++ b/tools/build-system/osc/sflphone-common-dbus-service-in-libdir.patch
@@ -0,0 +1,14 @@
+diff --git sflphone-common/src/dbus/Makefile.am sflphone-common/src/dbus/Makefile.am
+index 5a2745e..5ca2e42 100644
+--- sflphone-common/src/dbus/Makefile.am
++++ sflphone-common/src/dbus/Makefile.am
+@@ -38,7 +38,7 @@ service_DATA = $(service_in_files:.service.in=.service)
+ 
+ # Rule to make the service file with bindir expanded
+ $(service_DATA): $(service_in_files) Makefile
+-	sed -e "s|libexec|$(prefix)/lib/sflphone|" $<> $@
++	sed -e "s|libexec|$(libdir)/sflphone|" $<> $@
+ 
+ EXTRA_DIST = *.xml README
+ 
+
diff --git a/tools/build-system/osc/sflphone-common.spec b/tools/build-system/osc/sflphone-common.spec
index f44328fee6034f0e6837fc109d1375aeb18a32f8..9fccf3ef7d27aab0d6130959c532dfab4ece62ce 100644
--- a/tools/build-system/osc/sflphone-common.spec
+++ b/tools/build-system/osc/sflphone-common.spec
@@ -13,15 +13,15 @@ Name:           sflphone-common
 License:        GNU General Public License (GPL)
 Group:          System Environment/Daemons
 Summary:        SIP and IAX2 compatible softphone - Core
-Version:        VERSION
-Release:        VERSION_INDEX%{?dist}
+Version:	VERSION
+Release:	VERSION_INDEX%{?dist}
 URL:            http://www.sflphone.org/
 Vendor:         Savoir-faire Linux
 Packager:	Julien Bonjean <julien.bonjean@savoirfairelinux.com>
 
-Group:          Applications/Communications
 BuildRoot:      %{_tmppath}/%{name}
 Source0:        sflphone-common-%{version}.tar.gz
+Patch0:		sflphone-common-dbus-service-in-libdir.patch
 BuildRequires:	speex-devel
 BuildRequires:	gcc-c++
 BuildRequires:	expat
@@ -55,19 +55,35 @@ BuildRequires:	gsm-devel
 %endif
 
 Requires:	libsamplerate
-Requires:	libexpat1
 Requires:	commoncpp2
-Requires:	libgsm1
-Requires:	libspeex
 Requires:	dbus-1
 Requires:	dbus-1-x11
-Requires:	xorg-x11
+
+%if %{defined suse_version}
+Requires:	libgsm1
+Requires:	libexpat1
+Requires:	libspeex
 Requires:	libasound2
 Requires:	libpulse0
 Requires:	libccrtp1
+%endif
+
+%if %{defined fedora_version}
+Requires:	gsm
+Requires:	expat
+Requires:	compat-expat1
+Requires:	speex
+Requires:	alsa-lib
+Requires:	pulseaudio-libs
+Requires:	ccrtp
+Requires:	libzrtpcpp
+%endif
+
 Conflicts:      sflphone
 Prefix:		%{_prefix}
 
+Group:          Applications/Communications
+
 %description
 SFLphone is meant to be a robust enterprise-class desktop phone.
  SFLphone is released under the GNU General Public License.
@@ -84,13 +100,13 @@ Authors:
 %build
 cd libs/pjproject
 ./autogen.sh
-./configure --prefix=%{_prefix}
+./configure --prefix=%{_prefix} --libdir=%{_libdir}
 make dep
 make clean
 make
 cd -
 ./autogen.sh
-./configure --prefix=%{_prefix} 
+./configure --prefix=%{_prefix} --libdir=%{_libdir}
 make -j
 
 %install
@@ -106,17 +122,17 @@ make clean
 %files
 %defattr(-, root, root)
 %doc AUTHORS COPYING README TODO
-%dir %{_prefix}/lib/sflphone
-%dir %{_prefix}/lib/sflphone/codecs
-%dir %{_prefix}/lib/sflphone/plugins
+%dir %{_libdir}/sflphone
+%dir %{_libdir}/sflphone/codecs
+%dir %{_libdir}/sflphone/plugins
 %dir %{_prefix}/share/sflphone
 %dir %{_prefix}/share/sflphone/ringtones
-%{_prefix}/lib/libdbus-*
-%{_prefix}/lib/sflphone/codecs/*
-%{_prefix}/lib/sflphone/plugins/*
+%{_libdir}/libdbus-*
+%{_libdir}/sflphone/codecs/*
+%{_libdir}/sflphone/plugins/*
 %{_prefix}/share/dbus-1/services/org.sflphone.*
 %{_prefix}/share/sflphone/ringtones/*
-%{_prefix}/lib/sflphone/sflphoned
+%{_libdir}/sflphone/sflphoned
 %doc %{_prefix}/share/man/man1/sflphoned.1.gz
 
 %changelog