<!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][15258] </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=15258">15258</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-10-28 06:16:50 -0500 (Wed, 28 Oct 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>gsmopen: shut compiler warnings, allow the SMS sending in TEXT mode, while we change the code for receiving to PDU mode</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopengsmopen_protocolcpp">freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp</a></li>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopenmod_gsmopencpp">freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchbranchesgmaruzzmod_gsmopengsmopen_protocolcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp (15257 => 15258)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp        2009-10-27 22:04:44 UTC (rev 15257)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp        2009-10-28 11:16:50 UTC (rev 15258)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> #include "gsmopen.h"
</span><del>-#include <iostream.h>
</del><ins>+//#include <iostream.h>
</ins><span class="cx"> #include <gsmlib/gsm_sms.h>
</span><span class="cx">
</span><span class="cx"> using namespace std;
</span><span class="lines">@@ -302,9 +302,9 @@
</span><span class="cx">         if (res) {
</span><span class="cx">                 DEBUGA_GSMOPEN("AT+CMGF? failed, continue\n", GSMOPEN_P_LOG);
</span><span class="cx">         }
</span><del>-        res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0");        //TODO: support phones that only accept pdu mode
</del><ins>+        res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1");        //TODO: support phones that only accept pdu mode
</ins><span class="cx">         if (res) {
</span><del>-                ERRORA("Error setting SMS sending mode to TEXT on the cellphone\n", GSMOPEN_P_LOG);
</del><ins>+                ERRORA("Error setting SMS sending mode to PDU on the cellphone\n", GSMOPEN_P_LOG);
</ins><span class="cx">                 return RESULT_FAILURE;
</span><span class="cx">         }
</span><span class="cx">         /* what is the Charset of SMSs? */
</span><span class="lines">@@ -2909,6 +2909,7 @@
</span><span class="cx">         //char *stringp = NULL;
</span><span class="cx">         //int found = 0;
</span><span class="cx">         int failed = 0;
</span><ins>+                int err = 0;
</ins><span class="cx">
</span><span class="cx">         //strncpy(rdest, idest, sizeof(rdest) - 1);
</span><span class="cx">         DEBUGA_GSMOPEN("GSMopenSendsms: dest=%s text=%s\n", GSMOPEN_P_LOG, dest, text);
</span><span class="lines">@@ -2923,13 +2924,18 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if (tech_pvt->controldevprotocol == PROTOCOL_AT) {
</span><del>-                int err = 0;
</del><span class="cx">                 char smscommand[16000];
</span><span class="cx">                 memset(smscommand, '\0', sizeof(smscommand));
</span><span class="cx">
</span><span class="cx">                 PUSHA_UNLOCKA(&tech_pvt->controldev_lock);
</span><span class="cx">                 LOKKA(tech_pvt->controldev_lock);
</span><span class="cx">
</span><ins>+                        err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=1");
+                        if (err) {
+                                ERRORA("AT+CMGF=1 (set message sending to TEXT (as opposed to PDU) do not got OK from the phone\n", GSMOPEN_P_LOG);
+                        }
+
+
</ins><span class="cx">                 if (tech_pvt->no_ucs2) {
</span><span class="cx">                         sprintf(smscommand, "AT+CMGS=\"%s\"", dest);        //TODO: support phones that only accept pdu mode
</span><span class="cx">                 } else {
</span><span class="lines">@@ -3040,6 +3046,12 @@
</span><span class="cx">                 POPPA_UNLOCKA(&tech_pvt->controldev_lock);
</span><span class="cx">         }
</span><span class="cx">
</span><ins>+                        err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0");
+                        if (err) {
+                                ERRORA("AT+CMGF=1 (set message sending to PDU (as opposed to TEXT) do not got OK from the phone\n", GSMOPEN_P_LOG);
+                        }
+
+
</ins><span class="cx">         DEBUGA_GSMOPEN("FINISH\n", GSMOPEN_P_LOG);
</span><span class="cx">         if (failed)
</span><span class="cx">                 return -1;
</span></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_gsmopenmod_gsmopencpp"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp (15257 => 15258)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp        2009-10-27 22:04:44 UTC (rev 15257)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp        2009-10-28 11:16:50 UTC (rev 15258)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx"> #define SOFT_RELOAD 1
</span><span class="cx"> /* END: Changes heres */
</span><span class="cx">
</span><del>-char *interface_status[] = {        /* should match GSMOPEN_STATE_xxx in gsmopen.h */
</del><ins>+const char *interface_status[] = {        /* should match GSMOPEN_STATE_xxx in gsmopen.h */
</ins><span class="cx">         "IDLE",
</span><span class="cx">         "DOWN",
</span><span class="cx">         "RING",
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">         "HANG_RQ",
</span><span class="cx">         "PREANSW"
</span><span class="cx"> };
</span><del>-char *phone_callflow[] = {                /* should match CALLFLOW_XXX in gsmopen.h */
</del><ins>+const char *phone_callflow[] = {                /* should match CALLFLOW_XXX in gsmopen.h */
</ins><span class="cx">         "CALL_IDLE",
</span><span class="cx">         "CALL_DOWN",
</span><span class="cx">         "INCOMING_RNG",
</span><span class="lines">@@ -934,7 +934,7 @@
</span><span class="cx">         switch_assert(tech_pvt != NULL);
</span><span class="cx">
</span><span class="cx">         if (!body) {
</span><del>-                body = "";
</del><ins>+                body = (char *)"";
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         WARNINGA("event: |||%s|||\n", GSMOPEN_P_LOG, body);
</span><span class="lines">@@ -1107,7 +1107,7 @@
</span><span class="cx">
</span><span class="cx"> static switch_status_t load_config(int reload_type)
</span><span class="cx"> {
</span><del>-        char *cf = "gsmopen.conf";
</del><ins>+        const char *cf = "gsmopen.conf";
</ins><span class="cx">         switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
</span><span class="cx">         private_t *tech_pvt = NULL;
</span><span class="cx">
</span><span class="lines">@@ -1153,82 +1153,82 @@
</span><span class="cx">                 for (myinterface = switch_xml_child(interfaces, "interface"); myinterface; myinterface = myinterface->next) {
</span><span class="cx">                         char *id = (char *) switch_xml_attr(myinterface, "id");
</span><span class="cx">                         char *name = (char *) switch_xml_attr(myinterface, "name");
</span><del>-                        char *context = "default";
-                        char *dialplan = "XML";
-                        char *destination = "5000";
-                        char *controldevice_name = "/dev/ttyACM0";
</del><ins>+                        const char *context = "default";
+                        const char *dialplan = "XML";
+                        const char *destination = "5000";
+                        const char *controldevice_name = "/dev/ttyACM0";
</ins><span class="cx">                         char *digit_timeout = NULL;
</span><span class="cx">                         char *max_digits = NULL;
</span><span class="cx">                         char *hotline = NULL;
</span><span class="cx">                         char *dial_regex = NULL;
</span><span class="cx">                         char *hold_music = NULL;
</span><span class="cx">                         char *fail_dial_regex = NULL;
</span><del>-                        char *enable_callerid = "true";
</del><ins>+                        const char *enable_callerid = "true";
</ins><span class="cx">
</span><span class="cx">
</span><del>-                        char *at_dial_pre_number = "ATD";
-                        char *at_dial_post_number = ";";
-                        char *at_dial_expect = "OK";
-                        char *at_hangup = "ATH";
-                        char *at_hangup_expect = "OK";
-                        char *at_answer = "ATA";
-                        char *at_answer_expect = "OK";
-                        char *at_send_dtmf = "AT+VTS";
-                        char *at_preinit_1 = "";
-                        char *at_preinit_1_expect = "";
-                        char *at_preinit_2 = "";
-                        char *at_preinit_2_expect = "";
-                        char *at_preinit_3 = "";
-                        char *at_preinit_3_expect = "";
-                        char *at_preinit_4 = "";
-                        char *at_preinit_4_expect = "";
-                        char *at_preinit_5 = "";
-                        char *at_preinit_5_expect = "";
-                        char *at_postinit_1 = "at+cmic=0,9";
-                        char *at_postinit_1_expect = "OK";
-                        char *at_postinit_2 = "AT+CKPD=\"EEE\"";
-                        char *at_postinit_2_expect = "OK";
-                        char *at_postinit_3 = "AT+CSSN=1,0";
-                        char *at_postinit_3_expect = "OK";
-                        char *at_postinit_4 = "at+sidet=0";
-                        char *at_postinit_4_expect = "OK";
-                        char *at_postinit_5 = "at+clvl=99";
-                        char *at_postinit_5_expect = "OK";
-                        char *at_query_battchg = "AT+CBC";
-                        char *at_query_battchg_expect = "OK";
-                        char *at_query_signal = "AT+CSQ";
-                        char *at_query_signal_expect = "OK";
-                        char *at_call_idle = "+MCST: 1";
-                        char *at_call_incoming = "+MCST: 2";
-                        char *at_call_active = "+CSSI: 7";
-                        char *at_call_failed = "+MCST: 65";
-                        char *at_call_calling = "+CSSI: 1";
-                        char *at_indicator_noservice_string = "CIEV: 2;0";
-                        char *at_indicator_nosignal_string = "CIEV: 5;0";
-                        char *at_indicator_lowsignal_string = "CIEV: 5;1";
-                        char *at_indicator_lowbattchg_string = "CIEV: 0;1";
-                        char *at_indicator_nobattchg_string = "CIEV: 0;0";
-                        char *at_indicator_callactive_string = "CIEV: 3;1";
-                        char *at_indicator_nocallactive_string = "CIEV: 3;0";
-                        char *at_indicator_nocallsetup_string = "CIEV: 6;0";
-                        char *at_indicator_callsetupincoming_string = "CIEV: 6;1";
-                        char *at_indicator_callsetupoutgoing_string = "CIEV: 6;2";
-                        char *at_indicator_callsetupremoteringing_string = "CIEV: 6;3";
-                        //char *sms_receiving_program = "/usr/local/bin/ciapalo";
-                        char *alsacname = "plughw:1";
-                        char *alsapname = "plughw:1";
-                        char *at_early_audio = "0";
-                        char *at_after_preinit_pause = "500000";
-                        char *at_initial_pause = "500000";
-                        char *at_has_clcc = "0";
-                        char *at_has_ecam = "0";
-                        char *alsa_period_size = "160";
-                        char *alsa_periods_in_buffer = "4";
-                        char *gsmopen_sound_rate = "8000";
-                        char *alsa_play_is_mono = "1";
-                        char *alsa_capture_is_mono = "1";
-                        char *capture_boost = "5";
-                        char *playback_boost = "10";
</del><ins>+                        const char *at_dial_pre_number = "ATD";
+                        const char *at_dial_post_number = ";";
+                        const char *at_dial_expect = "OK";
+                        const char *at_hangup = "ATH";
+                        const char *at_hangup_expect = "OK";
+                        const char *at_answer = "ATA";
+                        const char *at_answer_expect = "OK";
+                        const char *at_send_dtmf = "AT+VTS";
+                        const char *at_preinit_1 = "";
+                        const char *at_preinit_1_expect = "";
+                        const char *at_preinit_2 = "";
+                        const char *at_preinit_2_expect = "";
+                        const char *at_preinit_3 = "";
+                        const char *at_preinit_3_expect = "";
+                        const char *at_preinit_4 = "";
+                        const char *at_preinit_4_expect = "";
+                        const char *at_preinit_5 = "";
+                        const char *at_preinit_5_expect = "";
+                        const char *at_postinit_1 = "at+cmic=0,9";
+                        const char *at_postinit_1_expect = "OK";
+                        const char *at_postinit_2 = "AT+CKPD=\"EEE\"";
+                        const char *at_postinit_2_expect = "OK";
+                        const char *at_postinit_3 = "AT+CSSN=1,0";
+                        const char *at_postinit_3_expect = "OK";
+                        const char *at_postinit_4 = "at+sidet=0";
+                        const char *at_postinit_4_expect = "OK";
+                        const char *at_postinit_5 = "at+clvl=99";
+                        const char *at_postinit_5_expect = "OK";
+                        const char *at_query_battchg = "AT+CBC";
+                        const char *at_query_battchg_expect = "OK";
+                        const char *at_query_signal = "AT+CSQ";
+                        const char *at_query_signal_expect = "OK";
+                        const char *at_call_idle = "+MCST: 1";
+                        const char *at_call_incoming = "+MCST: 2";
+                        const char *at_call_active = "+CSSI: 7";
+                        const char *at_call_failed = "+MCST: 65";
+                        const char *at_call_calling = "+CSSI: 1";
+                        const char *at_indicator_noservice_string = "CIEV: 2;0";
+                        const char *at_indicator_nosignal_string = "CIEV: 5;0";
+                        const char *at_indicator_lowsignal_string = "CIEV: 5;1";
+                        const char *at_indicator_lowbattchg_string = "CIEV: 0;1";
+                        const char *at_indicator_nobattchg_string = "CIEV: 0;0";
+                        const char *at_indicator_callactive_string = "CIEV: 3;1";
+                        const char *at_indicator_nocallactive_string = "CIEV: 3;0";
+                        const char *at_indicator_nocallsetup_string = "CIEV: 6;0";
+                        const char *at_indicator_callsetupincoming_string = "CIEV: 6;1";
+                        const char *at_indicator_callsetupoutgoing_string = "CIEV: 6;2";
+                        const char *at_indicator_callsetupremoteringing_string = "CIEV: 6;3";
+                        //const char *sms_receiving_program = "/usr/local/bin/ciapalo";
+                        const char *alsacname = "plughw:1";
+                        const char *alsapname = "plughw:1";
+                        const char *at_early_audio = "0";
+                        const char *at_after_preinit_pause = "500000";
+                        const char *at_initial_pause = "500000";
+                        const char *at_has_clcc = "0";
+                        const char *at_has_ecam = "0";
+                        const char *alsa_period_size = "160";
+                        const char *alsa_periods_in_buffer = "4";
+                        const char *gsmopen_sound_rate = "8000";
+                        const char *alsa_play_is_mono = "1";
+                        const char *alsa_capture_is_mono = "1";
+                        const char *capture_boost = "5";
+                        const char *playback_boost = "10";
</ins><span class="cx">
</span><span class="cx">                         uint32_t interface_id = 0;
</span><span class="cx">                         uint32_t controldevice_speed = B115200;        //FIXME TODO
</span><span class="lines">@@ -1615,8 +1615,8 @@
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">
</span><span class="cx">         }
</span><del>-                                gsmopen_store_boost("5", &globals.GSMOPEN_INTERFACES[interface_id].capture_boost);        //FIXME
-                                gsmopen_store_boost("10", &globals.GSMOPEN_INTERFACES[interface_id].playback_boost);        //FIXME
</del><ins>+                                gsmopen_store_boost((char *)"5", &globals.GSMOPEN_INTERFACES[interface_id].capture_boost);        //FIXME
+                                gsmopen_store_boost((char *)"10", &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(&gsmopen_api_thread_attr, gsmopen_module_pool);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>