<!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][14518] </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=14518">14518</a></dd>
<dt>Author</dt> <dd>gmaruzz</dd>
<dt>Date</dt> <dd>2009-08-14 12:14:40 -0500 (Fri, 14 Aug 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>skypiax: indent</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 (14517 => 14518)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2009-08-14 17:12:09 UTC (rev 14517)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c        2009-08-14 17:14:40 UTC (rev 14518)
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx"> static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
</span><span class="cx"> static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
</span><span class="cx"> static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
</span><del>-static switch_status_t  skypiax_tech_init(private_t * tech_pvt, switch_core_session_t *session);
</del><ins>+static switch_status_t skypiax_tech_init(private_t * tech_pvt, switch_core_session_t *session);
</ins><span class="cx"> 
</span><span class="cx"> static switch_status_t skypiax_codec(private_t * tech_pvt, int sample_rate, int codec_ms)
</span><span class="cx"> {
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx"> 
</span><span class="cx">         session = switch_core_session_locate(tech_pvt-&gt;session_uuid_str);
</span><span class="cx"> 
</span><del>-        if(session){
</del><ins>+        if (session) {
</ins><span class="cx">                 switch_core_session_set_read_codec(session, &amp;tech_pvt-&gt;read_codec);
</span><span class="cx">                 switch_core_session_set_write_codec(session, &amp;tech_pvt-&gt;write_codec);
</span><span class="cx">                 switch_core_session_rwunlock(session);
</span><span class="lines">@@ -198,7 +198,7 @@
</span><span class="cx">         switch_mutex_init(&amp;tech_pvt-&gt;flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
</span><span class="cx">         switch_core_session_set_private(session, tech_pvt);
</span><span class="cx">         switch_copy_string(tech_pvt-&gt;session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt-&gt;session_uuid_str));
</span><del>-        if(!strlen(tech_pvt-&gt;session_uuid_str)){
</del><ins>+        if (!strlen(tech_pvt-&gt;session_uuid_str)) {
</ins><span class="cx">                 ERRORA(&quot;no tech_pvt-&gt;session_uuid_str\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return SWITCH_STATUS_FALSE;
</span><span class="cx">         }
</span><span class="lines">@@ -741,7 +741,7 @@
</span><span class="cx">                                                                                                         switch_caller_profile_t *outbound_profile,
</span><span class="cx">                                                                                                         switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
</span><span class="cx"> {
</span><del>-                private_t *tech_pvt = NULL;
</del><ins>+        private_t *tech_pvt = NULL;
</ins><span class="cx">         if ((*new_session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
</span><span class="cx">                 switch_channel_t *channel = NULL;
</span><span class="cx">                 switch_caller_profile_t *caller_profile;
</span><span class="lines">@@ -766,8 +766,8 @@
</span><span class="cx">                                 //DEBUGA_SKYPE(&quot;Finding one available skype interface\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                 //tech_pvt = find_available_skypiax_interface(NULL);
</span><span class="cx">                                 //if (tech_pvt)
</span><del>-                                        //found = 1;
-                        //} else if (strncmp(&quot;RR&quot;, interface_name, strlen(interface_name)) == 0) {
</del><ins>+                                //found = 1;
+                                //} else if (strncmp(&quot;RR&quot;, interface_name, strlen(interface_name)) == 0) {
</ins><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">@@ -811,13 +811,13 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 channel = switch_core_session_get_channel(*new_session);
</span><del>-                if(!channel){
</del><ins>+                if (!channel) {
</ins><span class="cx">                         ERRORA(&quot;Doh! no channel?\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                         switch_core_session_destroy(new_session);
</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>-                if( skypiax_tech_init(tech_pvt, *new_session) != SWITCH_STATUS_SUCCESS){
</del><ins>+                if (skypiax_tech_init(tech_pvt, *new_session) != SWITCH_STATUS_SUCCESS) {
</ins><span class="cx">                         ERRORA(&quot;Doh! no tech_init?\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                         switch_core_session_destroy(new_session);
</span><span class="cx">                         switch_mutex_unlock(globals.mutex);
</span><span class="lines">@@ -893,14 +893,14 @@
</span><span class="cx">                                         channel = switch_core_session_get_channel(session);
</span><span class="cx">                                         if (channel) {
</span><span class="cx">                                                 switch_channel_state_t state = switch_channel_get_state(channel);
</span><del>-                                                if(state &lt; CS_EXECUTE){
-                                                        usleep(10000);//10 msec, let the state evolve from CS_NEW
</del><ins>+                                                if (state &lt; CS_EXECUTE) {
+                                                        usleep(10000);        //10 msec, let the state evolve from CS_NEW
</ins><span class="cx">                                                 }
</span><span class="cx">                                                 switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
</span><span class="cx">                                         } else {
</span><span class="cx">                                                 ERRORA(&quot;no channel?\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                         }
</span><del>-                                                switch_core_session_rwunlock(session);
</del><ins>+                                        switch_core_session_rwunlock(session);
</ins><span class="cx">                                 } else {
</span><span class="cx">                                         DEBUGA_SKYPE(&quot;no session\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                 }
</span><span class="lines">@@ -909,7 +909,7 @@
</span><span class="cx">                                 *tech_pvt-&gt;skype_call_id = '\0';
</span><span class="cx"> 
</span><span class="cx">                                 //ERRORA(&quot;LET'S WAIT\n&quot;, SKYPIAX_P_LOG);
</span><del>-                                usleep(300000); //0.3 sec
</del><ins>+                                usleep(300000);        //0.3 sec
</ins><span class="cx">                                 //ERRORA(&quot;WAIT'S OVER\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                 tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FINISHED;
</span><span class="cx">                         } else {
</span><span class="lines">@@ -1430,24 +1430,24 @@
</span><span class="cx">         switch_threadattr_detach_set(thd_attr, 1);
</span><span class="cx">         switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
</span><span class="cx">         if (switch_thread_create(&amp;tech_pvt-&gt;tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread, tech_pvt, skypiax_module_pool) == SWITCH_STATUS_SUCCESS) {
</span><del>-        DEBUGA_SKYPE(&quot;started tcp_srv_thread thread.\n&quot;, SKYPIAX_P_LOG);
</del><ins>+                DEBUGA_SKYPE(&quot;started tcp_srv_thread thread.\n&quot;, SKYPIAX_P_LOG);
</ins><span class="cx">         } else {
</span><del>-        ERRORA(&quot;failed to start tcp_srv_thread thread.\n&quot;, SKYPIAX_P_LOG);
-        return -1;
</del><ins>+                ERRORA(&quot;failed to start tcp_srv_thread thread.\n&quot;, SKYPIAX_P_LOG);
+                return -1;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         switch_threadattr_create(&amp;thd_attr, skypiax_module_pool);
</span><span class="cx">         switch_threadattr_detach_set(thd_attr, 1);
</span><span class="cx">         switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
</span><del>-        if(switch_thread_create(&amp;tech_pvt-&gt;tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread, tech_pvt, skypiax_module_pool) == SWITCH_STATUS_SUCCESS) {
-        DEBUGA_SKYPE(&quot;started tcp_cli_thread thread.\n&quot;, SKYPIAX_P_LOG);
-        }else{
-        ERRORA(&quot;failed to start tcp_cli_thread thread.\n&quot;, SKYPIAX_P_LOG);
-        return -1;
</del><ins>+        if (switch_thread_create(&amp;tech_pvt-&gt;tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread, tech_pvt, skypiax_module_pool) == SWITCH_STATUS_SUCCESS) {
+                DEBUGA_SKYPE(&quot;started tcp_cli_thread thread.\n&quot;, SKYPIAX_P_LOG);
+        } else {
+                ERRORA(&quot;failed to start tcp_cli_thread thread.\n&quot;, SKYPIAX_P_LOG);
+                return -1;
</ins><span class="cx">         }
</span><span class="cx">         switch_sleep(100000);
</span><span class="cx"> 
</span><del>-        if(tech_pvt-&gt;tcp_cli_thread == NULL || tech_pvt-&gt;tcp_srv_thread == NULL) {
</del><ins>+        if (tech_pvt-&gt;tcp_cli_thread == NULL || tech_pvt-&gt;tcp_srv_thread == NULL) {
</ins><span class="cx">                 ERRORA(&quot;tcp_cli_thread or tcp_srv_thread exited\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return -1;
</span><span class="cx">         }
</span><span class="lines">@@ -1463,12 +1463,12 @@
</span><span class="cx">         if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
</span><span class="cx">                 switch_core_session_add_stream(session, NULL);
</span><span class="cx">                 channel = switch_core_session_get_channel(session);
</span><del>-                if(!channel){
</del><ins>+                if (!channel) {
</ins><span class="cx">                         ERRORA(&quot;Doh! no channel?\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                         switch_core_session_destroy(&amp;session);
</span><span class="cx">                         return 0;
</span><span class="cx">                 }
</span><del>-                if( skypiax_tech_init(tech_pvt, session) != SWITCH_STATUS_SUCCESS){
</del><ins>+                if (skypiax_tech_init(tech_pvt, session) != SWITCH_STATUS_SUCCESS) {
</ins><span class="cx">                         ERRORA(&quot;Doh! no tech_init?\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                         switch_core_session_destroy(&amp;session);
</span><span class="cx">                         return 0;
</span><span class="lines">@@ -1491,7 +1491,7 @@
</span><span class="cx">                         return 0;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        if(channel){
</del><ins>+        if (channel) {
</ins><span class="cx">                 switch_channel_mark_answered(channel);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1653,12 +1653,15 @@
</span><span class="cx">                         tech_pvt = &amp;globals.SKYPIAX_INTERFACES[interface_id];
</span><span class="cx">                         skype_state = tech_pvt-&gt;interface_state;
</span><span class="cx">                         //DEBUGA_SKYPE(&quot;skype interface: %d, name: %s, state: %d\n&quot;, SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].name, skype_state);
</span><del>-                        if ((tech_pvt_calling ? strcmp(tech_pvt-&gt;skype_user, tech_pvt_calling-&gt;skype_user) : 1) &amp;&amp; (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) &amp;&amp; (tech_pvt-&gt;skype_callflow ==CALLFLOW_STATUS_FINISHED || 0 == tech_pvt-&gt;skype_callflow )) {
-                                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, tech_pvt-&gt;skype_callflow);
</del><ins>+                        if ((tech_pvt_calling ? strcmp(tech_pvt-&gt;skype_user, tech_pvt_calling-&gt;skype_user) : 1)
+                                &amp;&amp; (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) &amp;&amp; (tech_pvt-&gt;skype_callflow == CALLFLOW_STATUS_FINISHED
+                                                                                                                                                           || 0 == tech_pvt-&gt;skype_callflow)) {
+                                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,
+                                                         tech_pvt-&gt;skype_callflow);
</ins><span class="cx">                                 /*set to Dialing state to avoid other thread fint it, don't know if it is safe */
</span><span class="cx">                                 //XXX no, it's not safe 
</span><del>-                                if(tech_pvt_calling == NULL){
-                                tech_pvt-&gt;interface_state = SKYPIAX_STATE_SELECTED ;
</del><ins>+                                if (tech_pvt_calling == NULL) {
+                                        tech_pvt-&gt;interface_state = SKYPIAX_STATE_SELECTED;
</ins><span class="cx">                                 }
</span><span class="cx"> 
</span><span class="cx">                                 switch_mutex_unlock(globals.mutex);
</span><span class="lines">@@ -1851,12 +1854,12 @@
</span><span class="cx">                                         (&quot;FOUND  (name=%s, giovatech-&gt;interface_state=%d != SKYPIAX_STATE_DOWN) &amp;&amp; (giovatech-&gt;skype_user=%s == tech_pvt-&gt;skype_user=%s) &amp;&amp; (giovatech-&gt;callid_number=%s == value=%s)\n&quot;,
</span><span class="cx">                                          SKYPIAX_P_LOG, giovatech-&gt;name, giovatech-&gt;interface_state,
</span><span class="cx">                                          giovatech-&gt;skype_user, tech_pvt-&gt;skype_user, giovatech-&gt;callid_number, value)
</span><del>-                                        if(tech_pvt-&gt;interface_state == SKYPIAX_STATE_PRERING){
-                                                tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
-                                        }else if (tech_pvt-&gt;interface_state != 0 &amp;&amp; tech_pvt-&gt;interface_state != SKYPIAX_STATE_DOWN) {
-                                                WARNINGA(&quot;Why an interface_state %d HERE?\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;interface_state);
-                                                tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
-                                        }
</del><ins>+                                        if (tech_pvt-&gt;interface_state == SKYPIAX_STATE_PRERING) {
+                                        tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
+                                } else if (tech_pvt-&gt;interface_state != 0 &amp;&amp; tech_pvt-&gt;interface_state != SKYPIAX_STATE_DOWN) {
+                                        WARNINGA(&quot;Why an interface_state %d HERE?\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;interface_state);
+                                        tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
+                                }
</ins><span class="cx"> 
</span><span class="cx">                                 break;
</span><span class="cx">                         }
</span><span class="lines">@@ -1865,8 +1868,8 @@
</span><span class="cx"> 
</span><span class="cx">         if (found) {
</span><span class="cx">                 //tech_pvt-&gt;callid_number[0]='\0';
</span><del>-                        //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
-                                        //skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><ins>+                //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
+                //skypiax_signaling_write(tech_pvt, msg_to_skype);
</ins><span class="cx">                 switch_mutex_unlock(globals.mutex);
</span><span class="cx">                 return 0;
</span><span class="cx">         }
</span><span class="lines">@@ -1894,8 +1897,8 @@
</span><span class="cx">                 ERRORA(&quot;No Call ID?\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">         } else {
</span><span class="cx">                 DEBUGA_SKYPE(&quot;We're in a call now (%s), let's refuse this one (%s)\n&quot;, SKYPIAX_P_LOG, tech_pvt-&gt;skype_call_id, id);
</span><del>-                        sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
-                                        skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><ins>+                sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
+                skypiax_signaling_write(tech_pvt, msg_to_skype);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         switch_mutex_unlock(globals.mutex);
</span><span class="lines">@@ -1931,8 +1934,8 @@
</span><span class="cx"> 
</span><span class="cx">         if (found) {
</span><span class="cx">                 //tech_pvt-&gt;callid_number[0]='\0';
</span><del>-                        //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
-                                        //skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><ins>+                //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
+                //skypiax_signaling_write(tech_pvt, msg_to_skype);
</ins><span class="cx">                 switch_mutex_unlock(globals.mutex);
</span><span class="cx">                 return 0;
</span><span class="cx">         }
</span><span class="lines">@@ -1975,7 +1978,7 @@
</span><span class="cx">                 if (found) {
</span><span class="cx">                         //tech_pvt-&gt;callid_number[0]='\0';
</span><span class="cx">                         //sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
</span><del>-                                        //skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><ins>+                        //skypiax_signaling_write(tech_pvt, msg_to_skype);
</ins><span class="cx">                         switch_mutex_unlock(globals.mutex);
</span><span class="cx">                         return 0;
</span><span class="cx">                 }
</span><span class="lines">@@ -2002,7 +2005,7 @@
</span><span class="cx">                                 (&quot;Not answering the skype_call %s, because we are already in a skypiax call(%s) and not transferring, because no other skypiax interfaces are available\n&quot;,
</span><span class="cx">                                  SKYPIAX_P_LOG, id, tech_pvt-&gt;skype_call_id);
</span><span class="cx">                         sprintf(msg_to_skype, &quot;ALTER CALL %s END HANGUP&quot;, id);
</span><del>-                                        skypiax_signaling_write(tech_pvt, msg_to_skype);
</del><ins>+                        skypiax_signaling_write(tech_pvt, msg_to_skype);
</ins><span class="cx">                 }
</span><span class="cx">                 switch_sleep(10000);
</span><span class="cx">                 DEBUGA_SKYPE
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxskypiaxh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h (14517 => 14518)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h        2009-08-14 17:12:09 UTC (rev 14517)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h        2009-08-14 17:14:40 UTC (rev 14518)
</span><span class="lines">@@ -283,4 +283,4 @@
</span><span class="cx"> int remote_party_is_early_media(private_t * tech_pvt);
</span><span class="cx"> int skypiax_answer(private_t * tech_pvt, char *id, char *value);
</span><span class="cx"> int skypiax_transfer(private_t * tech_pvt, char *id, char *value);
</span><del>-int skypiax_socket_create_and_bind(private_t * tech_pvt, int * which_port);
</del><ins>+int skypiax_socket_create_and_bind(private_t * tech_pvt, int *which_port);
</ins></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skypiaxskypiax_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (14517 => 14518)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c        2009-08-14 17:12:09 UTC (rev 14517)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c        2009-08-14 17:14:40 UTC (rev 14518)
</span><span class="lines">@@ -26,9 +26,9 @@
</span><span class="cx"> #endif /* WIN32 */
</span><span class="cx"> /*************************************/
</span><span class="cx"> 
</span><del>-int skypiax_socket_create_and_bind(private_t * tech_pvt, int * which_port)
</del><ins>+int skypiax_socket_create_and_bind(private_t * tech_pvt, int *which_port)
</ins><span class="cx"> {
</span><del>-        int s=-1;
</del><ins>+        int s = -1;
</ins><span class="cx">         struct sockaddr_in my_addr;
</span><span class="cx">         int start_port = 6001;
</span><span class="cx"> 
</span><span class="lines">@@ -41,28 +41,32 @@
</span><span class="cx">                 return -1;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if(*which_port != 0)
</del><ins>+        if (*which_port != 0)
</ins><span class="cx">                 start_port = *which_port;
</span><span class="cx"> 
</span><span class="cx">         my_addr.sin_port = htons(start_port);
</span><span class="cx">         //tech_pvt-&gt;tcp_cli_port = start_port;
</span><span class="cx">         *which_port = start_port;
</span><span class="cx">         while (bind(s, (struct sockaddr *) &amp;my_addr, sizeof(struct sockaddr)) &lt; 0) {
</span><del>-                DEBUGA_SKYPE(&quot;*which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port, tech_pvt-&gt;tcp_cli_port, tech_pvt-&gt;tcp_srv_port);
</del><ins>+                DEBUGA_SKYPE(&quot;*which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port, tech_pvt-&gt;tcp_cli_port,
+                                         tech_pvt-&gt;tcp_srv_port);
</ins><span class="cx">                 DEBUGA_SKYPE(&quot;EADDRINUSE=%d, bind errno=%d, error: %s\n&quot;, SKYPIAX_P_LOG, EADDRINUSE, errno, strerror(errno));
</span><span class="cx">                 start_port++;
</span><span class="cx">                 my_addr.sin_port = htons(start_port);
</span><span class="cx">                 *which_port = start_port;
</span><del>-                DEBUGA_SKYPE(&quot;*which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port, tech_pvt-&gt;tcp_cli_port, tech_pvt-&gt;tcp_srv_port);
</del><ins>+                DEBUGA_SKYPE(&quot;*which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port, tech_pvt-&gt;tcp_cli_port,
+                                         tech_pvt-&gt;tcp_srv_port);
</ins><span class="cx"> 
</span><del>-                if(start_port &gt; 65000){
-                        ERRORA(&quot;NO MORE PORTS! *which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port, tech_pvt-&gt;tcp_cli_port, tech_pvt-&gt;tcp_srv_port);
</del><ins>+                if (start_port &gt; 65000) {
+                        ERRORA(&quot;NO MORE PORTS! *which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port,
+                                   tech_pvt-&gt;tcp_cli_port, tech_pvt-&gt;tcp_srv_port);
</ins><span class="cx">                         return -1;
</span><span class="cx">                 }
</span><span class="cx">                 //usleep(100);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        DEBUGA_SKYPE(&quot;SUCCESS! *which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port, tech_pvt-&gt;tcp_cli_port, tech_pvt-&gt;tcp_srv_port);
</del><ins>+        DEBUGA_SKYPE(&quot;SUCCESS! *which_port=%d, tech_pvt-&gt;tcp_cli_port=%d, tech_pvt-&gt;tcp_srv_port=%d\n&quot;, SKYPIAX_P_LOG, *which_port, tech_pvt-&gt;tcp_cli_port,
+                                 tech_pvt-&gt;tcp_srv_port);
</ins><span class="cx">         return s;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -91,7 +95,7 @@
</span><span class="cx">                 if (read_from_pipe[i] == '\0') {
</span><span class="cx"> 
</span><span class="cx">                         //if (!strstr(message, &quot;DURATION&quot;)) {
</span><del>-                                DEBUGA_SKYPE(&quot;READING: |||%s||| \n&quot;, SKYPIAX_P_LOG, message);
</del><ins>+                        DEBUGA_SKYPE(&quot;READING: |||%s||| \n&quot;, SKYPIAX_P_LOG, message);
</ins><span class="cx">                         //}
</span><span class="cx"> 
</span><span class="cx">                         if (!strcasecmp(message, &quot;ERROR 68&quot;)) {
</span><span class="lines">@@ -116,44 +120,47 @@
</span><span class="cx">                                         tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><del>-                                /*
-                        if (!strncasecmp(message, &quot;ERROR 96 CALL&quot;, 12) ) {
-                                ERRORA(&quot;Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. We abort this attenpt and leave the previous one to continue.\n&quot;, SKYPIAX_P_LOG, message);
-                                tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FINISHED;
-                                DEBUGA_SKYPE(&quot;skype_call now is DOWN\n&quot;, SKYPIAX_P_LOG);
-                                tech_pvt-&gt;skype_call_id[0] = '\0';
</del><ins>+                        /*
+                           if (!strncasecmp(message, &quot;ERROR 96 CALL&quot;, 12) ) {
+                           ERRORA(&quot;Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. We abort this attenpt and leave the previous one to continue.\n&quot;, SKYPIAX_P_LOG, message);
+                           tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FINISHED;
+                           DEBUGA_SKYPE(&quot;skype_call now is DOWN\n&quot;, SKYPIAX_P_LOG);
+                           tech_pvt-&gt;skype_call_id[0] = '\0';
</ins><span class="cx"> 
</span><del>-                                if (tech_pvt-&gt;interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
-                                        tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
-                                        return CALLFLOW_INCOMING_HANGUP;
-                                } else {
-                                        tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
-                                }
-                        }
-                                */
</del><ins>+                           if (tech_pvt-&gt;interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+                           tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
+                           return CALLFLOW_INCOMING_HANGUP;
+                           } else {
+                           tech_pvt-&gt;interface_state = SKYPIAX_STATE_DOWN;
+                           }
+                           }
+                         */
</ins><span class="cx">                         /*
</span><del>-                        if (!strncasecmp(message, &quot;ERROR 99 CALL&quot;, 12) ) {
-                                //TODO: let's kill the call
-                                ERRORA(&quot;Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n&quot;, SKYPIAX_P_LOG, message);
-                                //tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FINISHED;
-                                //DEBUGA_SKYPE(&quot;skype_call now is DOWN\n&quot;, SKYPIAX_P_LOG);
-                                //tech_pvt-&gt;skype_call_id[0] = '\0';
</del><ins>+                           if (!strncasecmp(message, &quot;ERROR 99 CALL&quot;, 12) ) {
+                           //TODO: let's kill the call
+                           ERRORA(&quot;Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n&quot;, SKYPIAX_P_LOG, message);
+                           //tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FINISHED;
+                           //DEBUGA_SKYPE(&quot;skype_call now is DOWN\n&quot;, SKYPIAX_P_LOG);
+                           //tech_pvt-&gt;skype_call_id[0] = '\0';
</ins><span class="cx"> 
</span><del>-                                        tech_pvt-&gt;interface_state = SKYPIAX_STATE_ERROR_DOUBLE_CALL;
-                        }
-                        */
</del><ins>+                           tech_pvt-&gt;interface_state = SKYPIAX_STATE_ERROR_DOUBLE_CALL;
+                           }
+                         */
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">                         if (!strncasecmp(message, &quot;ERROR&quot;, 4)) {
</span><del>-                                if (!strncasecmp(message, &quot;ERROR 96 CALL&quot;, 12) ) {
-                                        DEBUGA_SKYPE(&quot;Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. Let's the previous one to continue.\n&quot;, SKYPIAX_P_LOG, message);
-                                } else if (!strncasecmp(message, &quot;ERROR 99 CALL&quot;, 12) ) {
</del><ins>+                                if (!strncasecmp(message, &quot;ERROR 96 CALL&quot;, 12)) {
+                                        DEBUGA_SKYPE
+                                                (&quot;Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. Let's the previous one to continue.\n&quot;,
+                                                 SKYPIAX_P_LOG, message);
+                                } else if (!strncasecmp(message, &quot;ERROR 99 CALL&quot;, 12)) {
</ins><span class="cx">                                         ERRORA(&quot;Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n&quot;, SKYPIAX_P_LOG, message);
</span><span class="cx">                                         tech_pvt-&gt;interface_state = SKYPIAX_STATE_ERROR_DOUBLE_CALL;
</span><span class="cx">                                 } else if (!strncasecmp(message, &quot;ERROR 592 ALTER CALL&quot;, 19)) {
</span><span class="cx">                                         ERRORA(&quot;Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n&quot;, SKYPIAX_P_LOG, message);
</span><span class="cx">                                 } else if (!strncasecmp(message, &quot;ERROR 559 CALL&quot;, 13)) {
</span><del>-                                        DEBUGA_SKYPE(&quot;Skype got ERROR about a failed action (probably TRYING to HANGUP A CALL), no problem: |||%s|||\n&quot;, SKYPIAX_P_LOG, message);
</del><ins>+                                        DEBUGA_SKYPE(&quot;Skype got ERROR about a failed action (probably TRYING to HANGUP A CALL), no problem: |||%s|||\n&quot;, SKYPIAX_P_LOG,
+                                                                 message);
</ins><span class="cx">                                 } else {
</span><span class="cx">                                         ERRORA(&quot;Skype got ERROR: |||%s|||\n&quot;, SKYPIAX_P_LOG, message);
</span><span class="cx">                                         tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_FINISHED;
</span><span class="lines">@@ -252,7 +259,7 @@
</span><span class="cx"> 
</span><span class="cx">                                 if (!strcasecmp(prop, &quot;PARTNER_HANDLE&quot;)) {
</span><span class="cx">                                         if (!strlen(tech_pvt-&gt;skype_call_id) || !strlen(tech_pvt-&gt;session_uuid_str)) {
</span><del>-                                        //if (!strlen(tech_pvt-&gt;skype_call_id)) {
</del><ins>+                                                //if (!strlen(tech_pvt-&gt;skype_call_id)) {
</ins><span class="cx">                                                 /* we are NOT inside an active call */
</span><span class="cx">                                                 DEBUGA_SKYPE(&quot;Call %s TRY ANSWER\n&quot;, SKYPIAX_P_LOG, id);
</span><span class="cx">                                                 skypiax_answer(tech_pvt, id, value);
</span><span class="lines">@@ -312,10 +319,11 @@
</span><span class="cx"> 
</span><span class="cx">                                         if (!strcasecmp(value, &quot;RINGING&quot;)) {
</span><span class="cx">                                                 char msg_to_skype[1024];
</span><del>-                                                if ( (tech_pvt-&gt;interface_state != SKYPIAX_STATE_SELECTED &amp;&amp; tech_pvt-&gt;interface_state != SKYPIAX_STATE_DIALING ) &amp;&amp; (!strlen(tech_pvt-&gt;skype_call_id) || !strlen(tech_pvt-&gt;session_uuid_str)) ) {
</del><ins>+                                                if ((tech_pvt-&gt;interface_state != SKYPIAX_STATE_SELECTED &amp;&amp; tech_pvt-&gt;interface_state != SKYPIAX_STATE_DIALING)
+                                                        &amp;&amp; (!strlen(tech_pvt-&gt;skype_call_id) || !strlen(tech_pvt-&gt;session_uuid_str))) {
</ins><span class="cx">                                                         /* we are NOT inside an active call */
</span><span class="cx"> 
</span><del>-                                                                DEBUGA_SKYPE(&quot;NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_HANDLE\n&quot;, SKYPIAX_P_LOG, id);
</del><ins>+                                                        DEBUGA_SKYPE(&quot;NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_HANDLE\n&quot;, SKYPIAX_P_LOG, id);
</ins><span class="cx">                                                         sprintf(msg_to_skype, &quot;GET CALL %s PARTNER_HANDLE&quot;, id);
</span><span class="cx">                                                         skypiax_signaling_write(tech_pvt, msg_to_skype);
</span><span class="cx">                                                         skypiax_sleep(10000);
</span><span class="lines">@@ -329,7 +337,9 @@
</span><span class="cx">                                                                 DEBUGA_SKYPE(&quot;Our remote party in skype_call %s is RINGING\n&quot;, SKYPIAX_P_LOG, id);
</span><span class="cx">                                                                 remote_party_is_ringing(tech_pvt);
</span><span class="cx">                                                         } else {
</span><del>-                                                                DEBUGA_SKYPE(&quot;We are in another call, but skype_call %s is RINGING on us, let's ask PARTNER_HANDLE, so maybe we'll TRANSFER\n&quot;, SKYPIAX_P_LOG, id);
</del><ins>+                                                                DEBUGA_SKYPE
+                                                                        (&quot;We are in another call, but skype_call %s is RINGING on us, let's ask PARTNER_HANDLE, so maybe we'll TRANSFER\n&quot;,
+                                                                         SKYPIAX_P_LOG, id);
</ins><span class="cx">                                                                 sprintf(msg_to_skype, &quot;GET CALL %s PARTNER_HANDLE&quot;, id);
</span><span class="cx">                                                                 skypiax_signaling_write(tech_pvt, msg_to_skype);
</span><span class="cx">                                                                 skypiax_sleep(10000);
</span><span class="lines">@@ -340,7 +350,7 @@
</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><span class="cx">                                                 DEBUGA_SKYPE(&quot;Our remote party in skype_call %s is EARLYMEDIA\n&quot;, SKYPIAX_P_LOG, id);
</span><del>-                                                if (start_audio_threads(tech_pvt)){
</del><ins>+                                                if (start_audio_threads(tech_pvt)) {
</ins><span class="cx">                                                         ERRORA(&quot;start_audio_threads FAILED\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                                                         return CALLFLOW_INCOMING_HANGUP;
</span><span class="cx">                                                 }
</span><span class="lines">@@ -430,10 +440,10 @@
</span><span class="cx">                                                                         tech_pvt-&gt;skype_callflow = CALLFLOW_STATUS_INPROGRESS;
</span><span class="cx">                                                                         tech_pvt-&gt;interface_state = SKYPIAX_STATE_UP;
</span><span class="cx"> 
</span><del>-                                                if (start_audio_threads(tech_pvt)){
-                                                        ERRORA(&quot;start_audio_threads FAILED\n&quot;, SKYPIAX_P_LOG);
-                                                        return CALLFLOW_INCOMING_HANGUP;
-                                                }
</del><ins>+                                                                        if (start_audio_threads(tech_pvt)) {
+                                                                                ERRORA(&quot;start_audio_threads FAILED\n&quot;, SKYPIAX_P_LOG);
+                                                                                return CALLFLOW_INCOMING_HANGUP;
+                                                                        }
</ins><span class="cx">                                                                         skypiax_sleep(1000);        //FIXME
</span><span class="cx">                                                                         sprintf(msg_to_skype, &quot;ALTER CALL %s SET_INPUT PORT=\&quot;%d\&quot;&quot;, id, tech_pvt-&gt;tcp_cli_port);
</span><span class="cx">                                                                         skypiax_signaling_write(tech_pvt, msg_to_skype);
</span><span class="lines">@@ -553,8 +563,7 @@
</span><span class="cx"> #endif //NOTDEF
</span><span class="cx"> 
</span><span class="cx">         s = skypiax_socket_create_and_bind(tech_pvt, &amp;tech_pvt-&gt;tcp_srv_port);
</span><del>-        if(s &lt; 0)
-        {
</del><ins>+        if (s &lt; 0) {
</ins><span class="cx">                 ERRORA(&quot;skypiax_socket_create_and_bind error!\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return NULL;
</span><span class="cx">         }
</span><span class="lines">@@ -744,12 +753,10 @@
</span><span class="cx">                 tech_pvt-&gt;tcp_cli_thread = NULL;
</span><span class="cx">                 return NULL;
</span><span class="cx">         }
</span><del>-
</del><span class="cx"> #endif // NOTDEF
</span><span class="cx"> 
</span><span class="cx">         s = skypiax_socket_create_and_bind(tech_pvt, &amp;tech_pvt-&gt;tcp_cli_port);
</span><del>-        if(s &lt; 0)
-        {
</del><ins>+        if (s &lt; 0) {
</ins><span class="cx">                 ERRORA(&quot;skypiax_socket_create_and_bind error!\n&quot;, SKYPIAX_P_LOG);
</span><span class="cx">                 return NULL;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>