Example #1
0
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);
}
Example #2
0
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));
	}
}
Example #3
0
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);
}
Example #4
0
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));
	}
}
Example #5
0
static GtkWidget *create_video_window(LinphoneCall *call){
	char *remote,*title;
	GtkWidget *video_window;
	const LinphoneAddress *addr;
	guint timeout;
	MSVideoSize vsize={MS_VIDEO_SIZE_CIF_W,MS_VIDEO_SIZE_CIF_H};
	GdkColor color;

	addr=linphone_call_get_remote_address(call);
	remote=linphone_gtk_address(addr);
	video_window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	/*gtk_window_set_transient_for(GTK_WINDOW(video_window), GTK_WINDOW(linphone_gtk_get_main_window()));*/
	title=g_strdup_printf("%s - Video call with %s",linphone_gtk_get_ui_config("title","Linphone"),remote);
	ms_free(remote);
	gtk_window_set_title(GTK_WINDOW(video_window),title);
	g_free(title);
	gtk_window_resize(GTK_WINDOW(video_window),vsize.width,vsize.height);
	gdk_color_parse("black",&color);
	gtk_widget_modify_bg(video_window,GTK_STATE_NORMAL,&color);

	gtk_drag_dest_set(video_window, GTK_DEST_DEFAULT_ALL, targets, sizeof(targets)/sizeof(GtkTargetEntry), GDK_ACTION_COPY);
	gtk_widget_show(video_window);
	gdk_window_set_events(gtk_widget_get_window(video_window),
			      gdk_window_get_events(gtk_widget_get_window(video_window)) | GDK_POINTER_MOTION_MASK);
	timeout=g_timeout_add(500,(GSourceFunc)resize_video_window,call);
	g_signal_connect(video_window,"destroy",(GCallback)on_video_window_destroy,GINT_TO_POINTER(timeout));
	g_signal_connect(video_window,"key-press-event",(GCallback)on_video_window_key_press,NULL);
	g_signal_connect_swapped(video_window,"motion-notify-event",(GCallback)show_video_controls,video_window);
	g_signal_connect(video_window,"configure-event",(GCallback)video_window_moved,NULL);
	g_signal_connect(video_window, "drag-data-received",(GCallback)drag_data_received, NULL);
	g_signal_connect(video_window, "drag-drop",(GCallback)drag_drop, NULL);
	g_object_set_data(G_OBJECT(video_window),"call",call);
	return video_window;
}
Example #6
0
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);
}
Example #7
0
static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const LinphoneAddress *remote) {
	MSList *elem;
	ms_warning(" searching for already_a_call_with_remote_address.");

	for(elem=lc->calls;elem!=NULL;elem=elem->next){
		const LinphoneCall *call=(LinphoneCall*)elem->data;
		const LinphoneAddress *cRemote=linphone_call_get_remote_address(call);
		if (linphone_address_weak_equal(cRemote,remote)) {
			ms_warning("already_a_call_with_remote_address found.");
			return TRUE;
		}
	}
	return FALSE;
}
Example #8
0
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);
}
Example #9
0
void conferenceframe::set_in_conference(LinphoneCall *call)
{
	const LinphoneAddress *addr;
	QProgressBar *progressBar_speaker=NULL;
	QLabel *urilabel=NULL;
	sound_indicator* si;
	char *tmp;
	QString markup;
	int call_count=0;
	if(!call) return;
	if(_conferencealls.value(call)) return;
	call_count = _conferencealls.count();
	addr=linphone_call_get_remote_address(call);
	if (linphone_address_get_display_name(addr)!=NULL){
		markup.sprintf("<b>%s</b>",linphone_address_get_display_name(addr));
	}else{
		tmp=linphone_address_as_string_uri_only(addr);
		markup.sprintf("%s",tmp);
		ms_free(tmp);
	}
	si = new sound_indicator;
	/* 创建界面 */
	progressBar_speaker = new QProgressBar(this);
	progressBar_speaker->setStyleSheet("QProgressBar::chunk {background-color: grey;} QProgressBar{text-align: center;}");
	progressBar_speaker->setTextVisible(false);
	progressBar_speaker->setEnabled(true);
	progressBar_speaker->setValue(0);
	progressBar_speaker->setRange(0,100);
	QSizePolicy sizePolicy3(QSizePolicy::Expanding, QSizePolicy::Fixed);
	sizePolicy3.setHorizontalStretch(0);
	sizePolicy3.setVerticalStretch(0);
	sizePolicy3.setHeightForWidth(progressBar_speaker->sizePolicy().hasHeightForWidth());
	progressBar_speaker->setSizePolicy(sizePolicy3);
    progressBar_speaker->setAutoFillBackground(false);
	progressBar_speaker->setOrientation(Qt::Horizontal);
	progressBar_speaker->setInvertedAppearance(false);
	urilabel = new QLabel(this);
	urilabel->setText(markup);
	ui->gridLayout->addWidget(progressBar_speaker, call_count+1, 3, 1, 1);
	ui->gridLayout->addWidget(urilabel, call_count+1, 2, 1, 1);

	si->sound_meter = progressBar_speaker;
	si->speaker_last_value = 0;
	si->urilabel = urilabel;
	_conferencealls.insert(call, si);
}
Example #10
0
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);
}
Example #11
0
static void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage* msg){
	SalOp *op=NULL;
	LinphoneCall *call;
	char* content_type;
	const char *identity=NULL;
	time_t t=time(NULL);
	
	if (lp_config_get_int(cr->lc->config,"sip","chat_use_call_dialogs",0)){
		if((call = linphone_core_get_call_by_remote_address(cr->lc,cr->peer))!=NULL){
			if (call->state==LinphoneCallConnected ||
			call->state==LinphoneCallStreamsRunning ||
			call->state==LinphoneCallPaused ||
			call->state==LinphoneCallPausing ||
			call->state==LinphoneCallPausedByRemote){
				ms_message("send SIP message through the existing call.");
				op = call->op;
				call->pending_message=msg;
				identity=linphone_core_find_best_identity(cr->lc,linphone_call_get_remote_address(call));
			}
		}
	}
	msg->time=t;
	if (op==NULL){
		LinphoneProxyConfig *proxy=linphone_core_lookup_known_proxy(cr->lc,cr->peer_url);
		if (proxy){
			identity=linphone_proxy_config_get_identity(proxy);
		}else identity=linphone_core_get_primary_contact(cr->lc);
		/*sending out of calls*/
		op = sal_op_new(cr->lc->sal);
		linphone_configure_op(cr->lc,op,cr->peer_url,msg->custom_headers,lp_config_get_int(cr->lc->config,"sip","chat_msg_with_contact",0));
		sal_op_set_user_pointer(op, msg); /*if out of call, directly store msg*/
	}
	if (msg->external_body_url) {
		content_type=ms_strdup_printf("message/external-body; access-type=URL; URL=\"%s\"",msg->external_body_url);
		sal_message_send(op,identity,cr->peer,content_type, NULL);
		ms_free(content_type);
	} else {
		sal_text_send(op, identity, cr->peer,msg->message);
	}
	msg->dir=LinphoneChatMessageOutgoing;
	msg->from=linphone_address_new(identity);
	msg->storage_id=linphone_chat_message_store(msg);
}
Example #12
0
void linphone_gtk_in_call_view_set_incoming(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 *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,"buttons_panel"));
    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-small.png"));
    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-small.png"));
    gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(callview,"decline_call")),image);
    gtk_widget_show(image);

    linphone_gtk_in_call_set_animation_image(callview,GTK_STOCK_DIALOG_INFO,TRUE);
}
Example #13
0
/**
 * Returns the remote address associated to this call as a string.
 *
 * The result string must be freed by user using ms_free().
**/
char *linphone_call_get_remote_address_as_string(const LinphoneCall *call){
	return linphone_address_as_string(linphone_call_get_remote_address(call));
}