Revision
14710
Author
gmaruzz
Date
2009-09-01 04:44:32 -0500 (Tue, 01 Sep 2009)

Log Message

celliax: indented

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax.h (14709 => 14710)


--- freeswitch/branches/gmaruzz/mod_celliax/celliax.h	2009-09-01 09:43:29 UTC (rev 14709)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax.h	2009-09-01 09:44:32 UTC (rev 14710)
@@ -542,7 +542,7 @@
 int celliax_hangup(private_t * tech_pvt);
 int celliax_serial_call(private_t * tech_pvt, char *dstr);
 int celliax_serial_call_AT(private_t * tech_pvt, char *dstr);
-int celliax_sendsms( private_t * tech_pvt, char * dest, char * text);
+int celliax_sendsms(private_t * tech_pvt, char *dest, char *text);
 
 #ifdef CELLIAX_ALSA
 int alsa_init(private_t * tech_pvt);
@@ -555,4 +555,4 @@
 
 
 void celliax_store_boost(char *s, double *boost);
-int celliax_sound_boost(void * data, int samples_num, double boost);
+int celliax_sound_boost(void *data, int samples_num, double boost);

Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c (14709 => 14710)


--- freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c	2009-09-01 09:43:29 UTC (rev 14709)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c	2009-09-01 09:44:32 UTC (rev 14710)
@@ -2058,7 +2058,7 @@
 			ERRORA("device [%s], snd_pcm_close failed with error '%s'\n", SKYPIAX_P_LOG, tech_pvt->alsapname, snd_strerror(err));
 			return -1;
 		}
-tech_pvt->alsap = NULL;
+		tech_pvt->alsap = NULL;
 	}
 	if (tech_pvt->alsac) {
 		err = snd_pcm_drop(tech_pvt->alsac);
@@ -2071,7 +2071,7 @@
 			ERRORA("device [%s], snd_pcm_close failed with error '%s'\n", SKYPIAX_P_LOG, tech_pvt->alsacname, snd_strerror(err));
 			return -1;
 		}
-tech_pvt->alsac = NULL;
+		tech_pvt->alsac = NULL;
 	}
 
 	return 0;
@@ -2714,159 +2714,153 @@
 
 
 
-int celliax_sendsms( private_t * tech_pvt, char * dest, char * text)
+int celliax_sendsms(private_t * tech_pvt, char *dest, char *text)
 {
-  //char *idest = data;
-  //char rdest[256];
-  //struct celliax_pvt *p = NULL;
-  //char *device;
-  //char *dest;
-  //char *text;
-  //char *stringp = NULL;
-  //int found = 0;
-  int failed = 0;
+	//char *idest = data;
+	//char rdest[256];
+	//struct celliax_pvt *p = NULL;
+	//char *device;
+	//char *dest;
+	//char *text;
+	//char *stringp = NULL;
+	//int found = 0;
+	int failed = 0;
 
-  //strncpy(rdest, idest, sizeof(rdest) - 1);
-  DEBUGA_SKYPE("CelliaxSendsms: dest=%s text=%s\n", SKYPIAX_P_LOG, dest, text);
-  DEBUGA_SKYPE("START\n", SKYPIAX_P_LOG);
-  /* we can use celliax_request to get the channel, but celliax_request would look for onowned channels, and probably we can send SMSs while a call is ongoing
-   *
-   */
+	//strncpy(rdest, idest, sizeof(rdest) - 1);
+	DEBUGA_SKYPE("CelliaxSendsms: dest=%s text=%s\n", SKYPIAX_P_LOG, dest, text);
+	DEBUGA_SKYPE("START\n", SKYPIAX_P_LOG);
+	/* we can use celliax_request to get the channel, but celliax_request would look for onowned channels, and probably we can send SMSs while a call is ongoing
+	 *
+	 */
 
-  if (tech_pvt->controldevprotocol != PROTOCOL_AT) {
-    ERRORA(", SKYPIAX_P_LOGCelliaxSendsms supports only AT command cellphones at the moment :-( !\n",
-           SKYPIAX_P_LOG);
-    return RESULT_FAILURE;
-  }
+	if (tech_pvt->controldevprotocol != PROTOCOL_AT) {
+		ERRORA(", SKYPIAX_P_LOGCelliaxSendsms supports only AT command cellphones at the moment :-( !\n", SKYPIAX_P_LOG);
+		return RESULT_FAILURE;
+	}
 
-  if (tech_pvt->controldevprotocol == PROTOCOL_AT) {
-    int err = 0;
-    char smscommand[16000];
-    memset(smscommand, '\0', sizeof(smscommand));
+	if (tech_pvt->controldevprotocol == PROTOCOL_AT) {
+		int err = 0;
+		char smscommand[16000];
+		memset(smscommand, '\0', sizeof(smscommand));
 
-    PUSHA_UNLOCKA(&tech_pvt->controldev_lock);
-    LOKKA(tech_pvt->controldev_lock);
+		PUSHA_UNLOCKA(&tech_pvt->controldev_lock);
+		LOKKA(tech_pvt->controldev_lock);
 
-    if (tech_pvt->no_ucs2) {
-      sprintf(smscommand, "AT+CMGS=\"%s\"", dest);  //TODO: support phones that only accept pdu mode
-    } else {
-      char dest2[1048];
+		if (tech_pvt->no_ucs2) {
+			sprintf(smscommand, "AT+CMGS=\"%s\"", dest);	//TODO: support phones that only accept pdu mode
+		} else {
+			char dest2[1048];
 
-          err = celliax_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"UCS2\"");
-          if (err) {
-            ERRORA
-              ("AT+CSCS=\"UCS2\" (set TE messages to ucs2)  do not got OK from the phone\n",
-               SKYPIAX_P_LOG);
-          }
+			err = celliax_serial_write_AT_ack(tech_pvt, "AT+CSCS=\"UCS2\"");
+			if (err) {
+				ERRORA("AT+CSCS=\"UCS2\" (set TE messages to ucs2)  do not got OK from the phone\n", SKYPIAX_P_LOG);
+			}
 
-      memset(dest2, '\0', sizeof(dest2));
-      utf_to_ucs2(tech_pvt, dest, strlen(dest), dest2, sizeof(dest2));
-      sprintf(smscommand, "AT+CMGS=\"%s\"", dest2); //TODO: support phones that only accept pdu mode
-    }
-    //TODO: support phones that only accept pdu mode
-    //TODO would be better to lock controldev here
-    err = celliax_serial_write_AT_noack(tech_pvt, smscommand);
-    if (err) {
-      ERRORA("Error sending SMS\n", SKYPIAX_P_LOG);
-      failed = 1;
-      goto uscita;
-    }
-    err = celliax_serial_AT_expect(tech_pvt, "> ", 0, 1);  // wait 1.5s for the prompt, no  crlf
+			memset(dest2, '\0', sizeof(dest2));
+			utf_to_ucs2(tech_pvt, dest, strlen(dest), dest2, sizeof(dest2));
+			sprintf(smscommand, "AT+CMGS=\"%s\"", dest2);	//TODO: support phones that only accept pdu mode
+		}
+		//TODO: support phones that only accept pdu mode
+		//TODO would be better to lock controldev here
+		err = celliax_serial_write_AT_noack(tech_pvt, smscommand);
+		if (err) {
+			ERRORA("Error sending SMS\n", SKYPIAX_P_LOG);
+			failed = 1;
+			goto uscita;
+		}
+		err = celliax_serial_AT_expect(tech_pvt, "> ", 0, 1);	// wait 1.5s for the prompt, no  crlf
 #if 1
-    if (err) {
-      DEBUGA_SKYPE
-        ("Error or timeout getting prompt '> ' for sending sms directly to the remote party. BTW, seems that we cannot do that with Motorola c350, so we'll write to cellphone memory, then send from memory\n",
-         SKYPIAX_P_LOG);
+		if (err) {
+			DEBUGA_SKYPE
+				("Error or timeout getting prompt '> ' for sending sms directly to the remote party. BTW, seems that we cannot do that with Motorola c350, so we'll write to cellphone memory, then send from memory\n",
+				 SKYPIAX_P_LOG);
 
-      err = celliax_serial_write_AT_ack(tech_pvt, "ATE1"); //motorola (at least c350) do not echo the '>' prompt when in ATE0... go figure!!!!
-      if (err) {
-        ERRORA("Error activating echo from modem\n", SKYPIAX_P_LOG);
-      }
-      tech_pvt->at_cmgw[0] = '\0';
-      sprintf(smscommand, "AT+CMGW=\"%s\"", dest);  //TODO: support phones that only accept pdu mode
-      err = celliax_serial_write_AT_noack(tech_pvt, smscommand);
-      if (err) {
-        ERRORA("Error writing SMS destination to the cellphone memory\n", SKYPIAX_P_LOG);
-        failed = 1;
-        goto uscita;
-      }
-      err = celliax_serial_AT_expect(tech_pvt, "> ", 0, 1);    // wait 1.5s for the prompt, no  crlf
-      if (err) {
-        ERRORA
-          ("Error or timeout getting prompt '> ' for writing sms text in cellphone memory\n",
-           SKYPIAX_P_LOG);
-        failed = 1;
-        goto uscita;
-      }
-    }
+			err = celliax_serial_write_AT_ack(tech_pvt, "ATE1");	//motorola (at least c350) do not echo the '>' prompt when in ATE0... go figure!!!!
+			if (err) {
+				ERRORA("Error activating echo from modem\n", SKYPIAX_P_LOG);
+			}
+			tech_pvt->at_cmgw[0] = '\0';
+			sprintf(smscommand, "AT+CMGW=\"%s\"", dest);	//TODO: support phones that only accept pdu mode
+			err = celliax_serial_write_AT_noack(tech_pvt, smscommand);
+			if (err) {
+				ERRORA("Error writing SMS destination to the cellphone memory\n", SKYPIAX_P_LOG);
+				failed = 1;
+				goto uscita;
+			}
+			err = celliax_serial_AT_expect(tech_pvt, "> ", 0, 1);	// wait 1.5s for the prompt, no  crlf
+			if (err) {
+				ERRORA("Error or timeout getting prompt '> ' for writing sms text in cellphone memory\n", SKYPIAX_P_LOG);
+				failed = 1;
+				goto uscita;
+			}
+		}
 #endif
 
-    //sprintf(text,"ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大"); //let's test the beauty of utf
-    memset(smscommand, '\0', sizeof(smscommand));
-    if (tech_pvt->no_ucs2) {
-      sprintf(smscommand, "%s", text);
-    } else {
-      utf_to_ucs2(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand));
-    }
+		//sprintf(text,"ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大"); //let's test the beauty of utf
+		memset(smscommand, '\0', sizeof(smscommand));
+		if (tech_pvt->no_ucs2) {
+			sprintf(smscommand, "%s", text);
+		} else {
+			utf_to_ucs2(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand));
+		}
 
-    smscommand[strlen(smscommand)] = 0x1A;
-    DEBUGA_SKYPE("smscommand len is: %d, text is:|||%s|||\n", SKYPIAX_P_LOG,
-              strlen(smscommand), smscommand);
+		smscommand[strlen(smscommand)] = 0x1A;
+		DEBUGA_SKYPE("smscommand len is: %d, text is:|||%s|||\n", SKYPIAX_P_LOG, strlen(smscommand), smscommand);
 
-    err = celliax_serial_write_AT_ack_nocr_longtime(tech_pvt, smscommand);
-    //TODO would be better to unlock controldev here
-    if (err) {
-      ERRORA("Error writing SMS text to the cellphone memory\n", SKYPIAX_P_LOG);
-      //return RESULT_FAILURE;
-      failed = 1;
-      goto uscita;
-    }
-    if (tech_pvt->at_cmgw[0]) {
-      sprintf(smscommand, "AT+CMSS=%s", tech_pvt->at_cmgw);
-      err = celliax_serial_write_AT_expect_longtime(tech_pvt, smscommand, "OK");
-      if (err) {
-        ERRORA("Error sending SMS from the cellphone memory\n", SKYPIAX_P_LOG);
-        //return RESULT_FAILURE;
-        failed = 1;
-        goto uscita;
-      }
+		err = celliax_serial_write_AT_ack_nocr_longtime(tech_pvt, smscommand);
+		//TODO would be better to unlock controldev here
+		if (err) {
+			ERRORA("Error writing SMS text to the cellphone memory\n", SKYPIAX_P_LOG);
+			//return RESULT_FAILURE;
+			failed = 1;
+			goto uscita;
+		}
+		if (tech_pvt->at_cmgw[0]) {
+			sprintf(smscommand, "AT+CMSS=%s", tech_pvt->at_cmgw);
+			err = celliax_serial_write_AT_expect_longtime(tech_pvt, smscommand, "OK");
+			if (err) {
+				ERRORA("Error sending SMS from the cellphone memory\n", SKYPIAX_P_LOG);
+				//return RESULT_FAILURE;
+				failed = 1;
+				goto uscita;
+			}
 
-      err = celliax_serial_write_AT_ack(tech_pvt, "ATE0"); //motorola (at least c350) do not echo the '>' prompt when in ATE0... go figure!!!!
-      if (err) {
-        ERRORA("Error de-activating echo from modem\n", SKYPIAX_P_LOG);
-      }
-    }
-  uscita:
-    usleep(1000);
+			err = celliax_serial_write_AT_ack(tech_pvt, "ATE0");	//motorola (at least c350) do not echo the '>' prompt when in ATE0... go figure!!!!
+			if (err) {
+				ERRORA("Error de-activating echo from modem\n", SKYPIAX_P_LOG);
+			}
+		}
+	  uscita:
+		usleep(1000);
 
-    if (tech_pvt->at_cmgw[0]) {
+		if (tech_pvt->at_cmgw[0]) {
 
-      /* let's see what we've sent, just for check TODO: Motorola it's not reliable! Motorola c350 tells that all was sent, but is not true! It just sends how much it fits into one SMS FIXME: need an algorithm to calculate how many ucs2 chars fits into an SMS. It make difference based, probably, on the GSM alphabet translation, or so */
-      sprintf(smscommand, "AT+CMGR=%s", tech_pvt->at_cmgw);
-      err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
-      if (err) {
-        ERRORA("Error reading SMS back from the cellphone memory\n", SKYPIAX_P_LOG);
-      }
+			/* let's see what we've sent, just for check TODO: Motorola it's not reliable! Motorola c350 tells that all was sent, but is not true! It just sends how much it fits into one SMS FIXME: need an algorithm to calculate how many ucs2 chars fits into an SMS. It make difference based, probably, on the GSM alphabet translation, or so */
+			sprintf(smscommand, "AT+CMGR=%s", tech_pvt->at_cmgw);
+			err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
+			if (err) {
+				ERRORA("Error reading SMS back from the cellphone memory\n", SKYPIAX_P_LOG);
+			}
 
-      /* let's delete from cellphone memory what we've sent */
-      sprintf(smscommand, "AT+CMGD=%s", tech_pvt->at_cmgw);
-      err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
-      if (err) {
-        ERRORA("Error deleting SMS from the cellphone memory\n", SKYPIAX_P_LOG);
-      }
+			/* let's delete from cellphone memory what we've sent */
+			sprintf(smscommand, "AT+CMGD=%s", tech_pvt->at_cmgw);
+			err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
+			if (err) {
+				ERRORA("Error deleting SMS from the cellphone memory\n", SKYPIAX_P_LOG);
+			}
 
-      tech_pvt->at_cmgw[0] = '\0';
-    }
-    //usleep(500000);             //.5 secs
-    UNLOCKA(tech_pvt->controldev_lock);
-    POPPA_UNLOCKA(&tech_pvt->controldev_lock);
-  }
+			tech_pvt->at_cmgw[0] = '\0';
+		}
+		//usleep(500000);             //.5 secs
+		UNLOCKA(tech_pvt->controldev_lock);
+		POPPA_UNLOCKA(&tech_pvt->controldev_lock);
+	}
 
-  DEBUGA_SKYPE("FINISH\n", SKYPIAX_P_LOG);
-  if (failed)
-    return -1;
-  else
-    return RESULT_SUCCESS;
+	DEBUGA_SKYPE("FINISH\n", SKYPIAX_P_LOG);
+	if (failed)
+		return -1;
+	else
+		return RESULT_SUCCESS;
 }
 
 /************************************************/
@@ -2876,51 +2870,49 @@
  * be representable in 16 bits to avoid overflows.
  */
 #define BOOST_SCALE     (1<<9)
-#define BOOST_MAX       40          /* slightly less than 7 bits */
+#define BOOST_MAX       40		/* slightly less than 7 bits */
 
 /*
  * store the boost factor
  */
 void celliax_store_boost(char *s, double *boost)
 {
-  private_t * tech_pvt  = NULL;
+	private_t *tech_pvt = NULL;
 
-  if (sscanf(s, "%lf", boost) != 1) {
-    ERRORA("invalid boost <%s>\n", SKYPIAX_P_LOG, s);
-    return;
-  }
-  if (*boost < -BOOST_MAX) {
-    WARNINGA("boost %s too small, using %d\n", SKYPIAX_P_LOG, s, -BOOST_MAX);
-    *boost = -BOOST_MAX;
-  } else if (*boost > BOOST_MAX) {
-    WARNINGA("boost %s too large, using %d\n", SKYPIAX_P_LOG, s, BOOST_MAX);
-    *boost = BOOST_MAX;
-  }
-  *boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
-  if (option_debug > 1)
-    DEBUGA_SKYPE("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
+	if (sscanf(s, "%lf", boost) != 1) {
+		ERRORA("invalid boost <%s>\n", SKYPIAX_P_LOG, s);
+		return;
+	}
+	if (*boost < -BOOST_MAX) {
+		WARNINGA("boost %s too small, using %d\n", SKYPIAX_P_LOG, s, -BOOST_MAX);
+		*boost = -BOOST_MAX;
+	} else if (*boost > BOOST_MAX) {
+		WARNINGA("boost %s too large, using %d\n", SKYPIAX_P_LOG, s, BOOST_MAX);
+		*boost = BOOST_MAX;
+	}
+	*boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
+	if (option_debug > 1)
+		DEBUGA_SKYPE("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
 }
 
 
-int celliax_sound_boost(void * data, int samples_num, double boost)
+int celliax_sound_boost(void *data, int samples_num, double boost)
 {
 /* LUIGI RIZZO's magic */
-  if (boost != 0) {             /* scale and clip values */
-    int i, x;
+	if (boost != 0) {			/* scale and clip values */
+		int i, x;
 
-    int16_t *ptr = (int16_t *) data;
+		int16_t *ptr = (int16_t *) data;
 
-    for (i = 0; i < samples_num; i++) {
-      x = (ptr[i] * boost) / BOOST_SCALE;
-      if (x > 32767) {
-        x = 32767;
-      } else if (x < -32768) {
-        x = -32768;
-      }
-      ptr[i] = x;
-    }
-  }
-  return 0;
+		for (i = 0; i < samples_num; i++) {
+			x = (ptr[i] * boost) / BOOST_SCALE;
+			if (x > 32767) {
+				x = 32767;
+			} else if (x < -32768) {
+				x = -32768;
+			}
+			ptr[i] = x;
+		}
+	}
+	return 0;
 }
-
-

Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (14709 => 14710)


--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-09-01 09:43:29 UTC (rev 14709)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-09-01 09:44:32 UTC (rev 14710)
@@ -254,11 +254,10 @@
 		ERRORA("celliax_codec FAILED\n", SKYPIAX_P_LOG);
 		return SWITCH_STATUS_FALSE;
 	}
-
 	//teletone_dtmf_detect_init(&tech_pvt->dtmf_detect, tech_pvt->read_codec.implementation->actual_samples_per_second);
 	teletone_dtmf_detect_init(&tech_pvt->dtmf_detect, 8000);
 
-	if(alsa_init(tech_pvt)){
+	if (alsa_init(tech_pvt)) {
 		ERRORA("alsa_init failed\n", SKYPIAX_P_LOG);
 		return SWITCH_STATUS_FALSE;
 
@@ -269,7 +268,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-                switch_core_timer_sync(&tech_pvt->timer_read);
+	switch_core_timer_sync(&tech_pvt->timer_read);
 
 	if (switch_core_timer_init(&tech_pvt->timer_write, "soft", 20, tech_pvt->write_codec.implementation->samples_per_packet, celliax_module_pool) !=
 		SWITCH_STATUS_SUCCESS) {
@@ -277,7 +276,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-                switch_core_timer_sync(&tech_pvt->timer_write);
+	switch_core_timer_sync(&tech_pvt->timer_write);
 
 
 	switch_clear_flag(tech_pvt, TFLAG_HANGUP);
@@ -682,7 +681,7 @@
 	}
 
 
-		switch_core_timer_next(&tech_pvt->timer_read);
+	switch_core_timer_next(&tech_pvt->timer_read);
 
 	int samples;
 
@@ -695,7 +694,7 @@
 		//switch_core_timer_check(&tech_pvt->timer, SWITCH_TRUE);
 		tech_pvt->read_frame.timestamp = tech_pvt->timer_read.samplecount;
 
-celliax_sound_boost(tech_pvt->read_frame.data, tech_pvt->read_frame.samples, tech_pvt->capture_boost);
+		celliax_sound_boost(tech_pvt->read_frame.data, tech_pvt->read_frame.samples, tech_pvt->capture_boost);
 
 
 
@@ -706,11 +705,10 @@
 		switch_set_flag(tech_pvt, TFLAG_VOICE);
 	}
 
-	if (samples != 160){
+	if (samples != 160) {
 		ERRORA("samples=%d\n", SKYPIAX_P_LOG, samples);
-			goto cng;
-}
-
+		goto cng;
+	}
 //DEBUGA_SKYPE("samples=%d tech_pvt->read_frame.timestamp=%d\n", SKYPIAX_P_LOG, samples, tech_pvt->read_frame.timestamp);
 
 //usleep(17000);
@@ -814,13 +812,13 @@
 	}
 #endif
 
-		switch_core_timer_next(&tech_pvt->timer_write);
+	switch_core_timer_next(&tech_pvt->timer_write);
 	//sent = frame->datalen;
 
 	//ERRORA("PLAY \n", SKYPIAX_P_LOG);
 	//snd_pcm_writei(tech_pvt->alsap, (short *) frame->data, (int) (frame->datalen / 2));
 
-celliax_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost);
+	celliax_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost);
 	sent = alsa_write(tech_pvt, frame->data, (int) (frame->datalen));
 //DEBUGA_SKYPE("sent=%d \n", SKYPIAX_P_LOG, sent);
 
@@ -851,8 +849,8 @@
 {
 	switch_channel_t *channel;
 	private_t *tech_pvt;
-int samples;
-short tmp_buffer[1280];
+	int samples;
+	short tmp_buffer[1280];
 
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel != NULL);
@@ -867,16 +865,16 @@
 			channel_answer_channel(session);
 		}
 		break;
-case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
+	case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
 
 		WARNINGA("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
-	while ((samples = alsa_read(tech_pvt, tmp_buffer, tech_pvt->read_codec.implementation->samples_per_packet * 4)) > 160) {
-		WARNINGA("read %d samples\n", SKYPIAX_P_LOG, samples);
-}
+		while ((samples = alsa_read(tech_pvt, tmp_buffer, tech_pvt->read_codec.implementation->samples_per_packet * 4)) > 160) {
+			WARNINGA("read %d samples\n", SKYPIAX_P_LOG, samples);
+		}
 		switch_core_timer_sync(&tech_pvt->timer_read);
 		switch_core_timer_sync(&tech_pvt->timer_write);
 
-break;
+		break;
 
 
 	default:
@@ -1360,8 +1358,8 @@
 				globals.SKYPIAX_INTERFACES[interface_id].capture_boost = 0;
 				globals.SKYPIAX_INTERFACES[interface_id].playback_boost = 0;
 
-celliax_store_boost("5", &globals.SKYPIAX_INTERFACES[interface_id].capture_boost);
-celliax_store_boost("10", &globals.SKYPIAX_INTERFACES[interface_id].playback_boost);
+				celliax_store_boost("5", &globals.SKYPIAX_INTERFACES[interface_id].capture_boost);
+				celliax_store_boost("10", &globals.SKYPIAX_INTERFACES[interface_id].playback_boost);
 /*********************/
 				DEBUGA_SKYPE
 					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",
@@ -1508,7 +1506,7 @@
 
 
 
-		//alsa_shutdown(&globals.SKYPIAX_INTERFACES[interface_id]);
+			//alsa_shutdown(&globals.SKYPIAX_INTERFACES[interface_id]);
 			if (globals.SKYPIAX_INTERFACES[interface_id].celliax_signaling_thread) {
 #ifdef WIN32
 				switch_file_write(tech_pvt->SkypiaxHandles.fdesc[1], "sciutati", &howmany);	// let's the controldev_thread die
@@ -1940,6 +1938,7 @@
 
 	return SWITCH_STATUS_SUCCESS;
 }
+
 SWITCH_STANDARD_API(sendsms_function)
 {
 	char *mycmd = NULL, *argv[3] = { 0 };
@@ -2142,7 +2141,7 @@
 				//FIXME ERRORA("celliax_new failed! BAD BAD BAD\n", CELLIAX_P_LOG);
 				//FIXME }
 			}
-usleep(100); //give other threads a chance
+			usleep(100);		//give other threads a chance
 		}
 	} else {
 		ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG);