Commit 4b91e2b0 authored by François Grisez's avatar François Grisez
Browse files

Add a pre-condition to linphone_conference_remove_participant()

parent 30e504c2
...@@ -686,15 +686,25 @@ int RemoteConference::addParticipant(LinphoneCall *call) { ...@@ -686,15 +686,25 @@ int RemoteConference::addParticipant(LinphoneCall *call) {
} }
int RemoteConference::removeParticipant(const LinphoneAddress *uri) { int RemoteConference::removeParticipant(const LinphoneAddress *uri) {
char *tmp, *refer_to; char *refer_to;
LinphoneAddress *refer_to_addr;
int res; int res;
switch(m_state) { switch(m_state) {
case LinphoneConferenceReady: case LinphoneConferenceReady:
tmp = linphone_address_as_string_uri_only(uri); if(findParticipant(uri) == NULL) {
refer_to = ms_strdup_printf("%s;method=BYE", tmp); 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); res = sal_call_refer(m_focusCall->op, refer_to);
ms_free(tmp);
ms_free(refer_to); ms_free(refer_to);
if(res == 0) { if(res == 0) {
......
...@@ -86,6 +86,7 @@ LINPHONE_PUBLIC bool_t linphone_conference_params_video_requested(const Linphone ...@@ -86,6 +86,7 @@ LINPHONE_PUBLIC bool_t linphone_conference_params_video_requested(const Linphone
* Remove a participant from a conference * Remove a participant from a conference
* @param obj A #LinphoneConference * @param obj A #LinphoneConference
* @param uri SIP URI of the participant to remove * @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 * @return 0 if succeeded, -1 if failed
*/ */
LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri); LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment