]> sjero.net Git - linphone/commitdiff
Do not update session version in SDP when remote send re-invite without updating it.
authorGhislain MARY <ghislain.mary@belledonne-communications.com>
Wed, 9 Jan 2013 15:57:41 +0000 (16:57 +0100)
committerGhislain MARY <ghislain.mary@belledonne-communications.com>
Thu, 10 Jan 2013 10:15:05 +0000 (11:15 +0100)
coreapi/callbacks.c
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/private.h
coreapi/sal_eXosip2_sdp.c

index 2f0d25b0d87f8e015cda7b1d84906c32428a6493..032218a2ef561ac320c6dd803b4e64a913729ecc 100644 (file)
@@ -345,6 +345,7 @@ static void call_accepted(SalOp *op){
                if (call->referer) linphone_core_notify_refer_state(lc,call->referer,call);
        }
        if (md && !sal_media_description_empty(md)){
+               linphone_call_update_remote_session_id_and_ver(call);
                if (sal_media_description_has_dir(md,SalStreamSendOnly) ||
                    sal_media_description_has_dir(md,SalStreamInactive)){
                        if (lc->vtable.display_status){
@@ -425,6 +426,7 @@ static void call_accept_update(LinphoneCore *lc, LinphoneCall *call){
                linphone_core_update_ice_from_remote_media_description(call,rmd);
                linphone_core_update_local_media_description_from_ice(call->localdesc,call->ice_session);
        }
+       linphone_call_update_remote_session_id_and_ver(call);
        sal_call_accept(call->op);
        md=sal_call_get_final_media_description(call->op);
        if (md && !sal_media_description_empty(md))
index 3bf93f78e8afd68d52d646da6dab448ebe1931f0..663e552a902e3234220b0ab71d5067058cfb9649 100644 (file)
@@ -1704,6 +1704,16 @@ void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescript
 #endif
 }
 
+void linphone_call_update_remote_session_id_and_ver(LinphoneCall *call) {
+       SalMediaDescription *remote_desc = sal_call_get_remote_media_description(call->op);
+       if (remote_desc) {
+               ms_warning("linphone_call_update_remote_session_id_and_ver(): id=%u, ver=%u",
+                               remote_desc->session_id, remote_desc->session_ver);
+               call->remote_session_id = remote_desc->session_id;
+               call->remote_session_ver = remote_desc->session_ver;
+       }
+}
+
 void linphone_call_delete_ice_session(LinphoneCall *call){
        if (call->ice_session != NULL) {
                ice_session_destroy(call->ice_session);
index c6fc735907ea7e087eee44d86456680eca728812..2336dbfe13118909288d0f870ea4eab3f9860130 100644 (file)
@@ -2722,6 +2722,7 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call)
                }
                linphone_core_update_local_media_description_from_ice(call->localdesc, call->ice_session);
        }
+       linphone_call_update_remote_session_id_and_ver(call);
        sal_call_set_local_media_description(call->op,call->localdesc);
        sal_call_accept(call->op);
        md=sal_call_get_final_media_description(call->op);
@@ -2751,6 +2752,7 @@ int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call)
  * @return 0 if sucessful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state).
 **/
 int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
+       SalMediaDescription *remote_desc;
 #ifdef VIDEO_ENABLED
        bool_t old_has_video = call->params.has_video;
 #endif
@@ -2759,6 +2761,16 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const
                         linphone_call_state_to_string(call->state));
                return -1;
        }
+       remote_desc = sal_call_get_remote_media_description(call->op);
+       ms_warning("linphone_core_accept_update(): rmt_id=%u, rmt_ver=%u, call->rmt_id=%u, call->rmt_ver=%u",
+                       remote_desc->session_id, remote_desc->session_ver, call->remote_session_id, call->remote_session_ver);
+       if ((remote_desc->session_id == call->remote_session_id) && (remote_desc->session_ver == call->remote_session_ver)) {
+               /* Remote has sent an INVITE with the same SDP as before, so send a 200 OK with the same SDP as before. */
+               ms_warning("Send same SDP as before!");
+               sal_call_accept(call->op);
+               linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
+               return 0;
+       }
        if (params==NULL){
                call->params.has_video=lc->video_policy.automatically_accept || call->current_params.has_video;
        }else
@@ -2772,11 +2784,11 @@ int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const
                ms_warning("Video isn't supported in conference");
                call->params.has_video = FALSE;
        }
-       call->params.has_video &= linphone_core_media_description_contains_video_stream(sal_call_get_remote_media_description(call->op));
+       call->params.has_video &= linphone_core_media_description_contains_video_stream(remote_desc);
        call->camera_active=call->params.has_video;
        linphone_call_make_local_media_description(lc,call);
        if (call->ice_session != NULL) {
-               linphone_core_update_ice_from_remote_media_description(call, sal_call_get_remote_media_description(call->op));
+               linphone_core_update_ice_from_remote_media_description(call, remote_desc);
 #ifdef VIDEO_ENABLED
                if ((call->ice_session != NULL) &&!ice_session_candidates_gathered(call->ice_session)) {
                        if ((call->params.has_video) && (call->params.has_video != old_has_video)) {
@@ -2903,6 +2915,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
                audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard);
        }
 
+       linphone_call_update_remote_session_id_and_ver(call);
        sal_call_accept(call->op);
        if (lc->vtable.display_status!=NULL)
                lc->vtable.display_status(lc,_("Connected."));
index c171fac883d9382a73cab429327787fbf4b2e8d4..93baf7e44ac73128fdc69d5caec65a8e8180abe5 100644 (file)
@@ -148,6 +148,8 @@ struct _LinphoneCall
        IceSession *ice_session;
        LinphoneChatMessage* pending_message;
        int ping_time;
+       unsigned int remote_session_id;
+       unsigned int remote_session_ver;
        bool_t refer_pending;
        bool_t media_pending;
        bool_t audio_muted;
@@ -286,6 +288,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call);
 void linphone_call_delete_ice_session(LinphoneCall *call);
 void linphone_call_stop_media_streams_for_ice_gathering(LinphoneCall *call);
 void linphone_call_update_crypto_parameters(LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md);
+void linphone_call_update_remote_session_id_and_ver(LinphoneCall *call);
 
 const char * linphone_core_get_identity(LinphoneCore *lc);
 const char * linphone_core_get_route(LinphoneCore *lc);
index 050a53a764dd6c58cddbdffeee1cbe3fc62fd245..4aad1486388839b9b8c9c6210981291d0501f6e1 100644 (file)
@@ -434,10 +434,17 @@ static int payload_type_fill_from_rtpmap(PayloadType *pt, const char *rtpmap){
 int sdp_to_media_description(sdp_message_t *msg, SalMediaDescription *desc){
        int i,j;
        const char *mtype,*proto,*rtp_port,*rtp_addr,*number;
+       const char *sess;
        sdp_bandwidth_t *sbw=NULL;
        sdp_attribute_t *attr;
        int nb_ice_candidates;
 
+       /* Get session information. */
+       sess = sdp_message_o_sess_id_get(msg);
+       if (sess) desc->session_id = strtoul(sess, NULL, 10);
+       sess = sdp_message_o_sess_version_get(msg);
+       if (sess) desc->session_ver = strtoul(sess, NULL, 10);
+
        rtp_addr=sdp_message_c_addr_get (msg, -1, 0);
        if (rtp_addr)
                strncpy(desc->addr,rtp_addr,sizeof(desc->addr));