diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.cpp b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
index e30f40f78b200cdf0845cc5394b8c709a2a7af6e..908e8a7a8fb123344646cae1c1a28d5cb832da79 100644
--- a/sflphone-common/src/audio/pulseaudio/audiostream.cpp
+++ b/sflphone-common/src/audio/pulseaudio/audiostream.cpp
@@ -20,7 +20,7 @@
 #include <audiostream.h>
 #include "pulselayer.h"
 
-static pa_channel_map channel_map ;
+static pa_channel_map channel_map;
 
 
 AudioStream::AudioStream (PulseLayerType * driver)
@@ -31,7 +31,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.rate = 44100;
@@ -136,7 +136,6 @@ AudioStream::stream_state_callback (pa_stream* s, void* user_data)
             break;
 
         case PA_STREAM_READY:
-
             _debug ("Stream successfully created, connected to %s\n", pa_stream_get_device_name (s));
             // pa_stream_cork( s, 0, NULL, NULL);
             break;
@@ -187,9 +186,9 @@ AudioStream::createStream (pa_context* c)
     if (_streamType == PLAYBACK_STREAM) {
         attributes->maxlength = 16000;
         attributes->tlength = 2048;
-        attributes->prebuf = 1024;
+        attributes->prebuf = 2048;
         attributes->minreq = 1024;
-        attributes->fragsize = 1024;
+        attributes->fragsize = 4096;
         pa_stream_connect_playback( s , NULL , attributes, PA_STREAM_INTERPOLATE_TIMING, &_volume, NULL);
         // pa_stream_connect_playback (s , NULL , attributes, PA_STREAM_START_CORKED, &_volume, NULL);
     } else if (_streamType == CAPTURE_STREAM) {
diff --git a/sflphone-common/src/audio/pulseaudio/audiostream.h b/sflphone-common/src/audio/pulseaudio/audiostream.h
index 3f6e25c66c27fb7221ea9740e4a1434432e121c0..40fa26e50e663300876f63478fcbe2d93c9941cc 100644
--- a/sflphone-common/src/audio/pulseaudio/audiostream.h
+++ b/sflphone-common/src/audio/pulseaudio/audiostream.h
@@ -183,6 +183,8 @@ class AudioStream {
     
     ost::Mutex _mutex;
 
+    bool _stream_is_ready;
+
 };
 
 #endif // _AUDIO_STREAM_H
diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
index cea5e4eeccff50329d87b621a2f4eef1561f00da..a570e7df9b2d021636e8776a03a2372e23943057 100644
--- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
+++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp
@@ -154,6 +154,8 @@ PulseLayer::connectPulseAudioServer (void)
 
     pa_threaded_mainloop_unlock (m);
 
+    _urgentRingBuffer.flushAll();
+
     //serverinfo();
     //muteAudioApps(99);
     _debug ("Context creation done\n");
@@ -246,6 +248,8 @@ bool PulseLayer::createStreams (pa_context* c)
 
     pa_threaded_mainloop_signal (m , 0);
 
+    _urgentRingBuffer.flushAll();
+
 
     return true;
 }
@@ -258,6 +262,8 @@ bool PulseLayer::openDevice (int indexIn UNUSED, int indexOut UNUSED, int sample
     _audioSampleRate = sampleRate;
     _frameSize = frameSize;
 
+    _urgentRingBuffer.flushAll();
+
     /*
     m = pa_threaded_mainloop_new();
     assert (m);
@@ -373,9 +379,9 @@ PulseLayer::stopStream (void)
 	pa_stream_flush (playback->pulseStream(), NULL, NULL);
 	pa_stream_flush (record->pulseStream(), NULL, NULL);
 
-	flushMic();
-	flushMain();
-	flushUrgent();
+	// flushMic();
+	// flushMain();
+	// flushUrgent();
 
 	// closeCaptureStream();
 	// closePlaybackStream();
@@ -428,6 +434,8 @@ void PulseLayer::processPlaybackData (void)
     // Handle the data for the speakers
     if ( playback &&(playback->pulseStream()) && (pa_stream_get_state (playback->pulseStream()) == PA_STREAM_READY)) {
 
+	_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)
             return;
@@ -462,6 +470,8 @@ void PulseLayer::writeToSpeaker (void)
 
     if (urgentAvailBytes > 0) {
 
+	_debug("Urgent Avail?????????????????????\n");
+
         // Urgent data (dtmf, incoming call signal) come first.
         //_debug("Play urgent!: %i\e" , urgentAvail);
         toGet = (urgentAvailBytes < (int) (framesPerBuffer * sizeof (SFLDataFormat))) ? urgentAvailBytes : framesPerBuffer * sizeof (SFLDataFormat);
@@ -476,26 +486,43 @@ void PulseLayer::writeToSpeaker (void)
     } else {
 
         AudioLoop* tone = _manager->getTelephoneTone();
+	AudioLoop* file_tone = _manager->getTelephoneFile();
 
         if (tone != 0) {
 
-            toGet = framesPerBuffer;
-            out = (SFLDataFormat*) pa_xmalloc (toGet * sizeof (SFLDataFormat));
-            tone->getNext (out, toGet , 100);
-            pa_stream_write (playback->pulseStream(), out, toGet  * sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
+	    if (playback->getStreamState() == PA_STREAM_READY)
+	    {
+		_debug("Play Tone!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+		toGet = framesPerBuffer;
+		out = (SFLDataFormat*) pa_xmalloc (toGet * sizeof (SFLDataFormat));
+		tone->getNext (out, toGet , 100);
+		pa_stream_write (playback->pulseStream(), out, toGet  * sizeof (SFLDataFormat), NULL, 0, PA_SEEK_RELATIVE);
 
-	    pa_xfree (out);
+		pa_xfree (out);
+	    }
         }
 
-        if ( (tone=_manager->getTelephoneFile()) != 0) {
+        if (file_tone != 0) {
 
-            toGet = framesPerBuffer;
-            toPlay = ( (int) (toGet * sizeof (SFLDataFormat)) > framesPerBuffer) ? framesPerBuffer : toGet * sizeof (SFLDataFormat) ;
-            out = (SFLDataFormat*) pa_xmalloc (toPlay);
-            tone->getNext (out, toPlay/2 , 100);
-            pa_stream_write (playback->pulseStream(), out, toPlay, NULL, 0, PA_SEEK_RELATIVE);
+	    if (playback->getStreamState() == PA_STREAM_READY)
+	    {
 
-	    pa_xfree (out);
+		_debug("Play File Tone!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
+
+		toGet = framesPerBuffer;
+		toPlay = ( (int) (toGet * sizeof (SFLDataFormat)) > framesPerBuffer) ? framesPerBuffer : toGet * sizeof (SFLDataFormat);
+		_debug("toPlay: %i\n", toPlay);
+		out = (SFLDataFormat*) pa_xmalloc (toPlay);
+		file_tone->getNext (out, toPlay/2 , 100);
+		pa_stream_write (playback->pulseStream(), out, toPlay, NULL, 0, PA_SEEK_RELATIVE);
+
+		_debug("ok\n");
+
+		pa_xfree (out);
+
+		_debug("end of play file\n");
+	    }
 
         } else {
 
@@ -549,10 +576,13 @@ void PulseLayer::writeToSpeaker (void)
 
             } else {
 
-		_debug("send zeros......................\n");
+		if((tone == 0) && (file_tone == 0)) {
+		    
+		    _debug("send zeros......................\n");
 
-                bzero (out, maxNbBytesToGet);
-		pa_stream_write (playback->pulseStream(), out, maxNbBytesToGet, NULL, 0, PA_SEEK_RELATIVE);
+		    bzero (out, maxNbBytesToGet);
+		    pa_stream_write (playback->pulseStream(), out, maxNbBytesToGet, NULL, 0, PA_SEEK_RELATIVE);
+		}
             }
 
 	    _urgentRingBuffer.Discard(toGet);
diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 4055a143f154e96379c5d56054ac22e76aa11eed..7e977e432a671f879218c7b0c471616f7107d634 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -1998,6 +1998,9 @@ bool ManagerImpl::playATone (Tone::TONEID toneId)
 
     audiolayer = getAudioDriver();
 
+    if (audiolayer)
+	audiolayer->startStream();
+
     if (_telephoneTone != 0) {
         _toneMutex.enterMutex();
         _telephoneTone->setCurrentTone (toneId);
@@ -2148,7 +2151,7 @@ ManagerImpl::ringtone()
 AudioLoop*
 ManagerImpl::getTelephoneTone()
 {
-    // _debug("ManagerImpl::getTelephoneTone()\n");
+    _debug("ManagerImpl::getTelephoneTone()\n");
     if (_telephoneTone != 0) {
         ost::MutexLock m (_toneMutex);
         return _telephoneTone->getCurrentTone();