Commit a67e46ae authored by Simon Morlat's avatar Simon Morlat
Browse files

multicall bugfixes

parent da1736c7
......@@ -185,6 +185,8 @@ static void call_accepted(SalOp *op){
if ((call->audiostream!=NULL) && (call->audiostream->ticker!=NULL)){
/*case where we accepted early media or already in call*/
linphone_call_stop_media_streams(call);
}
if (call->audiostream==NULL){
linphone_call_init_media_streams(call);
}
if (call->resultdesc)
......@@ -200,8 +202,8 @@ static void call_accepted(SalOp *op){
linphone_call_set_state(call,LinphoneCallConnected,"Connected");
}
if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){
if (sal_media_description_has_dir(call->resultdesc,SalStreamSendOnly)){
/*we initiated a pause*/
if (sal_media_description_has_dir(call->resultdesc,SalStreamSendOnly) ||
sal_media_description_has_dir(call->resultdesc,SalStreamInactive)){
if (lc->vtable.display_status){
char *tmp=linphone_call_get_remote_address_as_string (call);
char *msg=ms_strdup_printf(_("Call with %s is paused."),tmp);
......@@ -298,7 +300,6 @@ static void call_updating(SalOp *op){
if (lc->current_call!=call){
ms_error("Inconsitency detected: current call is %p but call %p is being paused !",lc->current_call,call);
}
lc->current_call=NULL;
}
/*accept the modification (sends a 200Ok)*/
sal_call_accept(op);
......
......@@ -2255,7 +2255,7 @@ const MSList *linphone_core_get_calls(LinphoneCore *lc)
}
/**
* Returns TRUE if there is a call running or pending.
* Returns TRUE if there is a call running.
*
* @ingroup call_control
**/
......@@ -2282,6 +2282,11 @@ LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc)
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
{
LinphoneCall *call = the_call;
if (call->state!=LinphoneCallStreamsRunning && call->state!=LinphoneCallPausedByRemote){
ms_warning("Cannot pause this call, it is not active.");
return -1;
}
if (sal_call_hold(call->op,TRUE) != 0)
{
......@@ -2292,6 +2297,8 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Pausing the current call..."));
lc->current_call=NULL;
if (call->audiostream || call->videostream)
linphone_call_stop_media_streams (call);
linphone_core_start_pending_refered_calls(lc);
return 0;
}
......@@ -2304,7 +2311,7 @@ int linphone_core_pause_all_calls(LinphoneCore *lc){
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *call=(LinphoneCall *)elem->data;
LinphoneCallState cs=linphone_call_get_state(call);
if (cs==LinphoneCallStreamsRunning && cs==LinphoneCallPausedByRemote){
if (cs==LinphoneCallStreamsRunning || cs==LinphoneCallPausedByRemote){
linphone_core_pause_call(lc,call);
}
}
......
......@@ -85,6 +85,9 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){
idx = gtk_notebook_page_num(notebook, call_view);
gtk_notebook_set_current_page(notebook, idx);
call_index++;
linphone_gtk_enable_hold_button (call,FALSE,TRUE);
linphone_gtk_enable_mute_button(
GTK_BUTTON(linphone_gtk_get_widget(call_view,"incall_mute")),FALSE);
}
void linphone_gtk_remove_in_call_view(LinphoneCall *call){
......@@ -172,12 +175,11 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration");
GtkWidget *animation=linphone_gtk_get_widget(callview,"in_call_animation");
GdkPixbufAnimation *pbuf=create_pixbuf_animation("incall_anim.gif");
GtkWidget *holdbutton;
display_peer_name_in_label(callee,linphone_call_get_remote_address (call));
gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>In call with</b>"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>In call</b>"));
gtk_label_set_text(GTK_LABEL(duration),_("00::00::00"));
if (pbuf!=NULL){
......@@ -185,17 +187,16 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
g_object_unref(G_OBJECT(pbuf));
}else gtk_image_set_from_stock(GTK_IMAGE(animation),GTK_STOCK_EXECUTE,GTK_ICON_SIZE_DIALOG);
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),TRUE);
holdbutton=linphone_gtk_get_widget(callview,"hold_call");
linphone_gtk_enable_hold_button(GTK_TOGGLE_BUTTON(holdbutton),TRUE);
g_object_set_data(G_OBJECT(holdbutton),"call",call);
GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),TRUE);
}
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");
GtkWidget *animation=linphone_gtk_get_widget(callview,"in_call_animation");
gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>Paused call with</b>"));
gtk_label_set_markup(GTK_LABEL(status),_("<b>Paused call</b>"));
gtk_image_set_from_stock(GTK_IMAGE(animation),GTK_STOCK_MEDIA_PAUSE,GTK_ICON_SIZE_DIALOG);
}
void linphone_gtk_in_call_view_update_duration(LinphoneCall *call){
......@@ -234,13 +235,13 @@ void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_m
}
gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel"));
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),FALSE);
linphone_gtk_enable_hold_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(callview,"hold_call")),FALSE);
GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),FALSE);
linphone_gtk_enable_hold_button(call,FALSE,TRUE);
g_timeout_add_seconds(2,(GSourceFunc)in_call_view_terminated,call);
}
void linphone_gtk_draw_mute_button(GtkToggleButton *button, gboolean active){
void linphone_gtk_draw_mute_button(GtkButton *button, gboolean active){
g_object_set_data(G_OBJECT(button),"active",GINT_TO_POINTER(active));
if (active){
GtkWidget *image=create_pixmap("mic_muted.png");
gtk_button_set_label(GTK_BUTTON(button),_("Unmute"));
......@@ -258,19 +259,20 @@ void linphone_gtk_draw_mute_button(GtkToggleButton *button, gboolean active){
}
}
void linphone_gtk_mute_toggled(GtkToggleButton *button){
gboolean active=gtk_toggle_button_get_active(button);
linphone_core_mute_mic(linphone_gtk_get_core(),active);
linphone_gtk_draw_mute_button(button,active);
void linphone_gtk_mute_clicked(GtkButton *button){
int active=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"active"));
linphone_core_mute_mic(linphone_gtk_get_core(),!active);
linphone_gtk_draw_mute_button(button,!active);
}
void linphone_gtk_enable_mute_button(GtkToggleButton *button, gboolean sensitive)
void linphone_gtk_enable_mute_button(GtkButton *button, gboolean sensitive)
{
gtk_widget_set_sensitive(GTK_WIDGET(button),sensitive);
linphone_gtk_draw_mute_button(button,FALSE);
}
void linphone_gtk_draw_hold_button(GtkToggleButton *button, gboolean active){
void linphone_gtk_draw_hold_button(GtkButton *button, gboolean active){
g_object_set_data(G_OBJECT(button),"active",GINT_TO_POINTER(active));
if (active){
GtkWidget *image=create_pixmap("hold_off.png");
gtk_button_set_label(GTK_BUTTON(button),_("Resume"));
......@@ -288,10 +290,10 @@ void linphone_gtk_draw_hold_button(GtkToggleButton *button, gboolean active){
}
}
void linphone_gtk_hold_toggled(GtkToggleButton *button){
gboolean active=gtk_toggle_button_get_active(button);
LinphoneCall *call=(LinphoneCall*)g_object_get_data(G_OBJECT(button),"call");
if(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 ();
if(!active)
{
linphone_core_pause_call(linphone_gtk_get_core(),call);
}
......@@ -299,10 +301,13 @@ void linphone_gtk_hold_toggled(GtkToggleButton *button){
{
linphone_core_resume_call(linphone_gtk_get_core(),call);
}
linphone_gtk_draw_hold_button(button,active);
}
void linphone_gtk_enable_hold_button(GtkToggleButton *button, gboolean sensitive){
void linphone_gtk_enable_hold_button(LinphoneCall *call, gboolean sensitive, gboolean holdon){
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer (call);
GtkWidget *button;
g_return_if_fail(callview!=NULL);
button=linphone_gtk_get_widget(callview,"hold_call");
gtk_widget_set_sensitive(GTK_WIDGET(button),sensitive);
linphone_gtk_draw_hold_button(button,FALSE);
linphone_gtk_draw_hold_button(GTK_BUTTON(button),!holdon);
}
......@@ -95,8 +95,8 @@ void linphone_gtk_in_call_view_update_duration(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, bool_t with_pause);
void linphone_gtk_in_call_view_set_paused(LinphoneCall *call);
void linphone_gtk_enable_mute_button(GtkToggleButton *button, gboolean sensitive);
void linphone_gtk_enable_hold_button(GtkToggleButton *button, gboolean sensitive);
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_show_login_frame(LinphoneProxyConfig *cfg);
......@@ -637,7 +637,7 @@ static bool_t all_calls_paused(const MSList *calls){
for(;calls!=NULL;calls=calls->next){
LinphoneCall *call=(LinphoneCall*)calls->data;
LinphoneCallState cs=linphone_call_get_state(call);
if (cs!=LinphoneCallPaused && cs!=LinphoneCallIncomingReceived)
if (cs!=LinphoneCallPaused && cs!=LinphoneCallIncomingReceived && cs!=LinphoneCallPausing)
return FALSE;
}
return TRUE;
......@@ -655,17 +655,15 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
if (calls==NULL){
start_active=TRUE;
stop_active=FALSE;
}else if (linphone_core_get_current_call(lc)!=NULL){
start_active=FALSE;
stop_active=TRUE;
}else if (all_calls_paused(calls)){
start_active=TRUE;
}else{
stop_active=TRUE;
add_call=TRUE;
}else if (call!=NULL){
if (linphone_call_get_state(call)==LinphoneCallIncomingReceived){
if (all_calls_paused(calls)){
start_active=TRUE;
add_call=TRUE;
}else if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived){
start_active=TRUE;
stop_active=TRUE;
}else{
start_active=FALSE;
}
}
button=linphone_gtk_get_widget(mw,"start_call");
......@@ -679,7 +677,7 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),stop_active);
if (linphone_core_get_calls(lc)==NULL){
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"main_mute")),
GTK_BUTTON(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"main_mute")),
FALSE);
}
update_video_title();
......@@ -943,7 +941,7 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
case LinphoneCallStreamsRunning:
linphone_gtk_in_call_view_set_in_call(call);
linphone_gtk_enable_mute_button(
GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"main_mute")),
GTK_BUTTON(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"main_mute")),
TRUE);
g_timeout_add(250,(GSourceFunc)in_call_timer,NULL);
break;
......@@ -961,10 +959,17 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer ,call);
}
break;
case LinphoneCallPaused:
case LinphoneCallResuming:
linphone_gtk_enable_hold_button(call,TRUE,TRUE);
break;
case LinphoneCallPausing:
linphone_gtk_enable_hold_button(call,TRUE,FALSE);
case LinphoneCallPausedByRemote:
linphone_gtk_in_call_view_set_paused(call);
break;
case LinphoneCallConnected:
linphone_gtk_enable_hold_button (call,TRUE,TRUE);
break;
default:
break;
}
......@@ -1231,12 +1236,8 @@ static void linphone_gtk_init_main_window(){
linphone_gtk_connect_digits();
linphone_gtk_check_menu_items();
main_window=linphone_gtk_get_main_window();
linphone_gtk_enable_mute_button(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,
linphone_gtk_enable_mute_button(GTK_BUTTON(linphone_gtk_get_widget(main_window,
"main_mute")),FALSE);
linphone_gtk_enable_mute_button(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,
"incall_mute")),FALSE);
linphone_gtk_enable_hold_button(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(main_window,
"hold_call")),FALSE);
if (!linphone_gtk_use_in_call_view()) {
gtk_widget_show(linphone_gtk_get_widget(main_window, "main_mute"));
}
......
......@@ -1414,13 +1414,12 @@
<property name="visible">True</property>
<property name="layout_style">spread</property>
<child>
<object class="GtkToggleButton" id="incall_mute">
<object class="GtkButton" id="incall_mute">
<property name="label" translatable="yes">Mute</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="toggled" handler="linphone_gtk_mute_toggled"/>
<signal name="clicked" handler="linphone_gtk_mute_clicked"/>
</object>
<packing>
<property name="expand">False</property>
......@@ -1429,13 +1428,12 @@
</packing>
</child>
<child>
<object class="GtkToggleButton" id="hold_call">
<property name="label" translatable="yes">HoldOn</property>
<object class="GtkButton" id="hold_call">
<property name="label" translatable="yes">Pause</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="toggled" handler="linphone_gtk_hold_toggled"/>
<signal name="clicked" handler="linphone_gtk_hold_clicked"/>
</object>
<packing>
<property name="expand">False</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment