<!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][14625] </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=14625">14625</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-08-24 15:59:09 -0500 (Mon, 24 Aug 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>celliax: monitors the serial port, interpret AT signaling</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 (14624 => 14625)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_celliax/celliax.h        2009-08-24 20:52:11 UTC (rev 14624)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax.h        2009-08-24 20:59:09 UTC (rev 14625)
</span><span class="lines">@@ -59,8 +59,10 @@
</span><span class="cx"> #define         PROTOCOL_NO_SERIAL   3
</span><span class="cx"> 
</span><span class="cx"> #define                AT_BUFSIZ 8192
</span><ins>+//FIXME FIXME FIXME #define AT_MESG_MAX_LENGTH 2048 /* much more than 10 SMSs */
</ins><span class="cx"> #define AT_MESG_MAX_LENGTH 2048 /* much more than 10 SMSs */
</span><del>-#define AT_MESG_MAX_LINES 256   /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */
</del><ins>+//FIXME FIXME FIXME #define AT_MESG_MAX_LINES 256   /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */
+#define AT_MESG_MAX_LINES 20   /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */
</ins><span class="cx"> 
</span><span class="cx"> #define SAMPLERATE_SKYPIAX 16000
</span><span class="cx"> #define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
</span><span class="lines">@@ -189,10 +191,12 @@
</span><span class="cx">   char result[AT_MESG_MAX_LINES][AT_MESG_MAX_LENGTH];
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-struct owner_struct {
-int _state;
</del><ins>+struct ciapa_struct {
+int state;
</ins><span class="cx"> int hangupcause;
</span><span class="cx"> };
</span><ins>+typedef struct ciapa_struct ciapa_t;
+
</ins><span class="cx"> struct private_object {
</span><span class="cx">         unsigned int flags;
</span><span class="cx">         switch_codec_t read_codec;
</span><span class="lines">@@ -384,7 +388,7 @@
</span><span class="cx">   FILE *phonebook_writing_fp;
</span><span class="cx"> 
</span><span class="cx">   struct timeval ringtime;
</span><del>-  struct owner_struct *owner;
</del><ins>+  ciapa_t *owner;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef struct private_object private_t;
</span><span class="lines">@@ -477,13 +481,13 @@
</span><span class="cx"> //#define PUSHA_UNLOCKA(x)    pthread_cleanup_push(celliax_unlocka_log, (void *) x);
</span><span class="cx"> //#define POPPA_UNLOCKA(x)    pthread_cleanup_pop(0);
</span><span class="cx"> 
</span><del>-#define PUSHA_UNLOCKA(x)    ERRORA(&quot;PUSHA_UNLOCKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
-#define POPPA_UNLOCKA(x)    ERRORA(&quot;POPPA_UNLOCKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
-#define LOKKA(x)    ERRORA(&quot;LOKKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
-#define UNLOCKA(x)    ERRORA(&quot;UNLOCKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
</del><ins>+#define PUSHA_UNLOCKA(x)    if(option_debug &gt; 100) ERRORA(&quot;PUSHA_UNLOCKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
+#define POPPA_UNLOCKA(x)    if(option_debug &gt; 100) ERRORA(&quot;POPPA_UNLOCKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
+#define LOKKA(x)    if(option_debug &gt; 100) ERRORA(&quot;LOKKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
+#define UNLOCKA(x)    if(option_debug &gt; 100) ERRORA(&quot;UNLOCKA: %p\n&quot;, SKYPIAX_P_LOG, (void *)x);
</ins><span class="cx"> 
</span><span class="cx"> #define celliax_queue_control(x, y) ERRORA(&quot;celliax_queue_control: %p, %d\n&quot;, SKYPIAX_P_LOG, (void *)x, y);
</span><span class="cx"> 
</span><span class="cx"> #define ast_setstate(x, y) ERRORA(&quot;ast_setstate: %p, %d\n&quot;, SKYPIAX_P_LOG, (void *)x, y);
</span><span class="cx"> 
</span><del>-
</del><ins>+int celliax_serial_read(private_t * tech_pvt);
</ins></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_celliaxcelliax_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c (14624 => 14625)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c        2009-08-24 20:52:11 UTC (rev 14624)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c        2009-08-24 20:59:09 UTC (rev 14625)
</span><span class="lines">@@ -1398,8 +1398,9 @@
</span><span class="cx">         //if (celliax_present(SkypiaxHandles)) 
</span><span class="cx">         if (1) {
</span><span class="cx">                 while (running) {
</span><del>-                        celliax_sleep(1000000); //1 sec
-                        DEBUGA_SKYPE(&quot;ciao!\n&quot;, SKYPIAX_P_LOG);
</del><ins>+                        //celliax_sleep(1000000); //1 sec
+                        //DEBUGA_SKYPE(&quot;ciao!\n&quot;, SKYPIAX_P_LOG);
+                        celliax_serial_read(tech_pvt);
</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 class="lines">@@ -1459,7 +1460,7 @@
</span><span class="cx"> /*  set controldevice_speed */
</span><span class="cx">   rt = cfsetispeed(&amp;tp, tech_pvt-&gt;controldevice_speed);
</span><span class="cx">   if (rt == -1) {
</span><del>-    ERRORA(&quot;serial error: %s&quot;, SKYPIAX_P_LOG, strerror(errno));
</del><ins>+    ERRORA(&quot;serial error: %s, speed was: %d&quot;, SKYPIAX_P_LOG, strerror(errno), tech_pvt-&gt;controldevice_speed);
</ins><span class="cx">   }
</span><span class="cx">   rt = cfsetospeed(&amp;tp, tech_pvt-&gt;controldevice_speed);
</span><span class="cx">   if (rt == -1) {
</span><span class="lines">@@ -1501,6 +1502,22 @@
</span><span class="cx">   return (fd);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+int celliax_serial_read(private_t * tech_pvt)
+{
+  if (tech_pvt-&gt;controldevprotocol == PROTOCOL_AT)
+    return celliax_serial_read_AT(tech_pvt, 0, 100000, 0, NULL, 1);    // a 10th of a second timeout
+#ifdef CELLIAX_FBUS2
+  if (tech_pvt-&gt;controldevprotocol == PROTOCOL_FBUS2)
+    return celliax_serial_read_FBUS2(tech_pvt);
+#endif /* CELLIAX_FBUS2 */
+#ifdef CELLIAX_CVM
+  if (tech_pvt-&gt;controldevprotocol == PROTOCOL_CVM_BUSMAIL)
+    return celliax_serial_read_CVM_BUSMAIL(tech_pvt);
+#endif /* CELLIAX_CVM */
+  return -1;
+}
+
+
</ins><span class="cx"> int celliax_serial_sync(private_t * tech_pvt)
</span><span class="cx"> {
</span><span class="cx">   if (tech_pvt-&gt;controldevprotocol == PROTOCOL_AT)
</span><span class="lines">@@ -2227,7 +2244,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (tech_pvt-&gt;owner &amp;&amp; tech_pvt-&gt;interface_state == CALLFLOW_CALL_DIALING) {
</span><span class="cx">           DEBUGA_PBX(&quot;just received a remote ANSWER\n&quot;, SKYPIAX_P_LOG);
</span><del>-          if (tech_pvt-&gt;owner-&gt;_state != SKYPIAX_STATE_UP) {
</del><ins>+          if (tech_pvt-&gt;owner-&gt;state != SKYPIAX_STATE_UP) {
</ins><span class="cx">             celliax_queue_control(tech_pvt-&gt;owner, SKYPIAX_CONTROL_RINGING);
</span><span class="cx">             DEBUGA_PBX(&quot;just sent SKYPIAX_CONTROL_RINGING\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">             DEBUGA_PBX(&quot;going to send SKYPIAX_CONTROL_ANSWER\n&quot;, SKYPIAX_P_LOG);
</span><span class="lines">@@ -3418,7 +3435,7 @@
</span><span class="cx">   int res;
</span><span class="cx"> 
</span><span class="cx">   if (tech_pvt-&gt;owner) {
</span><del>-    if (tech_pvt-&gt;owner-&gt;_state != SKYPIAX_STATE_UP &amp;&amp; tech_pvt-&gt;owner-&gt;_state != SKYPIAX_STATE_DOWN) {
</del><ins>+    if (tech_pvt-&gt;owner-&gt;state != SKYPIAX_STATE_UP &amp;&amp; tech_pvt-&gt;owner-&gt;state != SKYPIAX_STATE_DOWN) {
</ins><span class="cx">       DEBUGA_SKYPE(&quot;No getstatus, we're neither UP nor DOWN\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">       return 0;
</span><span class="cx">     }
</span></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_celliaxmod_celliaxc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (14624 => 14625)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c        2009-08-24 20:52:11 UTC (rev 14624)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c        2009-08-24 20:59:09 UTC (rev 14625)
</span><span class="lines">@@ -1099,7 +1099,8 @@
</span><span class="cx">                         char *skype_user = NULL;
</span><span class="cx"> 
</span><span class="cx">                         uint32_t interface_id = 0, to = 0, max = 0;
</span><del>-                        uint32_t controldevice_speed = 115200;
</del><ins>+                        uint32_t controldevice_speed = B115200;
+                        int controldevprotocol = PROTOCOL_AT;
</ins><span class="cx"> 
</span><span class="cx">                         tech_pvt = NULL;
</span><span class="cx"> 
</span><span class="lines">@@ -1246,6 +1247,7 @@
</span><span class="cx">                                 switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
</span><span class="cx">                                 switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].controldevice_name, controldevice_name);
</span><span class="cx">                                 globals.SKYPIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
</span><ins>+                                globals.SKYPIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
</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></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>