<!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][14903] </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=14903">14903</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-09-17 12:51:11 -0500 (Thu, 17 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>celliax: it has not to answer each call is incoming: go to the RING state, wait for an explicit answer()</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 (14902 => 14903)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_celliax/celliax.h        2009-09-17 17:27:15 UTC (rev 14902)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax.h        2009-09-17 17:51:11 UTC (rev 14903)
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> #define CELLIAX_CAUSE_FAILURE                2
</span><span class="cx"> #define CELLIAX_CAUSE_NO_ANSWER                3
</span><span class="cx"> /*********************************/
</span><del>-#define CELLIAX_FRAME_DTMF                        1
</del><ins>+#define CELLIAX_FRAME_DTMF                1
</ins><span class="cx"> /*********************************/
</span><span class="cx"> #define CELLIAX_CONTROL_RINGING                1
</span><span class="cx"> #define CELLIAX_CONTROL_ANSWER                2
</span><span class="lines">@@ -136,22 +136,22 @@
</span><span class="cx"> #define CELLIAX_CONTROL_BUSY                4
</span><span class="cx"> 
</span><span class="cx"> /*********************************/
</span><del>-#define                CELLIAX_STATE_IDLE                                        0
-#define                CELLIAX_STATE_DOWN                                        1
-#define                CELLIAX_STATE_RING                                        2
</del><ins>+#define                CELLIAX_STATE_IDLE                                0
+#define                CELLIAX_STATE_DOWN                                1
+#define                CELLIAX_STATE_RING                                2
</ins><span class="cx"> #define                CELLIAX_STATE_DIALING                                3
</span><del>-#define                CELLIAX_STATE_BUSY                                        4
-#define                CELLIAX_STATE_UP                                        5
</del><ins>+#define                CELLIAX_STATE_BUSY                                4
+#define                CELLIAX_STATE_UP                                5
</ins><span class="cx"> #define                CELLIAX_STATE_RINGING                                6
</span><span class="cx"> #define                CELLIAX_STATE_PRERING                                7
</span><del>-#define                CELLIAX_STATE_ERROR_DOUBLE_CALL                8
</del><ins>+#define                CELLIAX_STATE_ERROR_DOUBLE_CALL                        8
</ins><span class="cx"> #define                CELLIAX_STATE_SELECTED                                9
</span><del>-#define         CELLIAX_STATE_HANGUP_REQUESTED                10
</del><ins>+#define         CELLIAX_STATE_HANGUP_REQUESTED                        10
</ins><span class="cx"> #define                CELLIAX_STATE_PREANSWER                                11
</span><span class="cx"> /*********************************/
</span><span class="cx"> /* call flow from the device */
</span><del>-#define         CALLFLOW_CALL_IDLE                                        0
-#define         CALLFLOW_CALL_DOWN                                        1
</del><ins>+#define         CALLFLOW_CALL_IDLE                                0
+#define         CALLFLOW_CALL_DOWN                                1
</ins><span class="cx"> #define         CALLFLOW_INCOMING_RING                                2
</span><span class="cx"> #define         CALLFLOW_CALL_DIALING                                3
</span><span class="cx"> #define         CALLFLOW_CALL_LINEBUSY                                4
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx"> #define         CALLFLOW_CALL_INCOMING                                10
</span><span class="cx"> #define         CALLFLOW_CALL_FAILED                                11
</span><span class="cx"> #define         CALLFLOW_CALL_NOSERVICE                                12
</span><del>-#define         CALLFLOW_CALL_OUTGOINGRESTRICTED        13
</del><ins>+#define         CALLFLOW_CALL_OUTGOINGRESTRICTED                13
</ins><span class="cx"> #define         CALLFLOW_CALL_SECURITYFAIL                        14
</span><span class="cx"> #define         CALLFLOW_CALL_NOANSWER                                15
</span><span class="cx"> #define         CALLFLOW_STATUS_FINISHED                        16
</span><span class="lines">@@ -178,6 +178,7 @@
</span><span class="cx"> #define         CALLFLOW_INCOMING_CALLID                        25
</span><span class="cx"> #define         CALLFLOW_STATUS_REMOTEHOLD                        26
</span><span class="cx"> #define         CALLFLOW_CALL_REMOTEANSWER                        27
</span><ins>+#define         CALLFLOW_CALL_HANGUP_REQUESTED                        28
</ins><span class="cx"> 
</span><span class="cx"> /*********************************/
</span><span class="cx"> 
</span><span class="lines">@@ -558,3 +559,4 @@
</span><span class="cx"> void celliax_store_boost(char *s, double *boost);
</span><span class="cx"> int celliax_sound_boost(void *data, int samples_num, double boost);
</span><span class="cx"> int sms_incoming(private_t * tech_pvt, char *value);
</span><ins>+int celliax_ring(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 (14902 => 14903)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c        2009-09-17 17:27:15 UTC (rev 14902)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c        2009-09-17 17:51:11 UTC (rev 14903)
</span><span class="lines">@@ -704,12 +704,14 @@
</span><span class="cx">                                         switch_core_session_t *session = NULL;
</span><span class="cx">                                         switch_channel_t *channel = NULL;
</span><span class="cx"> 
</span><ins>+tech_pvt-&gt;interface_state = CELLIAX_STATE_DOWN;
+
</ins><span class="cx">                                         session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
</span><span class="cx">                                         if(session){
</span><span class="cx">                                                 channel = switch_core_session_get_channel(session);
</span><del>-                                                switch_channel_hangup(channel, 0);
</del><span class="cx">                                                 //celliax_hangup(tech_pvt);
</span><span class="cx">                                                 switch_core_session_rwunlock(session);
</span><ins>+                                                switch_channel_hangup(channel, 0);
</ins><span class="cx">                                         }
</span><span class="cx">                                         //
</span><span class="cx">                                         //tech_pvt-&gt;owner-&gt;hangupcause = CELLIAX_CAUSE_FAILURE;
</span><span class="lines">@@ -1961,7 +1963,50 @@
</span><span class="cx">         }
</span><span class="cx">         return res;
</span><span class="cx"> }
</span><ins>+int celliax_ring(private_t * tech_pvt)
+{
+        int res=0;
+        switch_core_session_t *session = NULL;
+        switch_channel_t *channel = NULL;
</ins><span class="cx"> 
</span><ins>+        if (option_debug) {
+                DEBUGA_PBX(&quot;ENTERING FUNC\n&quot;, CELLIAX_P_LOG);
+        }
+
+        session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
+        if(session){
+                switch_core_session_rwunlock(session);
+                return 0;
+        }
+
+        new_inbound_channel(tech_pvt);
+
+        usleep(10000);
+
+        session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
+        if(session){
+                channel = switch_core_session_get_channel(session);
+
+                switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
+                if(channel){
+                        switch_channel_mark_ring_ready(channel);
+                } else {
+                        ERRORA(&quot;no session\n&quot;, CELLIAX_P_LOG);
+                }
+                switch_core_session_rwunlock(session);
+        } else {
+                ERRORA(&quot;no session\n&quot;, CELLIAX_P_LOG);
+
+        }
+
+
+        if (option_debug) {
+                DEBUGA_PBX(&quot;EXITING FUNC\n&quot;, CELLIAX_P_LOG);
+        }
+        return res;
+}
+
+
</ins><span class="cx"> /*! \brief  Hangup celliax call
</span><span class="cx">  * Part of PBX interface, called from ast_hangup */
</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 (14902 => 14903)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c        2009-09-17 17:27:15 UTC (rev 14902)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c        2009-09-17 17:51:11 UTC (rev 14903)
</span><span class="lines">@@ -521,6 +521,8 @@
</span><span class="cx">         tech_pvt = switch_core_session_get_private(session);
</span><span class="cx">         switch_assert(tech_pvt != NULL);
</span><span class="cx"> 
</span><ins>+tech_pvt-&gt;phone_callflow = CALLFLOW_CALL_HANGUP_REQUESTED;
+
</ins><span class="cx">         if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
</span><span class="cx">                 if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
</span><span class="cx">                         tech_pvt-&gt;ob_failed_calls++;
</span><span class="lines">@@ -529,6 +531,7 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">         DEBUGA_CELLIAX(&quot;%s CHANNEL HANGUP\n&quot;, CELLIAX_P_LOG, tech_pvt-&gt;name);
</span><span class="cx">         switch_clear_flag(tech_pvt, TFLAG_IO);
</span><span class="cx">         switch_clear_flag(tech_pvt, TFLAG_VOICE);
</span><span class="lines">@@ -847,6 +850,36 @@
</span><span class="cx">         tech_pvt = switch_core_session_get_private(session);
</span><span class="cx">         switch_assert(tech_pvt != NULL);
</span><span class="cx"> 
</span><ins>+        //ERRORA(&quot;%s CHANNEL INIT\n&quot;, CELLIAX_P_LOG, tech_pvt-&gt;name);
+        switch_set_flag(tech_pvt, TFLAG_IO);
+celliax_serial_answer(tech_pvt);
+
+        /* Move channel's state machine to ROUTING. This means the call is trying
+           to get from the initial start where the call because, to the point
+           where a destination has been identified. If the channel is simply
+           left in the initial state, nothing will happen. */
+        switch_channel_set_state(channel, CS_ROUTING);
+        switch_mutex_lock(globals.mutex);
+        globals.calls++;
+
+        switch_mutex_unlock(globals.mutex);
+        DEBUGA_CELLIAX(&quot;%s CHANNEL ANSWER %s\n&quot;, CELLIAX_P_LOG, tech_pvt-&gt;name, switch_core_session_get_uuid(session));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
</ins><span class="cx">         DEBUGA_CELLIAX(&quot;ANSWERED! \n&quot;, CELLIAX_P_LOG);
</span><span class="cx"> 
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="lines">@@ -1721,7 +1754,7 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         if (channel) {
</span><del>-                switch_channel_mark_answered(channel);
</del><ins>+                //switch_channel_mark_answered(channel);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         DEBUGA_CELLIAX(&quot;new_inbound_channel\n&quot;, CELLIAX_P_LOG);
</span><span class="lines">@@ -2169,9 +2202,12 @@
</span><span class="cx">                                 tech_pvt-&gt;controldev_dead = 1;
</span><span class="cx">                                 close(tech_pvt-&gt;controldevfd);
</span><span class="cx">                                 ERRORA(&quot;celliax_serial_monitor failed, declaring %s dead\n&quot;, CELLIAX_P_LOG, tech_pvt-&gt;controldevice_name);
</span><del>-                        } else if (tech_pvt-&gt;controldevprotocol != PROTOCOL_NO_SERIAL &amp;&amp; tech_pvt-&gt;interface_state == CELLIAX_STATE_RING) {
-                                WARNINGA(&quot;INCOMING RING, let's take the incoming call\n&quot;, CELLIAX_P_LOG);
-                                celliax_answer(tech_pvt);
</del><ins>+                        } else if (tech_pvt-&gt;controldevprotocol != PROTOCOL_NO_SERIAL &amp;&amp; tech_pvt-&gt;interface_state == CELLIAX_STATE_RING &amp;&amp; tech_pvt-&gt;phone_callflow != CALLFLOW_CALL_HANGUP_REQUESTED ) {
+                                WARNINGA(&quot;INCOMING RING\n&quot;, CELLIAX_P_LOG);
+
+                                celliax_ring(tech_pvt);
+
+                                //FIXME celliax_answer(tech_pvt);
</ins><span class="cx">                                 //new_inbound_channel(tech_pvt);
</span><span class="cx">                                 //FIXME if (!celliax_new(p, AST_STATE_RING, tech_pvt-&gt;context)) {
</span><span class="cx">                                 //FIXME ERRORA(&quot;celliax_new failed! BAD BAD BAD\n&quot;, CELLIAX_P_LOG);
</span><span class="lines">@@ -2303,7 +2339,7 @@
</span><span class="cx">                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;proto&quot;, MDL_CHAT_PROTO);
</span><span class="cx">                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;login&quot;, tech_pvt-&gt;name);
</span><span class="cx">                 //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;hint&quot;, tech_pvt-&gt;chatmessages[which].from_dispname);
</span><del>-                //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;from&quot;, tech_pvt-&gt;chatmessages[which].from_handle);
</del><ins>+                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;from&quot;, &quot;333444555&quot;); //FIXME
</ins><span class="cx">                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;subject&quot;, &quot;SIMPLE MESSAGE&quot;);
</span><span class="cx">                 //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;chatname&quot;, tech_pvt-&gt;chatmessages[which].chatname);
</span><span class="cx">                 //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;id&quot;, tech_pvt-&gt;chatmessages[which].id);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>