static void linphone_conference_server_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) { LinphoneCoreVTable *vtable = linphone_core_get_current_vtable(lc); LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)vtable->user_data; switch(cstate) { case LinphoneCallIncomingReceived: linphone_core_accept_call(lc, call); break; case LinphoneCallStreamsRunning: if(linphone_call_get_conference(call) == NULL) { linphone_core_add_to_conference(lc, call); linphone_core_leave_conference(lc); if(conf_srv->first_call == NULL) conf_srv->first_call = call; } break; case LinphoneCallEnd: if(call == conf_srv->first_call) { linphone_core_terminate_conference(lc); conf_srv->first_call = NULL; } break; default: break; } }
static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t active){ int err=0; if (!call->current_params.in_conference){ if (call->params.in_conference){ ms_warning("Not (yet) in conference, be patient"); return -1; }else{ ms_error("Not in a conference."); return -1; } } call->params.in_conference=FALSE; char *str=linphone_call_get_remote_address_as_string(call); ms_message("%s will be removed from conference", str); ms_free(str); if (active){ LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); params->in_conference=FALSE; // reconnect local audio with this call if (linphone_core_is_in_conference(lc)){ ms_message("Leaving conference for reconnecting with unique call."); linphone_core_leave_conference(lc); } ms_message("Updating call to actually remove from conference"); err=linphone_core_update_call(lc,call,params); linphone_call_params_destroy(params); } else{ ms_message("Pausing call to actually remove from conference"); err=_linphone_core_pause_call(lc,call); } return err; }