]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak for 3pcc proxy
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 26 Oct 2009 17:03:05 +0000 (17:03 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 26 Oct 2009 17:03:05 +0000 (17:03 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15228 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c

index 890ac9ba44dbbe48ba48d1ee08b378a694729014..cbf6830a385737866a908db307ca9f01c65982b4 100644 (file)
@@ -480,6 +480,13 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
        } else {
                /* This if statement check and handles the 3pcc proxy mode */
                if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
+
+                       tech_pvt->num_codecs = 0;
+                       sofia_glue_tech_prepare_codecs(tech_pvt);
+                       tech_pvt->local_sdp_str = NULL;
+                       sofia_glue_tech_choose_port(tech_pvt, 0);
+                       sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+                       
                        /* Send the 200 OK */
                        if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
                                char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
@@ -508,6 +515,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                        switch_mutex_lock(tech_pvt->sofia_mutex);
                        
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
+                       return SWITCH_STATUS_SUCCESS;
                }
 
                if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
@@ -1544,6 +1552,15 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                }
                break;
        case SWITCH_MESSAGE_INDICATE_RINGING:
+
+               if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
+                       switch_channel_mark_ring_ready(channel);
+                       status = SWITCH_STATUS_SUCCESS;
+                       switch_log_printf(SWITCH_CHANNEL_ID_LOG, msg->_file, msg->_func, msg->_line, NULL, SWITCH_LOG_INFO, 
+                                                         "Pretending to send ringing.  Not available for 3pcc calls\n");
+                       goto end_lock;
+               }
+
                if (!switch_channel_test_flag(channel, CF_RING_READY) && !sofia_test_flag(tech_pvt, TFLAG_BYE) &&
                        !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
                        char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
@@ -1565,6 +1582,15 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        char *sticky = NULL;
                        const char *val = NULL;
 
+                       if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
+                               sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+                               switch_channel_mark_pre_answered(channel);
+                               status = SWITCH_STATUS_SUCCESS;
+                               switch_log_printf(SWITCH_CHANNEL_ID_LOG, msg->_file, msg->_func, msg->_line, NULL, SWITCH_LOG_INFO, 
+                                                                 "Pretending to send early media.  Not available for 3pcc calls\n");
+                               goto end_lock;
+                       }
+
                        if (!sofia_test_flag(tech_pvt, TFLAG_ANS) && !sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
 
                                sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
index c24d19a5a182f94c437d814f9ba19ee27b5376e7..65c2fcbc0a262bd8425a9b0185270a2c1e71e28e 100644 (file)
@@ -3801,8 +3801,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                //3PCC proxy mode delays the 200 OK until the call is answered
                                                switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
                                                sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
-                                               sofia_glue_tech_choose_port(tech_pvt, 0);
-                                               sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
+                                               //sofia_glue_tech_choose_port(tech_pvt, 0);
+                                               //sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
                                                switch_channel_set_flag(channel, TFLAG_LATE_NEGOTIATION);
                                                //Moves into CS_INIT so call moves forward into the dialplan
                                                switch_channel_set_state(channel, CS_INIT);