/** * 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; }
void linphone_core_conference_check_uninit(LinphoneCore *lc){ LinphoneConference *ctx=&lc->conf_ctx; if (ctx->conf){ int remote_count=remote_participants_count(ctx); ms_message("conference_check_uninit(): size=%i",linphone_conference_get_size(ctx)); if (remote_count==1){ convert_conference_to_call(lc); } if (remote_count==0){ if (ctx->local_participant!=NULL) remove_local_endpoint(ctx); if (ctx->record_endpoint){ ms_audio_conference_remove_member(ctx->conf,ctx->record_endpoint); ms_audio_endpoint_destroy(ctx->record_endpoint); ctx->record_endpoint=NULL; } } if (ms_audio_conference_get_size(ctx->conf)==0){ ms_audio_conference_destroy(ctx->conf); ctx->conf=NULL; } } }