<!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][14375] </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=14375">14375</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-07-27 10:56:07 -0500 (Mon, 27 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>skypiax: indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skypiaxmod_skypiaxc">freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skypiaxskypiaxh">freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skypiaxskypiax_protocolc">freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxmod_skypiaxc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (14374 => 14375)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2009-07-27 15:51:03 UTC (rev 14374)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2009-07-27 15:56:07 UTC (rev 14375)
</span><span class="lines">@@ -40,57 +40,47 @@
</span><span class="cx"> /***************/
</span><span class="cx"> // from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
</span><span class="cx"> 
</span><del>-#include &lt;time.h&gt;
-     
-#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
-#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
-#else
-#define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
-#endif
-     
-    struct timezone 
-    {
-      int  tz_minuteswest; /* minutes W of Greenwich */
-      int  tz_dsttime;     /* type of dst correction */
-    };
-     
-    int gettimeofday(struct timeval *tv, struct timezone *tz)
-    {
-      FILETIME ft;
-      unsigned __int64 tmpres = 0;
-      static int tzflag;
-     
-      if (NULL != tv)
-      {
-        GetSystemTimeAsFileTime(&amp;ft);
-     
-        tmpres |= ft.dwHighDateTime;
-        tmpres &lt;&lt;= 32;
-        tmpres |= ft.dwLowDateTime;
-     
-        /*converting file time to unix epoch*/
-        tmpres /= 10;  /*convert into microseconds*/
-        tmpres -= DELTA_EPOCH_IN_MICROSECS; 
-        tv-&gt;tv_sec = (long)(tmpres / 1000000UL);
-        tv-&gt;tv_usec = (long)(tmpres % 1000000UL);
-      }
-     
-      if (NULL != tz)
-      {
-        if (!tzflag)
-        {
-          _tzset();
-          tzflag++;
-        }
-        tz-&gt;tz_minuteswest = _timezone / 60;
-        tz-&gt;tz_dsttime = _daylight;
-      }
-     
-      return 0;
-    }
</del><ins>+#include &lt;time.h&gt;
+
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
+#else /*  */
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
+#endif /*  */
+struct timezone {
+  int tz_minuteswest;           /* minutes W of Greenwich */
+  int tz_dsttime;               /* type of dst correction */
+};
+int gettimeofday(struct timeval *tv, struct timezone *tz)
+{
+  FILETIME ft;
+  unsigned __int64 tmpres = 0;
+  static int tzflag;
+  if (NULL != tv) {
+    GetSystemTimeAsFileTime(&amp;ft);
+    tmpres |= ft.dwHighDateTime;
+    tmpres &lt;&lt;= 32;
+    tmpres |= ft.dwLowDateTime;
+
+    /*converting file time to unix epoch */
+    tmpres /= 10;               /*convert into microseconds */
+    tmpres -= DELTA_EPOCH_IN_MICROSECS;
+    tv-&gt;tv_sec = (long) (tmpres / 1000000UL);
+    tv-&gt;tv_usec = (long) (tmpres % 1000000UL);
+  }
+  if (NULL != tz) {
+    if (!tzflag) {
+      _tzset();
+      tzflag++;
+    }
+    tz-&gt;tz_minuteswest = _timezone / 60;
+    tz-&gt;tz_dsttime = _daylight;
+  }
+  return 0;
+}
+
</ins><span class="cx"> /***************/
</span><span class="cx"> #endif /* WIN32 */
</span><del>-
</del><span class="cx"> SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load);
</span><span class="cx"> SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown);
</span><span class="cx"> SWITCH_MODULE_DEFINITION(mod_skypiax, mod_skypiax_load, mod_skypiax_shutdown, NULL);
</span><span class="lines">@@ -140,8 +130,8 @@
</span><span class="cx">                                   globals.codec_rates_string);
</span><span class="cx"> 
</span><span class="cx"> /* BEGIN: Changes here */
</span><del>-static switch_status_t interface_exists(char* skype_user);
-static switch_status_t remove_interface(char* skype_user);
</del><ins>+static switch_status_t interface_exists(char *skype_user);
+static switch_status_t remove_interface(char *skype_user);
</ins><span class="cx"> /* END: Changes here */
</span><span class="cx"> 
</span><span class="cx"> static switch_status_t channel_on_init(switch_core_session_t * session);
</span><span class="lines">@@ -221,93 +211,102 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /* BEGIN: Changes here */
</span><del>-static switch_status_t interface_exists(char* skype_user) {
-        int i;
-        for (i = 0; i &lt; SKYPIAX_MAX_INTERFACES; i++) {
-                if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
-                        if(strcmp(globals.SKYPIAX_INTERFACES[i].skype_user, skype_user) == 0) {
-                                return SWITCH_STATUS_SUCCESS;
-                        }
-                }
-        }
-        return SWITCH_STATUS_FALSE;
</del><ins>+static switch_status_t interface_exists(char *skype_user)
+{
+  int i;
+  for (i = 0; i &lt; SKYPIAX_MAX_INTERFACES; i++) {
+    if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+      if (strcmp(globals.SKYPIAX_INTERFACES[i].skype_user, skype_user) == 0) {
+        return SWITCH_STATUS_SUCCESS;
+      }
+    }
+  }
+  return SWITCH_STATUS_FALSE;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static switch_status_t remove_interface(char* skype_user) {
-        int x = 100;
-        unsigned int howmany = 8;
-        int interface_id = -1;
-        private_t *tech_pvt = NULL;
-        switch_status_t status;
</del><ins>+static switch_status_t remove_interface(char *skype_user)
+{
+  int x = 100;
+  unsigned int howmany = 8;
+  int interface_id = -1;
+  private_t *tech_pvt = NULL;
+  switch_status_t status;
</ins><span class="cx"> 
</span><del>-        running = 0;
</del><ins>+  running = 0;
</ins><span class="cx"> 
</span><del>-        for (interface_id = 0; interface_id &lt; SKYPIAX_MAX_INTERFACES; interface_id++) {
-                if(strcmp(globals.SKYPIAX_INTERFACES[interface_id].skype_user, skype_user) == 0) {
-                        tech_pvt = &amp;globals.SKYPIAX_INTERFACES[interface_id];
-                        break;
-                }
-        }
</del><ins>+  for (interface_id = 0; interface_id &lt; SKYPIAX_MAX_INTERFACES; interface_id++) {
+    if (strcmp(globals.SKYPIAX_INTERFACES[interface_id].skype_user, skype_user) == 0) {
+      tech_pvt = &amp;globals.SKYPIAX_INTERFACES[interface_id];
+      break;
+    }
+  }
</ins><span class="cx"> 
</span><del>-        if(!tech_pvt) {
-                DEBUGA_SKYPE(&quot;interface for skype user '%s' does not exist\n&quot;, SKYPIAX_P_LOG, skype_user);
-                goto end;
-        }
</del><ins>+  if (!tech_pvt) {
+    DEBUGA_SKYPE(&quot;interface for skype user '%s' does not exist\n&quot;, SKYPIAX_P_LOG,
+                 skype_user);
+    goto end;
+  }
</ins><span class="cx"> 
</span><del>-        if (strlen(globals.SKYPIAX_INTERFACES[interface_id].session_uuid_str)) {
-                DEBUGA_SKYPE(&quot;interface for skype user '%s' is busy\n&quot;, SKYPIAX_P_LOG, skype_user);
-                goto end;
-        }
</del><ins>+  if (strlen(globals.SKYPIAX_INTERFACES[interface_id].session_uuid_str)) {
+    DEBUGA_SKYPE(&quot;interface for skype user '%s' is busy\n&quot;, SKYPIAX_P_LOG, skype_user);
+    goto end;
+  }
</ins><span class="cx"> 
</span><del>-        if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
</del><ins>+  if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
</ins><span class="cx"> #ifdef WIN32
</span><del>-                switch_file_write(tech_pvt-&gt;SkypiaxHandles.fdesc[1], &quot;sciutati&quot;, &amp;howmany);   // let's the controldev_thread die
</del><ins>+    switch_file_write(tech_pvt-&gt;SkypiaxHandles.fdesc[1], &quot;sciutati&quot;, &amp;howmany); // let's the controldev_thread die
</ins><span class="cx"> #else /* WIN32 */
</span><del>-                howmany = write(tech_pvt-&gt;SkypiaxHandles.fdesc[1], &quot;sciutati&quot;, howmany);
</del><ins>+    howmany = write(tech_pvt-&gt;SkypiaxHandles.fdesc[1], &quot;sciutati&quot;, howmany);
</ins><span class="cx"> #endif /* WIN32 */
</span><del>-        }
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-        if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
</del><ins>+  if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
</ins><span class="cx"> #ifdef WIN32
</span><del>-                if (SendMessage(tech_pvt-&gt;SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) {  // let's the skypiax_api_thread_func die
-                        DEBUGA_SKYPE(&quot;got FALSE here, thread probably was already dead. GetLastError returned: %d\n&quot;,
-                                        SKYPIAX_P_LOG, GetLastError());
-                        globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
-                }
</del><ins>+    if (SendMessage(tech_pvt-&gt;SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) {    // let's the skypiax_api_thread_func die
+      DEBUGA_SKYPE
+        (&quot;got FALSE here, thread probably was already dead. GetLastError returned: %d\n&quot;,
+         SKYPIAX_P_LOG, GetLastError());
+      globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
+    }
</ins><span class="cx"> #else
</span><del>-                XEvent e;
-                Atom atom1 = XInternAtom(tech_pvt-&gt;SkypiaxHandles.disp, &quot;SKYPECONTROLAPI_MESSAGE_BEGIN&quot;, False);
-                memset(&amp;e, 0, sizeof(e));
-                e.xclient.type = ClientMessage;
-                e.xclient.message_type = atom1;   /*  leading message */
-                e.xclient.display = tech_pvt-&gt;SkypiaxHandles.disp;
-                e.xclient.window = tech_pvt-&gt;SkypiaxHandles.skype_win;
-                e.xclient.format = 8;
</del><ins>+    XEvent e;
+    Atom atom1 =
+      XInternAtom(tech_pvt-&gt;SkypiaxHandles.disp, &quot;SKYPECONTROLAPI_MESSAGE_BEGIN&quot;, False);
+    memset(&amp;e, 0, sizeof(e));
+    e.xclient.type = ClientMessage;
+    e.xclient.message_type = atom1; /*  leading message */
+    e.xclient.display = tech_pvt-&gt;SkypiaxHandles.disp;
+    e.xclient.window = tech_pvt-&gt;SkypiaxHandles.skype_win;
+    e.xclient.format = 8;
</ins><span class="cx"> 
</span><del>-                XSendEvent(tech_pvt-&gt;SkypiaxHandles.disp, tech_pvt-&gt;SkypiaxHandles.win, False, 0, &amp;e);
-                XSync(tech_pvt-&gt;SkypiaxHandles.disp, False);
</del><ins>+    XSendEvent(tech_pvt-&gt;SkypiaxHandles.disp, tech_pvt-&gt;SkypiaxHandles.win, False, 0, &amp;e);
+    XSync(tech_pvt-&gt;SkypiaxHandles.disp, False);
</ins><span class="cx"> #endif
</span><del>-        }
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-        while (x) {                 //FIXME 2 seconds?
-                x--;
-                switch_yield(20000);
-        }
</del><ins>+  while (x) {                   //FIXME 2 seconds?
+    x--;
+    switch_yield(20000);
+  }
</ins><span class="cx"> 
</span><del>-        if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
-                switch_thread_join(&amp;status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread);
-        }
</del><ins>+  if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
+    switch_thread_join(&amp;status,
+                       globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread);
+  }
</ins><span class="cx"> 
</span><del>-        if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
-                switch_thread_join(&amp;status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
-        }
</del><ins>+  if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
+    switch_thread_join(&amp;status,
+                       globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
+  }
</ins><span class="cx"> 
</span><del>-        memset(&amp;globals.SKYPIAX_INTERFACES[interface_id], '\0',sizeof(private_t));
-        DEBUGA_SKYPE(&quot;interface for skype user '%s' deleted successfully\n&quot;, SKYPIAX_P_LOG, skype_user);
</del><ins>+  memset(&amp;globals.SKYPIAX_INTERFACES[interface_id], '\0', sizeof(private_t));
+  DEBUGA_SKYPE(&quot;interface for skype user '%s' deleted successfully\n&quot;, SKYPIAX_P_LOG,
+               skype_user);
</ins><span class="cx"> end:
</span><del>-        running = 1;
-        return SWITCH_STATUS_SUCCESS;
</del><ins>+  running = 1;
+  return SWITCH_STATUS_SUCCESS;
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> /* END: Changes here */
</span><span class="cx"> 
</span><span class="cx"> /* 
</span><span class="lines">@@ -983,10 +982,10 @@
</span><span class="cx">       }
</span><span class="cx"> 
</span><span class="cx">       /* BEGIN: Changes here */
</span><del>-      if(reload_type == SOFT_RELOAD) {
-        if(interface_exists(skype_user) == SWITCH_STATUS_SUCCESS) {
-          continue;
-        }
</del><ins>+      if (reload_type == SOFT_RELOAD) {
+        if (interface_exists(skype_user) == SWITCH_STATUS_SUCCESS) {
+          continue;
+        }
</ins><span class="cx">       }
</span><span class="cx">       /* END: Changes here */
</span><span class="cx"> 
</span><span class="lines">@@ -1622,19 +1621,19 @@
</span><span class="cx"> 
</span><span class="cx"> /* BEGIN: Changes heres */
</span><span class="cx">   } else if (!strcasecmp(argv[0], &quot;reload&quot;)) {
</span><del>-    if(load_config(SOFT_RELOAD) != SWITCH_STATUS_SUCCESS) {
</del><ins>+    if (load_config(SOFT_RELOAD) != SWITCH_STATUS_SUCCESS) {
</ins><span class="cx">       stream-&gt;write_function(stream, &quot;sk reload failed\n&quot;);
</span><span class="cx">     } else {
</span><span class="cx">       stream-&gt;write_function(stream, &quot;sk reload success\n&quot;);
</span><span class="cx">     }
</span><span class="cx">   } else if (!strcasecmp(argv[0], &quot;remove&quot;)) {
</span><del>-    if(argc == 2) {
-      if(remove_interface(argv[1]) == SWITCH_STATUS_SUCCESS) {
-        if(interface_exists(argv[1]) == SWITCH_STATUS_SUCCESS) {
</del><ins>+    if (argc == 2) {
+      if (remove_interface(argv[1]) == SWITCH_STATUS_SUCCESS) {
+        if (interface_exists(argv[1]) == SWITCH_STATUS_SUCCESS) {
</ins><span class="cx">           stream-&gt;write_function(stream, &quot;sk remove '%s' failed\n&quot;, argv[1]);
</span><del>-        } else {
-          stream-&gt;write_function(stream, &quot;sk remove '%s' success\n&quot;,argv[1]);
-        }
</del><ins>+        } else {
+          stream-&gt;write_function(stream, &quot;sk remove '%s' success\n&quot;, argv[1]);
+        }
</ins><span class="cx">       }
</span><span class="cx">     } else {
</span><span class="cx">       stream-&gt;write_function(stream, &quot;-ERR Usage: sk remove interface_name\n&quot;);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxskypiaxh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h (14374 => 14375)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h        2009-07-27 15:51:03 UTC (rev 14374)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h        2009-07-27 15:56:07 UTC (rev 14375)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> #include &lt;switch.h&gt;
</span><span class="cx"> #include &lt;switch_version.h&gt;
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> #ifndef WIN32
</span><span class="cx"> #include &lt;sys/time.h&gt;
</span><span class="cx"> #include &lt;X11/Xlib.h&gt;
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxskypiax_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (14374 => 14375)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c        2009-07-27 15:51:03 UTC (rev 14374)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c        2009-07-27 15:56:07 UTC (rev 14375)
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx">               /* this is the call in which we are calling out */
</span><span class="cx">               DEBUGA_SKYPE(&quot;Call %s NOTHING\n&quot;, SKYPIAX_P_LOG, id);
</span><span class="cx">             } else {
</span><del>-              skypiax_sleep(400000);   //0.4 seconds
</del><ins>+              skypiax_sleep(400000);    //0.4 seconds
</ins><span class="cx">               DEBUGA_SKYPE(&quot;Call %s TRY TRANSFER\n&quot;, SKYPIAX_P_LOG, id);
</span><span class="cx">               skypiax_transfer(tech_pvt, id, value);
</span><span class="cx">             }
</span><span class="lines">@@ -252,8 +252,8 @@
</span><span class="cx">             char msg_to_skype[1024];
</span><span class="cx">             tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
</span><span class="cx">             tech_pvt-&gt;interface_state = SKYPIAX_STATE_DIALING;
</span><del>-            DEBUGA_SKYPE(&quot;Our remote party in skype_call %s is EARLYMEDIA\n&quot;, SKYPIAX_P_LOG,
-                   id);
</del><ins>+            DEBUGA_SKYPE(&quot;Our remote party in skype_call %s is EARLYMEDIA\n&quot;,
+                         SKYPIAX_P_LOG, id);
</ins><span class="cx">             start_audio_threads(tech_pvt);
</span><span class="cx">             skypiax_sleep(1000);
</span><span class="cx">             sprintf(msg_to_skype, &quot;ALTER CALL %s SET_INPUT PORT=\&quot;%d\&quot;&quot;, id,
</span><span class="lines">@@ -391,7 +391,7 @@
</span><span class="cx">                             sizeof(tech_pvt-&gt;skype_call_id) - 1);
</span><span class="cx">             tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
</span><span class="cx">             tech_pvt-&gt;skype_call_id[0] = '\0';
</span><del>-                        skypiax_sleep(1000);
</del><ins>+            skypiax_sleep(1000);
</ins><span class="cx">             return CALLFLOW_INCOMING_HANGUP;
</span><span class="cx">           } else if (!strcasecmp(value, &quot;WAITING_REDIAL_COMMAND&quot;)) {
</span><span class="cx">             tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FAILED;
</span><span class="lines">@@ -402,7 +402,7 @@
</span><span class="cx">                             sizeof(tech_pvt-&gt;skype_call_id) - 1);
</span><span class="cx">             tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
</span><span class="cx">             tech_pvt-&gt;skype_call_id[0] = '\0';
</span><del>-                        skypiax_sleep(1000);
</del><ins>+            skypiax_sleep(1000);
</ins><span class="cx">             return CALLFLOW_INCOMING_HANGUP;
</span><span class="cx">           } else {
</span><span class="cx">             WARNINGA(&quot;skype_call: %s, STATUS: %s is not recognized\n&quot;, SKYPIAX_P_LOG, id,
</span><span class="lines">@@ -695,7 +695,7 @@
</span><span class="cx">         DEBUGA_SKYPE(&quot;ACCEPTED here you send me %d\n&quot;, SKYPIAX_P_LOG,
</span><span class="cx">                      tech_pvt-&gt;tcp_cli_port);
</span><span class="cx"> #ifndef WIN32
</span><del>-                fcntl(tech_pvt-&gt;audioskypepipe[0], F_SETFL, O_NONBLOCK);
</del><ins>+        fcntl(tech_pvt-&gt;audioskypepipe[0], F_SETFL, O_NONBLOCK);
</ins><span class="cx"> #endif //WIN32
</span><span class="cx"> 
</span><span class="cx">         if (!running)
</span><span class="lines">@@ -713,7 +713,7 @@
</span><span class="cx">           if (!running)
</span><span class="cx">             break;
</span><span class="cx">           FD_ZERO(&amp;fs);
</span><del>-          to.tv_usec = 120000;   //120msec
</del><ins>+          to.tv_usec = 120000;  //120msec
</ins><span class="cx">           to.tv_sec = 0;
</span><span class="cx"> #if defined(WIN32) &amp;&amp; !defined(__CYGWIN__)
</span><span class="cx"> /* on win32 we cannot select from the apr &quot;pipe&quot;, so we select on socket writability */
</span><span class="lines">@@ -730,63 +730,63 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">           if (rt &gt; 0) {
</span><del>-                          int counter;
</del><ins>+            int counter;
</ins><span class="cx"> 
</span><del>-                          /* until we drained the pipe to empty */
-                        for(counter = 0; counter &lt; 10; counter++){
-            /* read from the pipe the audio frame we are supposed to send out */
-            got =
-              skypiax_pipe_read(tech_pvt-&gt;audioskypepipe[0], cli_in,
-                                SAMPLES_PER_FRAME * sizeof(short));
-                        if(got == -1)
-                                break;
</del><ins>+            /* until we drained the pipe to empty */
+            for (counter = 0; counter &lt; 10; counter++) {
+              /* read from the pipe the audio frame we are supposed to send out */
+              got =
+                skypiax_pipe_read(tech_pvt-&gt;audioskypepipe[0], cli_in,
+                                  SAMPLES_PER_FRAME * sizeof(short));
+              if (got == -1)
+                break;
</ins><span class="cx"> 
</span><del>-            if (got != SAMPLES_PER_FRAME * sizeof(short)) {
-              WARNINGA(&quot;got is %d, but was expected to be %d\n&quot;, SKYPIAX_P_LOG, got,
-                       (int) (SAMPLES_PER_FRAME * sizeof(short)));
-            }
</del><ins>+              if (got != SAMPLES_PER_FRAME * sizeof(short)) {
+                WARNINGA(&quot;got is %d, but was expected to be %d\n&quot;, SKYPIAX_P_LOG, got,
+                         (int) (SAMPLES_PER_FRAME * sizeof(short)));
+              }
</ins><span class="cx"> 
</span><del>-            if (got == SAMPLES_PER_FRAME * sizeof(short)) {
-              if (samplerate_skypiax == 8000) {
</del><ins>+              if (got == SAMPLES_PER_FRAME * sizeof(short)) {
+                if (samplerate_skypiax == 8000) {
</ins><span class="cx"> 
</span><del>-                /* we're upsampling from 8khz to 16khz, cli_out will contain two times each sample from cli_in */
-                a = 0;
-                for (i = 0; i &lt; got / sizeof(short); i++) {
-                  cli_out[a] = cli_in[i];
-                  a++;
-                  cli_out[a] = cli_in[i];
-                  a++;
</del><ins>+                  /* we're upsampling from 8khz to 16khz, cli_out will contain two times each sample from cli_in */
+                  a = 0;
+                  for (i = 0; i &lt; got / sizeof(short); i++) {
+                    cli_out[a] = cli_in[i];
+                    a++;
+                    cli_out[a] = cli_in[i];
+                    a++;
+                  }
+                  got = got * 2;
+                } else if (samplerate_skypiax == 16000) {
+                  /* we're NOT upsampling, cli_out will contain just ALL samples from cli_in */
+                  for (i = 0; i &lt; got / sizeof(short); i++) {
+                    cli_out[i] = cli_in[i];
+                  }
+                } else {
+                  ERRORA(&quot;SAMPLERATE_SKYPIAX can only be 8000 or 16000\n&quot;, SKYPIAX_P_LOG);
</ins><span class="cx">                 }
</span><del>-                got = got * 2;
-              } else if (samplerate_skypiax == 16000) {
-                /* we're NOT upsampling, cli_out will contain just ALL samples from cli_in */
-                for (i = 0; i &lt; got / sizeof(short); i++) {
-                  cli_out[i] = cli_in[i];
-                }
-              } else {
-                ERRORA(&quot;SAMPLERATE_SKYPIAX can only be 8000 or 16000\n&quot;, SKYPIAX_P_LOG);
-              }
</del><span class="cx"> 
</span><del>-              /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
-              if (tech_pvt-&gt;skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
-                len = send(fd, (char *) cli_out, got, 0);
-                skypiax_sleep(5000);    //5 msec
</del><ins>+                /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
+                if (tech_pvt-&gt;skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
+                  len = send(fd, (char *) cli_out, got, 0);
+                  skypiax_sleep(5000);  //5 msec
</ins><span class="cx"> 
</span><del>-                if (len == -1) {
-                  break;
-                } else if (len != got) {
-                  ERRORA(&quot;len=%d\n&quot;, SKYPIAX_P_LOG, len);
-                  skypiax_sleep(1000);
-                  break;
</del><ins>+                  if (len == -1) {
+                    break;
+                  } else if (len != got) {
+                    ERRORA(&quot;len=%d\n&quot;, SKYPIAX_P_LOG, len);
+                    skypiax_sleep(1000);
+                    break;
+                  }
</ins><span class="cx">                 }
</span><del>-              }
</del><span class="cx"> 
</span><del>-            } else {
</del><ins>+              } else {
</ins><span class="cx"> 
</span><del>-              WARNINGA(&quot;got is %d, but was expected to be %d\n&quot;, SKYPIAX_P_LOG, got,
-                       (int) (SAMPLES_PER_FRAME * sizeof(short)));
</del><ins>+                WARNINGA(&quot;got is %d, but was expected to be %d\n&quot;, SKYPIAX_P_LOG, got,
+                         (int) (SAMPLES_PER_FRAME * sizeof(short)));
+              }
</ins><span class="cx">             }
</span><del>-                        }
</del><span class="cx">           } else {
</span><span class="cx">             if (rt)
</span><span class="cx">               ERRORA(&quot;CLI rt=%d\n&quot;, SKYPIAX_P_LOG, rt);
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>