diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 215f5d462..02f6d3763 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -686,15 +686,25 @@ int RemoteConference::addParticipant(LinphoneCall *call) { } int RemoteConference::removeParticipant(const LinphoneAddress *uri) { - char *tmp, *refer_to; + char *refer_to; + LinphoneAddress *refer_to_addr; int res; switch(m_state) { case LinphoneConferenceReady: - tmp = linphone_address_as_string_uri_only(uri); - refer_to = ms_strdup_printf("%s;method=BYE", tmp); + if(findParticipant(uri) == NULL) { + char *tmp = linphone_address_as_string(uri); + ms_error("Conference: could not remove participant '%s': not in the participants list", tmp); + ms_free(tmp); + return -1; + } + +// refer_to = ms_strdup_printf("%s;method=BYE", tmp); + refer_to_addr = linphone_address_clone(uri); + linphone_address_set_method_param(refer_to_addr, "BYE"); + refer_to = linphone_address_as_string(refer_to_addr); + linphone_address_unref(refer_to_addr); res = sal_call_refer(m_focusCall->op, refer_to); - ms_free(tmp); ms_free(refer_to); if(res == 0) { diff --git a/coreapi/conference.h b/coreapi/conference.h index cc9762bf1..d14ff2f9d 100644 --- a/coreapi/conference.h +++ b/coreapi/conference.h @@ -86,6 +86,7 @@ LINPHONE_PUBLIC bool_t linphone_conference_params_video_requested(const Linphone * Remove a participant from a conference * @param obj A #LinphoneConference * @param uri SIP URI of the participant to remove + * @warning The passed SIP URI must be one of the URIs returned by linphone_conference_get_participants() * @return 0 if succeeded, -1 if failed */ LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri);