Index: mod_portaudio.c
===================================================================
--- mod_portaudio.c	(revision 8260)
+++ mod_portaudio.c	(working copy)
@@ -121,6 +121,7 @@
 	int ring_interval;
 	GFLAGS flags;
 	switch_timer_t timer;
+	switch_timer_t sync_timer;
 } globals;
 
 
@@ -282,7 +283,15 @@
 	}
 
 	switch_set_flag_locked(tech_pvt, TFLAG_IO);
+	
+	/* Start Synchronization Timer */
+	//Is it ok to always use 20ms? What about the 160 sample????
+	if ( switch_core_timer_init(&globals.sync_timer,"soft",20,160,switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS)
+	{
+	    	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sync Timer failed!!\n");
+	}
 
+
 	/* Move Channel's State Machine to RING */
 	switch_channel_set_state(channel, CS_RING);
 
@@ -412,6 +421,8 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	/* Destroy timer */
+	switch_core_timer_destroy(&globals.sync_timer);	
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -542,12 +553,17 @@
 	switch_mutex_lock(globals.device_lock);
 
  get_samples:
-
+	
 	if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, 
 								   globals.read_codec.implementation->samples_per_frame, 
 								   &globals.timer)) == 0) {
+
+	//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No data reset timer\n");
+	switch_core_timer_sync(&globals.sync_timer);
         switch_yield(1000);
+	
         goto get_samples;
+	
 	} else {
 		globals.read_frame.datalen = samples * 2;
 		globals.read_frame.samples = samples;
@@ -562,7 +578,9 @@
 		status = SWITCH_STATUS_SUCCESS;
 	}
 	switch_mutex_unlock(globals.device_lock);
-
+	
+	switch_core_timer_next(&globals.sync_timer);
+	
 	return status;
 }
 
