diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index d7a06785f..47e35e6b6 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -4305,25 +4305,19 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v ); } -static void linphone_call_lost(LinphoneCall *call, LinphoneReason reason){ +static void linphone_call_lost(LinphoneCall *call){ LinphoneCore *lc = call->core; char *temp = NULL; - char *from=NULL; + char *from = NULL; from = linphone_call_get_remote_address_as_string(call); - switch(reason){ - case LinphoneReasonIOError: - temp = ms_strdup_printf("Call with %s disconnected because of network, it is going to be closed.", from ? from : "?"); - break; - default: - temp = ms_strdup_printf("Media connectivity with %s is lost, call is going to be closed.", from ? from : "?"); - break; - } + temp = ms_strdup_printf("Media connectivity with %s is lost, call is going to be closed.", from ? from : "?"); if (from) ms_free(from); - ms_message("LinphoneCall [%p]: %s",call, temp); + ms_message("LinphoneCall [%p]: %s", call, temp); linphone_core_notify_display_warning(lc, temp); - linphone_core_terminate_call(lc,call); - linphone_core_play_named_tone(lc,LinphoneToneCallLost); + sal_error_info_set(&call->non_op_error, SalReasonIOError, 503, "IO error", NULL); + linphone_core_terminate_call(lc, call); + linphone_core_play_named_tone(lc, LinphoneToneCallLost); ms_free(temp); } @@ -4585,10 +4579,10 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse linphone_call_handle_stream_events(call, call->main_text_stream_index); if ((call->state == LinphoneCallStreamsRunning || call->state == LinphoneCallPausedByRemote) && one_second_elapsed && call->audiostream!=NULL - && call->audiostream->ms.state==MSStreamStarted && disconnect_timeout>0 ) + && call->audiostream->ms.state==MSStreamStarted && disconnect_timeout>0 ) { disconnected=!audio_stream_alive(call->audiostream,disconnect_timeout); - if (disconnected) - linphone_call_lost(call, LinphoneReasonUnknown); + } + if (disconnected) linphone_call_lost(call); } void linphone_call_log_completed(LinphoneCall *call){ diff --git a/gtk/main.c b/gtk/main.c index 258990ff5..b57522906 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1375,6 +1375,8 @@ static void linphone_gtk_call_updated_by_remote(LinphoneCall *call){ } static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg){ + const LinphoneErrorInfo *ei; + switch(cs){ case LinphoneCallOutgoingInit: linphone_gtk_create_in_call_view (call); @@ -1392,7 +1394,12 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call linphone_gtk_in_call_view_terminate (call,msg); break; case LinphoneCallEnd: - linphone_gtk_in_call_view_terminate(call,NULL); + ei = linphone_call_get_error_info(call); + if (ei && linphone_error_info_get_reason(ei) != LinphoneReasonNone) { + linphone_gtk_in_call_view_terminate(call, linphone_error_info_get_phrase(ei)); + } else { + linphone_gtk_in_call_view_terminate(call, NULL); + } linphone_gtk_status_icon_set_blinking(FALSE); break; case LinphoneCallIncomingReceived: