diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 395285eb4..a640f4814 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -984,7 +984,7 @@ const char *sal_get_supported_tags(Sal *ctx){ } void sal_add_supported_tag(Sal *ctx, const char* tag){ - MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,NULL); + MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag); if (!elem){ ctx->supported_tags=ms_list_append(ctx->supported_tags,ms_strdup(tag)); make_supported_header(ctx); @@ -993,7 +993,7 @@ void sal_add_supported_tag(Sal *ctx, const char* tag){ } void sal_remove_supported_tag(Sal *ctx, const char* tag){ - MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,NULL); + MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag); if (elem){ ms_free(elem->data); ctx->supported_tags=ms_list_remove_link(ctx->supported_tags,elem); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index beda9f6ba..47d5ca347 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -3066,3 +3066,10 @@ LinphonePlayer *linphone_call_get_player(LinphoneCall *call){ call->player=linphone_call_build_player(call); return call->player; } + +void linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params){ + LinphoneCallParams *cp=NULL; + if (params) cp=linphone_call_params_copy(params); + if (call->params) linphone_call_params_unref(call->params); + call->params=cp; +} diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6398117c8..e43135e3d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2820,7 +2820,7 @@ int linphone_core_accept_early_media_with_params(LinphoneCore* lc, LinphoneCall* // if parameters are passed, update the media description if ( params ) { - call->params = linphone_call_params_copy(params); + linphone_call_set_new_params(call,params); linphone_call_make_local_media_description ( lc,call ); sal_call_set_local_media_description ( call->op,call->localdesc ); sal_op_set_sent_custom_header ( call->op,params->custom_headers ); @@ -2926,8 +2926,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho } #endif /* defined(VIDEO_ENABLED) && defined(BUILD_UPNP) */ - - call->params = linphone_call_params_copy(params); + linphone_call_set_new_params(call,params); err=linphone_call_prepare_ice(call,FALSE); if (err==1) { ms_message("Defer call update to gather ICE candidates"); @@ -3057,7 +3056,7 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons if (params==NULL){ call->params->has_video=lc->video_policy.automatically_accept || call->current_params->has_video; }else - call->params = linphone_call_params_copy(params); + linphone_call_set_new_params(call,params); if (call->params->has_video && !linphone_core_video_enabled(lc)){ ms_warning("linphone_core_accept_call_update(): requested video but video support is globally disabled. Refusing video."); @@ -3172,7 +3171,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, linphone_call_set_contact_op(call); if (params){ const SalMediaDescription *md = sal_call_get_remote_media_description(call->op); - call->params = linphone_call_params_copy(params); + linphone_call_set_new_params(call,params); // There might not be a md if the INVITE was lacking an SDP // In this case we use the parameters as is. if (md) { diff --git a/coreapi/private.h b/coreapi/private.h index 89ff1f7a3..7d1fc0770 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -261,6 +261,7 @@ BELLE_SIP_DECLARE_VPTR(LinphoneCall); LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg); LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op); +void linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params); void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message); void linphone_call_set_contact_op(LinphoneCall* call); void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, const SalMediaDescription *md); diff --git a/tester/call_tester.c b/tester/call_tester.c index c8de2ee80..effc17844 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -2925,6 +2925,7 @@ static void call_with_in_dialog_update(void) { params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc)); params->no_user_consent=TRUE; linphone_core_update_call(marie->lc,linphone_core_get_current_call(marie->lc),params); + linphone_call_params_destroy(params); CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1)); CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1));