}
}
-static void conference_check_uninit(LinphoneConference *ctx){
+void linphone_core_conference_check_uninit(LinphoneConference *ctx){
if (ctx->conf){
- if (ctx->conf->nmembers==0){
+ ms_message("conference_check_uninit(): nmembers=%i",ctx->conf->nmembers);
+ if (ctx->conf->nmembers==1 && ctx->local_participant!=NULL){
remove_local_endpoint(ctx);
+ }
+ if (ctx->conf->nmembers==0){
ms_audio_conference_destroy(ctx->conf);
ctx->conf=NULL;
}
ms_audio_conference_remove_member(conf->conf,call->endpoint);
ms_audio_endpoint_release_from_stream(call->endpoint);
call->endpoint=NULL;
- conference_check_uninit(conf);
}
static void add_local_endpoint(LinphoneConference *conf,LinphoneCore *lc){
float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){
LinphoneConference *conf=&lc->conf_ctx;
AudioStream *st=conf->local_participant;
- if (st && st->volsend){
+ if (st && st->volsend && !conf->local_muted){
float vol=0;
ms_filter_call_method(st->volsend,MS_VOLUME_GET,&vol);
return vol;
}
int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){
+ int err=0;
if (!call->current_params.in_conference){
if (call->params.in_conference){
ms_warning("Not (yet) in conference, be patient");
}
}
call->params.in_conference=FALSE;
- return linphone_core_pause_call(lc,call);
+ err=linphone_core_pause_call(lc,call);
+ return err;
}
bool_t linphone_core_is_in_conference(const LinphoneCore *lc){
if (ms_list_size(lc->calls)==0)
linphone_core_notify_all_friends(lc,lc->presence_mode);
+ linphone_core_conference_check_uninit(&lc->conf_ctx);
+
}
const char *linphone_call_state_to_string(LinphoneCallState cs){
**/
void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){
LinphoneCall *call=linphone_core_get_current_call(lc);
- if (call==NULL){
+ AudioStream *st=NULL;
+ if (linphone_core_is_in_conference(lc)){
+ lc->conf_ctx.local_muted=val;
+ st=lc->conf_ctx.local_participant;
+ }else if (call==NULL){
ms_warning("linphone_core_mute_mic(): No current call !");
return;
+ }else{
+ call->audio_muted=val;
}
- if (call->audiostream!=NULL){
- audio_stream_set_mic_gain(call->audiostream,
+ if (st!=NULL){
+ audio_stream_set_mic_gain(st,
(val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1));
if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
- audio_stream_mute_rtp(call->audiostream,val);
+ audio_stream_mute_rtp(st,val);
}
- call->audio_muted=val;
+
}
}
-
+/**
+ * Returns whether microphone is muted.
+**/
bool_t linphone_core_is_mic_muted(LinphoneCore *lc) {
LinphoneCall *call=linphone_core_get_current_call(lc);
- if (call==NULL){
+ if (linphone_core_is_in_conference(lc)){
+ return lc->conf_ctx.local_muted;
+ }else if (call==NULL){
ms_warning("linphone_core_is_mic_muted(): No current call !");
return FALSE;
}
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error);
bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
+
struct _LinphoneProxyConfig
{
struct _LinphoneCore *lc;
MSAudioConference *conf;
AudioStream *local_participant;
MSAudioEndpoint *local_endpoint;
+ bool_t local_muted;
};
typedef struct _LinphoneConference LinphoneConference;
void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted);
void linphone_call_add_to_conf(LinphoneCall *call);
void linphone_call_remove_from_conf(LinphoneCall *call);
+void linphone_core_conference_check_uninit(LinphoneConference *ctx);
#define HOLD_OFF (0)
#define HOLD_ON (1)
#include "linphone.h"
+#define PADDING_PIXELS 4
+
static GtkWidget *create_conference_label(void){
GtkWidget *box=gtk_hbox_new(FALSE,0);
gtk_box_pack_start(GTK_BOX(box),gtk_image_new_from_stock(GTK_STOCK_ADD,GTK_ICON_SIZE_MENU),FALSE,FALSE,0);
static void init_local_participant(GtkWidget *participant){
GtkWidget *sound_meter;
+ GtkWidget *button=linphone_gtk_get_widget(participant,"conference_control");
gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(participant,"callee_name_label")),_("Me"));
sound_meter=linphone_gtk_get_widget(participant,"sound_indicator");
- gtk_widget_hide(linphone_gtk_get_widget(participant,"hangup_button"));
+ linphone_gtk_enable_mute_button(GTK_BUTTON(button),TRUE);
+ g_signal_connect(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_mute_clicked,NULL);
+ gtk_widget_show(button);
linphone_gtk_init_audio_meter(sound_meter, (get_volume_t) linphone_core_get_conference_local_input_volume, linphone_gtk_get_core());
}
if (box==NULL){
GtkWidget *box=gtk_vbox_new(FALSE,0);
GtkWidget *participant=linphone_gtk_create_widget("main","callee_frame");
+ gtk_box_set_homogeneous(GTK_BOX(box),TRUE);
init_local_participant(participant);
- gtk_box_pack_start(GTK_BOX(box),participant,FALSE,FALSE,0);
+ gtk_box_pack_start(GTK_BOX(box),participant,FALSE,FALSE,PADDING_PIXELS);
gtk_widget_show(box);
g_object_set_data(G_OBJECT(mw),"conference_tab",box);
gtk_notebook_append_page(GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch")),box,
return box;
}
-void linphone_gtk_add_to_conference(LinphoneCall *call){
- GtkWidget *mw=linphone_gtk_get_main_window();
- GtkWidget *tab=get_conference_tab(mw);
- GtkWidget *participant=linphone_gtk_create_widget("main","callee_frame");
- const char *hangup_image=linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png");
- const LinphoneAddress *addr=linphone_call_get_remote_address(call);
- GtkWidget *sound_meter;
- GtkWidget *viewswitch=linphone_gtk_get_widget(mw,"viewswitch");
- gchar *markup;
- if (linphone_address_get_display_name(addr)!=NULL){
- markup=g_strdup_printf("<b>%s</b>",linphone_address_get_display_name(addr));
- }else{
- char *tmp=linphone_address_as_string_uri_only(addr);
- markup=g_strdup_printf("%s",tmp);
- ms_free(tmp);
- }
- gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(participant,"callee_name_label")),markup);
- g_free(markup);
- gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(participant,"hangup_button")),create_pixmap(hangup_image));
- sound_meter=linphone_gtk_get_widget(participant,"sound_indicator");
- linphone_gtk_init_audio_meter(sound_meter, (get_volume_t) linphone_call_get_play_volume, call);
- gtk_box_pack_end(GTK_BOX(tab),participant,FALSE,FALSE,0);
- g_object_set_data_full(G_OBJECT(participant),"call",linphone_call_ref(call),(GDestroyNotify)linphone_call_unref);
- gtk_widget_show(participant);
- gtk_notebook_set_current_page(GTK_NOTEBOOK(viewswitch),
- gtk_notebook_page_num(GTK_NOTEBOOK(viewswitch),tab));
- linphone_core_add_to_conference(linphone_gtk_get_core(),call);
-}
-
static GtkWidget *find_conferencee_from_call(LinphoneCall *call){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *tab=get_conference_tab(mw);
GList *elem;
GtkWidget *ret=NULL;
- GList *l=gtk_container_get_children(GTK_CONTAINER(tab));
- for(elem=l;elem!=NULL;elem=elem->next){
- GtkWidget *frame=(GtkWidget*)elem->data;
- if (call==g_object_get_data(G_OBJECT(frame),"call")){
- ret=frame;
- break;
+ if (call!=NULL){
+ GList *l=gtk_container_get_children(GTK_CONTAINER(tab));
+ for(elem=l;elem!=NULL;elem=elem->next){
+ GtkWidget *frame=(GtkWidget*)elem->data;
+ if (call==g_object_get_data(G_OBJECT(frame),"call")){
+ ret=frame;
+ break;
+ }
}
+ g_list_free(l);
}
- g_list_free(l);
+ //g_message("find_conferencee_from_call(): found widget %p for call %p",ret,call);
return ret;
}
-void linphone_gtk_remove_from_conference(LinphoneCall *call){
+void linphone_gtk_set_in_conference(LinphoneCall *call){
+ GtkWidget *mw=linphone_gtk_get_main_window();
+ GtkWidget *participant=find_conferencee_from_call(call);
+
+ if (participant==NULL){
+ GtkWidget *tab=get_conference_tab(mw);
+ const LinphoneAddress *addr=linphone_call_get_remote_address(call);
+ participant=linphone_gtk_create_widget("main","callee_frame");
+ GtkWidget *sound_meter;
+ GtkWidget *viewswitch=linphone_gtk_get_widget(mw,"viewswitch");
+ gchar *markup;
+ if (linphone_address_get_display_name(addr)!=NULL){
+ markup=g_strdup_printf("<b>%s</b>",linphone_address_get_display_name(addr));
+ }else{
+ char *tmp=linphone_address_as_string_uri_only(addr);
+ markup=g_strdup_printf("%s",tmp);
+ ms_free(tmp);
+ }
+ gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(participant,"callee_name_label")),markup);
+ g_free(markup);
+ sound_meter=linphone_gtk_get_widget(participant,"sound_indicator");
+ linphone_gtk_init_audio_meter(sound_meter, (get_volume_t) linphone_call_get_play_volume, call);
+ gtk_box_pack_start(GTK_BOX(tab),participant,FALSE,FALSE,PADDING_PIXELS);
+ g_object_set_data_full(G_OBJECT(participant),"call",linphone_call_ref(call),(GDestroyNotify)linphone_call_unref);
+ gtk_widget_show(participant);
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(viewswitch),
+ gtk_notebook_page_num(GTK_NOTEBOOK(viewswitch),tab));
+ }
+}
+
+
+
+void linphone_gtk_terminate_conference_participant(LinphoneCall *call){
GtkWidget *frame=find_conferencee_from_call(call);
+ if (frame){
+ gtk_widget_set_sensitive(frame,FALSE);
+ }
+}
+
+void linphone_gtk_unset_from_conference(LinphoneCall *call){
+ GtkWidget *mw=linphone_gtk_get_main_window();
+ GtkWidget *box=(GtkWidget*)g_object_get_data(G_OBJECT(mw),"conference_tab");
+ GtkWidget *frame=find_conferencee_from_call(call);
+ GList *children;
if (frame){
gtk_widget_destroy(frame);
}
+ children=gtk_container_get_children(GTK_CONTAINER(box));
+ if (g_list_length(children)==1){
+ /*the conference is terminated */
+ gtk_widget_destroy(box);
+ g_object_set_data(G_OBJECT(mw),"conference_tab",NULL);
+ }
+ g_list_free(children);
}
return val;
}
-LinphoneCall *linphone_gtk_get_currently_displayed_call(){
+LinphoneCall *linphone_gtk_get_currently_displayed_call(gboolean *is_conf){
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *main_window=linphone_gtk_get_main_window ();
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
const MSList *calls=linphone_core_get_calls(lc);
+ if (is_conf) *is_conf=FALSE;
if (!linphone_gtk_use_in_call_view() || ms_list_size(calls)==1){
if (calls) return (LinphoneCall*)calls->data;
}else{
GtkWidget *page=gtk_notebook_get_nth_page(notebook,idx);
if (page!=NULL){
LinphoneCall *call=(LinphoneCall*)g_object_get_data(G_OBJECT(page),"call");
+ if (call==NULL){
+ if (page==g_object_get_data(G_OBJECT(main_window),"conference_tab")){
+ if (is_conf)
+ *is_conf=TRUE;
+ return NULL;
+ }
+ }
return call;
}
}
static void linphone_gtk_transfer_call(LinphoneCall *dest_call){
- LinphoneCall *call=linphone_gtk_get_currently_displayed_call();
- linphone_core_transfer_call_to_another (linphone_gtk_get_core(),call,dest_call);
+ LinphoneCall *call=linphone_gtk_get_currently_displayed_call(NULL);
+ if (call) linphone_core_transfer_call_to_another(linphone_gtk_get_core(),call,dest_call);
}
static void transfer_button_clicked(GtkWidget *button, gpointer call_ref){
button=NULL;
}else if (!button && value==TRUE){
button=gtk_button_new_with_label (_("Transfer"));
+ //gtk_button_set_image_position(GTK_BUTTON(button),GTK_POS_BOTTOM);
gtk_button_set_image(GTK_BUTTON(button),gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,GTK_ICON_SIZE_BUTTON));
g_signal_connect(G_OBJECT(button),"clicked",(GCallback)transfer_button_clicked,call);
gtk_widget_show_all(button);
}
static void conference_button_clicked(GtkWidget *button, gpointer call_ref){
- linphone_gtk_add_to_conference((LinphoneCall*)call_ref);
+ linphone_core_add_all_to_conference(linphone_gtk_get_core());
+ //linphone_core_add_to_conference(linphone_gtk_get_core(),(LinphoneCall*)call_ref);
gtk_widget_set_sensitive(button,FALSE);
}
button=NULL;
}else if (!button && value==TRUE){
button=gtk_button_new_with_label (_("Conference"));
+ //gtk_button_set_image_position(GTK_BUTTON(button),GTK_POS_BOTTOM);
gtk_button_set_image(GTK_BUTTON(button),gtk_image_new_from_stock (GTK_STOCK_ADD,GTK_ICON_SIZE_BUTTON));
g_signal_connect(G_OBJECT(button),"clicked",(GCallback)conference_button_clicked,call);
gtk_widget_show_all(button);
GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer (call);
GtkWidget *main_window=linphone_gtk_get_main_window ();
GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch");
+ gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
int idx;
g_return_if_fail(w!=NULL);
idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w);
gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
gtk_widget_destroy(w);
+ if (in_conf){
+ linphone_gtk_unset_from_conference(call);
+ }
linphone_call_set_user_pointer (call,NULL);
linphone_call_unref(call);
- gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), 0);
+ call=linphone_core_get_current_call(linphone_gtk_get_core());
+ if (call==NULL){
+ if (linphone_core_is_in_conference(linphone_gtk_get_core())){
+ /*show the conference*/
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
+ g_object_get_data(G_OBJECT(main_window),"conference_tab")));
+ }else gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), 0);
+ }else{
+ /*show the active call*/
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
+ linphone_call_get_user_pointer(call)));
+ }
}
static void display_peer_name_in_label(GtkWidget *label, const LinphoneAddress *from){
}else{
linphone_gtk_uninit_audio_meter(mic_level);
linphone_gtk_uninit_audio_meter(spk_level);
+ gtk_widget_hide(audio_view);
}
}
g_object_set_data(G_OBJECT(callview),"taskid",GINT_TO_POINTER(taskid));
}
linphone_gtk_in_call_view_enable_audio_view(call, !in_conf);
+ if (in_conf) linphone_gtk_set_in_conference(call);
}
void linphone_gtk_in_call_view_set_paused(LinphoneCall *call){
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status");
guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid"));
- gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
+ gboolean in_conf=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
if (error_msg==NULL)
gtk_label_set_markup(GTK_LABEL(status),_("<b>Call ended.</b>"));
linphone_gtk_enable_mute_button(
GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),FALSE);
linphone_gtk_enable_hold_button(call,FALSE,TRUE);
- if (in_conf){
- linphone_gtk_remove_from_conference(call);
- }
+
if (taskid!=0) g_source_remove(taskid);
g_timeout_add_seconds(2,(GSourceFunc)in_call_view_terminated,call);
+ if (in_conf)
+ linphone_gtk_terminate_conference_participant(call);
}
void linphone_gtk_draw_mute_button(GtkButton *button, gboolean active){
void linphone_gtk_hold_clicked(GtkButton *button){
int active=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"active"));
- LinphoneCall *call=linphone_gtk_get_currently_displayed_call ();
+ LinphoneCall *call=linphone_gtk_get_currently_displayed_call(NULL);
+ if (!call) return;
if(!active)
{
linphone_core_pause_call(linphone_gtk_get_core(),call);
/*functions controlling the different views*/
gboolean linphone_gtk_use_in_call_view();
-LinphoneCall *linphone_gtk_get_currently_displayed_call();
+LinphoneCall *linphone_gtk_get_currently_displayed_call(gboolean *is_conf);
void linphone_gtk_create_in_call_view(LinphoneCall *call);
void linphone_gtk_in_call_view_set_calling(LinphoneCall *call);
void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call);
void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_msg);
void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call);
void linphone_gtk_in_call_view_set_paused(LinphoneCall *call);
+void linphone_gtk_mute_clicked(GtkButton *button);
void linphone_gtk_enable_mute_button(GtkButton *button, gboolean sensitive);
void linphone_gtk_enable_hold_button(LinphoneCall *call, gboolean sensitive, gboolean holdon);
void linphone_gtk_enable_transfer_button(LinphoneCore *lc, gboolean value);
void linphone_gtk_enable_conference_button(LinphoneCore *lc, gboolean value);
-void linphone_gtk_add_to_conference(LinphoneCall *call);
-void linphone_gtk_remove_from_conference(LinphoneCall *call);
+void linphone_gtk_set_in_conference(LinphoneCall *call);
+void linphone_gtk_unset_from_conference(LinphoneCall *call);
+void linphone_gtk_terminate_conference_participant(LinphoneCall *call);
typedef float (*get_volume_t)(void *data);
void linphone_gtk_init_audio_meter(GtkWidget *w, get_volume_t get_volume, void *data);
GtkWidget *mw=gtk_widget_get_toplevel(w);
GtkWidget *uri_bar=linphone_gtk_get_widget(mw,"uribar");
- call=linphone_gtk_get_currently_displayed_call();
+ call=linphone_gtk_get_currently_displayed_call(NULL);
if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived){
linphone_core_accept_call(lc,call);
}else{
void linphone_gtk_terminate_call(GtkWidget *button){
- LinphoneCall *call=linphone_gtk_get_currently_displayed_call ();
- if (call)
+ gboolean is_conf;
+ LinphoneCall *call=linphone_gtk_get_currently_displayed_call(&is_conf);
+ if (call){
linphone_core_terminate_call(linphone_gtk_get_core(),call);
+ }else if (is_conf){
+ linphone_core_terminate_conference(linphone_gtk_get_core());
+ }
}
void linphone_gtk_decline_clicked(GtkWidget *button){
- LinphoneCall *call=linphone_gtk_get_currently_displayed_call ();
+ LinphoneCall *call=linphone_gtk_get_currently_displayed_call(NULL);
if (call)
linphone_core_terminate_call(linphone_gtk_get_core(),call);
}
void linphone_gtk_answer_clicked(GtkWidget *button){
- LinphoneCall *call=linphone_gtk_get_currently_displayed_call ();
+ LinphoneCall *call=linphone_gtk_get_currently_displayed_call(NULL);
if (call){
linphone_core_pause_all_calls(linphone_gtk_get_core());
linphone_core_accept_call(linphone_gtk_get_core(),call);
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkProgressBar" id="sound_indicator">
+ <object class="GtkHBox" id="conf_hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="callee_name_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Callee name</b></property>
+ <property name="use_markup">True</property>
+ <property name="justify">right</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="conference_control">
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkButton" id="hangup_button">
+ <object class="GtkProgressBar" id="sound_indicator">
+ <property name="width_request">170</property>
+ <property name="height_request">30</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- <signal name="clicked" handler="linphone_gtk_conf_hangup_clicked" swapped="no"/>
+ <property name="can_focus">False</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
- <child type="label">
- <object class="GtkLabel" id="callee_name_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes"><b>Callee name</b></property>
- <property name="use_markup">True</property>
- </object>
+ <child type="label_item">
+ <placeholder/>
</child>
</object>
</child>
-Subproject commit 85e43112e4054ba9112751655a52a42bb381584f
+Subproject commit d9957eac4e4409b1eccc65c59b3851542582b718
#: ../gtk/incall_view.c:347 ../gtk/main.ui.h:46
msgid "Pause"
-msgstr "Mettre en attente"
+msgstr "Pause"
#: ../gtk/loginframe.c:93
#, c-format