<!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][16209] </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=16209">16209</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2010-01-07 21:40:46 -0600 (Thu, 07 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>gsmopen: compiles, loads and runs on win32. It does nothing, just query the modem for model name. but... IT - CAN - BE - DONE</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopengsmlibgsmlib110patched12ubuntu1win32gsmlibvcproj">freeswitch/branches/gmaruzz/mod_gsmopen/gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/gsmlib.vcproj</a></li>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopengsmopenh">freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen.h</a></li>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopengsmopen_protocolcpp">freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp</a></li>
<li><a href="#freeswitchbranchesgmaruzzmod_gsmopenmod_gsmopen2008vcproj">freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.2008.vcproj</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_gsmopengsmlibgsmlib110patched12ubuntu1win32gsmlibvcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/gsmlib.vcproj (16208 => 16209)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/gsmlib.vcproj        2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/gsmlib.vcproj        2010-01-08 03:40:46 UTC (rev 16209)
</span><span class="lines">@@ -100,6 +100,7 @@
</span><span class="cx">                         UseOfMFC="0"
</span><span class="cx">                         ATLMinimizesCRunTimeLibraryUsage="false"
</span><span class="cx">                         CharacterSet="2"
</span><ins>+                        ManagedExtensions="0"
</ins><span class="cx">                         >
</span><span class="cx">                         <Tool
</span><span class="cx">                                 Name="VCPreBuildEventTool"
</span><span class="lines">@@ -121,9 +122,9 @@
</span><span class="cx">                                 Optimization="0"
</span><span class="cx">                                 AdditionalIncludeDirectories="..,."
</span><span class="cx">                                 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
</span><del>-                                MinimalRebuild="true"
-                                BasicRuntimeChecks="3"
-                                RuntimeLibrary="1"
</del><ins>+                                MinimalRebuild="false"
+                                BasicRuntimeChecks="0"
+                                RuntimeLibrary="3"
</ins><span class="cx">                                 RuntimeTypeInfo="true"
</span><span class="cx">                                 PrecompiledHeaderFile=".\Debug/gsmlib.pch"
</span><span class="cx">                                 AssemblerListingLocation=".\Debug/"
</span><span class="lines">@@ -131,7 +132,9 @@
</span><span class="cx">                                 ProgramDataBaseFileName=".\Debug/"
</span><span class="cx">                                 WarningLevel="3"
</span><span class="cx">                                 SuppressStartupBanner="true"
</span><del>-                                DebugInformationFormat="4"
</del><ins>+                                DebugInformationFormat="3"
+                                DisableSpecificWarnings="4290"
+                                OmitDefaultLibName="true"
</ins><span class="cx">                         />
</span><span class="cx">                         <Tool
</span><span class="cx">                                 Name="VCManagedResourceCompilerTool"
</span><span class="lines">@@ -148,6 +151,8 @@
</span><span class="cx">                                 Name="VCLibrarianTool"
</span><span class="cx">                                 OutputFile=".\Debug\gsmlib.lib"
</span><span class="cx">                                 SuppressStartupBanner="true"
</span><ins>+                                IgnoreAllDefaultLibraries="true"
+                                IgnoreDefaultLibraryNames="msvcprtd "
</ins><span class="cx">                         />
</span><span class="cx">                         <Tool
</span><span class="cx">                                 Name="VCALinkTool"
</span></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_gsmopengsmopenh"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen.h (16208 => 16209)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen.h        2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen.h        2010-01-08 03:40:46 UTC (rev 16209)
</span><span class="lines">@@ -34,6 +34,11 @@
</span><span class="cx"> *
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+#ifdef WIN32
+#define HAVE_VSNPRINTF
+#pragma warning(disable: 4290)
+#endif //WIN32
+
</ins><span class="cx"> #define MY_EVENT_INCOMING_SMS "gsmopen::incoming_sms"
</span><span class="cx">
</span><span class="cx"> #undef GIOVA48
</span><span class="lines">@@ -57,9 +62,11 @@
</span><span class="cx"> #endif // NO_ALSA
</span><span class="cx"> #include <switch.h>
</span><span class="cx"> #include <switch_version.h>
</span><ins>+#ifndef WIN32
</ins><span class="cx"> #include <termios.h>
</span><span class="cx"> #include <sys/ioctl.h>
</span><span class="cx"> #include <iconv.h>
</span><ins>+#endif //WIN32
</ins><span class="cx"> #include <libteletone.h>
</span><span class="cx">
</span><span class="cx"> #ifdef GSMOPEN_ALSA
</span><span class="lines">@@ -319,7 +326,11 @@
</span><span class="cx">         char controldevprotocolname[50];        /*!< \brief name of the serial device controlling protocol, one of "at" "fbus2" "no_serial" "alsa_voicemodem" */
</span><span class="cx">         int controldevfd;                        /*!< \brief serial controlling file descriptor for this interface */
</span><span class="cx">         //pthread_t controldev_thread; /*!< \brief serial control thread for this interface, running during the call */
</span><ins>+#ifdef WIN32
+        int controldevice_speed;
+#else
</ins><span class="cx">         speed_t controldevice_speed;
</span><ins>+#endif// WIN32
</ins><span class="cx">         int controldev_dead;
</span><span class="cx">
</span><span class="cx">         char at_dial_pre_number[64];
</span><span class="lines">@@ -489,7 +500,9 @@
</span><span class="cx"> int remote_party_is_ringing(private_t * tech_pvt);
</span><span class="cx"> int remote_party_is_early_media(private_t * tech_pvt);
</span><span class="cx"> //int gsmopen_answer(private_t * tech_pvt, char *id, char *value);
</span><ins>+#if 0
</ins><span class="cx"> int gsmopen_transfer(private_t * tech_pvt, char *id, char *value);
</span><ins>+#endif //0
</ins><span class="cx"> int gsmopen_socket_create_and_bind(private_t * tech_pvt, int *which_port);
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -497,7 +510,11 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> void *gsmopen_do_controldev_thread(void *data);
</span><ins>+#ifdef WIN32
+int gsmopen_serial_init(private_t * tech_pvt, int controldevice_speed);
+#else
</ins><span class="cx"> int gsmopen_serial_init(private_t * tech_pvt, speed_t controldevice_speed);
</span><ins>+#endif //WIN32
</ins><span class="cx"> int gsmopen_serial_monitor(private_t * tech_pvt);
</span><span class="cx"> int gsmopen_serial_sync(private_t * tech_pvt);
</span><span class="cx"> int gsmopen_serial_sync_AT(private_t * tech_pvt);
</span></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_gsmopengsmopen_protocolcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp (16208 => 16209)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp        2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp        2010-01-08 03:40:46 UTC (rev 16209)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> #include "gsmopen.h"
</span><span class="cx"> //#include <iostream.h>
</span><ins>+
</ins><span class="cx"> #ifndef NO_GSMLIB
</span><span class="cx"> #include <gsmlib/gsm_sms.h>
</span><span class="cx"> #ifdef WIN32
</span><span class="lines">@@ -15,7 +16,6 @@
</span><span class="cx"> using namespace gsmlib;
</span><span class="cx"> #endif// NO_GSMLIB
</span><span class="cx">
</span><del>-
</del><span class="cx"> #ifdef ASTERISK
</span><span class="cx"> #define gsmopen_sleep usleep
</span><span class="cx"> #define gsmopen_strncpy strncpy
</span><span class="lines">@@ -36,8 +36,58 @@
</span><span class="cx"> int option_debug = 100;
</span><span class="cx">
</span><span class="cx">
</span><ins>+#ifdef WIN32
+#define GSMLIBGIO
+#else //WIN32
+#undef GSMLIBGIO
+#endif //WIN32
</ins><span class="cx">
</span><del>-#undef GSMLIBGIO
</del><ins>+#ifdef WIN32
+/***************/
+// from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
+
+#include <time.h>
+
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
+#else /* */
+#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
+#endif /* */
+struct sk_timezone {
+        int tz_minuteswest;                        /* minutes W of Greenwich */
+        int tz_dsttime;                                /* type of dst correction */
+};
+int gettimeofday(struct timeval *tv, struct sk_timezone *tz)
+{
+        FILETIME ft;
+        unsigned __int64 tmpres = 0;
+        static int tzflag;
+        if (NULL != tv) {
+                GetSystemTimeAsFileTime(&ft);
+                tmpres |= ft.dwHighDateTime;
+                tmpres <<= 32;
+                tmpres |= ft.dwLowDateTime;
+
+                /*converting file time to unix epoch */
+                tmpres /= 10;                        /*convert into microseconds */
+                tmpres -= DELTA_EPOCH_IN_MICROSECS;
+                tv->tv_sec = (long) (tmpres / 1000000UL);
+                tv->tv_usec = (long) (tmpres % 1000000UL);
+        }
+        if (NULL != tz) {
+                if (!tzflag) {
+                        _tzset();
+                        tzflag++;
+                }
+                tz->tz_minuteswest = _timezone / 60;
+                tz->tz_dsttime = _daylight;
+        }
+        return 0;
+}
+
+/***************/
+#endif /* WIN32 */
+
</ins><span class="cx"> #ifndef GSMLIBGIO
</span><span class="cx"> int gsmopen_serial_init(private_t * tech_pvt, speed_t controldevice_speed)
</span><span class="cx"> {
</span><span class="lines">@@ -121,13 +171,17 @@
</span><span class="cx">         return (fd);
</span><span class="cx"> }
</span><span class="cx"> #else //GSMLIBGIO
</span><ins>+#ifdef WIN32
+int gsmopen_serial_init(private_t * tech_pvt, int controldevice_speed)
+#else
</ins><span class="cx"> int gsmopen_serial_init(private_t * tech_pvt, speed_t controldevice_speed)
</span><ins>+#endif //WIN32
</ins><span class="cx"> {
</span><span class="cx">         int i;
</span><span class="cx">         string ciapa;
</span><span class="cx">
</span><span class="cx"> #ifdef WIN32
</span><del>-        Ref < Port > port = new Win32SerialPort((string) tech_pvt->controldevice_name, 38400);
</del><ins>+        Ref <Port> port = new Win32SerialPort((string) tech_pvt->controldevice_name, 38400);
</ins><span class="cx"> #else
</span><span class="cx">         //Ref<Port> port = new UnixSerialPort((string)argv[1], B38400);
</span><span class="cx">         Ref < Port > port = new UnixSerialPort((string) tech_pvt->controldevice_name, B115200);
</span><span class="lines">@@ -135,7 +189,7 @@
</span><span class="cx">         MeTa m(port);
</span><span class="cx">
</span><span class="cx">         //cout << "Creating GsmAt object" << endl;
</span><del>-        Ref < GsmAt > gsmat = new GsmAt(m);
</del><ins>+        Ref <GsmAt> gsmat = new GsmAt(m);
</ins><span class="cx">
</span><span class="cx">         //cout << "Using GsmAt object" << endl;
</span><span class="cx">         //cout << gsmat->chat("AT", "OK", false, false) << endl;
</span><span class="lines">@@ -144,11 +198,10 @@
</span><span class="cx">         for (i = 0; i < 4; i++) {
</span><span class="cx">                 ciapa = gsmat->getLine();
</span><span class="cx">                 //cout << "PRESO: |||" << ciapa << "|||" << endl;
</span><del>-                ERRORA("PRESO %d |||%s|||\n", GSMOPEN_P_LOG, i, ciapa.c_str());
-                //usleep(5000);
</del><ins>+                NOTICA("PRESO %d |||%s|||\n", GSMOPEN_P_LOG, i, ciapa.c_str());
+                //gsmopen_sleep(5000);
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-
</del><span class="cx">         return (-1);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -236,7 +289,7 @@
</span><span class="cx"> /* initial_pause? */
</span><span class="cx">         if (tech_pvt->at_initial_pause) {
</span><span class="cx">                 DEBUGA_GSMOPEN("sleeping for %d usec\n", GSMOPEN_P_LOG, tech_pvt->at_initial_pause);
</span><del>-                usleep(tech_pvt->at_initial_pause);
</del><ins>+                gsmopen_sleep(tech_pvt->at_initial_pause);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> /* go until first empty preinit string, or last preinit string */
</span><span class="lines">@@ -293,7 +346,7 @@
</span><span class="cx"> /* after_preinit_pause? */
</span><span class="cx">         if (tech_pvt->at_after_preinit_pause) {
</span><span class="cx">                 DEBUGA_GSMOPEN("sleeping for %d usec\n", GSMOPEN_P_LOG, tech_pvt->at_after_preinit_pause);
</span><del>-                usleep(tech_pvt->at_after_preinit_pause);
</del><ins>+                gsmopen_sleep(tech_pvt->at_after_preinit_pause);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /* phone, brother, art you alive? */
</span><span class="lines">@@ -307,7 +360,7 @@
</span><span class="cx">         if (res) {
</span><span class="cx">                 DEBUGA_GSMOPEN("AT+mode=0 does not get OK from the phone. If it is NOT Motorola," " no problem.\n", GSMOPEN_P_LOG);
</span><span class="cx">         }
</span><del>-        usleep(50000);
</del><ins>+        gsmopen_sleep(50000);
</ins><span class="cx">         /* for motorola end */
</span><span class="cx">
</span><span class="cx">         /* reset AT configuration to phone default */
</span><span class="lines">@@ -532,7 +585,7 @@
</span><span class="cx">
</span><span class="cx"> int gsmopen_serial_sync_AT(private_t * tech_pvt)
</span><span class="cx"> {
</span><del>-        usleep(10000);                                /* 10msec */
</del><ins>+        gsmopen_sleep(10000);                                /* 10msec */
</ins><span class="cx">         time(&tech_pvt->gsmopen_serial_synced_timestamp);
</span><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -1021,7 +1074,7 @@
</span><span class="cx">                                 } else {
</span><span class="cx">                                         DEBUGA_GSMOPEN("|%s| +CMTI: Incoming SMS in position: %d!\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], pos);
</span><span class="cx">                                         tech_pvt->unread_sms_msg_id = pos;
</span><del>-                                        usleep(1000);
</del><ins>+                                        gsmopen_sleep(1000);
</ins><span class="cx">
</span><span class="cx">                                         if (tech_pvt->unread_sms_msg_id) {
</span><span class="cx">                                                 char at_command[256];
</span><span class="lines">@@ -1754,7 +1807,7 @@
</span><span class="cx">
</span><span class="cx">                 if (res != 1) {
</span><span class="cx">                         DEBUGA_GSMOPEN("Error sending (%.1s): %d (%s)\n", GSMOPEN_P_LOG, &data[i], res, strerror(errno));
</span><del>-                        usleep(100000);
</del><ins>+                        gsmopen_sleep(100000);
</ins><span class="cx">                         for (count = 0; count < 10; count++) {
</span><span class="cx">                                 res = write(tech_pvt->controldevfd, &data[i], 1);
</span><span class="cx">                                 if (res == 1) {
</span><span class="lines">@@ -1762,7 +1815,7 @@
</span><span class="cx">                                         break;
</span><span class="cx">                                 } else
</span><span class="cx">                                         DEBUGA_GSMOPEN("Error RE-sending (%.1s): %d %d (%s)\n", GSMOPEN_P_LOG, &data[i], count, res, strerror(errno));
</span><del>-                                usleep(100000);
</del><ins>+                                gsmopen_sleep(100000);
</ins><span class="cx">
</span><span class="cx">                         }
</span><span class="cx">                         if (res != 1) {
</span><span class="lines">@@ -1772,14 +1825,14 @@
</span><span class="cx">                 }
</span><span class="cx">                 if (option_debug > 1)
</span><span class="cx">                         DEBUGA_GSMOPEN("sent data... (%.1s)\n", GSMOPEN_P_LOG, &data[i]);
</span><del>-                usleep(1000);                        /* release the cpu */
</del><ins>+                gsmopen_sleep(1000);                        /* release the cpu */
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         res = write(tech_pvt->controldevfd, "\r", 1);
</span><span class="cx">
</span><span class="cx">         if (res != 1) {
</span><span class="cx">                 DEBUGA_GSMOPEN("Error sending (carriage return): %d (%s)\n", GSMOPEN_P_LOG, res, strerror(errno));
</span><del>-                usleep(100000);
</del><ins>+                gsmopen_sleep(100000);
</ins><span class="cx">                 for (count = 0; count < 10; count++) {
</span><span class="cx">                         res = write(tech_pvt->controldevfd, "\r", 1);
</span><span class="cx">
</span><span class="lines">@@ -1788,7 +1841,7 @@
</span><span class="cx">                                 break;
</span><span class="cx">                         } else
</span><span class="cx">                                 DEBUGA_GSMOPEN("Error RE-sending (carriage return): %d %d (%s)\n", GSMOPEN_P_LOG, count, res, strerror(errno));
</span><del>-                        usleep(100000);
</del><ins>+                        gsmopen_sleep(100000);
</ins><span class="cx">
</span><span class="cx">                 }
</span><span class="cx">                 if (res != 1) {
</span><span class="lines">@@ -1798,7 +1851,7 @@
</span><span class="cx">         }
</span><span class="cx">         if (option_debug > 1)
</span><span class="cx">                 DEBUGA_GSMOPEN("sent (carriage return)\n", GSMOPEN_P_LOG);
</span><del>-        usleep(1000);                                /* release the cpu */
</del><ins>+        gsmopen_sleep(1000);                                /* release the cpu */
</ins><span class="cx">
</span><span class="cx">         return howmany;
</span><span class="cx"> }
</span><span class="lines">@@ -1817,14 +1870,14 @@
</span><span class="cx">
</span><span class="cx">                 if (res != 1) {
</span><span class="cx">                         DEBUGA_GSMOPEN("Error sending (%.1s): %d (%s)\n", GSMOPEN_P_LOG, &data[i], res, strerror(errno));
</span><del>-                        usleep(100000);
</del><ins>+                        gsmopen_sleep(100000);
</ins><span class="cx">                         for (count = 0; count < 10; count++) {
</span><span class="cx">                                 res = write(tech_pvt->controldevfd, &data[i], 1);
</span><span class="cx">                                 if (res == 1)
</span><span class="cx">                                         break;
</span><span class="cx">                                 else
</span><span class="cx">                                         DEBUGA_GSMOPEN("Error RE-sending (%.1s): %d %d (%s)\n", GSMOPEN_P_LOG, &data[i], count, res, strerror(errno));
</span><del>-                                usleep(100000);
</del><ins>+                                gsmopen_sleep(100000);
</ins><span class="cx">
</span><span class="cx">                         }
</span><span class="cx">                         if (res != 1) {
</span><span class="lines">@@ -1834,10 +1887,10 @@
</span><span class="cx">                 }
</span><span class="cx">                 if (option_debug > 1)
</span><span class="cx">                         DEBUGA_GSMOPEN("sent data... (%.1s)\n", GSMOPEN_P_LOG, &data[i]);
</span><del>-                usleep(1000);                        /* release the cpu */
</del><ins>+                gsmopen_sleep(1000);                        /* release the cpu */
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        usleep(1000);                                /* release the cpu */
</del><ins>+        gsmopen_sleep(1000);                                /* release the cpu */
</ins><span class="cx">
</span><span class="cx">         return howmany;
</span><span class="cx"> }
</span><span class="lines">@@ -2075,6 +2128,7 @@
</span><span class="cx"> int ucs2_to_utf8(private_t * tech_pvt, char *ucs2_in, char *utf8_out, size_t outbytesleft)
</span><span class="cx"> {
</span><span class="cx">         char converted[16000];
</span><ins>+#ifndef WIN32
</ins><span class="cx">         iconv_t iconv_format;
</span><span class="cx">         int iconv_res;
</span><span class="cx">         char *outbuf;
</span><span class="lines">@@ -2123,12 +2177,14 @@
</span><span class="cx">                  GSMOPEN_P_LOG, iconv_res, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out);
</span><span class="cx">         iconv_close(iconv_format);
</span><span class="cx">
</span><ins>+#endif //WIN32
</ins><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> int iso_8859_1_to_utf8(private_t * tech_pvt, char *iso_8859_1_in, char *utf8_out, size_t outbytesleft)
</span><span class="cx"> {
</span><span class="cx">         char converted[16000];
</span><ins>+#ifndef WIN32
</ins><span class="cx">         iconv_t iconv_format;
</span><span class="cx">         int iconv_res;
</span><span class="cx">         char *outbuf;
</span><span class="lines">@@ -2169,6 +2225,7 @@
</span><span class="cx">
</span><span class="cx">         iconv_close(iconv_format);
</span><span class="cx">
</span><ins>+#endif //WIN32
</ins><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2176,6 +2233,7 @@
</span><span class="cx"> int utf_to_ucs2(private_t * tech_pvt, char *utf_in, size_t inbytesleft, char *ucs2_out, size_t outbytesleft)
</span><span class="cx"> {
</span><span class="cx">         /* cicopet */
</span><ins>+#ifndef WIN32
</ins><span class="cx">         iconv_t iconv_format;
</span><span class="cx">         int iconv_res;
</span><span class="cx">         char *outbuf;
</span><span class="lines">@@ -2219,6 +2277,7 @@
</span><span class="cx">                 strncat(ucs2_out, stringa2, ((outbytesleft - strlen(ucs2_out)) - 1));        //add the received line to the buffer
</span><span class="cx">                 DEBUGA_GSMOPEN("stringa=%s, stringa2=%s, ucs2_out=%s\n", GSMOPEN_P_LOG, stringa, stringa2, ucs2_out);
</span><span class="cx">         }
</span><ins>+#endif //WIN32
</ins><span class="cx">         return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2246,7 +2305,7 @@
</span><span class="cx">         tech_pvt->phone_callflow = CALLFLOW_CALL_ACTIVE;
</span><span class="cx">
</span><span class="cx">         while (tech_pvt->interface_state == GSMOPEN_STATE_RING) {
</span><del>-                usleep(10000);                        //10msec
</del><ins>+                gsmopen_sleep(10000);                        //10msec
</ins><span class="cx">         }
</span><span class="cx">         if (tech_pvt->interface_state != GSMOPEN_STATE_UP) {
</span><span class="cx">                 ERRORA("call answering failed\n", GSMOPEN_P_LOG);
</span><span class="lines">@@ -2292,7 +2351,7 @@
</span><span class="cx">
</span><span class="cx">         new_inbound_channel(tech_pvt);
</span><span class="cx">
</span><del>-        usleep(10000);
</del><ins>+        gsmopen_sleep(10000);
</ins><span class="cx">
</span><span class="cx">         session = switch_core_session_locate(tech_pvt->session_uuid_str);
</span><span class="cx">         if (session) {
</span><span class="lines">@@ -2349,7 +2408,7 @@
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         while (tech_pvt->interface_state != GSMOPEN_STATE_DOWN) {
</span><del>-                                usleep(10000);        //10msec
</del><ins>+                                gsmopen_sleep(10000);        //10msec
</ins><span class="cx">                         }
</span><span class="cx">                         if (tech_pvt->interface_state != GSMOPEN_STATE_DOWN) {
</span><span class="cx">                                 ERRORA("call hangup failed\n", GSMOPEN_P_LOG);
</span><span class="lines">@@ -3039,14 +3098,14 @@
</span><span class="cx">                         }
</span><span class="cx">                         DEBUGA_GSMOPEN("prepared!\n", GSMOPEN_P_LOG);
</span><span class="cx">                 }
</span><del>-                usleep(1000);
</del><ins>+                gsmopen_sleep(1000);
</ins><span class="cx">                 error = snd_pcm_start(tech_pvt->alsac);
</span><span class="cx">                 if (error) {
</span><span class="cx">                         ERRORA("snd_pcm_start failed, %s\n", GSMOPEN_P_LOG, snd_strerror(error));
</span><span class="cx">                         return r;
</span><span class="cx">                 }
</span><span class="cx">                 DEBUGA_GSMOPEN("started!\n", GSMOPEN_P_LOG);
</span><del>-                usleep(1000);
</del><ins>+                gsmopen_sleep(1000);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         buf = __buf + AST_FRIENDLY_OFFSET / 2;
</span><span class="lines">@@ -3079,7 +3138,7 @@
</span><span class="cx">         } else if (r == -EAGAIN) {
</span><span class="cx">                 DEBUGA_GSMOPEN("ALSA read -EAGAIN, the soundcard is not ready to be read by gsmopen\n", GSMOPEN_P_LOG);
</span><span class="cx">                 while (r == -EAGAIN) {
</span><del>-                        usleep(1000);
</del><ins>+                        gsmopen_sleep(1000);
</ins><span class="cx">
</span><span class="cx">                         if (tech_pvt->alsa_capture_is_mono) {
</span><span class="cx">                                 r = snd_pcm_readi(tech_pvt->alsac, buf + readpos, left);
</span><span class="lines">@@ -3248,7 +3307,7 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">          uscita:
</span><del>-                usleep(1000);
</del><ins>+                gsmopen_sleep(1000);
</ins><span class="cx">
</span><span class="cx">                 if (tech_pvt->at_cmgw[0]) {
</span><span class="cx">
</span><span class="lines">@@ -3268,7 +3327,7 @@
</span><span class="cx">
</span><span class="cx">                         tech_pvt->at_cmgw[0] = '\0';
</span><span class="cx">                 }
</span><del>-                //usleep(500000); //.5 secs
</del><ins>+                //gsmopen_sleep(500000); //.5 secs
</ins><span class="cx">                 UNLOCKA(tech_pvt->controldev_lock);
</span><span class="cx">                 POPPA_UNLOCKA(&tech_pvt->controldev_lock);
</span><span class="cx">         }
</span><span class="lines">@@ -3313,7 +3372,11 @@
</span><span class="cx">                 WARNINGA("boost %s too large, using %d\n", GSMOPEN_P_LOG, s, BOOST_MAX);
</span><span class="cx">                 *boost = BOOST_MAX;
</span><span class="cx">         }
</span><ins>+#ifdef WIN32
+        *boost = exp(log ((double)10) * *boost / 20) * BOOST_SCALE;
+#else
</ins><span class="cx">         *boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
</span><ins>+#endif //WIN32
</ins><span class="cx">         if (option_debug > 1)
</span><span class="cx">                 DEBUGA_GSMOPEN("setting boost %s to %f\n", GSMOPEN_P_LOG, s, *boost);
</span><span class="cx"> }
</span><span class="lines">@@ -3362,14 +3425,14 @@
</span><span class="cx">         if (res) {
</span><span class="cx">                 ERRORA("AT was not acknowledged, continuing but maybe there is a problem\n", GSMOPEN_P_LOG);
</span><span class="cx">         }
</span><del>-        usleep(1000);
</del><ins>+        gsmopen_sleep(1000);
</ins><span class="cx">
</span><span class="cx">         if (strlen(p->at_query_battchg)) {
</span><span class="cx">                 res = gsmopen_serial_write_AT_expect(p, p->at_query_battchg, p->at_query_battchg_expect);
</span><span class="cx">                 if (res) {
</span><span class="cx">                         WARNINGA("%s does not get %s from the phone. Continuing.\n", GSMOPEN_P_LOG, p->at_query_battchg, p->at_query_battchg_expect);
</span><span class="cx">                 }
</span><del>-                usleep(1000);
</del><ins>+                gsmopen_sleep(1000);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if (strlen(p->at_query_signal)) {
</span><span class="lines">@@ -3377,7 +3440,7 @@
</span><span class="cx">                 if (res) {
</span><span class="cx">                         WARNINGA("%s does not get %s from the phone. Continuing.\n", GSMOPEN_P_LOG, p->at_query_signal, p->at_query_signal_expect);
</span><span class="cx">                 }
</span><del>-                usleep(1000);
</del><ins>+                gsmopen_sleep(1000);
</ins><span class="cx">         }
</span><span class="cx">         //FIXME all the following commands in config!
</span><span class="cx">
</span><span class="lines">@@ -3388,7 +3451,7 @@
</span><span class="cx">                                 ("%s does not get %s from the phone. If your phone is not Motorola, please contact the gsmopen developers. Else, if your phone IS a Motorola, probably a long msg was incoming and ther first part was read and then deleted. The second part is now orphan. If you got this warning repeatedly, and you cannot correctly receive SMSs from this interface, please manually clean all messages (and the residual parts of them) from the cellphone/SIM. Continuing.\n",
</span><span class="cx">                                  GSMOPEN_P_LOG, "AT+MMGL=\"HEADER ONLY\"", "OK");
</span><span class="cx">                 } else {
</span><del>-                        usleep(1000);
</del><ins>+                        gsmopen_sleep(1000);
</ins><span class="cx">                         if (p->unread_sms_msg_id) {
</span><span class="cx">                                 char at_command[256];
</span><span class="cx">
</span></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_gsmopenmod_gsmopen2008vcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.2008.vcproj (16208 => 16209)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.2008.vcproj        2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.2008.vcproj        2010-01-08 03:40:46 UTC (rev 16209)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx">         ProjectType="Visual C++"
</span><span class="cx">         Version="9,00"
</span><span class="cx">         Name="mod_gsmopen"
</span><del>-        ProjectGUID="{13DD2A62-6348-4D2D-8F3F-6D29D38AB60D}"
</del><ins>+        ProjectGUID="{74B120FF-6935-4DFE-A142-CDB6BEA99C90}"
</ins><span class="cx">         RootNamespace="mod_skypiax"
</span><span class="cx">         Keyword="Win32Proj"
</span><span class="cx">         TargetFrameworkVersion="131072"
</span><span class="lines">@@ -39,6 +39,8 @@
</span><span class="cx">                         />
</span><span class="cx">                         <Tool
</span><span class="cx">                                 Name="VCCLCompilerTool"
</span><ins>+                                AdditionalIncludeDirectories="&quot;gsmlib\gsmlib-1.10-patched-12ubuntu1&quot;"
+                                PreprocessorDefinitions="NO_ALSA"
</ins><span class="cx">                                 UsePrecompiledHeader="0"
</span><span class="cx">                                 WarningLevel="4"
</span><span class="cx">                                 WarnAsError="false"
</span><span class="lines">@@ -54,7 +56,9 @@
</span><span class="cx">                         />
</span><span class="cx">                         <Tool
</span><span class="cx">                                 Name="VCLinkerTool"
</span><del>-                                AdditionalOptions="rpcrt4.lib "
</del><ins>+                                AdditionalOptions=" gsmlib.lib &quot;..\..\..\..\w32\library\debug\freeswitchcore.lib&quot; /xNODEFAULTLIB:msvcprtd /NODEFAULTLIB:LIBCMTD &quot;..\..\..\..\libs\libteletone\Debug\libteletone.lib&quot;&#x0D;&#x0A;ksuser.lib &#x0D;&#x0A;&quot;..\..\..\..\libs\win32\apr\debug\libapr-1.lib&quot; /xNODEFAULTLIB:MSVCRTD"
+                                LinkIncremental="1"
+                                AdditionalLibraryDirectories="&quot;gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/Debug/&quot;"
</ins><span class="cx">                                 RandomizedBaseAddress="1"
</span><span class="cx">                                 DataExecutionPrevention="0"
</span><span class="cx">                         />
</span></span></pre></div>
<a id="freeswitchbranchesgmaruzzmod_gsmopenmod_gsmopencpp"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp (16208 => 16209)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp        2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp        2010-01-08 03:40:46 UTC (rev 16209)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include "gsmopen.h"
</span><span class="cx"> #define MDL_CHAT_PROTO "SMS"
</span><span class="cx">
</span><ins>+#if 0
</ins><span class="cx"> #ifdef WIN32
</span><span class="cx"> /***************/
</span><span class="cx"> // from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
</span><span class="lines">@@ -82,9 +83,12 @@
</span><span class="cx">
</span><span class="cx"> /***************/
</span><span class="cx"> #endif /* WIN32 */
</span><ins>+#endif //0
+SWITCH_BEGIN_EXTERN_C
</ins><span class="cx"> SWITCH_MODULE_LOAD_FUNCTION(mod_gsmopen_load);
</span><span class="cx"> SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_gsmopen_shutdown);
</span><span class="cx"> SWITCH_MODULE_DEFINITION(mod_gsmopen, mod_gsmopen_load, mod_gsmopen_shutdown, NULL);
</span><ins>+SWITCH_END_EXTERN_C
</ins><span class="cx"> #if 0
</span><span class="cx"> SWITCH_STANDARD_API(sk_function);
</span><span class="cx"> /* BEGIN: Changes here */
</span><span class="lines">@@ -834,7 +838,11 @@
</span><span class="cx">         }
</span><span class="cx"> #ifdef BIGENDIAN
</span><span class="cx">         if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
</span><ins>+#ifdef WIN32
+                switch_swap_linear((int16_t *)frame->data, (int) frame->datalen / 2);
+#else
</ins><span class="cx">                 switch_swap_linear(frame->data, (int) frame->datalen / 2);
</span><ins>+#endif //WIN32
</ins><span class="cx">         }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -1259,7 +1267,11 @@
</span><span class="cx"> #endif // GSMOPEN_ALSA
</span><span class="cx">
</span><span class="cx">                         uint32_t interface_id = 0;
</span><ins>+#ifdef WIN32
+                        int controldevice_speed = 115200;        //FIXME TODO
+#else
</ins><span class="cx">                         uint32_t controldevice_speed = B115200;        //FIXME TODO
</span><ins>+#endif //WIN32
</ins><span class="cx">                         uint32_t controldevprotocol = PROTOCOL_AT;        //FIXME TODO
</span><span class="cx">                         uint32_t running = 1;        //FIXME TODO
</span><span class="cx">
</span><span class="lines">@@ -2308,6 +2320,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif //0
</span><span class="cx">
</span><ins>+#if 0
</ins><span class="cx"> int gsmopen_transfer(private_t * tech_pvt, char *id, char *value)
</span><span class="cx"> {
</span><span class="cx">         char msg_to_gsmopen[1024];
</span><span class="lines">@@ -2427,6 +2440,7 @@
</span><span class="cx">         }
</span><span class="cx">         return 0;
</span><span class="cx"> }
</span><ins>+#endif //0
</ins><span class="cx">
</span><span class="cx"> void *gsmopen_do_gsmopenapi_thread_func(void *obj)
</span><span class="cx"> {
</span><span class="lines">@@ -2479,7 +2493,7 @@
</span><span class="cx">                                 //FIXME ERRORA("gsmopen_new failed! BAD BAD BAD\n", GSMOPEN_P_LOG);
</span><span class="cx">                                 //FIXME }
</span><span class="cx">                         }
</span><del>-                        usleep(100);                //give other threads a chance
</del><ins>+                        switch_sleep(100);                //give other threads a chance
</ins><span class="cx">                         time(&now_timestamp);
</span><span class="cx">
</span><span class="cx">                         if ((now_timestamp - tech_pvt->gsmopen_serial_synced_timestamp) > 30) {        //TODO find a sensible period. 5min? in config?
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>