1 /***************************************************************************
5 * Copyright 2011 Belledonne Communications
7 * Email simon dot morlat at linphone dot org
8 ****************************************************************************/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 static void conference_check_init(LinphoneConference *ctx){
31 ctx->conf=ms_audio_conference_new();
35 static void conference_check_uninit(LinphoneConference *ctx){
37 if (ctx->conf->nmembers==0){
38 ms_audio_conference_destroy(ctx->conf);
45 void linphone_call_add_to_conf(LinphoneCall *call){
46 LinphoneCore *lc=call->core;
47 LinphoneConference *conf=&lc->conf_ctx;
49 ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE);
50 ms_audio_conference_add_member(conf->conf,ep);
54 void linphone_call_remove_from_conf(LinphoneCall *call){
55 LinphoneCore *lc=call->core;
56 LinphoneConference *conf=&lc->conf_ctx;
58 ms_audio_conference_remove_member(conf->conf,call->endpoint);
59 ms_audio_endpoint_release_from_stream(call->endpoint);
61 conference_check_uninit(conf);
64 int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){
65 LinphoneCallParams params;
66 if (call->current_params.in_conference){
67 ms_error("Already in conference");
70 conference_check_init(&lc->conf_ctx);
71 call->params.in_conference=TRUE;
72 call->params.has_video=FALSE;
74 if (call->state==LinphoneCallPaused)
75 linphone_core_resume_call(lc,call);
76 else if (call->state==LinphoneCallStreamsRunning){
77 /*this will trigger a reINVITE that will later redraw the streams */
78 linphone_core_update_call(lc,call,¶ms);
80 ms_error("Call is in state %s, it cannot be added to the conference.",linphone_call_state_to_string(call->state));
86 int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){
87 if (!call->current_params.in_conference){
88 if (call->params.in_conference){
89 ms_warning("Not (yet) in conference, be patient");
92 ms_error("Not in a conference.");
96 call->params.in_conference=FALSE;
97 return linphone_core_pause_call(lc,call);
100 int linphone_core_pause_conference(LinphoneCore *lc){
105 int linphone_core_resume_conference(LinphoneCore *lc){