static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState st, const char *msg){ char *from=linphone_call_get_remote_address_as_string(call); long id=(long)linphone_call_get_user_pointer (call); switch(st){ case LinphoneCallEnd: linphonec_out("Call %i with %s ended (%s).\n", id, from, linphone_reason_to_string(linphone_call_get_reason(call))); break; case LinphoneCallResuming: linphonec_out("Resuming call %i with %s.\n", id, from); break; case LinphoneCallStreamsRunning: linphonec_out("Media streams established with %s for call %i (%s).\n", from,id,( linphone_call_params_video_enabled( linphone_call_get_current_params(call)) ? "video":"audio")); break; case LinphoneCallPausing: linphonec_out("Pausing call %i with %s.\n", id, from); break; case LinphoneCallPaused: linphonec_out("Call %i with %s is now paused.\n", id, from); break; case LinphoneCallPausedByRemote: linphonec_out("Call %i has been paused by %s.\n",id,from); break; case LinphoneCallIncomingReceived: linphonec_call_identify(call); linphone_call_enable_camera (call,linphonec_camera_enabled); id=(long)linphone_call_get_user_pointer (call); linphonec_set_caller(from); if ( auto_answer) { answer_call=TRUE; } linphonec_out("Receiving new incoming call from %s, assigned id %i\n", from,id); break; case LinphoneCallOutgoingInit: linphonec_call_identify(call); id=(long)linphone_call_get_user_pointer (call); linphonec_out("Establishing call id to %s, assigned id %i\n", from,id); break; case LinphoneCallUpdatedByRemote: linphonec_call_updated(call); break; case LinphoneCallOutgoingProgress: linphonec_out("Call %i to %s in progress.\n", id, from); break; case LinphoneCallOutgoingRinging: linphonec_out("Call %i to %s ringing.\n", id, from); break; case LinphoneCallConnected: linphonec_out("Call %i with %s connected.\n", id, from); break; case LinphoneCallOutgoingEarlyMedia: linphonec_out("Call %i with %s early media.\n", id, from); break; case LinphoneCallError: linphonec_out("Call %i with %s error.\n", id, from); break; default: break; } ms_free(from); }
void linphone_gtk_remove_in_call_view(LinphoneCall *call){ 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); 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))); } }
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"); gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel")); gtk_label_set_markup(GTK_LABEL(status),_("<b>Paused call</b>")); linphone_gtk_in_call_set_animation_image(callview,GTK_STOCK_MEDIA_PAUSE,TRUE); }
void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri"); GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration"); 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)); display_peer_name_in_label(callee,linphone_call_get_remote_address (call)); gtk_widget_set_visible(linphone_gtk_get_widget(callview,"mute_pause_buttons"),!in_conf); gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel")); gtk_label_set_markup(GTK_LABEL(status),in_conf ? _("In conference") : _("<b>In call</b>")); gtk_label_set_text(GTK_LABEL(duration),_("00::00::00")); linphone_gtk_in_call_set_animation_image(callview,GTK_STOCK_MEDIA_PLAY,TRUE); linphone_gtk_enable_mute_button( GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),!in_conf); if (taskid==0){ taskid=g_timeout_add(250,(GSourceFunc)linphone_gtk_in_call_view_refresh,call); g_object_set_data(G_OBJECT(callview),"taskid",GINT_TO_POINTER(taskid)); } linphone_gtk_in_call_view_enable_audio_view(call, !in_conf); linphone_gtk_in_call_view_show_encryption(call); if (in_conf) linphone_gtk_set_in_conference(call); }
void linphone_gtk_update_video_button(LinphoneCall *call){ GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *button; const LinphoneCallParams *params=linphone_call_get_current_params(call); gboolean has_video=linphone_call_params_video_enabled(params); if (call_view==NULL) return; button=linphone_gtk_get_widget(call_view,"video_button"); gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_stock(has_video ? GTK_STOCK_REMOVE : GTK_STOCK_ADD,GTK_ICON_SIZE_BUTTON)); g_object_set_data(G_OBJECT(button),"adding_video",GINT_TO_POINTER(!has_video)); if (!linphone_core_video_supported(linphone_call_get_core(call))){ gtk_widget_set_sensitive(button,FALSE); return; } if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"signal_connected"))==0){ g_signal_connect(G_OBJECT(button),"clicked",(GCallback)video_button_clicked,call); g_object_set_data(G_OBJECT(button),"signal_connected",GINT_TO_POINTER(1)); } GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"conf_frame"); gtk_widget_set_sensitive(button,linphone_call_get_state(call)==LinphoneCallStreamsRunning); if(conf_frame!=NULL){ gtk_widget_set_sensitive(button,FALSE); } }
void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_msg){ 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"); GdkPixbuf *pbuf=create_pixbuf(linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png")); guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid")); if (error_msg==NULL) gtk_label_set_markup(GTK_LABEL(status),_("<b>Call ended.</b>")); else{ char *msg=g_markup_printf_escaped("<span color=\"red\"><b>%s</b></span>",error_msg); gtk_label_set_markup(GTK_LABEL(status),msg); g_free(msg); } if (pbuf!=NULL){ gtk_image_set_from_pixbuf(GTK_IMAGE(animation),pbuf); g_object_unref(G_OBJECT(pbuf)); } gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel")); linphone_gtk_enable_mute_button( GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),FALSE); linphone_gtk_enable_hold_button(call,FALSE,TRUE); if (taskid!=0) g_source_remove(taskid); g_timeout_add_seconds(2,(GSourceFunc)in_call_view_terminated,call); }
void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri"); 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"); guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid")); display_peer_name_in_label(callee,linphone_call_get_remote_address (call)); gtk_widget_show(linphone_gtk_get_widget(callview,"mute_pause_buttons")); gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel")); gtk_label_set_markup(GTK_LABEL(status),_("<b>In call</b>")); gtk_label_set_text(GTK_LABEL(duration),_("00::00::00")); if (pbuf!=NULL){ gtk_image_set_from_animation(GTK_IMAGE(animation),pbuf); 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_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),TRUE); if (taskid==0){ taskid=g_timeout_add(250,(GSourceFunc)linphone_gtk_in_call_view_refresh,call); g_object_set_data(G_OBJECT(callview),"taskid",GINT_TO_POINTER(taskid)); } }
void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_pause){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri"); GtkWidget *animation=linphone_gtk_get_widget(callview,"in_call_animation"); GdkPixbufAnimation *pbuf=create_pixbuf_animation("calling_anim.gif"); GtkWidget *answer_button; GtkWidget *image; gtk_label_set_markup(GTK_LABEL(status),_("<b>Incoming call</b>")); gtk_widget_show_all(linphone_gtk_get_widget(callview,"answer_decline_panel")); gtk_widget_hide(linphone_gtk_get_widget(callview,"mute_pause_buttons")); display_peer_name_in_label(callee,linphone_call_get_remote_address (call)); answer_button=linphone_gtk_get_widget(callview,"accept_call"); image=create_pixmap (linphone_gtk_get_ui_config("start_call_icon","startcall-green.png")); if (with_pause){ gtk_button_set_label(GTK_BUTTON(answer_button), _("Pause all calls\nand answer")); }else gtk_button_set_label(GTK_BUTTON(answer_button),_("Answer")); gtk_button_set_image(GTK_BUTTON(answer_button),image); gtk_widget_show(image); image=create_pixmap (linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png")); gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(callview,"decline_call")),image); gtk_widget_show(image); if (pbuf!=NULL){ gtk_image_set_from_animation(GTK_IMAGE(animation),pbuf); g_object_unref(G_OBJECT(pbuf)); }else gtk_image_set_from_stock(GTK_IMAGE(animation),GTK_STOCK_EXECUTE,GTK_ICON_SIZE_DIALOG); }
void transfer_button_clicked(GtkWidget *button, gpointer call_ref) { GtkWidget *menu_item; GtkWidget *menu=gtk_menu_new(); LinphoneCall *call=(LinphoneCall*)call_ref; LinphoneCore *lc=linphone_gtk_get_core(); const MSList *elem=linphone_core_get_calls(lc); for(; elem!=NULL; elem=elem->next) { LinphoneCall *other_call=(LinphoneCall*)elem->data; GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(other_call); if (other_call!=call) { int call_index=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(call_view),"call_index")); char *remote_uri=linphone_call_get_remote_address_as_string (other_call); char *text=g_strdup_printf(_("Transfer to call #%i with %s"),call_index,remote_uri); menu_item=gtk_image_menu_item_new_with_label(text); ms_free(remote_uri); g_free(text); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),create_pixmap("status-green.png")); gtk_widget_show(menu_item); gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item); g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_transfer_call,other_call); } } gtk_menu_popup(GTK_MENU(menu),NULL,NULL,NULL,NULL,0,gtk_get_current_event_time()); gtk_widget_show(menu); }
void linphone_gtk_call_update_tab_header(LinphoneCall *call,gboolean pause) { GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *main_window=linphone_gtk_get_main_window(); GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(main_window,"viewswitch")); gint call_index=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"call_index")); GtkWidget *new_label=gtk_hbox_new (FALSE,0); GtkWidget *i=NULL; GtkWidget *l; gchar *text; if(pause) { i=gtk_image_new_from_stock(GTK_STOCK_MEDIA_PAUSE,GTK_ICON_SIZE_SMALL_TOOLBAR); } else { i=create_pixmap ("startcall-small.png"); } text=g_strdup_printf(_("Call #%i"),call_index); l=gtk_label_new (text); gtk_box_pack_start (GTK_BOX(new_label),i,FALSE,FALSE,0); gtk_box_pack_end(GTK_BOX(new_label),l,TRUE,TRUE,0); gtk_notebook_set_tab_label(notebook,w,new_label); gtk_widget_show_all(new_label); g_free(text); }
void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_msg){ 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)); if (error_msg==NULL) gtk_label_set_markup(GTK_LABEL(status),_("<b>Call ended.</b>")); else{ char *msg=g_markup_printf_escaped("<span color=\"red\"><b>%s</b></span>",error_msg); gtk_label_set_markup(GTK_LABEL(status),msg); g_free(msg); } linphone_gtk_in_call_set_animation_image(callview, linphone_gtk_get_ui_config("stop_call_icon","stopcall-red.png"),FALSE); gtk_widget_hide(linphone_gtk_get_widget(callview,"answer_decline_panel")); gtk_widget_hide(linphone_gtk_get_widget(callview,"incall_audioview")); linphone_gtk_enable_mute_button( GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),FALSE); linphone_gtk_enable_hold_button(call,FALSE,TRUE); 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_in_call_view_show_encryption(LinphoneCall *call){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *encryption_box=linphone_gtk_get_widget(callview,"encryption_box"); GtkWidget *label=linphone_gtk_get_widget(callview,"encryption_label"); GtkWidget *status_icon=linphone_gtk_get_widget(callview,"encryption_status_icon"); GtkWidget *verify_button=linphone_gtk_get_widget(callview,"encryption_verify_button"); LinphoneMediaEncryption me=linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)); bool_t verified=linphone_call_get_authentication_token_verified(call); switch(me){ case LinphoneMediaEncryptionSRTP: gtk_widget_show_all(encryption_box); gtk_label_set_markup(GTK_LABEL(label),_("Secured by SRTP")); gtk_widget_hide(status_icon); gtk_widget_hide(verify_button); break; case LinphoneMediaEncryptionZRTP: { gchar *text=g_strdup_printf(_("Secured by ZRTP - [auth token: %s]"),linphone_call_get_authentication_token(call)); gtk_label_set_markup(GTK_LABEL(label),text); g_free(text); gtk_image_set_from_stock(GTK_IMAGE(status_icon), verified ? GTK_STOCK_APPLY : GTK_STOCK_DIALOG_WARNING,GTK_ICON_SIZE_MENU); gtk_button_set_label(GTK_BUTTON(verify_button), verified ? _("Set unverified") : _("Set verified")); gtk_widget_show_all(encryption_box); } break; default: gtk_widget_hide_all(encryption_box); } }
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(GTK_BUTTON(button),!holdon); }
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</b>")); gtk_image_set_from_stock(GTK_IMAGE(animation),GTK_STOCK_MEDIA_PAUSE,GTK_ICON_SIZE_DIALOG); }
void linphone_gtk_enable_video_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,"video_button"); gtk_widget_set_sensitive(GTK_WIDGET(button),sensitive); gtk_widget_set_visible(GTK_WIDGET(button),sensitive); }
/* * Linphone core callback */ static void linphonec_notify_received(LinphoneCore *lc, LinphoneCall *call, const char *from,const char *event) { if(!strcmp(event,"refer")) { linphonec_out("The distand endpoint %s of call %li has been transfered, you can safely close the call.\n", from,(long)linphone_call_get_user_pointer (call)); } }
static void linphonec_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t encrypted, const char *auth_token) { long id=(long)linphone_call_get_user_pointer (call); if (!encrypted) { linphonec_out("Call %i is not fully encrypted and auth token is %s.\n", id, (auth_token != NULL) ? auth_token : "absent"); } else { linphonec_out("Call %i is fully encrypted and auth token is %s.\n", id, (auth_token != NULL) ? auth_token : "absent"); } }
/* * Linphone core callback */ static void linphonec_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState new_call_state) { char *remote=linphone_call_get_remote_address_as_string(call); if (new_call_state==LinphoneCallConnected){ linphonec_out("The distant endpoint %s of call %li has been transfered, you can safely close the call.\n", remote,(long)linphone_call_get_user_pointer (call)); } ms_free(remote); }
LinphoneCall *linphonec_get_call(long id){ const MSList *elem=linphone_core_get_calls(linphonec); for (;elem!=NULL;elem=elem->next){ LinphoneCall *call=(LinphoneCall*)elem->data; if (linphone_call_get_user_pointer (call)==(void*)id){ return call; } } linphonec_out("Sorry, no call with id %i exists at this time.\n",id); return NULL; }
void linphone_gtk_enable_conference_button(LinphoneCore *lc, gboolean value) { const MSList *elem=linphone_core_get_calls(lc); for(; elem!=NULL; elem=elem->next) { LinphoneCall *call=(LinphoneCall*)elem->data; GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *button=linphone_gtk_get_widget (call_view,"conference_button"); if (button != NULL) { gtk_widget_set_sensitive(button,value); } } }
void linphone_gtk_in_call_view_update_duration(LinphoneCall *call) { GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *duration_label=linphone_gtk_get_widget(callview,"in_call_duration"); int duration=linphone_call_get_duration(call); char tmp[256]= {0}; int seconds=duration%60; int minutes=(duration/60)%60; int hours=duration/3600; snprintf(tmp,sizeof(tmp)-1,"%02i::%02i::%02i",hours,minutes,seconds); gtk_label_set_text(GTK_LABEL(duration_label),tmp); }
void linphone_gtk_in_call_view_set_calling(LinphoneCall *call) { GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri"); GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration"); gtk_label_set_markup(GTK_LABEL(status),_("<b>Calling...</b>")); display_peer_name_in_label(callee,linphone_call_get_remote_address (call)); gtk_label_set_text(GTK_LABEL(duration),_("00::00::00")); linphone_gtk_in_call_set_animation_spinner(callview); }
void linphone_gtk_remove_in_call_view(LinphoneCall *call){ 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"); 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); linphone_call_set_user_pointer (call,NULL); linphone_call_unref(call); gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), 0); }
static gboolean resize_video_window(LinphoneCall *call){ const LinphoneCallParams *params=linphone_call_get_current_params(call); if (params){ MSVideoSize vsize=linphone_call_params_get_received_video_size(params); if (vsize.width>0 && vsize.height>0){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *video_window=(GtkWidget*)g_object_get_data(G_OBJECT(callview),"video_window"); if (video_window){ _resize_video_window(video_window,vsize); } } } return TRUE; }
void linphone_gtk_in_call_view_set_calling(LinphoneCall *call){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri"); 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("calling_anim.gif"); gtk_label_set_markup(GTK_LABEL(status),_("<b>Calling...</b>")); display_peer_name_in_label(callee,linphone_call_get_remote_address (call)); gtk_label_set_text(GTK_LABEL(duration),_("00::00::00")); if (pbuf!=NULL){ gtk_image_set_from_animation(GTK_IMAGE(animation),pbuf); g_object_unref(G_OBJECT(pbuf)); }else gtk_image_set_from_stock(GTK_IMAGE(animation),GTK_STOCK_FIND,GTK_ICON_SIZE_DIALOG); }
static void linphone_gtk_show_call_stats(LinphoneCall *call) { GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(w),"call_stats"); if (call_stats==NULL) { guint tid; call_stats=linphone_gtk_create_window("call_statistics", NULL); g_object_set_data(G_OBJECT(w),"call_stats",call_stats); g_object_set_data(G_OBJECT(call_stats),"call",linphone_call_ref(call)); tid=g_timeout_add(1000,(GSourceFunc)refresh_call_stats,call_stats); g_object_set_data(G_OBJECT(call_stats),"tid",GINT_TO_POINTER(tid)); g_signal_connect_swapped(G_OBJECT(call_stats),"destroy",(GCallback)on_call_stats_destroyed,(gpointer)w); show_used_codecs(call_stats,call); refresh_call_stats(call_stats); gtk_widget_show(call_stats); } }
void linphone_gtk_record_call_toggled(GtkWidget *button) { gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); gboolean is_conf=FALSE; const char *filepath; gchar *message; LinphoneCore *lc=linphone_gtk_get_core(); LinphoneCall *call=linphone_gtk_get_currently_displayed_call(&is_conf); GtkWidget *callview; GtkWidget *label; if (call) { const LinphoneCallParams *params; callview=(GtkWidget*)linphone_call_get_user_pointer (call); params=linphone_call_get_current_params(call); filepath=linphone_call_params_get_record_file(params); label=linphone_gtk_get_widget(callview,"record_status"); } else if (is_conf) { GtkWidget *mw=linphone_gtk_get_main_window(); callview=(GtkWidget *)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"conf_frame"); label=linphone_gtk_get_widget(callview,"conf_record_status"); filepath=(const char*)g_object_get_data(G_OBJECT(mw),"conf_record_path"); if (filepath==NULL) { filepath=linphone_gtk_get_record_path(NULL,TRUE); g_object_set_data_full(G_OBJECT(mw),"conf_record_path",(char*)filepath,g_free); } } else { g_warning("linphone_gtk_record_call_toggled(): bug."); return; } message=g_strdup_printf(_("<small><i>Recording into\n%s %s</i></small>"),filepath,active ? "" : _("(Paused)")); if (active) { if (call) linphone_call_start_recording(call); else linphone_core_start_conference_recording(lc,filepath); } else { if (call) linphone_call_stop_recording(call); else linphone_core_stop_conference_recording(lc); } gtk_label_set_markup(GTK_LABEL(label),message); g_free(message); }
void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call) { GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); GtkWidget *callee=linphone_gtk_get_widget(callview,"in_call_uri"); GtkWidget *duration=linphone_gtk_get_widget(callview,"in_call_duration"); guint taskid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(callview),"taskid")); gboolean in_conf=linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call)); GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(callview),"call_stats"); linphone_gtk_in_call_show_video(call); 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),in_conf ? _("In conference") : _("<b>In call</b>")); gtk_widget_set_sensitive(linphone_gtk_get_widget(callview,"conference_button"),!in_conf); gtk_widget_set_sensitive(linphone_gtk_get_widget(callview,"transfer_button"),!in_conf); gtk_label_set_text(GTK_LABEL(duration),_("00::00::00")); linphone_gtk_in_call_set_animation_image(callview,GTK_STOCK_MEDIA_PLAY,TRUE); linphone_gtk_call_update_tab_header(call,FALSE); linphone_gtk_enable_mute_button( GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),TRUE); if (taskid==0) { taskid=g_timeout_add(250,(GSourceFunc)linphone_gtk_in_call_view_refresh,call); g_object_set_data(G_OBJECT(callview),"taskid",GINT_TO_POINTER(taskid)); } linphone_gtk_in_call_view_enable_audio_view(call, !in_conf); linphone_gtk_in_call_view_show_encryption(call); if (in_conf) { linphone_gtk_set_in_conference(call); gtk_widget_set_sensitive(linphone_gtk_get_widget(callview,"incall_mute"),FALSE); gtk_widget_set_sensitive(linphone_gtk_get_widget(callview,"hold_call"),FALSE); } else { linphone_gtk_unset_from_conference(call); /*in case it was previously*/ gtk_widget_set_sensitive(linphone_gtk_get_widget(callview,"incall_mute"),TRUE); gtk_widget_set_sensitive(linphone_gtk_get_widget(callview,"hold_call"),TRUE); } gtk_widget_show_all(linphone_gtk_get_widget(callview,"buttons_panel")); if (!in_conf) gtk_widget_show_all(linphone_gtk_get_widget(callview,"record_hbox")); else gtk_widget_hide(linphone_gtk_get_widget(callview,"record_hbox")); if (call_stats) show_used_codecs(call_stats,call); }
static gboolean linphone_gtk_in_call_view_refresh(LinphoneCall *call) { GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *qi=linphone_gtk_get_widget(callview,"quality_indicator"); float rating=linphone_call_get_current_quality(call); GdkColor color; gchar tmp[50]; linphone_gtk_in_call_view_update_duration(call); if (rating>=0) { gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(qi),rating/5.0); snprintf(tmp,sizeof(tmp),"%.1f (%s)",rating,rating_to_text(rating)); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(qi),tmp); } else { gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(qi),0); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(qi),_("unavailable")); } rating_to_color(rating,&color); gtk_widget_modify_bg(qi,GTK_STATE_NORMAL,&color); return TRUE; }
void linphone_gtk_in_call_view_enable_audio_view(LinphoneCall *call, gboolean val) { GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *audio_view=linphone_gtk_get_widget(callview,"incall_audioview"); GtkWidget *mic_level=linphone_gtk_get_widget(callview,"mic_audiolevel"); GtkWidget *spk_level=linphone_gtk_get_widget(callview,"spk_audiolevel"); GtkWidget *spk_vol_ctrl = linphone_gtk_get_widget(callview, "incall_spk_vol_ctrl_button"); GtkWidget *mic_vol_ctrl = linphone_gtk_get_widget(callview, "incall_mic_vol_ctrl_button"); if (val) { linphone_gtk_init_audio_meter(mic_level,(get_volume_t)linphone_call_get_record_volume,call); linphone_gtk_init_audio_meter(spk_level,(get_volume_t)linphone_call_get_play_volume,call); volume_control_init(spk_vol_ctrl, VOLUME_CTRL_PLAYBACK, call); volume_control_init(mic_vol_ctrl, VOLUME_CTRL_RECORD, call); gtk_widget_show_all(audio_view); } else { linphone_gtk_uninit_audio_meter(mic_level); linphone_gtk_uninit_audio_meter(spk_level); gtk_widget_hide(audio_view); } }