]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6889 #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 3 Oct 2014 16:34:37 +0000 (11:34 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 3 Oct 2014 16:34:42 +0000 (11:34 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c

index aff86a63319af462ba9aa911e1be1b4fd464ae5d..ae31d3a34c4382d9c7493eb96ea092566247bd61 100644 (file)
@@ -1419,14 +1419,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
        case SWITCH_MESSAGE_INDICATE_MEDIA:
                {
                        uint32_t send_invite = 1;
+                       const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 
                        switch_channel_clear_flag(channel, CF_PROXY_MODE);
                        switch_core_media_set_local_sdp(session, NULL, SWITCH_FALSE);
 
                        if (!(switch_channel_test_flag(channel, CF_ANSWERED) || switch_channel_test_flag(channel, CF_EARLY_MEDIA))) {
                                if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
-                                       const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
-
 
                                        switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
                                        if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
@@ -1439,7 +1438,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        }
 
                        if (!switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
-                               switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
+                               switch_core_media_set_sdp_codec_string(tech_pvt->session, r_sdp, SDP_TYPE_RESPONSE);
+                               switch_channel_set_variable(tech_pvt->channel, "absolute_codec_string", switch_channel_get_variable(tech_pvt->channel, "ep_codec_string"));
+                               switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
+
                                if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
                                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                                        goto end_lock;
index ee03f235cea4bc33fdc54e350a5da8ce66de8b08..ba8143de4fe689032463eafa908b52b30e5ddd90 100644 (file)
@@ -792,6 +792,7 @@ struct private_object {
        char *respond_dest;
        time_t last_vid_info;
        uint32_t keepalive;
+       uint32_t sent_invites;
 };
 
 
index 99caba5c2e002d6b97c508fba1f659c888a5a222..3a9fdf800f4e9c1f3ac9b863399a27ade660b36f 100644 (file)
@@ -735,8 +735,12 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
 
        cid_name = caller_profile->caller_id_name;
        cid_num = caller_profile->caller_id_number;
-       switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
-       switch_core_media_check_video_codecs(tech_pvt->session);
+
+       if (!tech_pvt->sent_invites && !switch_channel_test_flag(channel, CF_ANSWERED)) {
+               switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
+               switch_core_media_check_video_codecs(tech_pvt->session);
+       }
+
        check_decode(cid_name, session);
        check_decode(cid_num, session);
 
@@ -1229,6 +1233,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                                          switch_channel_get_name(tech_pvt->channel), switch_version_full_human(), 
                                          tech_pvt->mparams.local_sdp_str ? tech_pvt->mparams.local_sdp_str : "NO SDP PRESENT\n");
 
+       tech_pvt->sent_invites++;
 
        if (sofia_use_soa(tech_pvt)) {
                nua_invite(tech_pvt->nh,