diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 94d7f17d2..cc981d9a6 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -460,6 +460,8 @@ static void call_accept_update(LinphoneCore *lc, LinphoneCall *call){ } static void call_resumed(LinphoneCore *lc, LinphoneCall *call){ + /*when we are resumed, increment session id, because sdp is changed (a=recvonly disapears)*/ + linphone_call_increment_local_media_description(call); call_accept_update(lc,call); if(lc->vtable.display_status) lc->vtable.display_status(lc,_("We have been resumed.")); @@ -467,6 +469,8 @@ static void call_resumed(LinphoneCore *lc, LinphoneCall *call){ } static void call_paused_by_remote(LinphoneCore *lc, LinphoneCall *call){ + /*when we are resumed, increment session id, because sdp is changed (a=recvonly appears)*/ + linphone_call_increment_local_media_description(call); call_accept_update(lc,call); /* we are being paused */ if(lc->vtable.display_status) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 04023c386..3f473ce53 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -306,6 +306,11 @@ static void setup_rtcp_xr(LinphoneCall *call, SalMediaDescription *md) { } } +void linphone_call_increment_local_media_description(LinphoneCall *call){ + SalMediaDescription *md=call->localdesc; + md->session_ver++; +} + void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call){ MSList *l; PayloadType *pt; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a9e472388..95431b1f9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3153,23 +3153,28 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho #ifdef VIDEO_ENABLED bool_t has_video = FALSE; #endif + + if (call->state!=LinphoneCallStreamsRunning){ + ms_error("linphone_core_update_call() is not allowed in [%s] state",linphone_call_state_to_string(call->state)); + return -1; + } + if (params!=NULL){ linphone_call_set_state(call,LinphoneCallUpdating,"Updating call"); -#ifdef VIDEO_ENABLED +#if defined(VIDEO_ENABLED) && defined(BUILD_UPNP) has_video = call->params.has_video; // Video removing if((call->videostream != NULL) && !params->has_video) { -#ifdef BUILD_UPNP if(call->upnp_session != NULL) { if (linphone_core_update_upnp(lc, call)<0) { /* uPnP port mappings failed, proceed with the call anyway. */ linphone_call_delete_upnp_session(call); } } -#endif //BUILD_UPNP + } -#endif /* VIDEO_ENABLED */ +#endif /* defined(VIDEO_ENABLED) && defined(BUILD_UPNP) */ _linphone_call_params_copy(&call->params,params); err=linphone_call_prepare_ice(call,FALSE); @@ -3178,10 +3183,9 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho return 0; } -#ifdef VIDEO_ENABLED +#if defined(VIDEO_ENABLED) && defined(BUILD_UPNP) // Video adding if (!has_video && call->params.has_video) { -#ifdef BUILD_UPNP if(call->upnp_session != NULL) { ms_message("Defer call update to add uPnP port mappings"); video_stream_prepare_video(call->videostream); @@ -3192,9 +3196,8 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho return err; } } -#endif //BUILD_UPNP } -#endif //VIDEO_ENABLED +#endif //defined(VIDEO_ENABLED) && defined(BUILD_UPNP) err = linphone_core_start_update_call(lc, call); }else{ #ifdef VIDEO_ENABLED diff --git a/coreapi/private.h b/coreapi/private.h index a2fb3d9c2..5ebccdf35 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -742,6 +742,7 @@ int linphone_core_get_calls_nb(const LinphoneCore *lc); void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call); +void linphone_call_increment_local_media_description(LinphoneCall *call); void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md); bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, const PayloadType *pt, int bandwidth_limit);