<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14710] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14710">14710</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-09-01 04:44:32 -0500 (Tue, 01 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>celliax: indented</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchbranchesgmaruzzmod_celliaxcelliaxh">freeswitch/branches/gmaruzz/mod_celliax/celliax.h</a></li>
<li><a href="#freeswitchbranchesgmaruzzmod_celliaxcelliax_protocolc">freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c</a></li>
<li><a href="#freeswitchbranchesgmaruzzmod_celliaxmod_celliaxc">freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchbranchesgmaruzzmod_celliaxcelliaxh"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax.h (14709 => 14710)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -542,7 +542,7 @@
</span><span class="cx"> int celliax_hangup(private_t * tech_pvt);
</span><span class="cx"> int celliax_serial_call(private_t * tech_pvt, char *dstr);
</span><span class="cx"> int celliax_serial_call_AT(private_t * tech_pvt, char *dstr);
</span><del>-int celliax_sendsms( private_t * tech_pvt, char * dest, char * text);
</del><ins>+int celliax_sendsms(private_t * tech_pvt, char *dest, char *text);
</ins><span class="cx"> 
</span><span class="cx"> #ifdef CELLIAX_ALSA
</span><span class="cx"> int alsa_init(private_t * tech_pvt);
</span><span class="lines">@@ -555,4 +555,4 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> void celliax_store_boost(char *s, double *boost);
</span><del>-int celliax_sound_boost(void * data, int samples_num, double boost);
</del><ins>+int celliax_sound_boost(void *data, int samples_num, double boost);
</ins></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_celliaxcelliax_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c (14709 => 14710)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2058,7 +2058,7 @@
</span><span class="cx">                         ERRORA(&quot;device [%s], snd_pcm_close failed with error '%s'\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;alsapname, snd_strerror(err));
</span><span class="cx">                         return -1;
</span><span class="cx">                 }
</span><del>-tech_pvt-&gt;alsap = NULL;
</del><ins>+                tech_pvt-&gt;alsap = NULL;
</ins><span class="cx">         }
</span><span class="cx">         if (tech_pvt-&gt;alsac) {
</span><span class="cx">                 err = snd_pcm_drop(tech_pvt-&gt;alsac);
</span><span class="lines">@@ -2071,7 +2071,7 @@
</span><span class="cx">                         ERRORA(&quot;device [%s], snd_pcm_close failed with error '%s'\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;alsacname, snd_strerror(err));
</span><span class="cx">                         return -1;
</span><span class="cx">                 }
</span><del>-tech_pvt-&gt;alsac = NULL;
</del><ins>+                tech_pvt-&gt;alsac = NULL;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return 0;
</span><span class="lines">@@ -2714,159 +2714,153 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-int celliax_sendsms( private_t * tech_pvt, char * dest, char * text)
</del><ins>+int celliax_sendsms(private_t * tech_pvt, char *dest, char *text)
</ins><span class="cx"> {
</span><del>-  //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;
</del><ins>+        //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;
</ins><span class="cx"> 
</span><del>-  //strncpy(rdest, idest, sizeof(rdest) - 1);
-  DEBUGA_SKYPE(&quot;CelliaxSendsms: dest=%s text=%s\n&quot;, SKYPIAX_P_LOG, dest, text);
-  DEBUGA_SKYPE(&quot;START\n&quot;, 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
-   *
-   */
</del><ins>+        //strncpy(rdest, idest, sizeof(rdest) - 1);
+        DEBUGA_SKYPE(&quot;CelliaxSendsms: dest=%s text=%s\n&quot;, SKYPIAX_P_LOG, dest, text);
+        DEBUGA_SKYPE(&quot;START\n&quot;, 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
+         *
+         */
</ins><span class="cx"> 
</span><del>-  if (tech_pvt-&gt;controldevprotocol != PROTOCOL_AT) {
-    ERRORA(&quot;, SKYPIAX_P_LOGCelliaxSendsms supports only AT command cellphones at the moment :-( !\n&quot;,
-           SKYPIAX_P_LOG);
-    return RESULT_FAILURE;
-  }
</del><ins>+        if (tech_pvt-&gt;controldevprotocol != PROTOCOL_AT) {
+                ERRORA(&quot;, SKYPIAX_P_LOGCelliaxSendsms supports only AT command cellphones at the moment :-( !\n&quot;, SKYPIAX_P_LOG);
+                return RESULT_FAILURE;
+        }
</ins><span class="cx"> 
</span><del>-  if (tech_pvt-&gt;controldevprotocol == PROTOCOL_AT) {
-    int err = 0;
-    char smscommand[16000];
-    memset(smscommand, '\0', sizeof(smscommand));
</del><ins>+        if (tech_pvt-&gt;controldevprotocol == PROTOCOL_AT) {
+                int err = 0;
+                char smscommand[16000];
+                memset(smscommand, '\0', sizeof(smscommand));
</ins><span class="cx"> 
</span><del>-    PUSHA_UNLOCKA(&amp;tech_pvt-&gt;controldev_lock);
-    LOKKA(tech_pvt-&gt;controldev_lock);
</del><ins>+                PUSHA_UNLOCKA(&amp;tech_pvt-&gt;controldev_lock);
+                LOKKA(tech_pvt-&gt;controldev_lock);
</ins><span class="cx"> 
</span><del>-    if (tech_pvt-&gt;no_ucs2) {
-      sprintf(smscommand, &quot;AT+CMGS=\&quot;%s\&quot;&quot;, dest);  //TODO: support phones that only accept pdu mode
-    } else {
-      char dest2[1048];
</del><ins>+                if (tech_pvt-&gt;no_ucs2) {
+                        sprintf(smscommand, &quot;AT+CMGS=\&quot;%s\&quot;&quot;, dest);        //TODO: support phones that only accept pdu mode
+                } else {
+                        char dest2[1048];
</ins><span class="cx"> 
</span><del>-          err = celliax_serial_write_AT_ack(tech_pvt, &quot;AT+CSCS=\&quot;UCS2\&quot;&quot;);
-          if (err) {
-            ERRORA
-              (&quot;AT+CSCS=\&quot;UCS2\&quot; (set TE messages to ucs2)  do not got OK from the phone\n&quot;,
-               SKYPIAX_P_LOG);
-          }
</del><ins>+                        err = celliax_serial_write_AT_ack(tech_pvt, &quot;AT+CSCS=\&quot;UCS2\&quot;&quot;);
+                        if (err) {
+                                ERRORA(&quot;AT+CSCS=\&quot;UCS2\&quot; (set TE messages to ucs2)  do not got OK from the phone\n&quot;, SKYPIAX_P_LOG);
+                        }
</ins><span class="cx"> 
</span><del>-      memset(dest2, '\0', sizeof(dest2));
-      utf_to_ucs2(tech_pvt, dest, strlen(dest), dest2, sizeof(dest2));
-      sprintf(smscommand, &quot;AT+CMGS=\&quot;%s\&quot;&quot;, 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(&quot;Error sending SMS\n&quot;, SKYPIAX_P_LOG);
-      failed = 1;
-      goto uscita;
-    }
-    err = celliax_serial_AT_expect(tech_pvt, &quot;&gt; &quot;, 0, 1);  // wait 1.5s for the prompt, no  crlf
</del><ins>+                        memset(dest2, '\0', sizeof(dest2));
+                        utf_to_ucs2(tech_pvt, dest, strlen(dest), dest2, sizeof(dest2));
+                        sprintf(smscommand, &quot;AT+CMGS=\&quot;%s\&quot;&quot;, 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(&quot;Error sending SMS\n&quot;, SKYPIAX_P_LOG);
+                        failed = 1;
+                        goto uscita;
+                }
+                err = celliax_serial_AT_expect(tech_pvt, &quot;&gt; &quot;, 0, 1);        // wait 1.5s for the prompt, no  crlf
</ins><span class="cx"> #if 1
</span><del>-    if (err) {
-      DEBUGA_SKYPE
-        (&quot;Error or timeout getting prompt '&gt; ' 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&quot;,
-         SKYPIAX_P_LOG);
</del><ins>+                if (err) {
+                        DEBUGA_SKYPE
+                                (&quot;Error or timeout getting prompt '&gt; ' 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&quot;,
+                                 SKYPIAX_P_LOG);
</ins><span class="cx"> 
</span><del>-      err = celliax_serial_write_AT_ack(tech_pvt, &quot;ATE1&quot;); //motorola (at least c350) do not echo the '&gt;' prompt when in ATE0... go figure!!!!
-      if (err) {
-        ERRORA(&quot;Error activating echo from modem\n&quot;, SKYPIAX_P_LOG);
-      }
-      tech_pvt-&gt;at_cmgw[0] = '\0';
-      sprintf(smscommand, &quot;AT+CMGW=\&quot;%s\&quot;&quot;, dest);  //TODO: support phones that only accept pdu mode
-      err = celliax_serial_write_AT_noack(tech_pvt, smscommand);
-      if (err) {
-        ERRORA(&quot;Error writing SMS destination to the cellphone memory\n&quot;, SKYPIAX_P_LOG);
-        failed = 1;
-        goto uscita;
-      }
-      err = celliax_serial_AT_expect(tech_pvt, &quot;&gt; &quot;, 0, 1);    // wait 1.5s for the prompt, no  crlf
-      if (err) {
-        ERRORA
-          (&quot;Error or timeout getting prompt '&gt; ' for writing sms text in cellphone memory\n&quot;,
-           SKYPIAX_P_LOG);
-        failed = 1;
-        goto uscita;
-      }
-    }
</del><ins>+                        err = celliax_serial_write_AT_ack(tech_pvt, &quot;ATE1&quot;);        //motorola (at least c350) do not echo the '&gt;' prompt when in ATE0... go figure!!!!
+                        if (err) {
+                                ERRORA(&quot;Error activating echo from modem\n&quot;, SKYPIAX_P_LOG);
+                        }
+                        tech_pvt-&gt;at_cmgw[0] = '\0';
+                        sprintf(smscommand, &quot;AT+CMGW=\&quot;%s\&quot;&quot;, dest);        //TODO: support phones that only accept pdu mode
+                        err = celliax_serial_write_AT_noack(tech_pvt, smscommand);
+                        if (err) {
+                                ERRORA(&quot;Error writing SMS destination to the cellphone memory\n&quot;, SKYPIAX_P_LOG);
+                                failed = 1;
+                                goto uscita;
+                        }
+                        err = celliax_serial_AT_expect(tech_pvt, &quot;&gt; &quot;, 0, 1);        // wait 1.5s for the prompt, no  crlf
+                        if (err) {
+                                ERRORA(&quot;Error or timeout getting prompt '&gt; ' for writing sms text in cellphone memory\n&quot;, SKYPIAX_P_LOG);
+                                failed = 1;
+                                goto uscita;
+                        }
+                }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    //sprintf(text,&quot;ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大&quot;); //let's test the beauty of utf
-    memset(smscommand, '\0', sizeof(smscommand));
-    if (tech_pvt-&gt;no_ucs2) {
-      sprintf(smscommand, &quot;%s&quot;, text);
-    } else {
-      utf_to_ucs2(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand));
-    }
</del><ins>+                //sprintf(text,&quot;ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大&quot;); //let's test the beauty of utf
+                memset(smscommand, '\0', sizeof(smscommand));
+                if (tech_pvt-&gt;no_ucs2) {
+                        sprintf(smscommand, &quot;%s&quot;, text);
+                } else {
+                        utf_to_ucs2(tech_pvt, text, strlen(text), smscommand, sizeof(smscommand));
+                }
</ins><span class="cx"> 
</span><del>-    smscommand[strlen(smscommand)] = 0x1A;
-    DEBUGA_SKYPE(&quot;smscommand len is: %d, text is:|||%s|||\n&quot;, SKYPIAX_P_LOG,
-              strlen(smscommand), smscommand);
</del><ins>+                smscommand[strlen(smscommand)] = 0x1A;
+                DEBUGA_SKYPE(&quot;smscommand len is: %d, text is:|||%s|||\n&quot;, SKYPIAX_P_LOG, strlen(smscommand), smscommand);
</ins><span class="cx"> 
</span><del>-    err = celliax_serial_write_AT_ack_nocr_longtime(tech_pvt, smscommand);
-    //TODO would be better to unlock controldev here
-    if (err) {
-      ERRORA(&quot;Error writing SMS text to the cellphone memory\n&quot;, SKYPIAX_P_LOG);
-      //return RESULT_FAILURE;
-      failed = 1;
-      goto uscita;
-    }
-    if (tech_pvt-&gt;at_cmgw[0]) {
-      sprintf(smscommand, &quot;AT+CMSS=%s&quot;, tech_pvt-&gt;at_cmgw);
-      err = celliax_serial_write_AT_expect_longtime(tech_pvt, smscommand, &quot;OK&quot;);
-      if (err) {
-        ERRORA(&quot;Error sending SMS from the cellphone memory\n&quot;, SKYPIAX_P_LOG);
-        //return RESULT_FAILURE;
-        failed = 1;
-        goto uscita;
-      }
</del><ins>+                err = celliax_serial_write_AT_ack_nocr_longtime(tech_pvt, smscommand);
+                //TODO would be better to unlock controldev here
+                if (err) {
+                        ERRORA(&quot;Error writing SMS text to the cellphone memory\n&quot;, SKYPIAX_P_LOG);
+                        //return RESULT_FAILURE;
+                        failed = 1;
+                        goto uscita;
+                }
+                if (tech_pvt-&gt;at_cmgw[0]) {
+                        sprintf(smscommand, &quot;AT+CMSS=%s&quot;, tech_pvt-&gt;at_cmgw);
+                        err = celliax_serial_write_AT_expect_longtime(tech_pvt, smscommand, &quot;OK&quot;);
+                        if (err) {
+                                ERRORA(&quot;Error sending SMS from the cellphone memory\n&quot;, SKYPIAX_P_LOG);
+                                //return RESULT_FAILURE;
+                                failed = 1;
+                                goto uscita;
+                        }
</ins><span class="cx"> 
</span><del>-      err = celliax_serial_write_AT_ack(tech_pvt, &quot;ATE0&quot;); //motorola (at least c350) do not echo the '&gt;' prompt when in ATE0... go figure!!!!
-      if (err) {
-        ERRORA(&quot;Error de-activating echo from modem\n&quot;, SKYPIAX_P_LOG);
-      }
-    }
-  uscita:
-    usleep(1000);
</del><ins>+                        err = celliax_serial_write_AT_ack(tech_pvt, &quot;ATE0&quot;);        //motorola (at least c350) do not echo the '&gt;' prompt when in ATE0... go figure!!!!
+                        if (err) {
+                                ERRORA(&quot;Error de-activating echo from modem\n&quot;, SKYPIAX_P_LOG);
+                        }
+                }
+          uscita:
+                usleep(1000);
</ins><span class="cx"> 
</span><del>-    if (tech_pvt-&gt;at_cmgw[0]) {
</del><ins>+                if (tech_pvt-&gt;at_cmgw[0]) {
</ins><span class="cx"> 
</span><del>-      /* 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, &quot;AT+CMGR=%s&quot;, tech_pvt-&gt;at_cmgw);
-      err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
-      if (err) {
-        ERRORA(&quot;Error reading SMS back from the cellphone memory\n&quot;, SKYPIAX_P_LOG);
-      }
</del><ins>+                        /* 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, &quot;AT+CMGR=%s&quot;, tech_pvt-&gt;at_cmgw);
+                        err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
+                        if (err) {
+                                ERRORA(&quot;Error reading SMS back from the cellphone memory\n&quot;, SKYPIAX_P_LOG);
+                        }
</ins><span class="cx"> 
</span><del>-      /* let's delete from cellphone memory what we've sent */
-      sprintf(smscommand, &quot;AT+CMGD=%s&quot;, tech_pvt-&gt;at_cmgw);
-      err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
-      if (err) {
-        ERRORA(&quot;Error deleting SMS from the cellphone memory\n&quot;, SKYPIAX_P_LOG);
-      }
</del><ins>+                        /* let's delete from cellphone memory what we've sent */
+                        sprintf(smscommand, &quot;AT+CMGD=%s&quot;, tech_pvt-&gt;at_cmgw);
+                        err = celliax_serial_write_AT_ack(tech_pvt, smscommand);
+                        if (err) {
+                                ERRORA(&quot;Error deleting SMS from the cellphone memory\n&quot;, SKYPIAX_P_LOG);
+                        }
</ins><span class="cx"> 
</span><del>-      tech_pvt-&gt;at_cmgw[0] = '\0';
-    }
-    //usleep(500000);             //.5 secs
-    UNLOCKA(tech_pvt-&gt;controldev_lock);
-    POPPA_UNLOCKA(&amp;tech_pvt-&gt;controldev_lock);
-  }
</del><ins>+                        tech_pvt-&gt;at_cmgw[0] = '\0';
+                }
+                //usleep(500000);             //.5 secs
+                UNLOCKA(tech_pvt-&gt;controldev_lock);
+                POPPA_UNLOCKA(&amp;tech_pvt-&gt;controldev_lock);
+        }
</ins><span class="cx"> 
</span><del>-  DEBUGA_SKYPE(&quot;FINISH\n&quot;, SKYPIAX_P_LOG);
-  if (failed)
-    return -1;
-  else
-    return RESULT_SUCCESS;
</del><ins>+        DEBUGA_SKYPE(&quot;FINISH\n&quot;, SKYPIAX_P_LOG);
+        if (failed)
+                return -1;
+        else
+                return RESULT_SUCCESS;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /************************************************/
</span><span class="lines">@@ -2876,51 +2870,49 @@
</span><span class="cx">  * be representable in 16 bits to avoid overflows.
</span><span class="cx">  */
</span><span class="cx"> #define BOOST_SCALE     (1&lt;&lt;9)
</span><del>-#define BOOST_MAX       40          /* slightly less than 7 bits */
</del><ins>+#define BOOST_MAX       40                /* slightly less than 7 bits */
</ins><span class="cx"> 
</span><span class="cx"> /*
</span><span class="cx">  * store the boost factor
</span><span class="cx">  */
</span><span class="cx"> void celliax_store_boost(char *s, double *boost)
</span><span class="cx"> {
</span><del>-  private_t * tech_pvt  = NULL;
</del><ins>+        private_t *tech_pvt = NULL;
</ins><span class="cx"> 
</span><del>-  if (sscanf(s, &quot;%lf&quot;, boost) != 1) {
-    ERRORA(&quot;invalid boost &lt;%s&gt;\n&quot;, SKYPIAX_P_LOG, s);
-    return;
-  }
-  if (*boost &lt; -BOOST_MAX) {
-    WARNINGA(&quot;boost %s too small, using %d\n&quot;, SKYPIAX_P_LOG, s, -BOOST_MAX);
-    *boost = -BOOST_MAX;
-  } else if (*boost &gt; BOOST_MAX) {
-    WARNINGA(&quot;boost %s too large, using %d\n&quot;, SKYPIAX_P_LOG, s, BOOST_MAX);
-    *boost = BOOST_MAX;
-  }
-  *boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
-  if (option_debug &gt; 1)
-    DEBUGA_SKYPE(&quot;setting boost %s to %f\n&quot;, SKYPIAX_P_LOG, s, *boost);
</del><ins>+        if (sscanf(s, &quot;%lf&quot;, boost) != 1) {
+                ERRORA(&quot;invalid boost &lt;%s&gt;\n&quot;, SKYPIAX_P_LOG, s);
+                return;
+        }
+        if (*boost &lt; -BOOST_MAX) {
+                WARNINGA(&quot;boost %s too small, using %d\n&quot;, SKYPIAX_P_LOG, s, -BOOST_MAX);
+                *boost = -BOOST_MAX;
+        } else if (*boost &gt; BOOST_MAX) {
+                WARNINGA(&quot;boost %s too large, using %d\n&quot;, SKYPIAX_P_LOG, s, BOOST_MAX);
+                *boost = BOOST_MAX;
+        }
+        *boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
+        if (option_debug &gt; 1)
+                DEBUGA_SKYPE(&quot;setting boost %s to %f\n&quot;, SKYPIAX_P_LOG, s, *boost);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-int celliax_sound_boost(void * data, int samples_num, double boost)
</del><ins>+int celliax_sound_boost(void *data, int samples_num, double boost)
</ins><span class="cx"> {
</span><span class="cx"> /* LUIGI RIZZO's magic */
</span><del>-  if (boost != 0) {             /* scale and clip values */
-    int i, x;
</del><ins>+        if (boost != 0) {                        /* scale and clip values */
+                int i, x;
</ins><span class="cx"> 
</span><del>-    int16_t *ptr = (int16_t *) data;
</del><ins>+                int16_t *ptr = (int16_t *) data;
</ins><span class="cx"> 
</span><del>-    for (i = 0; i &lt; samples_num; i++) {
-      x = (ptr[i] * boost) / BOOST_SCALE;
-      if (x &gt; 32767) {
-        x = 32767;
-      } else if (x &lt; -32768) {
-        x = -32768;
-      }
-      ptr[i] = x;
-    }
-  }
-  return 0;
</del><ins>+                for (i = 0; i &lt; samples_num; i++) {
+                        x = (ptr[i] * boost) / BOOST_SCALE;
+                        if (x &gt; 32767) {
+                                x = 32767;
+                        } else if (x &lt; -32768) {
+                                x = -32768;
+                        }
+                        ptr[i] = x;
+                }
+        }
+        return 0;
</ins><span class="cx"> }
</span><del>-
-
</del></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_celliaxmod_celliaxc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (14709 => 14710)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -254,11 +254,10 @@
</span><span class="cx">                 ERRORA(&quot;celliax_codec FAILED\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><del>-
</del><span class="cx">         //teletone_dtmf_detect_init(&amp;tech_pvt-&gt;dtmf_detect, tech_pvt-&gt;read_codec.implementation-&gt;actual_samples_per_second);
</span><span class="cx">         teletone_dtmf_detect_init(&amp;tech_pvt-&gt;dtmf_detect, 8000);
</span><span class="cx"> 
</span><del>-        if(alsa_init(tech_pvt)){
</del><ins>+        if (alsa_init(tech_pvt)) {
</ins><span class="cx">                 ERRORA(&quot;alsa_init failed\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx"> 
</span><span class="lines">@@ -269,7 +268,7 @@
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-                switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
</del><ins>+        switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
</ins><span class="cx"> 
</span><span class="cx">         if (switch_core_timer_init(&amp;tech_pvt-&gt;timer_write, &quot;soft&quot;, 20, tech_pvt-&gt;write_codec.implementation-&gt;samples_per_packet, celliax_module_pool) !=
</span><span class="cx">                 SWITCH_STATUS_SUCCESS) {
</span><span class="lines">@@ -277,7 +276,7 @@
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-                switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
</del><ins>+        switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">         switch_clear_flag(tech_pvt, TFLAG_HANGUP);
</span><span class="lines">@@ -682,7 +681,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-                switch_core_timer_next(&amp;tech_pvt-&gt;timer_read);
</del><ins>+        switch_core_timer_next(&amp;tech_pvt-&gt;timer_read);
</ins><span class="cx"> 
</span><span class="cx">         int samples;
</span><span class="cx"> 
</span><span class="lines">@@ -695,7 +694,7 @@
</span><span class="cx">                 //switch_core_timer_check(&amp;tech_pvt-&gt;timer, SWITCH_TRUE);
</span><span class="cx">                 tech_pvt-&gt;read_frame.timestamp = tech_pvt-&gt;timer_read.samplecount;
</span><span class="cx"> 
</span><del>-celliax_sound_boost(tech_pvt-&gt;read_frame.data, tech_pvt-&gt;read_frame.samples, tech_pvt-&gt;capture_boost);
</del><ins>+                celliax_sound_boost(tech_pvt-&gt;read_frame.data, tech_pvt-&gt;read_frame.samples, tech_pvt-&gt;capture_boost);
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -706,11 +705,10 @@
</span><span class="cx">                 switch_set_flag(tech_pvt, TFLAG_VOICE);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (samples != 160){
</del><ins>+        if (samples != 160) {
</ins><span class="cx">                 ERRORA(&quot;samples=%d\n&quot;, SKYPIAX_P_LOG, samples);
</span><del>-                        goto cng;
-}
-
</del><ins>+                goto cng;
+        }
</ins><span class="cx"> //DEBUGA_SKYPE(&quot;samples=%d tech_pvt-&gt;read_frame.timestamp=%d\n&quot;, SKYPIAX_P_LOG, samples, tech_pvt-&gt;read_frame.timestamp);
</span><span class="cx"> 
</span><span class="cx"> //usleep(17000);
</span><span class="lines">@@ -814,13 +812,13 @@
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-                switch_core_timer_next(&amp;tech_pvt-&gt;timer_write);
</del><ins>+        switch_core_timer_next(&amp;tech_pvt-&gt;timer_write);
</ins><span class="cx">         //sent = frame-&gt;datalen;
</span><span class="cx"> 
</span><span class="cx">         //ERRORA(&quot;PLAY \n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">         //snd_pcm_writei(tech_pvt-&gt;alsap, (short *) frame-&gt;data, (int) (frame-&gt;datalen / 2));
</span><span class="cx"> 
</span><del>-celliax_sound_boost(frame-&gt;data, frame-&gt;samples, tech_pvt-&gt;playback_boost);
</del><ins>+        celliax_sound_boost(frame-&gt;data, frame-&gt;samples, tech_pvt-&gt;playback_boost);
</ins><span class="cx">         sent = alsa_write(tech_pvt, frame-&gt;data, (int) (frame-&gt;datalen));
</span><span class="cx"> //DEBUGA_SKYPE(&quot;sent=%d \n&quot;, SKYPIAX_P_LOG, sent);
</span><span class="cx"> 
</span><span class="lines">@@ -851,8 +849,8 @@
</span><span class="cx"> {
</span><span class="cx">         switch_channel_t *channel;
</span><span class="cx">         private_t *tech_pvt;
</span><del>-int samples;
-short tmp_buffer[1280];
</del><ins>+        int samples;
+        short tmp_buffer[1280];
</ins><span class="cx"> 
</span><span class="cx">         channel = switch_core_session_get_channel(session);
</span><span class="cx">         switch_assert(channel != NULL);
</span><span class="lines">@@ -867,16 +865,16 @@
</span><span class="cx">                         channel_answer_channel(session);
</span><span class="cx">                 }
</span><span class="cx">                 break;
</span><del>-case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
</del><ins>+        case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
</ins><span class="cx"> 
</span><span class="cx">                 WARNINGA(&quot;%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n&quot;, SKYPIAX_P_LOG, switch_channel_get_name(channel));
</span><del>-        while ((samples = alsa_read(tech_pvt, tmp_buffer, tech_pvt-&gt;read_codec.implementation-&gt;samples_per_packet * 4)) &gt; 160) {
-                WARNINGA(&quot;read %d samples\n&quot;, SKYPIAX_P_LOG, samples);
-}
</del><ins>+                while ((samples = alsa_read(tech_pvt, tmp_buffer, tech_pvt-&gt;read_codec.implementation-&gt;samples_per_packet * 4)) &gt; 160) {
+                        WARNINGA(&quot;read %d samples\n&quot;, SKYPIAX_P_LOG, samples);
+                }
</ins><span class="cx">                 switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
</span><span class="cx">                 switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
</span><span class="cx"> 
</span><del>-break;
</del><ins>+                break;
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">         default:
</span><span class="lines">@@ -1360,8 +1358,8 @@
</span><span class="cx">                                 globals.SKYPIAX_INTERFACES[interface_id].capture_boost = 0;
</span><span class="cx">                                 globals.SKYPIAX_INTERFACES[interface_id].playback_boost = 0;
</span><span class="cx"> 
</span><del>-celliax_store_boost(&quot;5&quot;, &amp;globals.SKYPIAX_INTERFACES[interface_id].capture_boost);
-celliax_store_boost(&quot;10&quot;, &amp;globals.SKYPIAX_INTERFACES[interface_id].playback_boost);
</del><ins>+                                celliax_store_boost(&quot;5&quot;, &amp;globals.SKYPIAX_INTERFACES[interface_id].capture_boost);
+                                celliax_store_boost(&quot;10&quot;, &amp;globals.SKYPIAX_INTERFACES[interface_id].playback_boost);
</ins><span class="cx"> /*********************/
</span><span class="cx">                                 DEBUGA_SKYPE
</span><span class="cx">                                         (&quot;interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n&quot;,
</span><span class="lines">@@ -1508,7 +1506,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-                //alsa_shutdown(&amp;globals.SKYPIAX_INTERFACES[interface_id]);
</del><ins>+                        //alsa_shutdown(&amp;globals.SKYPIAX_INTERFACES[interface_id]);
</ins><span class="cx">                         if (globals.SKYPIAX_INTERFACES[interface_id].celliax_signaling_thread) {
</span><span class="cx"> #ifdef WIN32
</span><span class="cx">                                 switch_file_write(tech_pvt-&gt;SkypiaxHandles.fdesc[1], &quot;sciutati&quot;, &amp;howmany);        // let's the controldev_thread die
</span><span class="lines">@@ -1940,6 +1938,7 @@
</span><span class="cx"> 
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> SWITCH_STANDARD_API(sendsms_function)
</span><span class="cx"> {
</span><span class="cx">         char *mycmd = NULL, *argv[3] = { 0 };
</span><span class="lines">@@ -2142,7 +2141,7 @@
</span><span class="cx">                                 //FIXME ERRORA(&quot;celliax_new failed! BAD BAD BAD\n&quot;, CELLIAX_P_LOG);
</span><span class="cx">                                 //FIXME }
</span><span class="cx">                         }
</span><del>-usleep(100); //give other threads a chance
</del><ins>+                        usleep(100);                //give other threads a chance
</ins><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 ERRORA(&quot;Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n&quot;, SKYPIAX_P_LOG);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>