]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Skinny: correct transfer
authorMathieu Parent <math.parent@gmail.com>
Fri, 16 Apr 2010 15:59:48 +0000 (17:59 +0200)
committerMathieu Parent <math.parent@gmail.com>
Fri, 16 Apr 2010 16:01:19 +0000 (18:01 +0200)
src/mod/endpoints/mod_skinny/skinny_protocol.c

index 0c0396e7f61faf1036734207506c0a98aa8e1894..261ef98789e3dd3b908e0efcfbefcec8d99c3075 100644 (file)
@@ -842,7 +842,7 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        private_t *tech_pvt = NULL;
        switch_channel_t *channel = NULL;
-       const char *uuid = NULL;
+       const char *remote_uuid = NULL;
        switch_core_session_t *session2 = NULL;
        private_t *tech_pvt2 = NULL;
 
@@ -852,18 +852,22 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
        
        tech_pvt = switch_core_session_get_private(session);
        channel = switch_core_session_get_channel(session);
-       uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE);
+       remote_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
 
        if (tech_pvt->transfer_from_call_id) {
-               if((session2 = skinny_profile_find_session(listener->profile, listener, &line_instance, 0))) {
+               if((session2 = skinny_profile_find_session(listener->profile, listener, &line_instance, tech_pvt->transfer_from_call_id))) {
                        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);
+                       const char *remote_uuid2 = switch_channel_get_variable(channel2, SWITCH_SIGNAL_BOND_VARIABLE);
+                       if (switch_ivr_uuid_bridge(remote_uuid, remote_uuid2) == SWITCH_STATUS_SUCCESS) {
+                               switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+                               switch_channel_hangup(channel2, SWITCH_CAUSE_NORMAL_CLEARING);
+                       } else {
+                               /* TODO: How to inform the user that the bridge is not possible? */
+                       }
                        switch_core_session_rwunlock(session2);
-                       /* TODO: How to inform the user that the bridge is not possible? */
                }
        } else {
-               if(uuid) {
+               if(remote_uuid) {
                        /* TODO CallSelectStat */
                        status = skinny_create_ingoing_session(listener, &line_instance, &session2);
                        tech_pvt2 = switch_core_session_get_private(session2);