<!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("device [%s], snd_pcm_close failed with error '%s'\n", SKYPIAX_P_LOG, tech_pvt->alsapname, snd_strerror(err));
</span><span class="cx">                         return -1;
</span><span class="cx">                 }
</span><del>-tech_pvt->alsap = NULL;
</del><ins>+                tech_pvt->alsap = NULL;
</ins><span class="cx">         }
</span><span class="cx">         if (tech_pvt->alsac) {
</span><span class="cx">                 err = snd_pcm_drop(tech_pvt->alsac);
</span><span class="lines">@@ -2071,7 +2071,7 @@
</span><span class="cx">                         ERRORA("device [%s], snd_pcm_close failed with error '%s'\n", SKYPIAX_P_LOG, tech_pvt->alsacname, snd_strerror(err));
</span><span class="cx">                         return -1;
</span><span class="cx">                 }
</span><del>-tech_pvt->alsac = NULL;
</del><ins>+                tech_pvt->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("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
- *
- */
</del><ins>+        //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
+         *
+         */
</ins><span class="cx">
</span><del>- 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;
- }
</del><ins>+        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;
+        }
</ins><span class="cx">
</span><del>- if (tech_pvt->controldevprotocol == PROTOCOL_AT) {
- int err = 0;
- char smscommand[16000];
- memset(smscommand, '\0', sizeof(smscommand));
</del><ins>+        if (tech_pvt->controldevprotocol == PROTOCOL_AT) {
+                int err = 0;
+                char smscommand[16000];
+                memset(smscommand, '\0', sizeof(smscommand));
</ins><span class="cx">
</span><del>- PUSHA_UNLOCKA(&tech_pvt->controldev_lock);
- LOKKA(tech_pvt->controldev_lock);
</del><ins>+                PUSHA_UNLOCKA(&tech_pvt->controldev_lock);
+                LOKKA(tech_pvt->controldev_lock);
</ins><span class="cx">
</span><del>- if (tech_pvt->no_ucs2) {
- sprintf(smscommand, "AT+CMGS=\"%s\"", dest); //TODO: support phones that only accept pdu mode
- } else {
- char dest2[1048];
</del><ins>+                if (tech_pvt->no_ucs2) {
+                        sprintf(smscommand, "AT+CMGS=\"%s\"", 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, "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);
- }
</del><ins>+                        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);
+                        }
</ins><span class="cx">
</span><del>- 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
</del><ins>+                        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
</ins><span class="cx"> #if 1
</span><del>- 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);
</del><ins>+                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);
</ins><span class="cx">
</span><del>- 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;
- }
- }
</del><ins>+                        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;
+                        }
+                }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- //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));
- }
</del><ins>+                //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));
+                }
</ins><span class="cx">
</span><del>- smscommand[strlen(smscommand)] = 0x1A;
- DEBUGA_SKYPE("smscommand len is: %d, text is:|||%s|||\n", SKYPIAX_P_LOG,
- strlen(smscommand), smscommand);
</del><ins>+                smscommand[strlen(smscommand)] = 0x1A;
+                DEBUGA_SKYPE("smscommand len is: %d, text is:|||%s|||\n", 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("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;
- }
</del><ins>+                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;
+                        }
</ins><span class="cx">
</span><del>- 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);
</del><ins>+                        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);
</ins><span class="cx">
</span><del>- if (tech_pvt->at_cmgw[0]) {
</del><ins>+                if (tech_pvt->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, "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);
- }
</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, "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);
+                        }
</ins><span class="cx">
</span><del>- /* 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);
- }
</del><ins>+                        /* 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);
+                        }
</ins><span class="cx">
</span><del>- tech_pvt->at_cmgw[0] = '\0';
- }
- //usleep(500000); //.5 secs
- UNLOCKA(tech_pvt->controldev_lock);
- POPPA_UNLOCKA(&tech_pvt->controldev_lock);
- }
</del><ins>+                        tech_pvt->at_cmgw[0] = '\0';
+                }
+                //usleep(500000); //.5 secs
+                UNLOCKA(tech_pvt->controldev_lock);
+                POPPA_UNLOCKA(&tech_pvt->controldev_lock);
+        }
</ins><span class="cx">
</span><del>- DEBUGA_SKYPE("FINISH\n", SKYPIAX_P_LOG);
- if (failed)
- return -1;
- else
- return RESULT_SUCCESS;
</del><ins>+        DEBUGA_SKYPE("FINISH\n", 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<<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, "%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);
</del><ins>+        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);
</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 < 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;
</del><ins>+                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;
</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("celliax_codec FAILED\n", 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(&tech_pvt->dtmf_detect, tech_pvt->read_codec.implementation->actual_samples_per_second);
</span><span class="cx">         teletone_dtmf_detect_init(&tech_pvt->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("alsa_init failed\n", 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(&tech_pvt->timer_read);
</del><ins>+        switch_core_timer_sync(&tech_pvt->timer_read);
</ins><span class="cx">
</span><span class="cx">         if (switch_core_timer_init(&tech_pvt->timer_write, "soft", 20, tech_pvt->write_codec.implementation->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(&tech_pvt->timer_write);
</del><ins>+        switch_core_timer_sync(&tech_pvt->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(&tech_pvt->timer_read);
</del><ins>+        switch_core_timer_next(&tech_pvt->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(&tech_pvt->timer, SWITCH_TRUE);
</span><span class="cx">                 tech_pvt->read_frame.timestamp = tech_pvt->timer_read.samplecount;
</span><span class="cx">
</span><del>-celliax_sound_boost(tech_pvt->read_frame.data, tech_pvt->read_frame.samples, tech_pvt->capture_boost);
</del><ins>+                celliax_sound_boost(tech_pvt->read_frame.data, tech_pvt->read_frame.samples, tech_pvt->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("samples=%d\n", SKYPIAX_P_LOG, samples);
</span><del>-                        goto cng;
-}
-
</del><ins>+                goto cng;
+        }
</ins><span class="cx"> //DEBUGA_SKYPE("samples=%d tech_pvt->read_frame.timestamp=%d\n", SKYPIAX_P_LOG, samples, tech_pvt->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(&tech_pvt->timer_write);
</del><ins>+        switch_core_timer_next(&tech_pvt->timer_write);
</ins><span class="cx">         //sent = frame->datalen;
</span><span class="cx">
</span><span class="cx">         //ERRORA("PLAY \n", SKYPIAX_P_LOG);
</span><span class="cx">         //snd_pcm_writei(tech_pvt->alsap, (short *) frame->data, (int) (frame->datalen / 2));
</span><span class="cx">
</span><del>-celliax_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost);
</del><ins>+        celliax_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost);
</ins><span class="cx">         sent = alsa_write(tech_pvt, frame->data, (int) (frame->datalen));
</span><span class="cx"> //DEBUGA_SKYPE("sent=%d \n", 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("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
</span><del>-        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);
-}
</del><ins>+                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);
+                }
</ins><span class="cx">                 switch_core_timer_sync(&tech_pvt->timer_read);
</span><span class="cx">                 switch_core_timer_sync(&tech_pvt->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("5", &globals.SKYPIAX_INTERFACES[interface_id].capture_boost);
-celliax_store_boost("10", &globals.SKYPIAX_INTERFACES[interface_id].playback_boost);
</del><ins>+                                celliax_store_boost("5", &globals.SKYPIAX_INTERFACES[interface_id].capture_boost);
+                                celliax_store_boost("10", &globals.SKYPIAX_INTERFACES[interface_id].playback_boost);
</ins><span class="cx"> /*********************/
</span><span class="cx">                                 DEBUGA_SKYPE
</span><span class="cx">                                         ("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",
</span><span class="lines">@@ -1508,7 +1506,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><del>-                //alsa_shutdown(&globals.SKYPIAX_INTERFACES[interface_id]);
</del><ins>+                        //alsa_shutdown(&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->SkypiaxHandles.fdesc[1], "sciutati", &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("celliax_new failed! BAD BAD BAD\n", 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("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>