<!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][15049] </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=15049">15049</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-10-02 09:28:15 -0500 (Fri, 02 Oct 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>gsmopen: indent</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopengsmopen_protocolc">freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.c</a></li>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopenmod_gsmopenc">freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchbranchesgmaruzzmod_gsmopengsmopen_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.c (15048 => 15049)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.c        2009-10-02 14:21:17 UTC (rev 15048)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.c        2009-10-02 14:28:15 UTC (rev 15049)
</span><span class="lines">@@ -449,7 +449,7 @@
</span><span class="cx"> }
</span><span class="cx"> int gsmopen_serial_read_AT(private_t * tech_pvt, int look_for_ack, int timeout_usec, int timeout_sec, const char *expected_string, int expect_crlf)
</span><span class="cx"> {
</span><del>-        int select_err=1;
</del><ins>+        int select_err = 1;
</ins><span class="cx">         int res;
</span><span class="cx">         fd_set read_fds;
</span><span class="cx">         struct timeval timeout;
</span><span class="lines">@@ -475,7 +475,7 @@
</span><span class="cx">         PUSHA_UNLOCKA(tech_pvt-&gt;controldev_lock);
</span><span class="cx">         LOKKA(tech_pvt-&gt;controldev_lock);
</span><span class="cx"> 
</span><del>-        while ((!tech_pvt-&gt;controldev_dead) &amp;&amp; ((select_err = select(tech_pvt-&gt;controldevfd + 1, &amp;read_fds, NULL, NULL, &amp;timeout)) &gt; 0) ) {
</del><ins>+        while ((!tech_pvt-&gt;controldev_dead) &amp;&amp; ((select_err = select(tech_pvt-&gt;controldevfd + 1, &amp;read_fds, NULL, NULL, &amp;timeout)) &gt; 0)) {
</ins><span class="cx">                 timeout.tv_sec = timeout_sec;        //reset the timeout, linux modify it
</span><span class="cx">                 timeout.tv_usec = timeout_usec;        //reset the timeout, linux modify it
</span><span class="cx">                 read_count = read(tech_pvt-&gt;controldevfd, tmp_answer_ptr, AT_BUFSIZ - (tmp_answer_ptr - tmp_answer));
</span><span class="lines">@@ -704,10 +704,10 @@
</span><span class="cx">                                         switch_core_session_t *session = NULL;
</span><span class="cx">                                         switch_channel_t *channel = NULL;
</span><span class="cx"> 
</span><del>-tech_pvt-&gt;interface_state = GSMOPEN_STATE_DOWN;
</del><ins>+                                        tech_pvt-&gt;interface_state = GSMOPEN_STATE_DOWN;
</ins><span class="cx"> 
</span><span class="cx">                                         session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
</span><del>-                                        if(session){
</del><ins>+                                        if (session) {
</ins><span class="cx">                                                 channel = switch_core_session_get_channel(session);
</span><span class="cx">                                                 //gsmopen_hangup(tech_pvt);
</span><span class="cx">                                                 switch_core_session_rwunlock(session);
</span><span class="lines">@@ -919,7 +919,7 @@
</span><span class="cx">                                                         //FIXME &quot;Interface: %s\r\nSMS_Message: %s\r\n&quot;, tech_pvt-&gt;name,
</span><span class="cx">                                                         //FIXME tech_pvt-&gt;sms_message);
</span><span class="cx"> 
</span><del>-                                                        res=sms_incoming(tech_pvt, tech_pvt-&gt;sms_message);
</del><ins>+                                                        res = sms_incoming(tech_pvt, tech_pvt-&gt;sms_message);
</ins><span class="cx"> 
</span><span class="cx">                                                         if (strlen(tech_pvt-&gt;sms_receiving_program)) {
</span><span class="cx">                                                                 int fd1[2];
</span><span class="lines">@@ -928,7 +928,7 @@
</span><span class="cx">                                                                 int i;
</span><span class="cx"> 
</span><span class="cx">                                                                 DEBUGA_GSMOPEN(&quot;incoming SMS message:&gt;&gt;&gt;%s&lt;&lt;&lt;\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;sms_message);
</span><del>-                                                                res=pipe(fd1);
</del><ins>+                                                                res = pipe(fd1);
</ins><span class="cx">                                                                 pid1 = fork();
</span><span class="cx"> 
</span><span class="cx">                                                                 if (pid1 == 0) {        //child
</span><span class="lines">@@ -950,7 +950,7 @@
</span><span class="cx">                                                                 close(fd1[0]);        // close output pipe side
</span><span class="cx">                                                                 // write the msg on the pipe input
</span><span class="cx">                                                                 for (i = 0; i &lt; strlen(tech_pvt-&gt;sms_message); i++) {
</span><del>-                                                                        res=write(fd1[1], &amp;tech_pvt-&gt;sms_message[i], 1);
</del><ins>+                                                                        res = write(fd1[1], &amp;tech_pvt-&gt;sms_message[i], 1);
</ins><span class="cx">                                                                 }
</span><span class="cx">                                                                 close(fd1[1]);        // close pipe input, let our program know we've finished
</span><span class="cx">                                                         } else {
</span><span class="lines">@@ -1321,7 +1321,7 @@
</span><span class="cx">                         if (tech_pvt-&gt;reading_sms_msg &gt; 1 &amp;&amp; at_ack == -1) {
</span><span class="cx">                                 int c;
</span><span class="cx">                                 char sms_body[16000];
</span><del>-                                int err=0;
</del><ins>+                                int err = 0;
</ins><span class="cx"> 
</span><span class="cx">                                 if (strncmp(tech_pvt-&gt;line_array.result[i], &quot;+CMGR&quot;, 5) == 0) {        /* we are reading the &quot;header&quot; of an SMS */
</span><span class="cx">                                         char content[512];
</span><span class="lines">@@ -1355,10 +1355,10 @@
</span><span class="cx">                                                                 strncat(tech_pvt-&gt;sms_message, &quot;|||&quot;, ((sizeof(tech_pvt-&gt;sms_message) - strlen(tech_pvt-&gt;sms_message)) - 1));
</span><span class="cx"> 
</span><span class="cx">                                                                 memset(content2, '\0', sizeof(content2));
</span><del>-                                                                if(which_field==1){
</del><ins>+                                                                if (which_field == 1) {
</ins><span class="cx">                                                                         err = ucs2_to_utf8(tech_pvt, content, content2, sizeof(content2));
</span><span class="cx">                                                                 } else {
</span><del>-                                                                        err=0;
</del><ins>+                                                                        err = 0;
</ins><span class="cx">                                                                         strncpy(content2, content, sizeof(content2));
</span><span class="cx">                                                                 }
</span><span class="cx"> 
</span><span class="lines">@@ -1368,13 +1368,13 @@
</span><span class="cx">                                                                 strncat(tech_pvt-&gt;sms_message, &quot;|||&quot;, ((sizeof(tech_pvt-&gt;sms_message) - strlen(tech_pvt-&gt;sms_message)) - 1));
</span><span class="cx">                                                                 memset(content, '\0', sizeof(content));
</span><span class="cx">                                                                 d = 0;
</span><del>-                                                                if(which_field==1){
</del><ins>+                                                                if (which_field == 1) {
</ins><span class="cx">                                                                         strncpy(tech_pvt-&gt;sms_sender, content2, sizeof(tech_pvt-&gt;sms_sender));
</span><span class="cx"> 
</span><del>-                                                                } else if(which_field==2){
</del><ins>+                                                                } else if (which_field == 2) {
</ins><span class="cx">                                                                         strncpy(tech_pvt-&gt;sms_date, content2, sizeof(tech_pvt-&gt;sms_date));
</span><del>-                                                                } else if(which_field &gt; 2){
-                                                                WARNINGA(&quot;WHY which_field is &gt; 2 ? (which_field is %d)\n&quot;, GSMOPEN_P_LOG, which_field);
</del><ins>+                                                                } else if (which_field &gt; 2) {
+                                                                        WARNINGA(&quot;WHY which_field is &gt; 2 ? (which_field is %d)\n&quot;, GSMOPEN_P_LOG, which_field);
</ins><span class="cx">                                                                 }
</span><span class="cx">                                                                 which_field++;
</span><span class="cx">                                                         } else {
</span><span class="lines">@@ -1980,9 +1980,10 @@
</span><span class="cx">         }
</span><span class="cx">         return res;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> int gsmopen_ring(private_t * tech_pvt)
</span><span class="cx"> {
</span><del>-        int res=0;
</del><ins>+        int res = 0;
</ins><span class="cx">         switch_core_session_t *session = NULL;
</span><span class="cx">         switch_channel_t *channel = NULL;
</span><span class="cx"> 
</span><span class="lines">@@ -1991,7 +1992,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
</span><del>-        if(session){
</del><ins>+        if (session) {
</ins><span class="cx">                 switch_core_session_rwunlock(session);
</span><span class="cx">                 return 0;
</span><span class="cx">         }
</span><span class="lines">@@ -2001,11 +2002,11 @@
</span><span class="cx">         usleep(10000);
</span><span class="cx"> 
</span><span class="cx">         session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
</span><del>-        if(session){
</del><ins>+        if (session) {
</ins><span class="cx">                 channel = switch_core_session_get_channel(session);
</span><span class="cx"> 
</span><span class="cx">                 switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
</span><del>-                if(channel){
</del><ins>+                if (channel) {
</ins><span class="cx">                         switch_channel_mark_ring_ready(channel);
</span><span class="cx">                 } else {
</span><span class="cx">                         ERRORA(&quot;no session\n&quot;, GSMOPEN_P_LOG);
</span></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_gsmopenmod_gsmopenc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.c (15048 => 15049)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.c        2009-10-02 14:21:17 UTC (rev 15048)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.c        2009-10-02 14:28:15 UTC (rev 15049)
</span><span class="lines">@@ -521,7 +521,7 @@
</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><del>-tech_pvt-&gt;phone_callflow = CALLFLOW_CALL_HANGUP_REQUESTED;
</del><ins>+        tech_pvt-&gt;phone_callflow = CALLFLOW_CALL_HANGUP_REQUESTED;
</ins><span class="cx"> 
</span><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="lines">@@ -852,7 +852,7 @@
</span><span class="cx"> 
</span><span class="cx">         //ERRORA(&quot;%s CHANNEL INIT\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;name);
</span><span class="cx">         switch_set_flag(tech_pvt, TFLAG_IO);
</span><del>-gsmopen_serial_answer(tech_pvt);
</del><ins>+        gsmopen_serial_answer(tech_pvt);
</ins><span class="cx"> 
</span><span class="cx">         /* Move channel's state machine to ROUTING. This means the call is trying
</span><span class="cx">            to get from the initial start where the call because, to the point
</span><span class="lines">@@ -1103,11 +1103,8 @@
</span><span class="cx">  * \brief This thread runs during a call, and monitor the interface for signaling, like hangup, caller id, etc most of signaling is handled inside the gsmopen_signaling_read function
</span><span class="cx">  *
</span><span class="cx">  */
</span><del>-/* BEGIN: Changes heres */
</del><span class="cx"> 
</span><del>-
</del><span class="cx"> static switch_status_t load_config(int reload_type)
</span><del>-/* END: Changes heres */
</del><span class="cx"> {
</span><span class="cx">         char *cf = &quot;gsmopen.conf&quot;;
</span><span class="cx">         switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
</span><span class="lines">@@ -1168,76 +1165,74 @@
</span><span class="cx">                         char *enable_callerid = &quot;true&quot;;
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-                        char *at_dial_pre_number= &quot;ATD&quot;;
-                        char *at_dial_post_number= &quot;;&quot;;
-                        char *at_dial_expect= &quot;OK&quot;;
-                        char *at_hangup= &quot;ATH&quot;;
-                        char *at_hangup_expect= &quot;OK&quot;;
-                        char *at_answer= &quot;ATA&quot;;
-                        char *at_answer_expect= &quot;OK&quot;;
-                        char *at_send_dtmf= &quot;AT+VTS&quot;;
-                        char *at_preinit_1= &quot;&quot;;
-                        char *at_preinit_1_expect= &quot;&quot;;
-                        char *at_preinit_2= &quot;&quot;;
-                        char *at_preinit_2_expect= &quot;&quot;;
-                        char *at_preinit_3= &quot;&quot;;
-                        char *at_preinit_3_expect= &quot;&quot;;
-                        char *at_preinit_4= &quot;&quot;;
-                        char *at_preinit_4_expect= &quot;&quot;;
-                        char *at_preinit_5= &quot;&quot;;
-                        char *at_preinit_5_expect= &quot;&quot;;
-                        char *at_postinit_1= &quot;at+cmic=0,9&quot;;
-                        char *at_postinit_1_expect= &quot;OK&quot;;
-                        char *at_postinit_2= &quot;AT+CKPD=\&quot;EEE\&quot;&quot;;
-                        char *at_postinit_2_expect= &quot;OK&quot;;
-                        char *at_postinit_3= &quot;AT+CSSN=1,0&quot;;
-                        char *at_postinit_3_expect= &quot;OK&quot;;
-                        char *at_postinit_4= &quot;at+sidet=0&quot;;
-                        char *at_postinit_4_expect= &quot;OK&quot;;
-                        char *at_postinit_5= &quot;at+clvl=99&quot;;
-                        char *at_postinit_5_expect= &quot;OK&quot;;
-                        char *at_query_battchg= &quot;AT+CBC&quot;;
-                        char *at_query_battchg_expect= &quot;OK&quot;;
-                        char *at_query_signal= &quot;AT+CSQ&quot;;
-                        char *at_query_signal_expect= &quot;OK&quot;;
-                        char *at_call_idle= &quot;+MCST: 1&quot;;
-                        char *at_call_incoming= &quot;+MCST: 2&quot;;
-                        char *at_call_active= &quot;+CSSI: 7&quot;;
-                        char *at_call_failed= &quot;+MCST: 65&quot;;
-                        char *at_call_calling= &quot;+CSSI: 1&quot;;
-                        char *at_indicator_noservice_string= &quot;CIEV: 2;0&quot;;
-                        char *at_indicator_nosignal_string= &quot;CIEV: 5;0&quot;;
-                        char *at_indicator_lowsignal_string= &quot;CIEV: 5;1&quot;;
-                        char *at_indicator_lowbattchg_string= &quot;CIEV: 0;1&quot;;
-                        char *at_indicator_nobattchg_string= &quot;CIEV: 0;0&quot;;
-                        char *at_indicator_callactive_string= &quot;CIEV: 3;1&quot;;
-                        char *at_indicator_nocallactive_string= &quot;CIEV: 3;0&quot;;
-                        char *at_indicator_nocallsetup_string= &quot;CIEV: 6;0&quot;;
-                        char *at_indicator_callsetupincoming_string= &quot;CIEV: 6;1&quot;;
-                        char *at_indicator_callsetupoutgoing_string= &quot;CIEV: 6;2&quot;;
-                        char *at_indicator_callsetupremoteringing_string= &quot;CIEV: 6;3&quot;;
-                        char *sms_receiving_program= &quot;/usr/local/bin/ciapalo&quot;;
-                        char *alsacname= &quot;plughw:1&quot;;
-                        char *alsapname= &quot;plughw:1&quot;;
-                        char *at_early_audio =&quot;0&quot;;
-                        char *at_after_preinit_pause=&quot;500000&quot;;
-                        char *at_initial_pause=&quot;500000&quot;;
-                        char *at_has_clcc=&quot;0&quot;;
-                        char *at_has_ecam=&quot;0&quot;;
-                        char *alsa_period_size=&quot;160&quot;;
-                        char *alsa_periods_in_buffer=&quot;4&quot;;
-                        char *gsmopen_sound_rate=&quot;8000&quot;;
-                        char *alsa_play_is_mono=&quot;1&quot;;
-                        char *alsa_capture_is_mono=&quot;1&quot;;
-                        char *capture_boost=&quot;5&quot;;
-                        char *playback_boost=&quot;10&quot;;
</del><ins>+                        char *at_dial_pre_number = &quot;ATD&quot;;
+                        char *at_dial_post_number = &quot;;&quot;;
+                        char *at_dial_expect = &quot;OK&quot;;
+                        char *at_hangup = &quot;ATH&quot;;
+                        char *at_hangup_expect = &quot;OK&quot;;
+                        char *at_answer = &quot;ATA&quot;;
+                        char *at_answer_expect = &quot;OK&quot;;
+                        char *at_send_dtmf = &quot;AT+VTS&quot;;
+                        char *at_preinit_1 = &quot;&quot;;
+                        char *at_preinit_1_expect = &quot;&quot;;
+                        char *at_preinit_2 = &quot;&quot;;
+                        char *at_preinit_2_expect = &quot;&quot;;
+                        char *at_preinit_3 = &quot;&quot;;
+                        char *at_preinit_3_expect = &quot;&quot;;
+                        char *at_preinit_4 = &quot;&quot;;
+                        char *at_preinit_4_expect = &quot;&quot;;
+                        char *at_preinit_5 = &quot;&quot;;
+                        char *at_preinit_5_expect = &quot;&quot;;
+                        char *at_postinit_1 = &quot;at+cmic=0,9&quot;;
+                        char *at_postinit_1_expect = &quot;OK&quot;;
+                        char *at_postinit_2 = &quot;AT+CKPD=\&quot;EEE\&quot;&quot;;
+                        char *at_postinit_2_expect = &quot;OK&quot;;
+                        char *at_postinit_3 = &quot;AT+CSSN=1,0&quot;;
+                        char *at_postinit_3_expect = &quot;OK&quot;;
+                        char *at_postinit_4 = &quot;at+sidet=0&quot;;
+                        char *at_postinit_4_expect = &quot;OK&quot;;
+                        char *at_postinit_5 = &quot;at+clvl=99&quot;;
+                        char *at_postinit_5_expect = &quot;OK&quot;;
+                        char *at_query_battchg = &quot;AT+CBC&quot;;
+                        char *at_query_battchg_expect = &quot;OK&quot;;
+                        char *at_query_signal = &quot;AT+CSQ&quot;;
+                        char *at_query_signal_expect = &quot;OK&quot;;
+                        char *at_call_idle = &quot;+MCST: 1&quot;;
+                        char *at_call_incoming = &quot;+MCST: 2&quot;;
+                        char *at_call_active = &quot;+CSSI: 7&quot;;
+                        char *at_call_failed = &quot;+MCST: 65&quot;;
+                        char *at_call_calling = &quot;+CSSI: 1&quot;;
+                        char *at_indicator_noservice_string = &quot;CIEV: 2;0&quot;;
+                        char *at_indicator_nosignal_string = &quot;CIEV: 5;0&quot;;
+                        char *at_indicator_lowsignal_string = &quot;CIEV: 5;1&quot;;
+                        char *at_indicator_lowbattchg_string = &quot;CIEV: 0;1&quot;;
+                        char *at_indicator_nobattchg_string = &quot;CIEV: 0;0&quot;;
+                        char *at_indicator_callactive_string = &quot;CIEV: 3;1&quot;;
+                        char *at_indicator_nocallactive_string = &quot;CIEV: 3;0&quot;;
+                        char *at_indicator_nocallsetup_string = &quot;CIEV: 6;0&quot;;
+                        char *at_indicator_callsetupincoming_string = &quot;CIEV: 6;1&quot;;
+                        char *at_indicator_callsetupoutgoing_string = &quot;CIEV: 6;2&quot;;
+                        char *at_indicator_callsetupremoteringing_string = &quot;CIEV: 6;3&quot;;
+                        char *sms_receiving_program = &quot;/usr/local/bin/ciapalo&quot;;
+                        char *alsacname = &quot;plughw:1&quot;;
+                        char *alsapname = &quot;plughw:1&quot;;
+                        char *at_early_audio = &quot;0&quot;;
+                        char *at_after_preinit_pause = &quot;500000&quot;;
+                        char *at_initial_pause = &quot;500000&quot;;
+                        char *at_has_clcc = &quot;0&quot;;
+                        char *at_has_ecam = &quot;0&quot;;
+                        char *alsa_period_size = &quot;160&quot;;
+                        char *alsa_periods_in_buffer = &quot;4&quot;;
+                        char *gsmopen_sound_rate = &quot;8000&quot;;
+                        char *alsa_play_is_mono = &quot;1&quot;;
+                        char *alsa_capture_is_mono = &quot;1&quot;;
+                        char *capture_boost = &quot;5&quot;;
+                        char *playback_boost = &quot;10&quot;;
</ins><span class="cx"> 
</span><span class="cx">                         uint32_t interface_id = 0;
</span><del>-                        //uint32_t to=0;
-                        //uint32_t max=0;
-                        uint32_t controldevice_speed = B115200; //FIXME TODO
-                        uint32_t controldevprotocol = PROTOCOL_AT; //FIXME TODO
-                        uint32_t running =1; //FIXME TODO
</del><ins>+                        uint32_t controldevice_speed = B115200;        //FIXME TODO
+                        uint32_t controldevprotocol = PROTOCOL_AT;        //FIXME TODO
+                        uint32_t running = 1;        //FIXME TODO
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1430,51 +1425,51 @@
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        if(!switch_is_number(at_early_audio)) {
</del><ins>+                        if (!switch_is_number(at_early_audio)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'at_early_audio' MUST be a number, now at_early_audio='%s'\n&quot;, GSMOPEN_P_LOG, at_early_audio);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(at_after_preinit_pause)) {
</del><ins>+                        if (!switch_is_number(at_after_preinit_pause)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'at_after_preinit_pause' MUST be a number, now at_after_preinit_pause='%s'\n&quot;, GSMOPEN_P_LOG, at_after_preinit_pause);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(at_initial_pause)) {
</del><ins>+                        if (!switch_is_number(at_initial_pause)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'at_initial_pause' MUST be a number, now at_initial_pause='%s'\n&quot;, GSMOPEN_P_LOG, at_initial_pause);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(at_has_clcc)) {
</del><ins>+                        if (!switch_is_number(at_has_clcc)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'at_has_clcc' MUST be a number, now at_has_clcc='%s'\n&quot;, GSMOPEN_P_LOG, at_has_clcc);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(at_has_ecam)) {
</del><ins>+                        if (!switch_is_number(at_has_ecam)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'at_has_ecam' MUST be a number, now at_has_ecam='%s'\n&quot;, GSMOPEN_P_LOG, at_has_ecam);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(alsa_period_size)) {
</del><ins>+                        if (!switch_is_number(alsa_period_size)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'alsa_period_size' MUST be a number, now alsa_period_size='%s'\n&quot;, GSMOPEN_P_LOG, alsa_period_size);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(alsa_periods_in_buffer)) {
</del><ins>+                        if (!switch_is_number(alsa_periods_in_buffer)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'alsa_periods_in_buffer' MUST be a number, now alsa_periods_in_buffer='%s'\n&quot;, GSMOPEN_P_LOG, alsa_periods_in_buffer);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(gsmopen_sound_rate)) {
</del><ins>+                        if (!switch_is_number(gsmopen_sound_rate)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'gsmopen_sound_rate' MUST be a number, now gsmopen_sound_rate='%s'\n&quot;, GSMOPEN_P_LOG, gsmopen_sound_rate);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(alsa_play_is_mono)) {
</del><ins>+                        if (!switch_is_number(alsa_play_is_mono)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'alsa_play_is_mono' MUST be a number, now alsa_play_is_mono='%s'\n&quot;, GSMOPEN_P_LOG, alsa_play_is_mono);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(alsa_capture_is_mono)) {
</del><ins>+                        if (!switch_is_number(alsa_capture_is_mono)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'alsa_capture_is_mono' MUST be a number, now alsa_capture_is_mono='%s'\n&quot;, GSMOPEN_P_LOG, alsa_capture_is_mono);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(capture_boost)) {
</del><ins>+                        if (!switch_is_number(capture_boost)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'capture_boost' MUST be a number, now capture_boost='%s'\n&quot;, GSMOPEN_P_LOG, capture_boost);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><del>-                        if(!switch_is_number(playback_boost)) {
</del><ins>+                        if (!switch_is_number(playback_boost)) {
</ins><span class="cx">                                 ERRORA(&quot;interface param 'playback_boost' MUST be a number, now playback_boost='%s'\n&quot;, GSMOPEN_P_LOG, playback_boost);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><span class="lines">@@ -1493,19 +1488,15 @@
</span><span class="cx">                                 switch_mutex_init(&amp;globals.GSMOPEN_INTERFACES[interface_id].controldev_lock, SWITCH_MUTEX_NESTED, gsmopen_module_pool);
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].id , id );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].name , name );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].context , context );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].dialplan , dialplan );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].destination , destination );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].controldevice_name , controldevice_name );
-                                //FIXME switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].digit_timeout , digit_timeout );
-                                //FIXME switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].max_digits , max_digits );
-                                //FIXME switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].hotline , hotline );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].dial_regex , dial_regex );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].hold_music , hold_music );
-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].fail_dial_regex , fail_dial_regex );
-                                //FIXME switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].enable_callerid , enable_callerid );
</del><ins>+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].id, id);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].name, name);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].context, context);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].dialplan, dialplan);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].destination, destination);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].controldevice_name, controldevice_name);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].dial_regex, dial_regex);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].hold_music, hold_music);
+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].fail_dial_regex, fail_dial_regex);
</ins><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_dial_pre_number, at_dial_pre_number);
</span><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_dial_post_number, at_dial_post_number);
</span><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_dial_expect, at_dial_expect);
</span><span class="lines">@@ -1553,7 +1544,8 @@
</span><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_indicator_nocallsetup_string, at_indicator_nocallsetup_string);
</span><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_indicator_callsetupincoming_string, at_indicator_callsetupincoming_string);
</span><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, at_indicator_callsetupoutgoing_string);
</span><del>-                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, at_indicator_callsetupremoteringing_string);
</del><ins>+                                switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string,
+                                                                  at_indicator_callsetupremoteringing_string);
</ins><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].sms_receiving_program, sms_receiving_program);
</span><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].alsacname, alsacname);
</span><span class="cx">                                 switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].alsapname, alsapname);
</span><span class="lines">@@ -1573,21 +1565,9 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-                                globals.GSMOPEN_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
-                                globals.GSMOPEN_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
-                                //globals.GSMOPEN_INTERFACES[interface_id].at_early_audio = at_early_audio;
-                                //globals.GSMOPEN_INTERFACES[interface_id].at_after_preinit_pause = at_after_preinit_pause;
-                                //globals.GSMOPEN_INTERFACES[interface_id].at_initial_pause = at_initial_pause;
-                                //globals.GSMOPEN_INTERFACES[interface_id].at_has_clcc = at_has_clcc;
-                                //globals.GSMOPEN_INTERFACES[interface_id].at_has_ecam = at_has_ecam;
-                                //globals.GSMOPEN_INTERFACES[interface_id].alsa_period_size = alsa_period_size;
-                                //globals.GSMOPEN_INTERFACES[interface_id].alsa_periods_in_buffer = alsa_periods_in_buffer;
-                                //globals.GSMOPEN_INTERFACES[interface_id].gsmopen_sound_rate = gsmopen_sound_rate;
-                                //globals.GSMOPEN_INTERFACES[interface_id].alsa_play_is_mono = alsa_play_is_mono;
-                                //globals.GSMOPEN_INTERFACES[interface_id].alsa_capture_is_mono = alsa_capture_is_mono;
-                                //globals.GSMOPEN_INTERFACES[interface_id].capture_boost = capture_boost;
-                                //globals.GSMOPEN_INTERFACES[interface_id].playback_boost = playback_boost;
-                                globals.GSMOPEN_INTERFACES[interface_id].running = running; //FIXME
</del><ins>+                                globals.GSMOPEN_INTERFACES[interface_id].controldevice_speed = controldevice_speed;        //FIXME
+                                globals.GSMOPEN_INTERFACES[interface_id].controldevprotocol = controldevprotocol;        //FIXME
+                                globals.GSMOPEN_INTERFACES[interface_id].running = running;        //FIXME
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1611,35 +1591,26 @@
</span><span class="cx">                                         if (globals.GSMOPEN_INTERFACES[interface_id].controldevfd &lt; 1) {
</span><span class="cx">                                                 ERRORA(&quot;gsmopen_serial_init failed\n&quot;, GSMOPEN_P_LOG);
</span><span class="cx">                                                 return SWITCH_STATUS_FALSE;
</span><del>-                                                //gsmopen_sound_shutdown(tmp);
-                                                //if (tmp)
-                                                //free(tmp);
-                                                //return NULL;
</del><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="cx">                                 /* config the phone/modem on the serial port */
</span><span class="cx">                                 if (globals.GSMOPEN_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
</span><del>-                                        //int res;
</del><span class="cx">                                         res = gsmopen_serial_config(&amp;globals.GSMOPEN_INTERFACES[interface_id]);
</span><span class="cx">                                         if (res) {
</span><span class="cx">                                                 ERRORA(&quot;gsmopen_serial_config failed\n&quot;, GSMOPEN_P_LOG);
</span><span class="cx">                                                 return SWITCH_STATUS_FALSE;
</span><del>-                                                //gsmopen_sound_shutdown(tmp);
-                                                //if (tmp)
-                                                //free(tmp);
-                                                //return NULL;
</del><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx"> 
</span><del>-                                gsmopen_store_boost(&quot;5&quot;, &amp;globals.GSMOPEN_INTERFACES[interface_id].capture_boost); //FIXME
-                                gsmopen_store_boost(&quot;10&quot;, &amp;globals.GSMOPEN_INTERFACES[interface_id].playback_boost); //FIXME
</del><ins>+                                gsmopen_store_boost(&quot;5&quot;, &amp;globals.GSMOPEN_INTERFACES[interface_id].capture_boost);        //FIXME
+                                gsmopen_store_boost(&quot;10&quot;, &amp;globals.GSMOPEN_INTERFACES[interface_id].playback_boost);        //FIXME
</ins><span class="cx"> 
</span><span class="cx">                                 switch_sleep(100000);
</span><span class="cx">                                 switch_threadattr_create(&amp;gsmopen_api_thread_attr, gsmopen_module_pool);
</span><span class="cx">                                 switch_threadattr_stacksize_set(gsmopen_api_thread_attr, SWITCH_THREAD_STACKSIZE);
</span><span class="cx">                                 switch_thread_create(&amp;globals.GSMOPEN_INTERFACES[interface_id].gsmopen_api_thread, gsmopen_api_thread_attr, gsmopen_do_gsmopenapi_thread,
</span><del>-                                                &amp;globals.GSMOPEN_INTERFACES[interface_id], gsmopen_module_pool);
</del><ins>+                                                                         &amp;globals.GSMOPEN_INTERFACES[interface_id], gsmopen_module_pool);
</ins><span class="cx"> 
</span><span class="cx">                                 switch_sleep(100000);
</span><span class="cx">                                 WARNINGA(&quot;STARTED interface_id=%d\n&quot;, GSMOPEN_P_LOG, interface_id);
</span><span class="lines">@@ -1680,19 +1651,20 @@
</span><span class="cx"> static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint)
</span><span class="cx"> {
</span><span class="cx">         char *user, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL;
</span><del>-        private_t * tech_pvt=NULL;
-        int i=0, found=0;
</del><ins>+        private_t *tech_pvt = NULL;
+        int i = 0, found = 0;
</ins><span class="cx"> 
</span><span class="cx">         switch_assert(proto != NULL);
</span><span class="cx"> 
</span><del>-        DEBUGA_GSMOPEN(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n&quot;, GSMOPEN_P_LOG, proto, from, to, subject, body, type, hint?hint:&quot;NULL&quot;);
</del><ins>+        DEBUGA_GSMOPEN(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n&quot;, GSMOPEN_P_LOG, proto, from, to, subject, body, type,
+                                   hint ? hint : &quot;NULL&quot;);
</ins><span class="cx"> 
</span><span class="cx">         if (!to || !strlen(to)) {
</span><span class="cx">                 ERRORA(&quot;Missing To: header.\n&quot;, GSMOPEN_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_SUCCESS;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ((!from &amp;&amp; !hint) || (!strlen(from) &amp;&amp; !strlen(hint)) ) {
</del><ins>+        if ((!from &amp;&amp; !hint) || (!strlen(from) &amp;&amp; !strlen(hint))) {
</ins><span class="cx">                 ERRORA(&quot;Missing From: AND Hint: headers.\n&quot;, GSMOPEN_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_SUCCESS;
</span><span class="cx">         }
</span><span class="lines">@@ -1706,47 +1678,49 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-if(!strlen(hint)){ //FIXME FIXME FIXME
-        hint=from;
-}
</del><ins>+        if (!strlen(hint)) {                //FIXME FIXME FIXME
+                hint = from;
+        }
</ins><span class="cx">         if (to &amp;&amp; (user = strdup(to))) {
</span><span class="cx">                 if ((host = strchr(user, '@'))) {
</span><span class="cx">                         *host++ = '\0';
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                DEBUGA_GSMOPEN(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n&quot;, GSMOPEN_P_LOG, proto, from, to, subject, body, type, hint?hint:&quot;NULL&quot;);
</del><ins>+                DEBUGA_GSMOPEN(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n&quot;, GSMOPEN_P_LOG, proto, from, to, subject, body, type,
+                                           hint ? hint : &quot;NULL&quot;);
</ins><span class="cx">                 if (hint &amp;&amp; strlen(hint)) {
</span><span class="cx">                         //in hint we receive the interface name to use
</span><span class="cx">                         for (i = 0; !found &amp;&amp; i &lt; GSMOPEN_MAX_INTERFACES; i++) {
</span><span class="cx">                                 if (strlen(globals.GSMOPEN_INTERFACES[i].name)
</span><del>-                                                &amp;&amp; (strncmp(globals.GSMOPEN_INTERFACES[i].name, hint, strlen(hint)) == 0)) {
</del><ins>+                                        &amp;&amp; (strncmp(globals.GSMOPEN_INTERFACES[i].name, hint, strlen(hint)) == 0)) {
</ins><span class="cx">                                         tech_pvt = &amp;globals.GSMOPEN_INTERFACES[i];
</span><span class="cx">                                         DEBUGA_GSMOPEN(&quot;Using interface: globals.GSMOPEN_INTERFACES[%d].name=|||%s|||\n&quot;, GSMOPEN_P_LOG, i, globals.GSMOPEN_INTERFACES[i].name);
</span><span class="cx">                                         found = 1;
</span><span class="cx">                                         break;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                } /* FIXME add a tech_pvt member for the SIM telephone number //else {
-                //we have no a predefined interface name to use (hint is NULL), so let's choose an interface from the username (from)
-                for (i = 0; !found &amp;&amp; i &lt; GSMOPEN_MAX_INTERFACES; i++) {
-                if (strlen(globals.GSMOPEN_INTERFACES[i].name)
-                &amp;&amp; (strncmp(globals.GSMOPEN_INTERFACES[i].skype_user, from, strlen(from)) == 0)) {
-                tech_pvt = &amp;globals.GSMOPEN_INTERFACES[i];
-                DEBUGA_GSMOPEN(&quot;Using interface: globals.GSMOPEN_INTERFACES[%d].name=|||%s|||\n&quot;, GSMOPEN_P_LOG, i, globals.GSMOPEN_INTERFACES[i].name);
-                found = 1;
-                break;
-                }
-                }
-                }
-                */
</del><ins>+                }                                                /* FIXME add a tech_pvt member for the SIM telephone number //else {
+                                                                   //we have no a predefined interface name to use (hint is NULL), so let's choose an interface from the username (from)
+                                                                   for (i = 0; !found &amp;&amp; i &lt; GSMOPEN_MAX_INTERFACES; i++) {
+                                                                   if (strlen(globals.GSMOPEN_INTERFACES[i].name)
+                                                                   &amp;&amp; (strncmp(globals.GSMOPEN_INTERFACES[i].skype_user, from, strlen(from)) == 0)) {
+                                                                   tech_pvt = &amp;globals.GSMOPEN_INTERFACES[i];
+                                                                   DEBUGA_GSMOPEN(&quot;Using interface: globals.GSMOPEN_INTERFACES[%d].name=|||%s|||\n&quot;, GSMOPEN_P_LOG, i, globals.GSMOPEN_INTERFACES[i].name);
+                                                                   found = 1;
+                                                                   break;
+                                                                   }
+                                                                   }
+                                                                   }
+                                                                 */
</ins><span class="cx">                 if (!found) {
</span><del>-                        ERRORA(&quot;ERROR: A GSMopen interface with name='%s' or one with SIM_number='%s' was not found\n&quot;, GSMOPEN_P_LOG, hint?hint:&quot;NULL&quot;, from?from:&quot;NULL&quot;);
</del><ins>+                        ERRORA(&quot;ERROR: A GSMopen interface with name='%s' or one with SIM_number='%s' was not found\n&quot;, GSMOPEN_P_LOG, hint ? hint : &quot;NULL&quot;,
+                                   from ? from : &quot;NULL&quot;);
</ins><span class="cx">                         goto end;
</span><span class="cx">                 } else {
</span><del>-                        gsmopen_sendsms(tech_pvt, (char *)to, (char *)body);
</del><ins>+                        gsmopen_sendsms(tech_pvt, (char *) to, (char *) body);
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><del>-end:
</del><ins>+  end:
</ins><span class="cx">         switch_safe_free(user);
</span><span class="cx">         switch_safe_free(f_user);
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="lines">@@ -1768,10 +1742,10 @@
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (switch_event_reserve_subclass(MY_EVENT_INCOMING_SMS) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;Couldn't register subclass!\n&quot;);
-                return SWITCH_STATUS_GENERR;
-        }
</del><ins>+        if (switch_event_reserve_subclass(MY_EVENT_INCOMING_SMS) != SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, &quot;Couldn't register subclass!\n&quot;);
+                return SWITCH_STATUS_GENERR;
+        }
</ins><span class="cx"> 
</span><span class="cx">         *module_interface = switch_loadable_module_create_module_interface(pool, modname);
</span><span class="cx">         gsmopen_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
</span><span class="lines">@@ -1849,7 +1823,7 @@
</span><span class="cx"> 
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        switch_event_free_subclass(MY_EVENT_INCOMING_SMS);
</del><ins>+        switch_event_free_subclass(MY_EVENT_INCOMING_SMS);
</ins><span class="cx"> 
</span><span class="cx">         switch_safe_free(globals.dialplan);
</span><span class="cx">         switch_safe_free(globals.context);
</span><span class="lines">@@ -2384,7 +2358,8 @@
</span><span class="cx">                                 close(tech_pvt-&gt;controldevfd);
</span><span class="cx">                                 ERRORA(&quot;gsmopen_serial_monitor failed, declaring %s dead\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;controldevice_name);
</span><span class="cx">                                 switch_sleep(1000000);
</span><del>-                        } else if (tech_pvt-&gt;controldevprotocol != PROTOCOL_NO_SERIAL &amp;&amp; tech_pvt-&gt;interface_state == GSMOPEN_STATE_RING &amp;&amp; tech_pvt-&gt;phone_callflow != CALLFLOW_CALL_HANGUP_REQUESTED ) {
</del><ins>+                        } else if (tech_pvt-&gt;controldevprotocol != PROTOCOL_NO_SERIAL &amp;&amp; tech_pvt-&gt;interface_state == GSMOPEN_STATE_RING
+                                           &amp;&amp; tech_pvt-&gt;phone_callflow != CALLFLOW_CALL_HANGUP_REQUESTED) {
</ins><span class="cx">                                 WARNINGA(&quot;INCOMING RING\n&quot;, GSMOPEN_P_LOG);
</span><span class="cx"> 
</span><span class="cx">                                 gsmopen_ring(tech_pvt);
</span><span class="lines">@@ -2427,6 +2402,7 @@
</span><span class="cx">         return NULL;
</span><span class="cx"> 
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #ifdef NOTDEF
</span><span class="cx"> int sms_incoming(private_t * tech_pvt, char *value)
</span><span class="cx"> {
</span><span class="lines">@@ -2446,7 +2422,7 @@
</span><span class="cx"> 
</span><span class="cx">         return 0;
</span><span class="cx"> }
</span><del>-#endif// NOTDEF
</del><ins>+#endif // NOTDEF
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> SWITCH_STANDARD_API(sendsms_function)
</span><span class="lines">@@ -2491,7 +2467,8 @@
</span><span class="cx">                         return SWITCH_STATUS_SUCCESS;
</span><span class="cx">                 } else {
</span><span class="cx">                         //gsmopen_sendsms(tech_pvt, (char *) argv[1], (char *) argv[2]);
</span><del>-                        NOTICA(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n&quot;, GSMOPEN_P_LOG, MDL_CHAT_PROTO, tech_pvt-&gt;name, argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil(argv[2]), tech_pvt-&gt;name);
</del><ins>+                        NOTICA(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n&quot;, GSMOPEN_P_LOG, MDL_CHAT_PROTO, tech_pvt-&gt;name, argv[1],
+                                   &quot;SIMPLE MESSAGE&quot;, switch_str_nil(argv[2]), tech_pvt-&gt;name);
</ins><span class="cx"> 
</span><span class="cx">                         chat_send(MDL_CHAT_PROTO, tech_pvt-&gt;name, argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil(argv[2]), NULL, tech_pvt-&gt;name);
</span><span class="cx">                 }
</span><span class="lines">@@ -2513,7 +2490,8 @@
</span><span class="cx">         int event_sent_to_esl = 0;
</span><span class="cx"> 
</span><span class="cx">         DEBUGA_GSMOPEN(&quot;received SMS on interface %s: %s\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;name, tech_pvt-&gt;sms_message);
</span><del>-        DEBUGA_GSMOPEN(&quot;received SMS on interface %s: DATE=%s, SENDER=%s, BODY=%s\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;name, tech_pvt-&gt;sms_date, tech_pvt-&gt;sms_sender, tech_pvt-&gt;sms_body);
</del><ins>+        DEBUGA_GSMOPEN(&quot;received SMS on interface %s: DATE=%s, SENDER=%s, BODY=%s\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;name, tech_pvt-&gt;sms_date, tech_pvt-&gt;sms_sender,
+                                   tech_pvt-&gt;sms_body);
</ins><span class="cx"> 
</span><span class="cx">         if (!switch_strlen_zero(tech_pvt-&gt;session_uuid_str)) {
</span><span class="cx">                 session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
</span><span class="lines">@@ -2523,28 +2501,28 @@
</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><span class="cx">                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;from&quot;, tech_pvt-&gt;sms_sender);
</span><del>-                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;date&quot;, tech_pvt-&gt;sms_date); 
</del><ins>+                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;date&quot;, tech_pvt-&gt;sms_date);
</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 class="cx">                 switch_event_add_body(event, &quot;%s&quot;, tech_pvt-&gt;sms_body);
</span><del>-                if(session){
</del><ins>+                if (session) {
</ins><span class="cx">                         switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;during-call&quot;, &quot;true&quot;);
</span><span class="cx">                         if (switch_core_session_queue_event(session, &amp;event) != SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;delivery-failure&quot;, &quot;true&quot;);
</span><span class="cx">                                 switch_event_fire(&amp;event);
</span><span class="cx">                         }
</span><del>-                } else { //no session
</del><ins>+                } else {                                //no session
</ins><span class="cx">                         switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;during-call&quot;, &quot;false&quot;);
</span><span class="cx">                         switch_event_fire(&amp;event);
</span><del>-                        event_sent_to_esl=1;
</del><ins>+                        event_sent_to_esl = 1;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-        }else{
</del><ins>+        } else {
</ins><span class="cx">                 ERRORA(&quot;cannot create event on interface %s. WHY?????\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;name);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if(!event_sent_to_esl){
</del><ins>+        if (!event_sent_to_esl) {
</ins><span class="cx"> 
</span><span class="cx">                 if (switch_event_create(&amp;event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                         switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;proto&quot;, MDL_CHAT_PROTO);
</span><span class="lines">@@ -2552,27 +2530,27 @@
</span><span class="cx">                         //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;hint&quot;, tech_pvt-&gt;chatmessages[which].from_dispname);
</span><span class="cx">                         //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;from&quot;, tech_pvt-&gt;chatmessages[which].from_handle);
</span><span class="cx">                         switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;from&quot;, tech_pvt-&gt;sms_sender);
</span><del>-                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;date&quot;, tech_pvt-&gt;sms_date); 
</del><ins>+                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;date&quot;, tech_pvt-&gt;sms_date);
</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 class="cx">                         switch_event_add_body(event, &quot;%s&quot;, tech_pvt-&gt;sms_body);
</span><del>-                        if(session){
</del><ins>+                        if (session) {
</ins><span class="cx">                                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;during-call&quot;, &quot;true&quot;);
</span><del>-                        } else { //no session
</del><ins>+                        } else {                        //no session
</ins><span class="cx">                                 switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, &quot;during-call&quot;, &quot;false&quot;);
</span><span class="cx">                         }
</span><span class="cx">                         switch_event_fire(&amp;event);
</span><del>-                } else{
</del><ins>+                } else {
</ins><span class="cx">                         ERRORA(&quot;cannot create event on interface %s. WHY?????\n&quot;, GSMOPEN_P_LOG, tech_pvt-&gt;name);
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if(session){
</del><ins>+        if (session) {
</ins><span class="cx">                 switch_core_session_rwunlock(session);
</span><span class="cx">         }
</span><span class="cx">         //memset(&amp;tech_pvt-&gt;chatmessages[which], '\0', sizeof(&amp;tech_pvt-&gt;chatmessages[which]) );
</span><del>-        memset(tech_pvt-&gt;sms_message, '\0', sizeof(tech_pvt-&gt;sms_message) );
</del><ins>+        memset(tech_pvt-&gt;sms_message, '\0', sizeof(tech_pvt-&gt;sms_message));
</ins><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2606,7 +2584,7 @@
</span><span class="cx">                 for (i = 0; !found &amp;&amp; i &lt; GSMOPEN_MAX_INTERFACES; i++) {
</span><span class="cx">                         /* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the &quot;ANY&quot; interface */
</span><span class="cx">                         if (strlen(globals.GSMOPEN_INTERFACES[i].name)
</span><del>-                                        &amp;&amp; (strncmp(globals.GSMOPEN_INTERFACES[i].name, argv[0], strlen(argv[0])) == 0)) {
</del><ins>+                                &amp;&amp; (strncmp(globals.GSMOPEN_INTERFACES[i].name, argv[0], strlen(argv[0])) == 0)) {
</ins><span class="cx">                                 tech_pvt = &amp;globals.GSMOPEN_INTERFACES[i];
</span><span class="cx">                                 stream-&gt;write_function(stream, &quot;Using interface: globals.GSMOPEN_INTERFACES[%d].name=|||%s|||\n&quot;, i, globals.GSMOPEN_INTERFACES[i].name);
</span><span class="cx">                                 found = 1;
</span><span class="lines">@@ -2623,9 +2601,11 @@
</span><span class="cx">                         //chat_send(p*roto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint);
</span><span class="cx">                         //chat_send(MDL_CHAT_PROTO, tech_pvt-&gt;skype_user, argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, hint);
</span><span class="cx"> 
</span><del>-                        NOTICA(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n&quot;, GSMOPEN_P_LOG, MDL_CHAT_PROTO, tech_pvt-&gt;skype_user, argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), tech_pvt-&gt;name);
</del><ins>+                        NOTICA(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n&quot;, GSMOPEN_P_LOG, MDL_CHAT_PROTO, tech_pvt-&gt;skype_user,
+                                   argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), tech_pvt-&gt;name);
</ins><span class="cx"> 
</span><del>-                        chat_send(MDL_CHAT_PROTO, tech_pvt-&gt;skype_user, argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, tech_pvt-&gt;name);
</del><ins>+                        chat_send(MDL_CHAT_PROTO, tech_pvt-&gt;skype_user, argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]),
+                                          NULL, tech_pvt-&gt;name);
</ins><span class="cx"> 
</span><span class="cx">                         //NOTICA(&quot;TEXT is: %s\n&quot;, GSMOPEN_P_LOG, (char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1] );
</span><span class="cx">                         //snprintf(skype_msg, sizeof(skype_msg), &quot;CHAT CREATE %s&quot;, argv[1]);
</span><span class="lines">@@ -2639,21 +2619,22 @@
</span><span class="cx"> 
</span><span class="cx"> #ifdef NOTDEF
</span><span class="cx"> 
</span><del>-        found=0;
</del><ins>+        found = 0;
</ins><span class="cx"> 
</span><del>-        while(!found){
-                for(i=0; i&lt;MAX_CHATS; i++){
-                        if(!strcmp(tech_pvt-&gt;chats[i].dialog_partner, argv[1]) ){
-                                snprintf(skype_msg, sizeof(skype_msg), &quot;CHATMESSAGE %s %s&quot;, tech_pvt-&gt;chats[i].chatname, (char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]);
</del><ins>+        while (!found) {
+                for (i = 0; i &lt; MAX_CHATS; i++) {
+                        if (!strcmp(tech_pvt-&gt;chats[i].dialog_partner, argv[1])) {
+                                snprintf(skype_msg, sizeof(skype_msg), &quot;CHATMESSAGE %s %s&quot;, tech_pvt-&gt;chats[i].chatname,
+                                                 (char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]);
</ins><span class="cx">                                 skypiax_signaling_write(tech_pvt, skype_msg);
</span><del>-                                found=1;
</del><ins>+                                found = 1;
</ins><span class="cx">                                 break;
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-                if(found){
</del><ins>+                if (found) {
</ins><span class="cx">                         break;
</span><span class="cx">                 }
</span><del>-                if(tried &gt; 1000){
</del><ins>+                if (tried &gt; 1000) {
</ins><span class="cx">                         stream-&gt;write_function(stream, &quot;ERROR: no chat with dialog_partner='%s' was found\n&quot;, argv[1]);
</span><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="lines">@@ -2661,12 +2642,12 @@
</span><span class="cx">         }
</span><span class="cx"> #endif //NOTDEF
</span><span class="cx"> 
</span><del>-end:
</del><ins>+  end:
</ins><span class="cx">         switch_safe_free(mycmd);
</span><span class="cx"> 
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><del>-#endif// NOTDEF
</del><ins>+#endif // NOTDEF
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> /* For Emacs:
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>