]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
revert
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 15 Jun 2011 15:29:07 +0000 (10:29 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 15 Jun 2011 15:29:07 +0000 (10:29 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_ivr_originate.c

index 8558aeee1d177a105c02f5565ca291a41ace58e2..86fa14004653e2a8f2284b19e48c30391fa9a5e5 100644 (file)
@@ -575,9 +575,31 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
        const char *val;
        const char *b_sdp = NULL;
        int is_proxy = 0;
+       int is_3pcc = 0;
        char *sticky = NULL;
        const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full");
 
+
+       if(sofia_test_flag(tech_pvt, TFLAG_3PCC_INVITE)) {
+               // SNARK: complete hack to get final ack sent when a 3pcc invite has been passed from the other leg in bypass_media mode.
+               // This code handles the pass_indication sent after the 3pcc ack is received by the other leg in the is_3pcc && is_proxy case below.
+               // Is there a better place to hang this...?
+               b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
+               sofia_glue_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY nomedia - sending ack\n");
+               nua_ack(tech_pvt->nh,
+                       TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+                       SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+                       SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+                       SOATAG_REUSE_REJECTED(1),
+                       SOATAG_RTP_SELECT(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+                       TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
+                       TAG_END());
+               sofia_clear_flag(tech_pvt, TFLAG_3PCC_INVITE); // all done
+               return SWITCH_STATUS_SUCCESS;
+       }
+
        if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
                return SWITCH_STATUS_SUCCESS;
        }
@@ -585,8 +607,9 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
 
        b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
        is_proxy = (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA));
+       is_3pcc = (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC));
 
-       if (b_sdp && is_proxy) {
+       if (b_sdp && is_proxy && !is_3pcc) {
                sofia_glue_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
 
                if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
@@ -597,23 +620,35 @@ 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)) {
+               if (is_3pcc) {
 
+                       if(!is_proxy) {
                        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);
+                       } else {
+                               sofia_glue_tech_set_local_sdp(tech_pvt, b_sdp, SWITCH_TRUE);
+
+                               if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+                                       sofia_glue_tech_patch_sdp(tech_pvt);
+                                       if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+                                               return SWITCH_STATUS_FALSE;
+                                       }
+                               }
+                       }
 
                        /* Send the 200 OK */
                        if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
                                char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
                                if (sofia_use_soa(tech_pvt)) {
                                        nua_respond(tech_pvt->nh, SIP_200_OK,
+                                                               TAG_IF(is_proxy, NUTAG_AUTOANSWER(0)),
                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
                                                                TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
-                                                               SOATAG_REUSE_REJECTED(1),
+                                                               SOATAG_REUSE_REJECTED(1), TAG_IF(is_proxy, SOATAG_RTP_SELECT(1)),
                                                                SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
                                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
                                                                TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
@@ -645,6 +680,14 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                        /*  Regain lock on sofia */
                        switch_mutex_lock(tech_pvt->sofia_mutex);
 
+                       if(is_proxy) {
+                               sofia_clear_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
+                               sofia_clear_flag(tech_pvt, TFLAG_3PCC);
+                               // This sends the message to the other leg that causes it to call the TFLAG_3PCC_INVITE code at the start of this function.
+                               // Is there another message it would be better to hang this on though?
+                               switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_ANSWER);
+                       }
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
                        return SWITCH_STATUS_SUCCESS;
                }
@@ -1691,6 +1734,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                          switch_channel_get_name(channel), msg->string_arg);
                        sofia_glue_tech_set_local_sdp(tech_pvt, msg->string_arg, SWITCH_TRUE);
 
+                       if(zstr(tech_pvt->local_sdp_str)) {
+                               sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE);
+                       }
+
                        sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
                        switch_channel_set_flag(channel, CF_REQ_MEDIA);
                        sofia_glue_do_invite(session);
@@ -2189,6 +2236,23 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                                SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
                                                                                TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
                                                }
+                                               if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
+                                                       /* Unlock the session signal to allow the ack to make it in */
+                                                       // Maybe we should timeout?
+                                                       switch_mutex_unlock(tech_pvt->sofia_mutex);
+
+                                                       while (switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
+                                                               switch_cond_next();
+                                                       }
+
+                                                       /*  Regain lock on sofia */
+                                                       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");
+                                                       sofia_clear_flag(tech_pvt, TFLAG_3PCC);
+                                                       sofia_clear_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
+                                                       switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_ANSWER);
+                                               }
                                        } else {
                                                nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                                        TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
@@ -4397,6 +4461,14 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                        } else {
                                sofia_clear_flag(ctech_pvt, TFLAG_ENABLE_SOA);
                        }
+
+                       /* SNARK: lets copy this across so we can see if we're the other leg of 3PCC + bypass_media... */
+                       if (sofia_test_flag(ctech_pvt, TFLAG_3PCC) && (switch_channel_test_flag(o_channel, CF_PROXY_MODE) || switch_channel_test_flag(o_channel, CF_PROXY_MEDIA))) {
+                               sofia_set_flag(tech_pvt, TFLAG_3PCC_INVITE);
+                               sofia_set_flag(tech_pvt, TFLAG_LATE_NEGOTIATION);
+                       } else {
+                               sofia_clear_flag(tech_pvt, TFLAG_3PCC_INVITE);
+                       }
                }
 
                if (switch_channel_test_flag(o_channel, CF_PROXY_MEDIA)) {
@@ -4817,8 +4889,6 @@ static void general_event_handler(switch_event_t *event)
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EVENT_TRAP: IP change detected\n");
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IP change detected [%s]->[%s] [%s]->[%s]\n", old_ip4, new_ip4, old_ip6, new_ip6);
 
-                               strncpy(mod_sofia_globals.guess_ip, new_ip4, sizeof(mod_sofia_globals.guess_ip));
-
                                switch_mutex_lock(mod_sofia_globals.hash_mutex);
                                if (mod_sofia_globals.profile_hash) {
                                        for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
index 12ca7bd01d59b3bbd040270ecd159ee7a3b782ed..5b130850b2d98cc8de17cf7ba5d4aebe61185d62 100644 (file)
@@ -4547,7 +4547,9 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
                                                }
                                        }
 
-                                       switch_core_session_queue_message(other_session, msg);
+                                       /* SNARK: message to respond to reinvite wasn't being delivered in 3pcc+bypass media case. */
+                                       //switch_core_session_queue_message(other_session, msg);
+                                       switch_core_session_receive_message(other_session, msg);
 
                                        switch_core_session_rwunlock(other_session);
                                }
@@ -4721,7 +4723,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
        const char *uuid;
        switch_core_session_t *other_session = NULL;
        switch_channel_t *other_channel = NULL;
-       //private_object_t *other_tech_pvt = NULL;
+       private_object_t *other_tech_pvt = NULL;
        char st[80] = "";
        int is_dup_sdp = 0;
        switch_event_t *s_event = NULL;
@@ -4928,7 +4930,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
                                        && (other_session = switch_core_session_locate(uuid))) {
                                        other_channel = switch_core_session_get_channel(other_session);
-                                       //other_tech_pvt = switch_core_session_get_private(other_session);
+                                       other_tech_pvt = switch_core_session_get_private(other_session);
 
                                        if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
                                                switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
@@ -5052,10 +5054,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
                                }
                        } else {
+                               if (sofia_test_pflag(profile, PFLAG_3PCC)) {
                                if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-                                       goto done;
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No SDP in INVITE and 3pcc=yes cannot work with bypass or proxy media, hanging up.\n");
+                                               switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "3PCC DISABLED");
+                                               switch_channel_hangup(channel, SWITCH_CAUSE_MANDATORY_IE_MISSING);
                                } else {
-                                       if (sofia_test_pflag(profile, PFLAG_3PCC)) {
                                                switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
                                                sofia_glue_tech_choose_port(tech_pvt, 0);
                                                sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
@@ -5074,8 +5078,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                                                SIPTAG_CONTACT_STR(tech_pvt->profile->url),
                                                                                SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
                                                }
+                                       }
                                        } else if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
                                                //3PCC proxy mode delays the 200 OK until the call is answered
+                                       // so can be made to work with bypass media as we have time to find out what the other end thinks codec offer should be...
                                                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);
@@ -5090,11 +5096,29 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        }
                                        goto done;
                                }
-                       }
 
                } else if (tech_pvt && sofia_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
-                       nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
                        sofia_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+                       if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+                               sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
+                               if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
+                                       && (other_session = switch_core_session_locate(uuid))) {
+                                       switch_core_session_message_t *msg;
+                                       msg = switch_core_session_alloc(other_session, sizeof(*msg));
+                                       msg->message_id = SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT;
+                                       msg->from = __FILE__;
+                                       msg->string_arg = NULL;
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing NOSDP to other leg.\n");
+                                       switch_core_session_queue_message(other_session, msg);
+                                       switch_core_session_rwunlock(other_session);
+                               } else {
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+                                                 "NOSDP Re-INVITE to a proxy mode channel that is not in a bridge.\n");
+                                       switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+                               }
+                               goto done;
+                       }
+                       nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
                        goto done;
                } else {
                        ss_state = nua_callstate_completed;
@@ -5106,12 +5130,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                break;
        case nua_callstate_completed:
                if (r_sdp) {
+                       const char *var;
                        uint8_t match = 0, is_ok = 1, is_t38 = 0;
                        tech_pvt->hold_laps = 0;
 
-                       if (r_sdp) {
-                               const char *var;
-
                                if ((var = switch_channel_get_variable(channel, "sip_ignore_reinvites")) && switch_true(var)) {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Ignoring Re-invite\n");
                                        nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
@@ -5273,7 +5295,6 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
                                }
                        }
-               }
                break;
        case nua_callstate_ready:
                if (r_sdp && !is_dup_sdp && switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -5306,10 +5327,34 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                }
 
                if (r_sdp && sofia_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
+                       sofia_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+                       if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+                               if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
+                                       if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+                                               goto done;
+                                       }
+                               }
+
+                               if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
+                                       && (other_session = switch_core_session_locate(uuid))) {
+                                       other_channel = switch_core_session_get_channel(other_session);
+                                       if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
+                                               switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
+                                       }
+                                               
+                                       if (sofia_test_flag(tech_pvt, TFLAG_3PCC) && sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
+                                               sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
+                                       } else {
+                                               switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER);
+                                       }
+
+                                       switch_core_session_rwunlock(other_session);
+                               }
+                       } else {
                        uint8_t match = 0;
                        int is_ok = 1;
 
-                       sofia_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
 
                        if (tech_pvt->num_codecs) {
                                match = sofia_glue_negotiate_sdp(session, r_sdp);
@@ -5332,7 +5377,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
                                switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
                        }
-
+                       }
                        goto done;
                }
 
@@ -5399,6 +5444,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 
                                                switch_core_session_rwunlock(other_session);
                                        }
+
+                                       if (sofia_test_flag(tech_pvt, TFLAG_3PCC) && sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
+                                               sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
+                                       }
+
                                        goto done;
                                } else {
                                        uint8_t match = 0;
index 2ab0e723b0dab64e94ac4e0b3538a32d931350e8..dba65d2aacce8fb4afd4dd60db3acf2572baae93 100644 (file)
@@ -2396,6 +2396,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
        if (sofia_use_soa(tech_pvt)) {
                nua_invite(tech_pvt->nh,
                                   NUTAG_AUTOANSWER(0),
+                                  NUTAG_AUTOACK(0),
                                   NUTAG_SESSION_TIMER(session_timeout),
                                   NUTAG_SESSION_REFRESHER(session_timeout ? nua_local_refresher : nua_no_refresher),
                                   TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)),
@@ -2417,15 +2418,19 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                   TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)),
                                   TAG_IF(tech_pvt->profile->minimum_session_expires, NUTAG_MIN_SE(tech_pvt->profile->minimum_session_expires)),
                                   TAG_IF(cseq, SIPTAG_CSEQ(cseq)),
-                                  SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
-                                  SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-                                  SOATAG_REUSE_REJECTED(1),
-                                  SOATAG_ORDERED_USER(1),
-                                  SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE),
-                                  SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END());
+                                  TAG_IF(zstr(tech_pvt->local_sdp_str), SIPTAG_PAYLOAD_STR("")),
+                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip)),
+                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str)),
+                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_REUSE_REJECTED(1)),
+                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_ORDERED_USER(1)),
+                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE)),
+                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL)),
+                                  TAG_IF(rep, SIPTAG_REPLACES_STR(rep)),
+                                  TAG_IF(!zstr(tech_pvt->local_sdp_str), SOATAG_HOLD(holdstr)), TAG_END());
        } else {
                nua_invite(tech_pvt->nh,
                                   NUTAG_AUTOANSWER(0),
+                                  NUTAG_AUTOACK(0),
                                   NUTAG_SESSION_TIMER(session_timeout),
                                   TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)),
                                   TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)),
index 2329780a8b16f253c44a386fdbbf69f40bc23739..872c11cf64c2d38930152454818537bdcb35c17f 100644 (file)
@@ -2934,7 +2934,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                oglobals.idx = IDX_CANCEL;
                        }
 
-                       if (oglobals.session && (ringback_data || !(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
+                       if (oglobals.session && (ringback_data || !(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) ||
                                                                                                                switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)))) {
                                switch_core_session_reset(oglobals.session, SWITCH_FALSE, SWITCH_TRUE);
                        }