<!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][17318] </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=17318">17318</a></dd>
<dt>Author</dt> <dd>math.parent</dd>
<dt>Date</dt> <dd>2010-04-16 04:59:58 -0500 (Fri, 16 Apr 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Skinny: initial transfer support

and some re-indentation</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skinnymod_skinnyc">freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skinnymod_skinnyh">freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolc">freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c</a></li>
<li><a href="#freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolh">freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodendpointsmod_skinnymod_skinnyc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c (17317 => 17318)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c        2010-04-16 04:29:38 UTC (rev 17317)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c        2010-04-16 09:59:58 UTC (rev 17318)
</span><span class="lines">@@ -542,9 +542,9 @@
</span><span class="cx">         tech_pvt-&gt;read_frame.buflen = sizeof(tech_pvt-&gt;databuf);
</span><span class="cx">         switch_mutex_init(&amp;tech_pvt-&gt;mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
</span><span class="cx">         switch_mutex_init(&amp;tech_pvt-&gt;flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
</span><ins>+        tech_pvt-&gt;profile = profile;
</ins><span class="cx">         tech_pvt-&gt;call_id = ++profile-&gt;next_call_id;
</span><span class="cx">         tech_pvt-&gt;party_id = tech_pvt-&gt;call_id;
</span><del>-        tech_pvt-&gt;profile = profile;
</del><span class="cx">         switch_core_session_set_private(session, tech_pvt);
</span><span class="cx">         tech_pvt-&gt;session = session;
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skinnymod_skinnyh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h (17317 => 17318)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h        2010-04-16 04:29:38 UTC (rev 17317)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.h        2010-04-16 09:59:58 UTC (rev 17318)
</span><span class="lines">@@ -147,36 +147,40 @@
</span><span class="cx"> } GFLAGS;
</span><span class="cx"> 
</span><span class="cx"> struct private_object {
</span><del>-    unsigned int flags;
-    switch_frame_t read_frame;
-    unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
-    switch_core_session_t *session;
-    switch_caller_profile_t *caller_profile;
-    switch_mutex_t *mutex;
-    switch_mutex_t *flag_mutex;
-    /* identification */
-    uint32_t call_id;
-    uint32_t party_id;
</del><ins>+        unsigned int flags;
+        switch_frame_t read_frame;
+        unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+        switch_core_session_t *session;
+        switch_caller_profile_t *caller_profile;
+        switch_mutex_t *mutex;
+        switch_mutex_t *flag_mutex;
</ins><span class="cx"> 
</span><del>-    skinny_profile_t *profile;
</del><ins>+        /* identification */
+        skinny_profile_t *profile;
+        uint32_t call_id;
+        uint32_t party_id;
</ins><span class="cx"> 
</span><del>-    /* codec */
-    char *iananame;        
-    switch_codec_t read_codec;
-    switch_codec_t write_codec;
-    switch_codec_implementation_t read_impl;
-    switch_codec_implementation_t write_impl;
-    unsigned long rm_rate;
-    uint32_t codec_ms;
-    char *rm_encoding;
-    char *rm_fmtp;
-    switch_payload_t agreed_pt;
-    /* RTP */
-    switch_rtp_t *rtp_session;
-    char *local_sdp_audio_ip;
-    switch_port_t local_sdp_audio_port;
-    char *remote_sdp_audio_ip;
-    switch_port_t remote_sdp_audio_port;
</del><ins>+        /* related calls */
+        uint32_t transfer_to_call_id;
+        uint32_t transfer_from_call_id;
+
+        /* codec */
+        char *iananame;        
+        switch_codec_t read_codec;
+        switch_codec_t write_codec;
+        switch_codec_implementation_t read_impl;
+        switch_codec_implementation_t write_impl;
+        unsigned long rm_rate;
+        uint32_t codec_ms;
+        char *rm_encoding;
+        char *rm_fmtp;
+        switch_payload_t agreed_pt;
+        /* RTP */
+        switch_rtp_t *rtp_session;
+        char *local_sdp_audio_ip;
+        switch_port_t local_sdp_audio_port;
+        char *remote_sdp_audio_ip;
+        switch_port_t remote_sdp_audio_port;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef struct private_object private_t;
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c (17317 => 17318)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c        2010-04-16 04:29:38 UTC (rev 17317)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c        2010-04-16 09:59:58 UTC (rev 17318)
</span><span class="lines">@@ -837,6 +837,47 @@
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+switch_status_t skinny_session_transfer(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
+{
+        switch_status_t status = SWITCH_STATUS_SUCCESS;
+        private_t *tech_pvt = NULL;
+        switch_channel_t *channel = NULL;
+        const char *uuid = NULL;
+        switch_core_session_t *session2 = NULL;
+        private_t *tech_pvt2 = NULL;
+
+        switch_assert(session);
+        switch_assert(listener);
+        switch_assert(listener-&gt;profile);
+        
+        tech_pvt = switch_core_session_get_private(session);
+        channel = switch_core_session_get_channel(session);
+        uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE);
+
+        if (tech_pvt-&gt;transfer_from_call_id) {
+                if((session2 = skinny_profile_find_session(listener-&gt;profile, listener, &amp;line_instance, 0))) {
+                        switch_channel_t *channel2 = switch_core_session_get_channel(session2);
+                        const char *uuid2 = switch_channel_get_variable(channel2, SWITCH_BRIDGE_VARIABLE);
+                        switch_ivr_uuid_bridge(uuid, uuid2);
+                        switch_core_session_rwunlock(session2);
+                        /* TODO: How to inform the user that the bridge is not possible? */
+                }
+        } else {
+                if(uuid) {
+                        /* TODO CallSelectStat */
+                        status = skinny_create_ingoing_session(listener, &amp;line_instance, &amp;session2);
+                        tech_pvt2 = switch_core_session_get_private(session2);
+                        tech_pvt2-&gt;transfer_from_call_id = tech_pvt-&gt;call_id;
+                        tech_pvt-&gt;transfer_to_call_id = tech_pvt2-&gt;call_id;
+                        skinny_session_process_dest(session2, listener, line_instance, NULL, '\0', 0);
+                        switch_core_session_rwunlock(session2);
+                } else {
+                        /* TODO: How to inform the user that the bridge is not possible? */
+                }
+        }
+        return status;
+}
+
</ins><span class="cx"> switch_status_t skinny_session_stop_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
</span><span class="cx"> {
</span><span class="cx">         switch_channel_t *channel = NULL;
</span><span class="lines">@@ -1990,6 +2031,7 @@
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[0] = SOFTKEY_ENDCALL;
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[1] = SOFTKEY_HOLD;
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[2] = SOFTKEY_NEWCALL;
</span><ins>+        message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[3] = SOFTKEY_TRANSFER;
</ins><span class="cx">         
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_RING_IN].soft_key_template_index[0] = SOFTKEY_ANSWER;
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_RING_IN].soft_key_template_index[1] = SOFTKEY_ENDCALL;
</span><span class="lines">@@ -1998,6 +2040,9 @@
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[0] = SOFTKEY_NEWCALL;
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[1] = SOFTKEY_RESUME;
</span><span class="cx">         message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[2] = SOFTKEY_ENDCALL;
</span><ins>+        
+        message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES].soft_key_template_index[1] = SOFTKEY_REDIAL;
+        message-&gt;data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES].soft_key_template_index[2] = SOFTKEY_ENDCALL;
</ins><span class="cx"> 
</span><span class="cx">         skinny_send_reply(listener, message);
</span><span class="cx"> 
</span><span class="lines">@@ -2146,6 +2191,13 @@
</span><span class="cx">                     status = skinny_session_hold_line(session, listener, line_instance);
</span><span class="cx">                 }
</span><span class="cx">                         break;
</span><ins>+                case SOFTKEY_TRANSFER:
+                        session = skinny_profile_find_session(listener-&gt;profile, listener, &amp;line_instance, request-&gt;data.soft_key_event.call_id);
+
+                        if(session) {
+                                status = skinny_session_transfer(session, listener, line_instance);
+                        }
+                        break;
</ins><span class="cx">                 case SOFTKEY_BACKSPACE:
</span><span class="cx">                 session = skinny_profile_find_session(listener-&gt;profile, listener, &amp;line_instance, request-&gt;data.soft_key_event.call_id);
</span><span class="cx"> 
</span><span class="lines">@@ -2341,19 +2393,17 @@
</span><span class="cx">                         0, /* uint32_t silence_suppression, */
</span><span class="cx">                         0, /* uint16_t max_frames_per_packet, */
</span><span class="cx">                         0 /* uint32_t g723_bitrate */
</span><del>-                );
-            if (switch_channel_get_state(channel) == CS_NEW) {
-                    switch_channel_set_state(channel, CS_INIT);
-            }
</del><ins>+                        );
+
+                if (switch_channel_get_state(channel) == CS_NEW) {
+                        switch_channel_set_state(channel, CS_INIT);
+                }
</ins><span class="cx">                 switch_channel_mark_answered(channel);
</span><del>-
</del><span class="cx">         }
</span><span class="cx"> end:
</span><del>-
</del><span class="cx">         if(session) {
</span><span class="cx">                 switch_core_session_rwunlock(session);
</span><span class="cx">         }
</span><del>-
</del><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2509,14 +2559,14 @@
</span><span class="cx">                         return skinny_handle_unregister(listener, request);
</span><span class="cx">                 case SOFT_KEY_TEMPLATE_REQ_MESSAGE:
</span><span class="cx">                         return skinny_handle_soft_key_template_request(listener, request);
</span><ins>+                case HEADSET_STATUS_MESSAGE:
+                        return skinny_headset_status_message(listener, request);
+                case REGISTER_AVAILABLE_LINES_MESSAGE:
+                        return skinny_handle_register_available_lines_message(listener, request);
</ins><span class="cx">                 case SERVICE_URL_STAT_REQ_MESSAGE:
</span><span class="cx">                         return skinny_handle_service_url_stat_request(listener, request);
</span><span class="cx">                 case FEATURE_STAT_REQ_MESSAGE:
</span><span class="cx">                         return skinny_handle_feature_stat_request(listener, request);
</span><del>-                case HEADSET_STATUS_MESSAGE:
-                        return skinny_headset_status_message(listener, request);
-                case REGISTER_AVAILABLE_LINES_MESSAGE:
-                        return skinny_handle_register_available_lines_message(listener, request);
</del><span class="cx">                 default:
</span><span class="cx">                         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
</span><span class="cx">                                 &quot;Unhandled request %s (type=%x,length=%d).\n&quot;, skinny_message_type2str(request-&gt;type), request-&gt;type, request-&gt;length);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodendpointsmod_skinnyskinny_protocolh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h (17317 => 17318)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h        2010-04-16 04:29:38 UTC (rev 17317)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h        2010-04-16 09:59:58 UTC (rev 17318)
</span><span class="lines">@@ -162,6 +162,18 @@
</span><span class="cx"> /* SoftKeyTemplateReqMessage */
</span><span class="cx"> #define SOFT_KEY_TEMPLATE_REQ_MESSAGE 0x0028
</span><span class="cx"> 
</span><ins>+/* HeadsetStatusMessage */
+#define HEADSET_STATUS_MESSAGE 0x002B
+struct headset_status_message {
+    uint32_t mode;
+};
+
+/* RegisterAvailableLinesMessage */
+#define REGISTER_AVAILABLE_LINES_MESSAGE 0x002D
+struct register_available_lines_message {
+    uint32_t count;
+};
+
</ins><span class="cx"> /* ServiceUrlStatReqMessage */
</span><span class="cx"> #define SERVICE_URL_STAT_REQ_MESSAGE 0x0033
</span><span class="cx"> struct service_url_stat_req_message {
</span><span class="lines">@@ -174,18 +186,6 @@
</span><span class="cx">     uint32_t feature_index;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* HeadsetStatusMessage */
-#define HEADSET_STATUS_MESSAGE 0x002B
-struct headset_status_message {
-    uint32_t mode;
-};
-
-/* RegisterAvailableLinesMessage */
-#define REGISTER_AVAILABLE_LINES_MESSAGE 0x002D
-struct register_available_lines_message {
-    uint32_t count;
-};
-
</del><span class="cx"> /* RegisterAckMessage */
</span><span class="cx"> #define REGISTER_ACK_MESSAGE 0x0081
</span><span class="cx"> struct register_ack_message {
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>