From a32d59ae3074339237896f8953eac5868eb364fa Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 19 Oct 2015 16:00:08 +0200 Subject: [PATCH] Add API to clear custom SDP attributes. --- coreapi/call_params.c | 8 ++++++++ coreapi/call_params.h | 15 +++++++++++++++ tester/call_tester.c | 8 ++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/coreapi/call_params.c b/coreapi/call_params.c index 63dc25cbf..bd53be849 100644 --- a/coreapi/call_params.c +++ b/coreapi/call_params.c @@ -119,6 +119,14 @@ void linphone_call_params_add_custom_sdp_media_attribute(LinphoneCallParams *par params->custom_sdp_media_attributes[type] = sal_custom_sdp_attribute_append(params->custom_sdp_media_attributes[type], attribute_name, attribute_value); } +void linphone_call_params_clear_custom_sdp_attributes(LinphoneCallParams *params) { + linphone_call_params_set_custom_sdp_attributes(params, NULL); +} + +void linphone_call_params_clear_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type) { + linphone_call_params_set_custom_sdp_media_attributes(params, type, NULL); +} + LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp){ unsigned int i; LinphoneCallParams *ncp=linphone_call_params_new(); diff --git a/coreapi/call_params.h b/coreapi/call_params.h index 6b55f7334..5e42e0950 100644 --- a/coreapi/call_params.h +++ b/coreapi/call_params.h @@ -426,6 +426,21 @@ LINPHONE_PUBLIC const char * linphone_call_params_get_custom_sdp_attribute(const **/ LINPHONE_PUBLIC const char * linphone_call_params_get_custom_sdp_media_attribute(const LinphoneCallParams *params, LinphoneStreamType type, const char *attribute_name); +/** + * Clear the custom SDP attributes related to all the streams in the SDP exchanged within SIP messages during a call. + * @param[in] params The #LinphoneCallParams to clear the custom SDP attributes from. + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC void linphone_call_params_clear_custom_sdp_attributes(LinphoneCallParams *params); + +/** + * Clear the custom SDP attributes related to a specific stream in the SDP exchanged within SIP messages during a call. + * @param[in] params The #LinphoneCallParams to clear the custom SDP attributes from. + * @param[in] type The type of the stream to clear the custom SDP attributes from. + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC void linphone_call_params_clear_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type); + /******************************************************************************* * DEPRECATED * diff --git a/tester/call_tester.c b/tester/call_tester.c index b31cc69bc..531b260ef 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -1234,8 +1234,8 @@ static void call_with_custom_sdp_attributes_cb(LinphoneCore *lc, LinphoneCall *c BC_ASSERT_PTR_NOT_NULL(value); if (value) BC_ASSERT_STRING_EQUAL(value, "sunny"); params = linphone_core_create_call_params(lc, call); - linphone_call_params_set_custom_sdp_attributes(params, NULL); - linphone_call_params_set_custom_sdp_media_attributes(params, LinphoneStreamTypeAudio, NULL); + linphone_call_params_clear_custom_sdp_attributes(params); + linphone_call_params_clear_custom_sdp_media_attributes(params, LinphoneStreamTypeAudio); linphone_call_params_add_custom_sdp_attribute(params, "working", "no"); BC_ASSERT_EQUAL(linphone_core_accept_call_update(lc, call, params), 0, int, "%i"); linphone_call_params_destroy(params); @@ -1276,8 +1276,8 @@ static void call_with_custom_sdp_attributes(void) { vtable->call_state_changed = call_with_custom_sdp_attributes_cb; linphone_core_add_listener(marie->lc, vtable); pauline_params = linphone_core_create_call_params(pauline->lc, call_pauline); - linphone_call_params_set_custom_sdp_attributes(pauline_params, NULL); - linphone_call_params_set_custom_sdp_media_attributes(pauline_params, LinphoneStreamTypeAudio, NULL); + linphone_call_params_clear_custom_sdp_attributes(pauline_params); + linphone_call_params_clear_custom_sdp_media_attributes(pauline_params, LinphoneStreamTypeAudio); linphone_call_params_add_custom_sdp_attribute(pauline_params, "weather", "sunny"); linphone_core_update_call(pauline->lc, call_pauline, pauline_params); BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneCallUpdatedByRemote, 1));