/** * Remove a call from the conference. * @param lc the linphone core * @param call a call that has been previously merged into the conference. * * After removing the remote participant belonging to the supplied call, the call becomes a normal call in paused state. * If one single remote participant is left alone together with the local user in the conference after the removal, then the conference is * automatically transformed into a simple call in StreamsRunning state. * The conference's resources are then automatically destroyed. * * In other words, unless linphone_core_leave_conference() is explicitely called, the last remote participant of a conference is automatically * put in a simple call in running state. * * @returns 0 if successful, -1 otherwise. **/ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){ char * str=linphone_call_get_remote_address_as_string(call); ms_message("Removing call %s from the conference", str); ms_free(str); int err=remove_from_conference(lc,call, FALSE); if (err){ ms_error("Error removing participant from conference."); return err; } if (remote_participants_count(&lc->conf_ctx)==1){ ms_message("conference size is 1: need to be converted to plain call"); err=convert_conference_to_call(lc); } else { ms_message("the conference need not to be converted as size is %i", remote_participants_count(&lc->conf_ctx)); } return err; }
static int convert_conference_to_call(LinphoneCore *lc){ int err=0; MSList *calls=lc->calls; if (remote_participants_count(&lc->conf_ctx)!=1){ ms_error("No unique call remaining in conference."); return -1; } while (calls) { LinphoneCall *rc=(LinphoneCall*)calls->data; calls=calls->next; if (rc->params.in_conference) { // not using current_param bool_t active_after_removed=linphone_core_is_in_conference(lc); err=remove_from_conference(lc, rc, active_after_removed); break; } } return err; }