}
}
+static int linphone_conference_get_size(LinphoneConference *conf){
+ if (conf->conf == NULL) {
+ return 0;
+ }
+ return ms_audio_conference_get_size(conf->conf) - (conf->record_endpoint ? 1 : 0);
+}
+
static int remote_participants_count(LinphoneConference *ctx) {
- if (!ctx->conf || ms_audio_conference_get_size(ctx->conf)==0) return 0;
- if (!ctx->local_participant) return ms_audio_conference_get_size(ctx->conf);
- return ms_audio_conference_get_size(ctx->conf) -1;
+ int count=linphone_conference_get_size(ctx);
+ if (count==0) return 0;
+ if (!ctx->local_participant) return count;
+ return count -1;
}
void linphone_core_conference_check_uninit(LinphoneCore *lc){
LinphoneConference *ctx=&lc->conf_ctx;
if (ctx->conf){
- ms_message("conference_check_uninit(): nmembers=%i",ms_audio_conference_get_size(ctx->conf));
- if (remote_participants_count(ctx)==1){
+ 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 (ms_audio_conference_get_size(ctx->conf)==1 && ctx->local_participant!=NULL){
- remove_local_endpoint(ctx);
+ 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;
*
* If this is the first call that enters the conference, the virtual conference will be created automatically.
* If the local user was actively part of the call (ie not in paused state), then the local user is automatically entered into the conference.
+ * If the call was in paused state, then it is automatically resumed when entering into the conference.
*
* @returns 0 if successful, -1 otherwise.
**/
err=linphone_core_update_call(lc,call,&call->params);
} else{
ms_message("Pausing call to actually remove from conference");
- err=linphone_core_pause_call(lc,call);
+ err=_linphone_core_pause_call(lc,call);
}
return err;
* @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 in the conference after the removal, then it is
- * automatically removed from the conference and put into a simple call, like before entering the conference.
+ * 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){
return -1;
}
if (lc->current_call != NULL) {
- linphone_core_pause_call(lc, lc->current_call);
+ _linphone_core_pause_call(lc, lc->current_call);
}
LinphoneConference *conf=&lc->conf_ctx;
if (conf->local_participant==NULL) add_local_endpoint(conf,lc);
* @returns the number of participants to the conference
**/
int linphone_core_get_conference_size(LinphoneCore *lc) {
- if (lc->conf_ctx.conf == NULL) {
- return 0;
+ LinphoneConference *conf=&lc->conf_ctx;
+ return linphone_conference_get_size(conf);
+}
+
+
+int linphone_core_start_conference_recording(LinphoneCore *lc, const char *path){
+ LinphoneConference *conf=&lc->conf_ctx;
+ if (conf->conf == NULL) {
+ ms_warning("linphone_core_start_conference_recording(): no conference now.");
+ return -1;
+ }
+ if (conf->record_endpoint==NULL){
+ conf->record_endpoint=ms_audio_endpoint_new_recorder();
+ ms_audio_conference_add_member(conf->conf,conf->record_endpoint);
}
- return ms_audio_conference_get_size(lc->conf_ctx.conf);
+ ms_audio_recorder_endpoint_start(conf->record_endpoint,path);
+ return 0;
+}
+
+int linphone_core_stop_conference_recording(LinphoneCore *lc){
+ LinphoneConference *conf=&lc->conf_ctx;
+ if (conf->conf == NULL) {
+ ms_warning("linphone_core_stop_conference_recording(): no conference now.");
+ return -1;
+ }
+ if (conf->record_endpoint==NULL){
+ ms_warning("linphone_core_stop_conference_recording(): no record active.");
+ return -1;
+ }
+ ms_audio_recorder_endpoint_stop(conf->record_endpoint);
+ return 0;
}
/**