<!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][16826] </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=16826">16826</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2010-02-25 12:38:41 -0600 (Thu, 25 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>skypiax: cleaning</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skypiaxmod_skypiaxc">freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.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 (16825 => 16826)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2010-02-25 18:26:23 UTC (rev 16825)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2010-02-25 18:38:41 UTC (rev 16826)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;skypiax.h&quot;
</span><span class="cx"> #define MDL_CHAT_PROTO &quot;skype&quot;
</span><del>-#define TIMER_WRITE
</del><span class="cx"> 
</span><span class="cx"> #ifdef WIN32
</span><span class="cx"> /***************/
</span><span class="lines">@@ -95,10 +94,8 @@
</span><span class="cx"> 
</span><span class="cx"> SWITCH_STANDARD_API(skypiax_chat_function);
</span><span class="cx"> #define SKYPIAX_CHAT_SYNTAX &quot;interface_name remote_skypename TEXT&quot;
</span><del>-/* BEGIN: Changes here */
</del><span class="cx"> #define FULL_RELOAD 0
</span><span class="cx"> #define SOFT_RELOAD 1
</span><del>-/* END: Changes heres */
</del><span class="cx"> 
</span><span class="cx"> char *interface_status[] = {        /* should match SKYPIAX_STATE_xxx in skypiax.h */
</span><span class="cx">         &quot;IDLE&quot;,
</span><span class="lines">@@ -147,23 +144,12 @@
</span><span class="cx"> 
</span><span class="cx"> static struct {
</span><span class="cx">         int debug;
</span><del>-        //char *ip;
-        //int port;
</del><span class="cx">         char *dialplan;
</span><span class="cx">         char *destination;
</span><span class="cx">         char *context;
</span><del>-        //char *codec_string;
-        //char *codec_order[SWITCH_MAX_CODECS];
-        //int codec_order_last;
-        //char *codec_rates_string;
-        //char *codec_rates[SWITCH_MAX_CODECS];
-        //int codec_rates_last;
-        //unsigned int flags;
-        //int fd;
</del><span class="cx">         int calls;
</span><span class="cx">         int real_interfaces;
</span><span class="cx">         int next_interface;
</span><del>-        //char hold_music[256];
</del><span class="cx">         private_t SKYPIAX_INTERFACES[SKYPIAX_MAX_INTERFACES];
</span><span class="cx">         switch_mutex_t *mutex;
</span><span class="cx">         private_t *sk_console;
</span><span class="lines">@@ -177,13 +163,9 @@
</span><span class="cx"> SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
</span><span class="cx"> SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, globals.context);
</span><span class="cx"> SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_destination, globals.destination);
</span><del>-//SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
-//SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
</del><span class="cx"> 
</span><del>-/* BEGIN: Changes here */
</del><span class="cx"> static switch_status_t interface_exists(char *the_interface);
</span><span class="cx"> static switch_status_t remove_interface(char *the_interface);
</span><del>-/* END: Changes here */
</del><span class="cx"> 
</span><span class="cx"> static switch_status_t channel_on_init(switch_core_session_t *session);
</span><span class="cx"> static switch_status_t channel_on_hangup(switch_core_session_t *session);
</span><span class="lines">@@ -258,26 +240,7 @@
</span><span class="cx">                 ERRORA(&quot;skypiax_codec FAILED\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><del>-#if 0
-        if (switch_core_timer_init(&amp;tech_pvt-&gt;timer_read, &quot;soft&quot;, 20, tech_pvt-&gt;read_codec.implementation-&gt;samples_per_packet, skypiax_module_pool) !=
-                SWITCH_STATUS_SUCCESS) {
-                ERRORA(&quot;setup timer failed\n&quot;, SKYPIAX_P_LOG);
-                return SWITCH_STATUS_FALSE;
-        }
</del><span class="cx"> 
</span><del>-        switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
-
-#ifdef TIMER_WRITE
-        if (switch_core_timer_init(&amp;tech_pvt-&gt;timer_write, &quot;soft&quot;, 10, tech_pvt-&gt;write_codec.implementation-&gt;samples_per_packet, skypiax_module_pool) !=
-                SWITCH_STATUS_SUCCESS) {
-                ERRORA(&quot;setup timer failed\n&quot;, SKYPIAX_P_LOG);
-                return SWITCH_STATUS_FALSE;
-        }
-
-        switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
-#endif // TIMER_WRITE
-#endif
-
</del><span class="cx">         dtmf_rx_init(&amp;tech_pvt-&gt;dtmf_state, NULL, NULL);
</span><span class="cx">         dtmf_rx_parms(&amp;tech_pvt-&gt;dtmf_state, 0, 10, 10, -99);
</span><span class="cx"> 
</span><span class="lines">@@ -286,7 +249,6 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* BEGIN: Changes here */
</del><span class="cx"> static switch_status_t interface_exists(char *the_interface)
</span><span class="cx"> {
</span><span class="cx">         int i;
</span><span class="lines">@@ -333,9 +295,7 @@
</span><span class="cx">         private_t *tech_pvt = NULL;
</span><span class="cx">         switch_status_t status;
</span><span class="cx"> 
</span><del>-        //running = 0;
</del><span class="cx"> 
</span><del>-
</del><span class="cx">         if (*the_interface == '#') {        /* remove by interface id or interface name */
</span><span class="cx">                 the_interface++;
</span><span class="cx">                 switch_assert(the_interface);
</span><span class="lines">@@ -376,6 +336,8 @@
</span><span class="cx"> 
</span><span class="cx">         if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
</span><span class="cx"> #ifdef WIN32
</span><ins>+                skypiax_signaling_write(tech_pvt, &quot;DIE&quot;);
+                switch_sleep(10000);
</ins><span class="cx">                 switch_file_write(tech_pvt-&gt;SkypiaxHandles.fdesc[1], &quot;sciutati&quot;, &amp;howmany);        // let's the controldev_thread die
</span><span class="cx"> #else /* WIN32 */
</span><span class="cx">                 howmany = write(tech_pvt-&gt;SkypiaxHandles.fdesc[1], &quot;sciutati&quot;, howmany);
</span><span class="lines">@@ -432,11 +394,9 @@
</span><span class="cx">         DEBUGA_SKYPE(&quot;interface '%s' deleted successfully\n&quot;, SKYPIAX_P_LOG, the_interface);
</span><span class="cx">         globals.SKYPIAX_INTERFACES[interface_id].running = 1;
</span><span class="cx">   end:
</span><del>-        //running = 1;
</del><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* END: Changes here */
</del><span class="cx"> 
</span><span class="cx"> /* 
</span><span class="cx">    State methods they get called when the state changes to the specific state 
</span><span class="lines">@@ -454,7 +414,6 @@
</span><span class="cx">         channel = switch_core_session_get_channel(session);
</span><span class="cx">         switch_assert(channel != NULL);
</span><span class="cx">         switch_channel_set_variable(channel, &quot;skype_user&quot;, tech_pvt-&gt;skype_user);
</span><del>-        //ERRORA(&quot;%s CHANNEL INIT\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;name);
</del><span class="cx">         switch_set_flag(tech_pvt, TFLAG_IO);
</span><span class="cx"> 
</span><span class="cx">         /* Move channel's state machine to ROUTING. This means the call is trying
</span><span class="lines">@@ -490,10 +449,8 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 switch_core_timer_destroy(&amp;tech_pvt-&gt;timer_read);
</span><del>-#ifdef TIMER_WRITE
</del><span class="cx"> 
</span><span class="cx">                 switch_core_timer_destroy(&amp;tech_pvt-&gt;timer_write);
</span><del>-#endif // TIMER_WRITE
</del><span class="cx"> 
</span><span class="cx">                 switch_buffer_destroy(&amp;tech_pvt-&gt;read_buffer);
</span><span class="cx">                 switch_buffer_destroy(&amp;tech_pvt-&gt;write_buffer);
</span><span class="lines">@@ -535,7 +492,6 @@
</span><span class="cx"> 
</span><span class="cx">         switch_clear_flag(tech_pvt, TFLAG_IO);
</span><span class="cx">         switch_clear_flag(tech_pvt, TFLAG_VOICE);
</span><del>-        //switch_set_flag(tech_pvt, TFLAG_HANGUP);
</del><span class="cx"> 
</span><span class="cx">         tech_pvt-&gt;interface_state = SKYPIAX_STATE_HANGUP_REQUESTED;
</span><span class="cx"> 
</span><span class="lines">@@ -544,19 +500,13 @@
</span><span class="cx">                 sprintf(msg_to_skype, &quot;ALTER CALL %s HANGUP&quot;, tech_pvt-&gt;skype_call_id);
</span><span class="cx">                 skypiax_signaling_write(tech_pvt, msg_to_skype);
</span><span class="cx">         }
</span><del>-        //memset(tech_pvt-&gt;session_uuid_str, '\0', sizeof(tech_pvt-&gt;session_uuid_str));
-        //*tech_pvt-&gt;session_uuid_str = '\0';
</del><span class="cx"> 
</span><span class="cx">         if (tech_pvt-&gt;tcp_cli_thread) {
</span><span class="cx">                 switch_thread_join(&amp;status, tech_pvt-&gt;tcp_cli_thread);
</span><span class="cx">         }
</span><del>-        //if(status!=SWITCH_STATUS_SUCCESS)
-        //ERRORA(&quot;%s cli_join HANGUP\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;name);
</del><span class="cx">         if (tech_pvt-&gt;tcp_srv_thread) {
</span><span class="cx">                 switch_thread_join(&amp;status, tech_pvt-&gt;tcp_srv_thread);
</span><span class="cx">         }
</span><del>-        //if(status!=SWITCH_STATUS_SUCCESS)
-        //ERRORA(&quot;%s srv_join HANGUP\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;name);
</del><span class="cx">         DEBUGA_SKYPE(&quot;%s CHANNEL HANGUP\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;name);
</span><span class="cx">         switch_mutex_lock(globals.mutex);
</span><span class="cx">         globals.calls--;
</span><span class="lines">@@ -641,7 +591,6 @@
</span><span class="cx">                 break;
</span><span class="cx">         case SWITCH_SIG_BREAK:
</span><span class="cx">                 DEBUGA_SKYPE(&quot;%s CHANNEL got SWITCH_SIG_BREAK\n&quot;, SKYPIAX_P_LOG, switch_channel_get_name(channel));
</span><del>-                //switch_set_flag(tech_pvt, TFLAG_BREAK);
</del><span class="cx">                 switch_mutex_lock(tech_pvt-&gt;flag_mutex);
</span><span class="cx">                 switch_set_flag(tech_pvt, TFLAG_BREAK);
</span><span class="cx">                 switch_mutex_unlock(tech_pvt-&gt;flag_mutex);
</span><span class="lines">@@ -713,12 +662,9 @@
</span><span class="cx"> 
</span><span class="cx">         if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
</span><span class="cx">                 ERRORA(&quot;channel not ready \n&quot;, SKYPIAX_P_LOG);
</span><del>-                //TODO: kill the bastard
</del><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">         if (!tech_pvt-&gt;read_buffer) {
</span><span class="cx">                 int32_t max_len = 640 * 10;
</span><span class="cx"> 
</span><span class="lines">@@ -726,19 +672,14 @@
</span><span class="cx">                 switch_assert(tech_pvt-&gt;read_buffer);
</span><span class="cx">                 switch_buffer_zero(tech_pvt-&gt;read_buffer);
</span><span class="cx">                 tech_pvt-&gt;begin_to_read = 1;
</span><del>-                //switch_sleep(40000);
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-
-
</del><span class="cx">         tech_pvt-&gt;read_frame.flags = SFF_NONE;
</span><span class="cx">         *frame = NULL;
</span><span class="cx"> 
</span><span class="cx">         switch_core_timer_next(&amp;tech_pvt-&gt;timer_read);
</span><span class="cx"> 
</span><del>-
</del><span class="cx">         switch_mutex_lock(tech_pvt-&gt;mutex_audio_srv);
</span><span class="cx">         if (switch_buffer_inuse(tech_pvt-&gt;read_buffer)) {
</span><span class="cx">                 bytes_read = switch_buffer_read(tech_pvt-&gt;read_buffer, tech_pvt-&gt;read_frame.data, 640);
</span><span class="lines">@@ -746,7 +687,6 @@
</span><span class="cx">         }
</span><span class="cx">         switch_mutex_unlock(tech_pvt-&gt;mutex_audio_srv);
</span><span class="cx"> 
</span><del>-
</del><span class="cx">         if (!bytes_read) {
</span><span class="cx">                 //NOTICA(&quot;skypiax_audio_read Silence\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 memset(tech_pvt-&gt;read_frame.data, 255, SAMPLES_PER_FRAME * sizeof(short));
</span><span class="lines">@@ -786,10 +726,8 @@
</span><span class="cx">                                         i++;
</span><span class="cx">                                         a++;
</span><span class="cx">                                 }
</span><del>-                                //DEBUGA_SKYPE(&quot;a=%d i=%d\n&quot;, SKYPIAX_P_LOG, a, i);
</del><span class="cx"> 
</span><span class="cx">                                 memset(digit_str, 0, sizeof(digit_str));
</span><del>-                                //dtmf_rx(&amp;tech_pvt-&gt;dtmf_state, (int16_t *) tech_pvt-&gt;read_frame.data,tech_pvt-&gt;read_frame.datalen/sizeof(short) );
</del><span class="cx">                                 dtmf_rx(&amp;tech_pvt-&gt;dtmf_state, (int16_t *) frame_8_khz, 160);
</span><span class="cx">                                 dtmf_rx_get(&amp;tech_pvt-&gt;dtmf_state, digit_str, sizeof(digit_str));
</span><span class="cx"> 
</span><span class="lines">@@ -820,10 +758,8 @@
</span><span class="cx"> #endif
</span><span class="cx">                         return SWITCH_STATUS_SUCCESS;
</span><span class="cx">                 }
</span><del>-
</del><span class="cx">                 DEBUGA_SKYPE(&quot;CHANNEL READ no TFLAG_IO\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><del>-
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         DEBUGA_SKYPE(&quot;CHANNEL READ FALSE\n&quot;, SKYPIAX_P_LOG);
</span><span class="lines">@@ -853,7 +789,6 @@
</span><span class="cx"> 
</span><span class="cx">         if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
</span><span class="cx">                 ERRORA(&quot;channel not ready \n&quot;, SKYPIAX_P_LOG);
</span><del>-                //TODO: kill the bastard
</del><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="cx"> #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
</span><span class="lines">@@ -861,7 +796,6 @@
</span><span class="cx">                 switch_swap_linear(frame-&gt;data, (int) frame-&gt;datalen / 2);
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><del>-
</del><span class="cx">         if (!tech_pvt-&gt;write_buffer) {
</span><span class="cx">                 int32_t max_len = 640 * 3;
</span><span class="cx"> 
</span><span class="lines">@@ -914,31 +848,21 @@
</span><span class="cx">         case SWITCH_MESSAGE_INDICATE_ANSWER:
</span><span class="cx">                 {
</span><span class="cx">                         DEBUGA_SKYPE(&quot;MSG_ID=%d, TO BE ANSWERED!\n&quot;, SKYPIAX_P_LOG, msg-&gt;message_id);
</span><del>-
</del><span class="cx">                         switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
</span><del>-#ifdef TIMER_WRITE
</del><span class="cx">                         switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
</span><del>-#endif // TIMER_WRITE
</del><span class="cx">                         channel_answer_channel(session);
</span><span class="cx">                 }
</span><span class="cx">                 break;
</span><span class="cx">         case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
</span><span class="cx"> 
</span><span class="cx">                 DEBUGA_SKYPE(&quot;%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n&quot;, SKYPIAX_P_LOG, switch_channel_get_name(channel));
</span><del>-
</del><span class="cx">                 switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
</span><del>-#ifdef TIMER_WRITE
</del><span class="cx">                 switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
</span><del>-#endif // TIMER_WRITE
</del><span class="cx">                 break;
</span><span class="cx">         case SWITCH_MESSAGE_INDICATE_BRIDGE:
</span><del>-
</del><span class="cx">                 DEBUGA_SKYPE(&quot;%s CHANNEL got SWITCH_MESSAGE_INDICATE_BRIDGE\n&quot;, SKYPIAX_P_LOG, switch_channel_get_name(channel));
</span><del>-
</del><span class="cx">                 switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
</span><del>-#ifdef TIMER_WRITE
</del><span class="cx">                 switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
</span><del>-#endif // TIMER_WRITE
</del><span class="cx">                 break;
</span><span class="cx"> 
</span><span class="cx">         default:
</span><span class="lines">@@ -1020,12 +944,6 @@
</span><span class="cx"> 
</span><span class="cx">                         switch_mutex_lock(globals.mutex);
</span><span class="cx">                         if (strncmp(&quot;ANY&quot;, interface_name, strlen(interface_name)) == 0 || strncmp(&quot;RR&quot;, interface_name, strlen(interface_name)) == 0) {
</span><del>-                                /* we've been asked for the &quot;ANY&quot; interface, let's find the first idle interface */
-                                //DEBUGA_SKYPE(&quot;Finding one available skype interface\n&quot;, SKYPIAX_P_LOG);
-                                //tech_pvt = find_available_skypiax_interface(NULL);
-                                //if (tech_pvt)
-                                //found = 1;
-                                //} else if (strncmp(&quot;RR&quot;, interface_name, strlen(interface_name)) == 0) {
</del><span class="cx">                                 /* Find the first idle interface using Round Robin */
</span><span class="cx">                                 DEBUGA_SKYPE(&quot;Finding one available skype interface RR\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                 tech_pvt = find_available_skypiax_interface_rr(NULL);
</span><span class="lines">@@ -1066,7 +984,6 @@
</span><span class="cx">                         DEBUGA_SKYPE(&quot;2 SESSION_DESTROY %s\n&quot;, SKYPIAX_P_LOG, switch_core_session_get_uuid(*new_session));
</span><span class="cx">                         switch_core_session_destroy(new_session);
</span><span class="cx">                         switch_mutex_unlock(globals.mutex);
</span><del>-                        //return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
</del><span class="cx">                         return SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -1077,7 +994,6 @@
</span><span class="cx">                         switch_mutex_unlock(globals.mutex);
</span><span class="cx">                         return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
</span><span class="cx">                 }
</span><del>-                //switch_channel_set_variable(channel, &quot;send_silence_when_idle&quot;, &quot;1500&quot;);
</del><span class="cx">                 switch_channel_set_variable(channel, &quot;waste&quot;, &quot;false&quot;);
</span><span class="cx">                 if (skypiax_tech_init(tech_pvt, *new_session) != SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                         ERRORA(&quot;Doh! no tech_init?\n&quot;, SKYPIAX_P_LOG);
</span><span class="lines">@@ -1098,8 +1014,6 @@
</span><span class="cx">                                 snprintf(name, sizeof(name), &quot;skypiax/%s&quot;, outbound_profile-&gt;destination_number);
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        //snprintf(name, sizeof(name), &quot;skypiax/%s&quot;, outbound_profile-&gt;destination_number);
-                        //snprintf(name, sizeof(name), &quot;skypiax/%s&quot;, tech_pvt-&gt;name);
</del><span class="cx">                         switch_channel_set_name(channel, name);
</span><span class="cx">                         caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
</span><span class="cx">                         switch_channel_set_caller_profile(channel, caller_profile);
</span><span class="lines">@@ -1116,8 +1030,6 @@
</span><span class="cx">                 rdest = strchr(caller_profile-&gt;destination_number, '/');
</span><span class="cx">                 *rdest++ = '\0';
</span><span class="cx"> 
</span><del>-                //skypiax_call(tech_pvt, rdest, 30);
-
</del><span class="cx">                 switch_copy_string(tech_pvt-&gt;session_uuid_str, switch_core_session_get_uuid(*new_session), sizeof(tech_pvt-&gt;session_uuid_str));
</span><span class="cx">                 caller_profile = tech_pvt-&gt;caller_profile;
</span><span class="cx">                 caller_profile-&gt;destination_number = rdest;
</span><span class="lines">@@ -1156,7 +1068,7 @@
</span><span class="cx">                 if (res == CALLFLOW_INCOMING_HANGUP || tech_pvt-&gt;skype_callflow == CALLFLOW_INCOMING_HANGUP) {
</span><span class="cx">                         switch_core_session_t *session = NULL;
</span><span class="cx">                         switch_channel_t *channel = NULL;
</span><del>-                        //private_t *tech_pvt = NULL;
</del><ins>+
</ins><span class="cx">                         DEBUGA_SKYPE(&quot;skype call ended\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx"> 
</span><span class="cx">                         if (tech_pvt) {
</span><span class="lines">@@ -1183,11 +1095,7 @@
</span><span class="cx">                                 *tech_pvt-&gt;initial_skype_user = '\0';
</span><span class="cx">                                 switch_mutex_unlock(globals.mutex);
</span><span class="cx"> 
</span><del>-                                //ERRORA(&quot;LET'S WAIT\n&quot;, SKYPIAX_P_LOG);
</del><span class="cx">                                 switch_sleep(300000);        //0.3 sec
</span><del>-                                //ERRORA(&quot;WAIT'S OVER\n&quot;, SKYPIAX_P_LOG);
-                                //tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FINISHED;
-                                //switch_sleep(30000);    //0.03 sec
</del><span class="cx">                                 switch_mutex_lock(globals.mutex);
</span><span class="cx">                                 tech_pvt-&gt;skype_callflow = CALLFLOW_CALL_IDLE;
</span><span class="cx">                                 tech_pvt-&gt;interface_state = SKYPIAX_STATE_IDLE;
</span><span class="lines">@@ -1201,9 +1109,7 @@
</span><span class="cx">         return NULL;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* BEGIN: Changes heres */
</del><span class="cx"> static switch_status_t load_config(int reload_type)
</span><del>-/* END: Changes heres */
</del><span class="cx"> {
</span><span class="cx">         char *cf = &quot;skypiax.conf&quot;;
</span><span class="cx">         switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface;
</span><span class="lines">@@ -1227,19 +1133,6 @@
</span><span class="cx">                                 DEBUGA_SKYPE(&quot;globals.debug=%d\n&quot;, SKYPIAX_P_LOG, globals.debug);
</span><span class="cx">                                 globals.debug = atoi(val);
</span><span class="cx">                                 DEBUGA_SKYPE(&quot;globals.debug=%d\n&quot;, SKYPIAX_P_LOG, globals.debug);
</span><del>-#if 0
-                        } else if (!strcasecmp(var, &quot;hold-music&quot;)) {
-                                switch_set_string(globals.hold_music, val);
-                                DEBUGA_SKYPE(&quot;globals.hold_music=%s\n&quot;, SKYPIAX_P_LOG, globals.hold_music);
-                        } else if (!strcmp(var, &quot;port&quot;)) {
-                                globals.port = atoi(val);
-                                DEBUGA_SKYPE(&quot;globals.port=%d\n&quot;, SKYPIAX_P_LOG, globals.port);
-                        } else if (!strcmp(var, &quot;codec-master&quot;)) {
-                                if (!strcasecmp(val, &quot;us&quot;)) {
-                                        switch_set_flag(&amp;globals, GFLAG_MY_CODEC_PREFS);
-                                }
-                                DEBUGA_SKYPE(&quot;codec-master globals.debug=%d\n&quot;, SKYPIAX_P_LOG, globals.debug);
-#endif //0
</del><span class="cx">                         } else if (!strcmp(var, &quot;dialplan&quot;)) {
</span><span class="cx">                                 set_global_dialplan(val);
</span><span class="cx">                                 DEBUGA_SKYPE(&quot;globals.dialplan=%s\n&quot;, SKYPIAX_P_LOG, globals.dialplan);
</span><span class="lines">@@ -1249,16 +1142,6 @@
</span><span class="cx">                         } else if (!strcmp(var, &quot;context&quot;)) {
</span><span class="cx">                                 set_global_context(val);
</span><span class="cx">                                 DEBUGA_SKYPE(&quot;globals.context=%s\n&quot;, SKYPIAX_P_LOG, globals.context);
</span><del>-#if 0
-                        } else if (!strcmp(var, &quot;codec-prefs&quot;)) {
-                                set_global_codec_string(val);
-                                DEBUGA_SKYPE(&quot;globals.codec_string=%s\n&quot;, SKYPIAX_P_LOG, globals.codec_string);
-                                globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
-                        } else if (!strcmp(var, &quot;codec-rates&quot;)) {
-                                set_global_codec_rates_string(val);
-                                DEBUGA_SKYPE(&quot;globals.codec_rates_string=%s\n&quot;, SKYPIAX_P_LOG, globals.codec_rates_string);
-                                globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
-#endif //0
</del><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                 }
</span><span class="lines">@@ -1283,8 +1166,6 @@
</span><span class="cx">                         char *fail_dial_regex = NULL;
</span><span class="cx">                         char *enable_callerid = &quot;true&quot;;
</span><span class="cx">                         char *X11_display = NULL;
</span><del>-                        //char *tcp_cli_port = &quot;45000&quot;;
-                        //char *tcp_srv_port = &quot;45001&quot;;
</del><span class="cx">                         char *skype_user = NULL;
</span><span class="cx">                         char *report_incoming_chatmessages = &quot;true&quot;;
</span><span class="cx">                         char *silent_mode = &quot;false&quot;;
</span><span class="lines">@@ -1321,12 +1202,6 @@
</span><span class="cx">                                         report_incoming_chatmessages = val;
</span><span class="cx">                                 } else if (!strcasecmp(var, &quot;silent_mode&quot;)) {
</span><span class="cx">                                         silent_mode = val;
</span><del>-#if 0
-                                } else if (!strcasecmp(var, &quot;tcp_cli_port&quot;)) {
-                                        tcp_cli_port = val;
-                                } else if (!strcasecmp(var, &quot;tcp_srv_port&quot;)) {
-                                        tcp_srv_port = val;
-#endif //0
</del><span class="cx">                                 } else if (!strcasecmp(var, &quot;X11-display&quot;) || !strcasecmp(var, &quot;X11_display&quot;)) {
</span><span class="cx">                                         X11_display = val;
</span><span class="cx">                                 } else if (!strcasecmp(var, &quot;max_digits&quot;) || !strcasecmp(var, &quot;max-digits&quot;)) {
</span><span class="lines">@@ -1341,7 +1216,6 @@
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        /* BEGIN: Changes here */
</del><span class="cx">                         if (reload_type == SOFT_RELOAD) {
</span><span class="cx">                                 char the_interface[256];
</span><span class="cx">                                 sprintf(the_interface, &quot;#%s&quot;, name);
</span><span class="lines">@@ -1350,25 +1224,12 @@
</span><span class="cx">                                         continue;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                        /* END: Changes here */
-
</del><span class="cx"> #ifndef WIN32
</span><span class="cx">                         if (!X11_display) {
</span><span class="cx">                                 ERRORA(&quot;interface missing REQUIRED param 'X11_display'\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><span class="cx"> #endif
</span><del>-#if 0
-                        if (!tcp_cli_port) {
-                                ERRORA(&quot;interface missing REQUIRED param 'tcp_cli_port'\n&quot;, SKYPIAX_P_LOG);
-                                continue;
-                        }
-
-                        if (!tcp_srv_port) {
-                                ERRORA(&quot;interface missing REQUIRED param 'tcp_srv_port'\n&quot;, SKYPIAX_P_LOG);
-                                continue;
-                        }
-#endif //0
</del><span class="cx">                         if (!id) {
</span><span class="cx">                                 ERRORA(&quot;interface missing REQUIRED param 'id'\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                 continue;
</span><span class="lines">@@ -1428,15 +1289,7 @@
</span><span class="cx">                                         switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].name, &quot;N/A&quot;);
</span><span class="cx">                                 }
</span><span class="cx">                                 DEBUGA_SKYPE(&quot;CONFIGURING interface_id=%d\n&quot;, SKYPIAX_P_LOG, interface_id);
</span><del>-#if 0
-#ifdef WIN32
-                                globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port = (unsigned short) atoi(tcp_cli_port);
-                                globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port = (unsigned short) atoi(tcp_srv_port);
-#else /* WIN32 */
-                                globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port = atoi(tcp_cli_port);
-                                globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port = atoi(tcp_srv_port);
-#endif /* WIN32 */
-#endif //0
</del><ins>+
</ins><span class="cx">                                 switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].X11_display, X11_display);
</span><span class="cx">                                 switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].skype_user, skype_user);
</span><span class="cx">                                 switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
</span><span class="lines">@@ -1464,14 +1317,6 @@
</span><span class="cx">                                 DEBUGA_SKYPE
</span><span class="cx">                                         (&quot;interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].skype_user=%s\n&quot;,
</span><span class="cx">                                          SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
</span><del>-#if 0
-                                DEBUGA_SKYPE
-                                        (&quot;interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port=%d\n&quot;,
-                                         SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port);
-                                DEBUGA_SKYPE
-                                        (&quot;interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port=%d\n&quot;,
-                                         SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port);
-#endif //0
</del><span class="cx">                                 DEBUGA_SKYPE(&quot;interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].name=%s\n&quot;,
</span><span class="cx">                                                          SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].name);
</span><span class="cx">                                 DEBUGA_SKYPE
</span><span class="lines">@@ -1613,9 +1458,7 @@
</span><span class="cx"> static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type,
</span><span class="cx">                                                                  const char *hint)
</span><span class="cx"> {
</span><del>-        //char *user, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL;
</del><span class="cx">         char *user = NULL, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL;
</span><del>-        //mdl_profile_t *profile = NULL;
</del><span class="cx">         private_t *tech_pvt = NULL;
</span><span class="cx">         int i = 0, found = 0, tried = 0;
</span><span class="cx">         char skype_msg[1024];
</span><span class="lines">@@ -1648,7 +1491,6 @@
</span><span class="cx">                 if ((host = strchr(user, '@'))) {
</span><span class="cx">                         *host++ = '\0';
</span><span class="cx">                 }
</span><del>-                //if (!strcmp(proto, MDL_CHAT_PROTO)) {
</del><span class="cx"> 
</span><span class="cx">                 DEBUGA_SKYPE(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n&quot;, SKYPIAX_P_LOG, proto, from, to, subject, body, type,
</span><span class="cx">                                          hint ? hint : &quot;NULL&quot;);
</span><span class="lines">@@ -1685,18 +1527,6 @@
</span><span class="cx">                         skypiax_signaling_write(tech_pvt, skype_msg);
</span><span class="cx">                         switch_sleep(1000);
</span><span class="cx">                 }
</span><del>-                //} else {
-                //FIXME don't know how to do here, let's hope this is correct
-                //char *p;
-                //ffrom = switch_mprintf(&quot;%s+%s&quot;, proto, from);
-                //from = ffrom;
-                //if ((p = strchr(from, '/'))) {
-                //*p = '\0';
-                //}
-                //NOTICA(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n&quot;, SKYPIAX_P_LOG, proto, from, to, subject, body, type, hint?hint:&quot;NULL&quot;);
-                //switch_core_chat_send(proto, proto, from, to, subject, body, type, hint);
-                //return SWITCH_STATUS_SUCCESS;
-                //}
</del><span class="cx"> 
</span><span class="cx">                 found = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -1796,9 +1626,7 @@
</span><span class="cx"> #ifdef WIN32
</span><span class="cx">                                 if (SendMessage(tech_pvt-&gt;SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) {        // let's the skypiax_api_thread_func die
</span><span class="cx">                                         DEBUGA_SKYPE(&quot;got FALSE here, thread probably was already dead. GetLastError returned: %d\n&quot;, SKYPIAX_P_LOG, GetLastError());
</span><del>-                                        //globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
</del><span class="cx">                                 }
</span><del>-//cicopet
</del><span class="cx"> #else
</span><span class="cx">                                 if (tech_pvt-&gt;SkypiaxHandles.disp) {
</span><span class="cx">                                         XEvent e;
</span><span class="lines">@@ -1854,8 +1682,6 @@
</span><span class="cx">         switch_safe_free(globals.dialplan);
</span><span class="cx">         switch_safe_free(globals.context);
</span><span class="cx">         switch_safe_free(globals.destination);
</span><del>-        //switch_safe_free(globals.codec_string);
-        //switch_safe_free(globals.codec_rates_string);
</del><span class="cx"> 
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="lines">@@ -1900,7 +1726,6 @@
</span><span class="cx">                         switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) };
</span><span class="cx">                         DEBUGA_SKYPE(&quot;received DTMF %c on channel %s\n&quot;, SKYPIAX_P_LOG, dtmf.digit, switch_channel_get_name(channel));
</span><span class="cx">                         switch_mutex_lock(tech_pvt-&gt;flag_mutex);
</span><del>-                        //FIXME: why sometimes DTMFs from here do not seems to be get by FS?
</del><span class="cx">                         switch_channel_queue_dtmf(channel, &amp;dtmf);
</span><span class="cx">                         switch_set_flag(tech_pvt, TFLAG_DTMF);
</span><span class="cx">                         switch_mutex_unlock(tech_pvt-&gt;flag_mutex);
</span><span class="lines">@@ -1919,7 +1744,7 @@
</span><span class="cx"> 
</span><span class="cx">         tech_pvt-&gt;begin_to_write = 0;
</span><span class="cx">         tech_pvt-&gt;begin_to_read = 0;
</span><del>-#if 1
</del><ins>+
</ins><span class="cx">         if (switch_core_timer_init(&amp;tech_pvt-&gt;timer_read, &quot;soft&quot;, 20, 320, skypiax_module_pool) != SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                 ERRORA(&quot;setup timer failed\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="lines">@@ -1927,17 +1752,13 @@
</span><span class="cx"> 
</span><span class="cx">         switch_core_timer_sync(&amp;tech_pvt-&gt;timer_read);
</span><span class="cx"> 
</span><del>-#ifdef TIMER_WRITE
-        //if (switch_core_timer_init(&amp;tech_pvt-&gt;timer_write, &quot;soft&quot;, 10, 320, skypiax_module_pool) !=
</del><span class="cx">         if (switch_core_timer_init(&amp;tech_pvt-&gt;timer_write, &quot;soft&quot;, 20, 320, skypiax_module_pool) != SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                 ERRORA(&quot;setup timer failed\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         switch_core_timer_sync(&amp;tech_pvt-&gt;timer_write);
</span><del>-#endif // TIMER_WRITE
</del><span class="cx"> 
</span><del>-#endif
</del><span class="cx">         switch_threadattr_create(&amp;thd_attr, skypiax_module_pool);
</span><span class="cx">         switch_threadattr_detach_set(thd_attr, 0);
</span><span class="cx">         switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
</span><span class="lines">@@ -1981,7 +1802,6 @@
</span><span class="cx">                         switch_core_session_destroy(&amp;session);
</span><span class="cx">                         return 0;
</span><span class="cx">                 }
</span><del>-                //switch_channel_set_variable(channel, &quot;send_silence_when_idle&quot;, &quot;1500&quot;);
</del><span class="cx">                 switch_channel_set_variable(channel, &quot;waste&quot;, &quot;false&quot;);
</span><span class="cx">                 if (skypiax_tech_init(tech_pvt, session) != SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                         ERRORA(&quot;Doh! no tech_init?\n&quot;, SKYPIAX_P_LOG);
</span><span class="lines">@@ -1994,7 +1814,6 @@
</span><span class="cx">                                                                            tech_pvt-&gt;dialplan, tech_pvt-&gt;callid_name,
</span><span class="cx">                                                                            tech_pvt-&gt;callid_number, NULL, NULL, NULL, NULL, &quot;mod_skypiax&quot;, tech_pvt-&gt;context, tech_pvt-&gt;destination)) != 0) {
</span><span class="cx">                         char name[128];
</span><del>-                        //switch_snprintf(name, sizeof(name), &quot;skypiax/%s/%s&quot;, tech_pvt-&gt;name, tech_pvt-&gt;caller_profile-&gt;destination_number);
</del><span class="cx">                         switch_snprintf(name, sizeof(name), &quot;skypiax/%s&quot;, tech_pvt-&gt;name);
</span><span class="cx">                         switch_channel_set_name(channel, name);
</span><span class="cx">                         switch_channel_set_caller_profile(channel, tech_pvt-&gt;caller_profile);
</span><span class="lines">@@ -2056,7 +1875,6 @@
</span><span class="cx">                 session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
</span><span class="cx">         } else {
</span><span class="cx">                 ERRORA(&quot;No session???\n\n\n&quot;, SKYPIAX_P_LOG);
</span><del>-                //TODO: kill the bastard
</del><span class="cx">                 goto done;
</span><span class="cx">         }
</span><span class="cx">         if (session) {
</span><span class="lines">@@ -2064,7 +1882,6 @@
</span><span class="cx">                 switch_core_session_add_stream(session, NULL);
</span><span class="cx">         } else {
</span><span class="cx">                 ERRORA(&quot;No session???\n&quot;, SKYPIAX_P_LOG);
</span><del>-                //TODO: kill the bastard
</del><span class="cx">                 goto done;
</span><span class="cx">         }
</span><span class="cx">         if (channel) {
</span><span class="lines">@@ -2072,7 +1889,6 @@
</span><span class="cx">                 DEBUGA_SKYPE(&quot;skype_call: REMOTE PARTY EARLY MEDIA\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">         } else {
</span><span class="cx">                 ERRORA(&quot;No channel???\n&quot;, SKYPIAX_P_LOG);
</span><del>-                //TODO: kill the bastard
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         switch_core_session_rwunlock(session);
</span><span class="lines">@@ -2100,7 +1916,6 @@
</span><span class="cx">         }
</span><span class="cx">         if (channel) {
</span><span class="cx">                 switch_channel_mark_answered(channel);
</span><del>-                //DEBUGA_SKYPE(&quot;skype_call: %s, answered\n&quot;, SKYPIAX_P_LOG, id);
</del><span class="cx">         } else {
</span><span class="cx">                 ERRORA(&quot;No channel???\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">         }
</span><span class="lines">@@ -2117,8 +1932,6 @@
</span><span class="cx"> {
</span><span class="cx">         private_t *tech_pvt = NULL;
</span><span class="cx">         int i;
</span><del>-        //int num_interfaces = SKYPIAX_MAX_INTERFACES; 
-        //int num_interfaces = globals.real_interfaces;
</del><span class="cx"> 
</span><span class="cx">         switch_mutex_lock(globals.mutex);
</span><span class="cx"> 
</span><span class="lines">@@ -2130,7 +1943,6 @@
</span><span class="cx">                 int interface_id;
</span><span class="cx"> 
</span><span class="cx">                 interface_id = globals.next_interface;
</span><del>-                //interface_id = interface_id &lt; SKYPIAX_MAX_INTERFACES ? interface_id : interface_id - SKYPIAX_MAX_INTERFACES + 1;
</del><span class="cx">                 globals.next_interface = interface_id + 1 &lt; SKYPIAX_MAX_INTERFACES ? interface_id + 1 : 0;
</span><span class="cx"> 
</span><span class="cx">                 if (strlen(globals.SKYPIAX_INTERFACES[interface_id].name)) {
</span><span class="lines">@@ -2144,8 +1956,6 @@
</span><span class="cx">                                                                                                                                                            || 0 == tech_pvt-&gt;skype_callflow)) {
</span><span class="cx">                                 DEBUGA_SKYPE(&quot;returning as available skype interface name: %s, state: %d callflow: %d\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;name, skype_state,
</span><span class="cx">                                                          tech_pvt-&gt;skype_callflow);
</span><del>-                                /*set to Dialing state to avoid other thread fint it, don't know if it is safe */
-                                //XXX no, it's not safe 
</del><span class="cx">                                 if (tech_pvt_calling == NULL) {
</span><span class="cx">                                         tech_pvt-&gt;interface_state = SKYPIAX_STATE_SELECTED;
</span><span class="cx">                                 }
</span><span class="lines">@@ -2153,9 +1963,7 @@
</span><span class="cx">                                 switch_mutex_unlock(globals.mutex);
</span><span class="cx">                                 return tech_pvt;
</span><span class="cx">                         }
</span><del>-                }                                                // else {
-                //DEBUGA_SKYPE(&quot;Skype interface: %d blank!! A hole here means we cannot hunt the last interface.\n&quot;, SKYPIAX_P_LOG, interface_id);
-                //}
</del><ins>+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         switch_mutex_unlock(globals.mutex);
</span><span class="lines">@@ -2246,7 +2054,6 @@
</span><span class="cx"> 
</span><span class="cx">         } else if (!strcasecmp(argv[0], &quot;ciapalino&quot;)) {
</span><span class="cx"> 
</span><del>-/* BEGIN: Changes heres */
</del><span class="cx">         } else if (!strcasecmp(argv[0], &quot;reload&quot;)) {
</span><span class="cx">                 if (load_config(SOFT_RELOAD) != SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                         stream-&gt;write_function(stream, &quot;sk reload failed\n&quot;);
</span><span class="lines">@@ -2266,7 +2073,6 @@
</span><span class="cx">                         stream-&gt;write_function(stream, &quot;-ERR Usage: sk remove interface_name\n&quot;);
</span><span class="cx">                         goto end;
</span><span class="cx">                 }
</span><del>-/* END: Changes heres */
</del><span class="cx"> 
</span><span class="cx">         } else {
</span><span class="cx">                 if (globals.sk_console)
</span><span class="lines">@@ -2347,7 +2153,6 @@
</span><span class="cx">                 if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
</span><span class="cx"> 
</span><span class="cx">                         giovatech = &amp;globals.SKYPIAX_INTERFACES[i];
</span><del>-                        //NOTICA(&quot;interface=%d, name=%s, giovatech-&gt;skype_call_id=%s, giovatech-&gt;interface_state=%d, giovatech-&gt;skype_user=%s, tech_pvt-&gt;skype_user=%s, giovatech-&gt;callid_number=%s, value=%s, delta=%ld  500000\n&quot;, SKYPIAX_P_LOG, i, giovatech-&gt;name, giovatech-&gt;skype_call_id, giovatech-&gt;interface_state, giovatech-&gt;skype_user, tech_pvt-&gt;skype_user, giovatech-&gt;callid_number, value, (((timenow.tv_sec - giovatech-&gt;answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech-&gt;answer_time.tv_usec)) );
</del><span class="cx">                         if (strlen(giovatech-&gt;skype_call_id) &amp;&amp; (giovatech-&gt;interface_state != SKYPIAX_STATE_DOWN) &amp;&amp; (!strcmp(giovatech-&gt;skype_user, tech_pvt-&gt;skype_user)) &amp;&amp; (!strcmp(giovatech-&gt;callid_number, value)) &amp;&amp; ((((timenow.tv_sec - giovatech-&gt;answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech-&gt;answer_time.tv_usec)) &lt; 1000000)) {        //XXX 1.5sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.5 seconds
</span><span class="cx">                                 found = 1;
</span><span class="cx">                                 DEBUGA_SKYPE
</span><span class="lines">@@ -2367,9 +2172,6 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (found) {
</span><del>-                //tech_pvt-&gt;callid_number[0]='\0';
-                //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
-                //skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><span class="cx">                 switch_mutex_unlock(globals.mutex);
</span><span class="cx">                 return 0;
</span><span class="cx">         }
</span><span class="lines">@@ -2387,7 +2189,6 @@
</span><span class="cx">                 sprintf(msg_to_skype, &quot;ALTER CALL %s ANSWER&quot;, id);
</span><span class="cx">                 skypiax_signaling_write(tech_pvt, msg_to_skype);
</span><span class="cx">                 DEBUGA_SKYPE(&quot;We answered a Skype RING on skype_call %s\n&quot;, SKYPIAX_P_LOG, id);
</span><del>-                //FIXME write a timestamp here
</del><span class="cx">                 gettimeofday(&amp;tech_pvt-&gt;answer_time, NULL);
</span><span class="cx">                 switch_copy_string(tech_pvt-&gt;skype_call_id, id, sizeof(tech_pvt-&gt;skype_call_id) - 1);
</span><span class="cx"> 
</span><span class="lines">@@ -2422,8 +2223,6 @@
</span><span class="cx">                 if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
</span><span class="cx"> 
</span><span class="cx">                         giovatech = &amp;globals.SKYPIAX_INTERFACES[i];
</span><del>-                        //NOTICA(&quot;skype interface: %d, name: %s, state: %d, value=%s, giovatech-&gt;callid_number=%s, giovatech-&gt;skype_user=%s\n&quot;, SKYPIAX_P_LOG, i, giovatech-&gt;name, giovatech-&gt;interface_state, value, giovatech-&gt;callid_number, giovatech-&gt;skype_user);
-                        //FIXME check a timestamp here
</del><span class="cx">                         if (strlen(giovatech-&gt;skype_call_id) &amp;&amp; (giovatech-&gt;interface_state != SKYPIAX_STATE_DOWN) &amp;&amp; (!strcmp(giovatech-&gt;skype_user, tech_pvt-&gt;skype_user)) &amp;&amp; (!strcmp(giovatech-&gt;callid_number, value)) &amp;&amp; ((((timenow.tv_sec - giovatech-&gt;answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech-&gt;answer_time.tv_usec)) &lt; 500000)) {        //0.5sec
</span><span class="cx">                                 found = 1;
</span><span class="cx">                                 DEBUGA_SKYPE
</span><span class="lines">@@ -2436,9 +2235,6 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (found) {
</span><del>-                //tech_pvt-&gt;callid_number[0]='\0';
-                //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
-                //skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><span class="cx">                 switch_mutex_unlock(globals.mutex);
</span><span class="cx">                 return 0;
</span><span class="cx">         }
</span><span class="lines">@@ -2451,7 +2247,7 @@
</span><span class="cx"> 
</span><span class="cx">         } else {
</span><span class="cx"> 
</span><del>-                /* we're owned, we're in a call, let's try to transfer */
</del><ins>+                /*  we're in a call, let's try to transfer */
</ins><span class="cx">                 /************************** TODO
</span><span class="cx">                   Checking here if it is possible to transfer this call to Test2
</span><span class="cx">                   -&gt; GET CALL 288 CAN_TRANSFER Test2
</span><span class="lines">@@ -2465,8 +2261,6 @@
</span><span class="cx">                         if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
</span><span class="cx"> 
</span><span class="cx">                                 giovatech = &amp;globals.SKYPIAX_INTERFACES[i];
</span><del>-                                //NOTICA(&quot;skype interface: %d, name: %s, state: %d, value=%s, giovatech-&gt;callid_number=%s, giovatech-&gt;skype_user=%s\n&quot;, SKYPIAX_P_LOG, i, giovatech-&gt;name, giovatech-&gt;interface_state, value, giovatech-&gt;callid_number, giovatech-&gt;skype_user);
-                                //FIXME check a timestamp here
</del><span class="cx">                                 if (strlen(giovatech-&gt;skype_transfer_call_id) &amp;&amp; (giovatech-&gt;interface_state != SKYPIAX_STATE_DOWN) &amp;&amp; (!strcmp(giovatech-&gt;skype_user, tech_pvt-&gt;skype_user)) &amp;&amp; (!strcmp(giovatech-&gt;transfer_callid_number, value)) &amp;&amp; ((((timenow.tv_sec - giovatech-&gt;transfer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech-&gt;transfer_time.tv_usec)) &lt; 1000000)) {        //1.0 sec
</span><span class="cx">                                         found = 1;
</span><span class="cx">                                         DEBUGA_SKYPE
</span><span class="lines">@@ -2479,9 +2273,6 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if (found) {
</span><del>-                        //tech_pvt-&gt;callid_number[0]='\0';
-                        //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
-                        //skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><span class="cx">                         switch_mutex_unlock(globals.mutex);
</span><span class="cx">                         return 0;
</span><span class="cx">                 }
</span><span class="lines">@@ -2502,8 +2293,6 @@
</span><span class="cx">                                 (&quot;Let's transfer the skype_call %s to %s interface (with skype_user: %s), because we are already in a skypiax call(%s)\n&quot;,
</span><span class="cx">                                  SKYPIAX_P_LOG, tech_pvt-&gt;skype_call_id, available_skypiax_interface-&gt;name, available_skypiax_interface-&gt;skype_user, id);
</span><span class="cx"> 
</span><del>-                        //FIXME why this? the inbound call will come, eventually, on that other interface
-                        //available_skypiax_interface-&gt;ib_calls++;
</del><span class="cx"> 
</span><span class="cx">                         sprintf(msg_to_skype, &quot;ALTER CALL %s TRANSFER %s&quot;, id, available_skypiax_interface-&gt;skype_user);
</span><span class="cx">                         skypiax_signaling_write(tech_pvt, msg_to_skype);
</span><span class="lines">@@ -2604,10 +2393,8 @@
</span><span class="cx">         char *mycmd = NULL, *argv[10] = { 0 };
</span><span class="cx">         int argc = 0;
</span><span class="cx">         private_t *tech_pvt = NULL;
</span><del>-        //int tried =0;
</del><span class="cx">         int i;
</span><span class="cx">         int found = 0;
</span><del>-        //char skype_msg[1024];
</del><span class="cx"> 
</span><span class="cx">         if (!zstr(cmd) &amp;&amp; (mycmd = strdup(cmd))) {
</span><span class="cx">                 argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
</span><span class="lines">@@ -2640,51 +2427,18 @@
</span><span class="cx">                         goto end;
</span><span class="cx">                 } else {
</span><span class="cx"> 
</span><del>-                        //chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint);
-                        //chat_send(p*roto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint);
-                        //chat_send(MDL_CHAT_PROTO, tech_pvt-&gt;skype_user, argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, hint);
-
</del><span class="cx">                         NOTICA(&quot;chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n&quot;, SKYPIAX_P_LOG, MDL_CHAT_PROTO, tech_pvt-&gt;skype_user,
</span><span class="cx">                                    argv[1], &quot;SIMPLE MESSAGE&quot;, switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), tech_pvt-&gt;name);
</span><span class="cx"> 
</span><span class="cx">                         chat_send(MDL_CHAT_PROTO, tech_pvt-&gt;skype_user, argv[1], &quot;SIMPLE MESSAGE&quot;,
</span><span class="cx">                                           switch_str_nil((char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, tech_pvt-&gt;name);
</span><span class="cx"> 
</span><del>-                        //NOTICA(&quot;TEXT is: %s\n&quot;, SKYPIAX_P_LOG, (char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1] );
-                        //snprintf(skype_msg, sizeof(skype_msg), &quot;CHAT CREATE %s&quot;, argv[1]);
-                        //skypiax_signaling_write(tech_pvt, skype_msg);
-                        //switch_sleep(100);
</del><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 stream-&gt;write_function(stream, &quot;ERROR, usage: %s&quot;, SKYPIAX_CHAT_SYNTAX);
</span><span class="cx">                 goto end;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-#ifdef NOTDEF
-
-        found = 0;
-
-        while (!found) {
-                for (i = 0; i &lt; MAX_CHATS; i++) {
-                        if (!strcmp(tech_pvt-&gt;chats[i].dialog_partner, argv[1])) {
-                                snprintf(skype_msg, sizeof(skype_msg), &quot;CHATMESSAGE %s %s&quot;, tech_pvt-&gt;chats[i].chatname,
-                                                 (char *) &amp;cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]);
-                                skypiax_signaling_write(tech_pvt, skype_msg);
-                                found = 1;
-                                break;
-                        }
-                }
-                if (found) {
-                        break;
-                }
-                if (tried &gt; 1000) {
-                        stream-&gt;write_function(stream, &quot;ERROR: no chat with dialog_partner='%s' was found\n&quot;, argv[1]);
-                        break;
-                }
-                switch_sleep(1000);
-        }
-#endif //NOTDEF
-
</del><span class="cx">   end:
</span><span class="cx">         switch_safe_free(mycmd);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>