diff --git a/sflphone-gtk/src/audioconf.c b/sflphone-gtk/src/audioconf.c
index 3e194d2f79565f8871dc01799dea0c0c6fcebe7d..18b1b4e7150151c1b4e34bc769402189b776d3c0 100644
--- a/sflphone-gtk/src/audioconf.c
+++ b/sflphone-gtk/src/audioconf.c
@@ -599,7 +599,9 @@ GtkWidget* codecs_box()
   void
 select_audio_manager( void )
 {
+
   g_print("audio manager selected\n");
+  
   if( !SHOW_ALSA_CONF && !gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(pulse) ) )
   {
     g_print(" display alsa conf panel\n");
diff --git a/src/audio/alsa-bak b/src/audio/alsa-bak
deleted file mode 100644
index b2733b244ee201771196b46d7946de829c9e16e1..0000000000000000000000000000000000000000
--- a/src/audio/alsa-bak
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
- *  Copyright (C) 2008 Savoir-Faire Linux inc.
- *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
- *  Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com> 
- *  Author: Emmanuel Milou <emmanuel.milou@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.
- */
-
-#include "alsalayer.h"
-
-// Constructor
-AlsaLayer::AlsaLayer( ManagerImpl* manager ) 
-  : AudioLayer( manager ) 
-  , _PlaybackHandle(NULL)
-  , _CaptureHandle(NULL)
-{
-  _debug(" Constructor of AlsaLayer called\n");
-  _defaultVolume = 100;
-}
-
-// Destructor
-AlsaLayer::~AlsaLayer (void) 
-{ 
-  _debugAlsa("Close ALSA streams\n");
-  closeCaptureStream();
-  closePlaybackStream();
-  deviceClosed = true;
-}
-
-  bool 
-AlsaLayer::openDevice (int indexIn, int indexOut, int sampleRate, int frameSize, int stream , std::string plugin) 
-{
-
-  if(deviceClosed == false)
-  {
-    if( stream == SFL_PCM_CAPTURE )
-      closeCaptureStream();
-    else if( stream == SFL_PCM_PLAYBACK)
-      closePlaybackStream();
-    else
-    {
-      closeCaptureStream();
-      closePlaybackStream();
-    }
-  }
-
-  _indexIn = indexIn;
-  _indexOut = indexOut;
-  _sampleRate = sampleRate;
-  _frameSize = frameSize;	
-  _audioPlugin = plugin;
-
-  _debugAlsa(" Setting AlsaLayer: device     in=%2d, out=%2d\n", _indexIn, _indexOut);
-  _debugAlsa("                   : alsa plugin=%s\n", _audioPlugin.c_str());
-  _debugAlsa("                   : nb channel in=%2d, out=%2d\n", _inChannel, _outChannel);
-  _debugAlsa("                   : sample rate=%5d, format=%s\n", _sampleRate, SFLDataFormatString);
-
-  ost::MutexLock lock( _mutex );
-
-  std::string pcmp = buildDeviceTopo( plugin , indexOut , 0);
-  std::string pcmc = buildDeviceTopo( PCM_PLUGHW , indexIn , 0);
-  return open_device( pcmp , pcmc , stream);
-}
-
-  void
-AlsaLayer::startStream(void) 
-{
-  if( _CaptureHandle && _PlaybackHandle )
-  {
-    _talk = true ;
-    _debugAlsa(" Start stream\n");
-    int err;
-    //ost::MutexLock lock( _mutex );
-    snd_pcm_prepare( _CaptureHandle );
-    snd_pcm_start( _CaptureHandle ) ;
-
-    snd_pcm_prepare( _PlaybackHandle );
-    if( err = snd_pcm_start( _PlaybackHandle) < 0 )  _debugAlsa(" Cannot start (%s)\n", snd_strerror(err));
-  }
-} 
-
-  void
-AlsaLayer::stopStream(void) 
-{
-  if( _CaptureHandle && _PlaybackHandle )
-  {
-    //ost::MutexLock lock( _mutex );
-    _debugAlsa(" Stop Stream\n ");
-    _talk = false;
-    snd_pcm_drop( _CaptureHandle );
-    snd_pcm_prepare( _CaptureHandle );
-    snd_pcm_drop( _PlaybackHandle );
-    snd_pcm_prepare( _PlaybackHandle );
-    _urgentBuffer.flush();
-  }
-}
-
-void AlsaLayer::AlsaCallBack( snd_async_handler_t* pcm_callback )
-{ 
-  ( ( AlsaLayer *)snd_async_handler_get_callback_private( pcm_callback )) -> playTones();
-}
-
-  void 
-AlsaLayer::fillHWBuffer( void)
-{
-  unsigned char* data;
-  int pcmreturn, l1, l2;
-  short s1, s2;
-  int periodSize = 128 ;
-  int frames = periodSize >> 2 ;
-  _debug("frames  = %d\n");
-
-  data = (unsigned char*)malloc(periodSize);
-  for(l1 = 0; l1 < 100; l1++) {
-    for(l2 = 0; l2 < frames; l2++) {
-      s1 = 0;
-      s2 = 0;
-      data[4*l2] = (unsigned char)s1;
-      data[4*l2+1] = s1 >> 8;
-      data[4*l2+2] = (unsigned char)s2;
-      data[4*l2+3] = s2 >> 8;
-    }
-    while ((pcmreturn = snd_pcm_mmap_writei(_PlaybackHandle, data, frames)) < 0) {
-      snd_pcm_prepare(_PlaybackHandle);
-      //_debugAlsa("< Buffer Underrun >\n");
-    }
-  }
-}
-
-  bool
-AlsaLayer::isStreamActive (void) 
-{
-  ost::MutexLock lock( _mutex );
-  return (isPlaybackActive() && isCaptureActive());
-}
-
-
-  int 
-AlsaLayer::playSamples(void* buffer, int toCopy, bool isTalking)
-{
-  //ost::MutexLock lock( _mutex );
-  if( isTalking )
-    _talk = true;
-  if ( _PlaybackHandle ){ 
-    write( adjustVolume( buffer , toCopy , SFL_PCM_PLAYBACK ) , toCopy );
-  }
-  return 0;
-}
-
-  int
-AlsaLayer::putUrgent(void* buffer, int toCopy)
-{
-  if ( _PlaybackHandle ){ 
-    fillHWBuffer();
-    int a = _urgentBuffer.AvailForPut();
-    if( a >= toCopy ){
-      return _urgentBuffer.Put( buffer , toCopy , _defaultVolume );
-    } else {
-      return _urgentBuffer.Put( buffer , a , _defaultVolume ) ;
-    }
-  }
-  return 0;
-}
-
-  int
-AlsaLayer::canGetMic()
-{
-  int avail;
-  if ( _CaptureHandle ) {
-    avail = snd_pcm_avail_update( _CaptureHandle );
-    //printf("%d\n", avail ); 
-    if(avail > 0)
-      return avail;
-    else 
-      return 0;  
-  }
-  else
-    return 0;
-}
-
-  int 
-AlsaLayer::getMic(void *buffer, int toCopy)
-{
-  int res = 0 ; 
-  if( _CaptureHandle ) 
-  {
-    res = read( buffer, toCopy );
-    adjustVolume( buffer , toCopy , SFL_PCM_CAPTURE );
-  }
-  return res ;
-}
-
-
-  bool
-AlsaLayer::isStreamStopped (void) 
-{
-  ost::MutexLock lock( _mutex );
-  return !(isStreamActive());
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////   ALSA PRIVATE FUNCTIONS   ////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-  void
-AlsaLayer::playTones( void )
-{
-  int frames = _periodSize ; 
-  int maxBytes = frames * sizeof(SFLDataFormat) ;
-  SFLDataFormat* out = (SFLDataFormat*)malloc(maxBytes * sizeof(SFLDataFormat));
-  if( _talk ) {}
-  else {
-    AudioLoop *tone = _manager -> getTelephoneTone();
-    int spkrVol = _manager -> getSpkrVolume();
-    if( tone != 0 ){
-      tone -> getNext( out , frames , spkrVol );
-      write( out , maxBytes );
-    } 
-    else if( ( tone=_manager->getTelephoneFile() ) != 0 ){
-      tone ->getNext( out , frames , spkrVol );
-      write( out , maxBytes );
-    }
-  }
-  // free the temporary data buffer 
-  free( out ); out = 0;
-}
-
-bool
-AlsaLayer::isPlaybackActive(void) {
-  ost::MutexLock guard( _mutex );
-  if( _PlaybackHandle )
-    return (snd_pcm_state(_PlaybackHandle) == SND_PCM_STATE_RUNNING ? true : false); 
-  else
-    return false;
-}
-
-bool
-AlsaLayer::isCaptureActive(void) {
-  ost::MutexLock guard( _mutex );
-  if( _CaptureHandle )
-    return (snd_pcm_state( _CaptureHandle) == SND_PCM_STATE_RUNNING ? true : false); 
-  else
-    return false;
-}
-
-
-  bool 
-AlsaLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
-{
-  std::stringstream errMsg;
-  int err;
-  snd_pcm_hw_params_t* hwParams = NULL;
-  snd_pcm_sw_params_t *swparams = NULL;
-  unsigned int rate_in = getSampleRate();
-  unsigned int rate_out = getSampleRate();
-  int dir = 0;
-  snd_pcm_uframes_t period_size = 2048;
-  snd_pcm_uframes_t buffer_size = period_size * 4 ; 
-  snd_pcm_uframes_t threshold = 1024 ;
-  snd_pcm_uframes_t period_size_out =  getFrameSize() * getSampleRate() / 1000 *  2;//1024 ;
-  snd_pcm_uframes_t buffer_size_out = period_size_out * 4 ;
-
-  unsigned int buffer_time = 80000; //80ms
-  unsigned int period_time = buffer_time / 4 ; //20ms
-
-  if(flag == SFL_PCM_BOTH || flag == SFL_PCM_CAPTURE)
-  {
-    _debugAlsa("Opening capture device %s\n", pcm_c.c_str());
-    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 );
-      return false;
-    }
-
-    if( err = snd_pcm_hw_params_malloc( &hwParams ) < 0 ) {
-      _debugAlsa(" Cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
-      return false;
-    }
-    if( err = snd_pcm_hw_params_any(_CaptureHandle, hwParams) < 0) _debugAlsa(" Cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_access( _CaptureHandle, hwParams, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) _debugAlsa(" Cannot set access type (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_format( _CaptureHandle, hwParams, SND_PCM_FORMAT_S16_LE) < 0) _debugAlsa(" Cannot set sample format (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_rate_near( _CaptureHandle, hwParams, &rate_in, &dir) < 0) _debugAlsa(" Cannot set sample rate (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_channels( _CaptureHandle, hwParams, 1) < 0) _debugAlsa(" Cannot set channel count (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_period_time_near( _CaptureHandle, hwParams, &period_time , &dir) < 0) _debugAlsa(" Cannot set period time (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_buffer_time_near( _CaptureHandle, hwParams, &buffer_time , &dir) < 0) _debugAlsa(" Cannot set buffer time (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params( _CaptureHandle, hwParams ) < 0) _debugAlsa(" Cannot set hw parameters (%s)\n", snd_strerror(err));
-    snd_pcm_hw_params_free( hwParams );
-
-    snd_pcm_uframes_t val ;
-    snd_pcm_sw_params_malloc( &swparams );
-    snd_pcm_sw_params_current( _CaptureHandle, swparams );
-
-    if( err = snd_pcm_sw_params_set_start_threshold( _CaptureHandle, swparams, period_size_out) < 0 ) _debugAlsa(" Cannot set start threshold (%s)\n", snd_strerror(err)); 
-    snd_pcm_sw_params_get_start_threshold( swparams , &val);
-    _debug("Start threshold = %d\n" ,val);
-    //if( err = snd_pcm_sw_params_set_avail_min( _CaptureHandle, swparams, period_size_out) < 0) _debugAlsa(" Cannot set min avail (%s)\n" , snd_strerror(err)); 
-    //snd_pcm_sw_params_get_avail_min( swparams , &val);
-    //_debug("Min available = %d\n" ,val);
-    if( err = snd_pcm_sw_params( _CaptureHandle, swparams ) < 0 ) _debugAlsa(" Cannot set sw parameters (%s)\n", snd_strerror(err)); 
-    snd_pcm_sw_params_free( swparams );
-    deviceClosed = false;
-  }
-
-  if(flag == SFL_PCM_BOTH || flag == SFL_PCM_PLAYBACK)
-  {
-
-    _debugAlsa(" Opening playback device %s\n", pcm_p.c_str());
-    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 );
-      return false;
-    }
-    if( err = snd_pcm_hw_params_malloc( &hwParams ) < 0 ) {
-      _debugAlsa(" Cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
-      return false;
-    }
-    if( err = snd_pcm_hw_params_any( _PlaybackHandle,hwParams) < 0) _debugAlsa(" Cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_access( _PlaybackHandle, hwParams, SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) _debugAlsa(" Cannot set access type (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_format( _PlaybackHandle, hwParams, SND_PCM_FORMAT_S16_LE) < 0) _debugAlsa(" Cannot set sample format (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_rate( _PlaybackHandle, hwParams, rate_out, dir) < 0) _debugAlsa(" Cannot set sample rate (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_channels( _PlaybackHandle, hwParams, 1) < 0) _debugAlsa(" Cannot set channel count (%s)\n", snd_strerror(err));
-
-    if( err = snd_pcm_hw_params_set_buffer_time_near( _PlaybackHandle, hwParams, &buffer_time , &dir) < 0) _debugAlsa(" Cannot set buffer time (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_set_period_time_near( _PlaybackHandle, hwParams, &period_time , &dir) < 0) _debugAlsa(" Cannot set period time (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_get_period_size(  hwParams, &_periodSize , &dir) < 0) _debugAlsa(" Cannot get period size (%s)\n", snd_strerror(err));
-    if( err = snd_pcm_hw_params_get_buffer_size(  hwParams, &buffer_size_out ) < 0) _debugAlsa(" Cannot get buffer size (%s)\n", snd_strerror(err));
-
-    if( err = snd_pcm_hw_params( _PlaybackHandle, hwParams ) < 0) _debugAlsa(" Cannot set hw parameters (%s)\n", snd_strerror(err));
-
-
-    snd_pcm_hw_params_free( hwParams );
-
-    snd_pcm_uframes_t val ;
-    snd_pcm_sw_params_malloc( &swparams );
-    snd_pcm_sw_params_current( _PlaybackHandle, swparams );
-
-    if( err = snd_pcm_sw_params_set_start_threshold( _PlaybackHandle, swparams, period_size_out) < 0 ) _debugAlsa(" Cannot set start threshold (%s)\n", snd_strerror(err)); 
-    snd_pcm_sw_params_get_start_threshold( swparams , &val);
-    _debug("Start threshold = %d\n" ,val);
-    //if( err = snd_pcm_sw_params_set_stop_threshold( _PlaybackHandle, swparams, buffer_size_out ) < 0 ) _debugAlsa(" Cannot set stop threshold (%s)\n", snd_strerror(err)); 
-    //snd_pcm_sw_params_get_stop_threshold( swparams , &val);
-    //_debug("Stop threshold = %d\n" ,val);
-    //if( err = snd_pcm_sw_params_set_avail_min( _PlaybackHandle, swparams, period_size_out) < 0) _debugAlsa(" Cannot set min avail (%s)\n" , snd_strerror(err)); 
-    //if( err = snd_pcm_sw_params_set_xfer_align( _PlaybackHandle, swparams, 1) < 0) _debugAlsa(" Cannot set xfer align (%s)\n" , snd_strerror(err)); 
-    //snd_pcm_sw_params_get_avail_min( swparams , &val);
-    //_debug("Min available = %d\n" ,val);
-    //if( err = snd_pcm_sw_params_set_silence_threshold( _PlaybackHandle, swparams, period_size_out) < 0) _debugAlsa(" Cannot set silence threshold (%s)\n" , snd_strerror(err)); 
-    //snd_pcm_sw_params_get_silence_threshold( swparams , &val);
-    //  _debug("Silence threshold = %d\n" ,val);
-    if( err = snd_pcm_sw_params( _PlaybackHandle, swparams ) < 0 ) _debugAlsa(" Cannot set sw parameters (%s)\n", snd_strerror(err)); 
-    snd_pcm_sw_params_free( swparams );
-
-    if ( err = snd_async_add_pcm_handler( &_AsyncHandler, _PlaybackHandle , AlsaCallBack, this ) < 0)	_debugAlsa(" Unable to install the async callback handler (%s)\n", snd_strerror(err));
-    deviceClosed = false;
-  }
-  //fillHWBuffer();
-
-  _talk = false;
-  return true;
-}
-
-//TODO	first frame causes broken pipe (underrun) because not enough data are send --> make the handle wait to be ready
-  int
-AlsaLayer::write(void* buffer, int length)
-{
-  snd_pcm_uframes_t frames = snd_pcm_bytes_to_frames( _PlaybackHandle, length);
-  int err = snd_pcm_mmap_writei( _PlaybackHandle , buffer , frames );
-  switch(err) {
-    case -EAGAIN: 
-      _debugAlsa("EAGAIN (%s)\n", snd_strerror( err ));
-      //snd_pcm_resume( _PlaybackHandle );
-      break;
-    case -EPIPE: 
-      _debugAlsa(" UNDERRUN (%s)\n", snd_strerror(err));
-      handle_xrun_playback();
-      snd_pcm_mmap_writei( _PlaybackHandle , buffer , frames );
-      break;
-    case -ESTRPIPE:
-      _debugAlsa("ESTRPIPE (%s)\n", snd_strerror(err));
-      //snd_pcm_resume( _PlaybackHandle );
-      break;
-    case -EBADFD:
-      _debugAlsa("EBADFD (%s)\n", snd_strerror( err ));
-      break;
-  }
-
-  if( err >=0 && err < frames )
-    _debugAlsa("Short write : %d out of %d\n", err , frames);
-
-  return ( err > 0 )? err : 0 ;
-}
-
-  int
-AlsaLayer::read( void* buffer, int toCopy)
-{
-  if(deviceClosed || _CaptureHandle == NULL)
-    return 0;
-  int err;
-  if(snd_pcm_state( _CaptureHandle ) == SND_PCM_STATE_XRUN)
-  {
-    snd_pcm_prepare( _CaptureHandle );
-    snd_pcm_start( _CaptureHandle );
-  }
-  snd_pcm_uframes_t frames = snd_pcm_bytes_to_frames( _CaptureHandle, toCopy );
-  if( err = snd_pcm_mmap_readi( _CaptureHandle, buffer, frames) < 0 ) {
-    switch(err){
-      case EPERM:
-	_debugAlsa(" Capture EPERM (%s)\n", snd_strerror(err));
-	snd_pcm_prepare( _CaptureHandle);
-	snd_pcm_start( _CaptureHandle );
-	break;
-      case -ESTRPIPE:
-	_debugAlsa(" Capture ESTRPIPE (%s)\n", snd_strerror(err));
-	snd_pcm_resume( _CaptureHandle);
-	break;
-      case -EAGAIN:
-	_debugAlsa(" Capture EAGAIN (%s)\n", snd_strerror(err));
-	break;
-      case -EBADFD:
-	_debugAlsa(" Capture EBADFD (%s)\n", snd_strerror(err));
-	break;
-      case -EPIPE:
-	_debugAlsa(" Capture EPIPE (%s)\n", snd_strerror(err));
-	handle_xrun_capture();
-	break;
-    }
-    return 0;
-  }
-
-  return toCopy;
-
-}
-
-  void
-AlsaLayer::handle_xrun_capture( void )
-{
-  snd_pcm_status_t* status;
-  snd_pcm_status_alloca( &status );
-
-  int res = snd_pcm_status( _CaptureHandle, status );
-  if( res <= 0){
-    if(snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN ){
-      snd_pcm_drop( _CaptureHandle );
-      snd_pcm_prepare( _CaptureHandle );
-      snd_pcm_start( _CaptureHandle ); 
-    }
-  }
-  else
-    _debugAlsa(" Get status failed\n");
-}
-
-  void
-AlsaLayer::handle_xrun_playback( void )
-{
-  int state; 
-  snd_pcm_status_t* status;
-  snd_pcm_status_alloca( &status );
-
-  if( state = snd_pcm_status( _PlaybackHandle, status ) < 0 )   _debugAlsa(" Error: Cannot get playback handle status (%s)\n" , snd_strerror( state ) );
-  else 
-  { 
-    state = snd_pcm_status_get_state( status );
-    if( state  == SND_PCM_STATE_XRUN )
-    {
-      //snd_pcm_drop( _PlaybackHandle );
-      _debug("Underrun\n");
-      snd_pcm_prepare( _PlaybackHandle );
-      //snd_pcm_start( _PlaybackHandle ); 
-    }
-  }
-}
-
-  std::string
-AlsaLayer::buildDeviceTopo( std::string plugin, int card, int subdevice )
-{
-  std::string pcm = plugin;
-  std::stringstream ss,ss1;
-  if( pcm == "default" || pcm == "pulse")
-    return pcm;
-  ss << card;
-  pcm.append(":");
-  pcm.append(ss.str());
-  if( subdevice != 0 ){
-    pcm.append(",");
-    ss1 << subdevice;
-    pcm.append(ss1.str());
-  }
-  return pcm;
-}
-
-  std::vector<std::string>
-AlsaLayer::getSoundCardsInfo( int stream )
-{
-  std::vector<std::string> cards_id;
-  HwIDPair p;
-
-  snd_ctl_t* handle;
-  snd_ctl_card_info_t *info;
-  snd_pcm_info_t* pcminfo;
-  snd_ctl_card_info_alloca( &info );
-  snd_pcm_info_alloca( &pcminfo );
-
-  int numCard = -1 ;
-  int err;
-  std::string description;
-
-  if(snd_card_next( &numCard ) < 0 || numCard < 0)
-    return cards_id;
-
-  while(numCard >= 0){
-    std::stringstream ss;
-    ss << numCard;
-    std::string name= "hw:";
-    name.append(ss.str());
-
-    if( snd_ctl_open( &handle, name.c_str(), 0) == 0 ){
-      if( snd_ctl_card_info( handle, info) == 0){
-	snd_pcm_info_set_device( pcminfo , 0);
-	snd_pcm_info_set_stream( pcminfo, ( stream == SFL_PCM_CAPTURE )? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK );
-	if( snd_ctl_pcm_info ( handle ,pcminfo ) < 0) _debugAlsa(" Cannot get info\n");
-	else{
-	  _debugAlsa("card %i : %s [%s]\n", 
-	      numCard, 
-	      snd_ctl_card_info_get_id(info),
-	      snd_ctl_card_info_get_name( info ));
-	  description = snd_ctl_card_info_get_name( info );
-	  description.append(" - ");
-	  description.append(snd_pcm_info_get_name( pcminfo ));
-	  cards_id.push_back( description );
-	  // The number of the sound card is associated with a string description 
-	  p = HwIDPair( numCard , description );
-	  IDSoundCards.push_back( p );
-	}
-      }
-      snd_ctl_close( handle );
-    }
-    if ( snd_card_next( &numCard ) < 0 ) {
-      break;
-    }
-  }
-  return cards_id;
-}
-
-  void
-AlsaLayer::closeCaptureStream( void)
-{
-  if(_CaptureHandle){
-    snd_pcm_drop( _CaptureHandle );
-    snd_pcm_close( _CaptureHandle );
-    _CaptureHandle = 0;
-  }
-}
-
-  void
-AlsaLayer::closePlaybackStream( void)
-{
-  if(_PlaybackHandle){
-    snd_pcm_drop( _PlaybackHandle );
-    snd_pcm_close( _PlaybackHandle );
-    _PlaybackHandle = 0;
-  }
-}
-
-  bool
-AlsaLayer::soundCardIndexExist( int card , int stream )
-{
-  snd_ctl_t* handle;
-  snd_pcm_info_t *pcminfo;
-  snd_pcm_info_alloca( &pcminfo );
-  std::string name = "hw:";
-  std::stringstream ss;
-  ss << card ;
-  name.append(ss.str());
-  if(snd_ctl_open( &handle, name.c_str(), 0) == 0 ){
-    snd_pcm_info_set_stream( pcminfo , ( stream == SFL_PCM_PLAYBACK )? SND_PCM_STREAM_PLAYBACK : SND_PCM_STREAM_CAPTURE );
-    if( snd_ctl_pcm_info( handle , pcminfo ) < 0) return false;
-    else
-      return true;
-  }
-  else
-    return false;
-}  
-
-  int
-AlsaLayer::soundCardGetIndex( std::string description )
-{
-  int i;
-  for( i = 0 ; i < IDSoundCards.size() ; i++ )
-  {
-    HwIDPair p = IDSoundCards[i];
-    if( p.second == description )
-      return  p.first ;
-  }
-  // else return the default one
-  return 0;
-}
-
-  void*
-AlsaLayer::adjustVolume( void* buffer , int len, int stream )
-{
-  int vol;
-  if( stream == SFL_PCM_PLAYBACK )
-    vol = _manager->getSpkrVolume();
-  else
-    vol = _manager->getMicVolume();
-
-  SFLDataFormat* src = (SFLDataFormat*) buffer;
-  if( vol != 100 )
-  {
-    int size = len / sizeof(SFLDataFormat);
-    int i;
-    for( i = 0 ; i < size ; i++ ){
-      src[i] = src[i] * vol  / 100 ;
-    }
-  }
-  return src ; 
-}
diff --git a/src/audio/alsalayer.cpp b/src/audio/alsalayer.cpp
index 5d7e378837b6fda5bfd1b897e17160e78b27dbfa..3402cfe4db642a178d9601d2dd05a2831149c936 100644
--- a/src/audio/alsalayer.cpp
+++ b/src/audio/alsalayer.cpp
@@ -466,11 +466,6 @@ AlsaLayer::read( void* buffer, int toCopy)
 
 }
 
-
-  int 
-AlsaLayer::putMain(void* buffer, int toCopy)
-{}
-
   int
 AlsaLayer::putInCache( char code, void *buffer, int toCopy )
 {}
diff --git a/src/audio/alsalayer.h b/src/audio/alsalayer.h
index 1b31eb2f03a2c6286e56310b87327341924f3164..fb5def1fa6d4e8e81ebfad4e152dd1f876f08eb9 100644
--- a/src/audio/alsalayer.h
+++ b/src/audio/alsalayer.h
@@ -186,10 +186,6 @@ class AlsaLayer : public AudioLayer {
      */
     int putInCache( char code, void *buffer, int toCopy );
 
-    /**
-     * UNUSED in ALSA layer
-     */
-    int putMain(void* buffer, int toCopy);
 
     /**
      * UNUSED in ALSA layer
diff --git a/src/audio/audiolayer.h b/src/audio/audiolayer.h
index 6e2b70879d2aed393ac3708ff6f8b13a9ae9951a..690542f5e08ddf0ba8eb006352289449c3ccd888 100644
--- a/src/audio/audiolayer.h
+++ b/src/audio/audiolayer.h
@@ -99,12 +99,6 @@ class AudioLayer {
      */
     virtual void stopStream(void) = 0;
     
-    /**
-     * Check if both capture and playback are running
-     * @return true if capture and playback are running
-     *	       false otherwise
-     */
-    virtual bool isStreamActive(void) = 0;
 
     /**
      * Check if the capture is running
@@ -131,7 +125,6 @@ class AudioLayer {
      */
     virtual int putUrgent(void* buffer, int toCopy) = 0; 
 
-    virtual int putMain( void* buffer, int toCopy) = 0;
     virtual int putInCache(char code, void* buffer, int toCopy) = 0;
 
     /**
diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp
index 641eb4f841a5ebfc05ea3fb7c06828ca6a36d4fa..2c7da7d7e29938a5dee72d21d79af4b908069300 100644
--- a/src/audio/audiortp.cpp
+++ b/src/audio/audiortp.cpp
@@ -336,13 +336,9 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
 #ifdef DATAFORMAT_IS_FLOAT
 #else
 #endif
-
-      int layer = audiolayer->getLayerType();
-      //_debug(" interface %i - ALSA = %i\n" , layer, ALSA);
-      if( CHECK_INTERFACE( layer, ALSA ) )
-	audiolayer->playSamples( spkrDataConverted, nbSample * sizeof(SFLDataFormat), true);
-      else      
-	audiolayer->putMain( spkrDataConverted, nbSample * sizeof(SFLDataFormat) );
+      
+      audiolayer->playSamples( spkrDataConverted, nbSample * sizeof(SFLDataFormat), true);
+      
       // Notify (with a beep) an incoming call when there is already a call 
       countTime += time->getSecond();
       if (Manager::instance().incomingCallWaiting() > 0) {
diff --git a/src/audio/audiostream.cpp b/src/audio/audiostream.cpp
index 196a17e1086fb714ca9e2d511f6f2bcfa08703a0..0ad925c4e574e3119fa77b672c8d69f483744f49 100644
--- a/src/audio/audiostream.cpp
+++ b/src/audio/audiostream.cpp
@@ -47,6 +47,7 @@ AudioStream::disconnect( void )
 { 
   _debug("Destroy audio streams\n");
   pa_stream_disconnect( pulseStream() );
+  pa_stream_unref( pulseStream() );
 } 
 
   void 
@@ -74,7 +75,6 @@ AudioStream::stream_state_callback( pa_stream* s, void* user_data )
   pa_stream*
 AudioStream::createStream( pa_context* c )
 {
-  _debug("Creating %s stream...\n" , _streamDescription.c_str());
   pa_stream* s;
   pa_cvolume cv;
 
@@ -88,14 +88,14 @@ AudioStream::createStream( pa_context* c )
 
   if( _streamType == PLAYBACK_STREAM ){
     pa_buffer_attr* attributes;
-    attributes->maxlength = 66500;
-    attributes->tlength = 44100;
-    attributes->prebuf = 10000;
-    attributes->minreq = 882;
-    pa_stream_connect_playback( s , NULL , attributes , 
+    //attributes->maxlength = 66500;
+    //attributes->tlength = 44100;
+    //attributes->prebuf = 10000;
+    //attributes->minreq = 882;
+    pa_stream_connect_playback( s , NULL , NULL , 
 				PA_STREAM_INTERPOLATE_TIMING,
 				&_volume, NULL);
-				//pa_cvolume_set(&cv, sample_spec.channels , _volume) , NULL );
+				//pa_cvolume_set(&cv, sample_spec.channels , PA_VOLUME_NORM) , NULL );
   }
   else if( _streamType == CAPTURE_STREAM ){
     pa_stream_connect_record( s , NULL , NULL , PA_STREAM_START_CORKED );
diff --git a/src/audio/pulselayer.cpp b/src/audio/pulselayer.cpp
index 99e8c0fce15bfd3ddcd4e44737c2965fcaef7f67..9c0d401b74931525bf911a04400fe83ed3028909 100644
--- a/src/audio/pulselayer.cpp
+++ b/src/audio/pulselayer.cpp
@@ -37,6 +37,7 @@ PulseLayer::~PulseLayer (void)
   delete playback;
   delete record;
   pa_context_disconnect(context);
+  pa_context_unref( context );
 }
 
   void
@@ -45,6 +46,7 @@ PulseLayer::closeLayer( void )
   playback->disconnect(); 
   record->disconnect();
   pa_context_disconnect( context ); 
+  pa_context_unref( context );
 }
 
   void
@@ -160,11 +162,6 @@ PulseLayer::closePlaybackStream( void )
 
   int 
 PulseLayer::playSamples(void* buffer, int toCopy, bool isTalking)
-{
-}
-
-  int 
-PulseLayer::putMain(void* buffer, int toCopy)
 {
   int a = _mainSndRingBuffer.AvailForPut();
   if ( a >= toCopy ) {
@@ -238,11 +235,6 @@ PulseLayer::stopStream (void)
   flushMic();
 }
 
-  bool 
-PulseLayer::isStreamActive (void) 
-{
-}
-
   void 
 PulseLayer::audioCallback ( pa_stream* s, size_t bytes, void* userdata )
 { 
diff --git a/src/audio/pulselayer.h b/src/audio/pulselayer.h
index 63b951120a048f600dd61a82bf59e115e730d8a7..122b267753edb7ebfd70adc3d8e53042377cf647 100644
--- a/src/audio/pulselayer.h
+++ b/src/audio/pulselayer.h
@@ -70,8 +70,6 @@ class PulseLayer : public AudioLayer {
      */
     void flushMain();
     
-    int putMain(void* buffer, int toCopy);
-    
     int putUrgent(void* buffer, int toCopy);
 
     /**
diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp
index 6b76c9c123dc6bcdfae3761b2cdb33facedd8b45..1629c1a35c598cb31907e24878d76841c334a8ff 100644
--- a/src/iaxvoiplink.cpp
+++ b/src/iaxvoiplink.cpp
@@ -201,11 +201,9 @@ IAXVoIPLink::getEvent()
   }
   _mutexIAX.leaveMutex();
 
-
   // Do the doodle-moodle to send audio from the microphone to the IAX channel.
   sendAudioFromMic();
 
-
   // Refresh registration.
   if (_nextRefreshStamp && _nextRefreshStamp - 2 < time(NULL)) {
     sendRegister();
@@ -622,7 +620,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
 
 	Manager::instance().peerAnsweredCall(id);
 	//audiolayer->flushMic();
-	audiolayer->startStream();
+	//audiolayer->startStream();
 	// start audio here?
       } else {
 	// deja connecté ?
@@ -639,7 +637,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
     case IAX_EVENT_VOICE:
       //_debug("Should have a decent value!!!!!! = %i\n" , call -> getAudioCodec());
       //if( !audiolayer -> isCaptureActive())
-      //audiolayer->startStream();
+	//audiolayer->startStream();
       iaxHandleVoiceEvent(event, call);
       break;
 
diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp
index af9c12f6f6cd435f90193f6f505d9571885d86f3..6e86c6d8b48ea0da4a0f7518d4249f922a28a412 100644
--- a/src/managerimpl.cpp
+++ b/src/managerimpl.cpp
@@ -1224,14 +1224,14 @@ ManagerImpl::setInputAudioPlugin(const std::string& audioPlugin)
 ManagerImpl::setOutputAudioPlugin(const std::string& audioPlugin)
 {
   int layer = _audiodriver -> getLayerType();
-    _debug("Set output audio plugin\n");
-    _audiodriver -> setErrorMessage( -1 );
-    _audiodriver -> openDevice( _audiodriver -> getIndexIn(),
-      _audiodriver -> getIndexOut(),
-      _audiodriver -> getSampleRate(),
-      _audiodriver -> getFrameSize(),
-      SFL_PCM_BOTH,
-      audioPlugin);
+  _debug("Set output audio plugin\n");
+  _audiodriver -> setErrorMessage( -1 );
+  _audiodriver -> openDevice( _audiodriver -> getIndexIn(),
+			      _audiodriver -> getIndexOut(),
+			      _audiodriver -> getSampleRate(),
+			      _audiodriver -> getFrameSize(),
+			      SFL_PCM_BOTH,
+			      audioPlugin);
   if( _audiodriver -> getErrorMessage() != -1)
     notifyErrClient( _audiodriver -> getErrorMessage() );
   // set config