Merge remote-tracking branch 'origin/master' into dev_videoios

Conflicts:
	mediastreamer2
This commit is contained in:
Jehan Monnier 2011-09-21 08:28:17 +02:00
commit 191084508f
36 changed files with 1769 additions and 922 deletions

8
NEWS
View file

@ -1,3 +1,11 @@
linphone-3.5.0 -- future date
* added VP-8 video codec
* UI: call history tab, menu simplified
* UI: cosmetics for incall views
* UI: integration with libnotify
* UI: show registered SIP accounts
* Fixes for MacOS X, and uses GtkQuartz engine
linphone-3.4.3 -- March 28, 2011
* Fully ported to mac os x with gtk-osx (menu integration, bundle generation with "make bundle", sound I/O improved) but still audio only
* Fix stupid warning "no response" that sometimes arrived at end of calls

View file

@ -47,6 +47,7 @@ LOCAL_SRC_FILES := \
offeranswer.c \
callbacks.c \
linphonecall.c \
conference.c \
ec-calibrator.c
ifndef MY_LOG_DOMAIN

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT([linphone],[3.4.99.1],[linphone-developers@nongnu.org])
AC_INIT([linphone],[3.4.99.2],[linphone-developers@nongnu.org])
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([coreapi/linphonecore.c])
@ -153,6 +153,37 @@ else
echo "GTK interface compilation is disabled."
fi
AC_ARG_ENABLE(notify,
[ --enable-notify=[yes/no] Enable libnotify support [default=yes]],
[case "${enableval}" in
yes) notify=true ;;
no) notify=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-notify) ;;
esac],[notify=true])
dnl conditionnal build of the notify library
if test "$gtk_ui" = "true" ; then
if test "$notify" = "true"; then
PKG_CHECK_MODULES([NOTIFY4], [libnotify >= 0.7.0 ], [found_notify4=yes], foo=bar)
case "$found_notify4" in
yes)
AC_SUBST(NOTIFY4_CFLAGS)
AC_SUBST(NOTIFY4_LIBS)
AC_DEFINE([HAVE_NOTIFY4],[1],[NOTIFY4 support])
esac
PKG_CHECK_MODULES([NOTIFY1], [libnotify < 0.7.0], [found_notify1=yes], foo=bar)
case "$found_notify1" in
yes)
AC_SUBST(NOTIFY1_CFLAGS)
AC_SUBST(NOTIFY1_LIBS)
AC_DEFINE([HAVE_NOTIFY1],[1],[NOTIFY1 support])
esac
else
NotifyNotification *n;
echo "Libnotify support is disabled."
fi
fi
dnl os-specific problems not handled by existing macros.
case "$host_os" in

View file

@ -102,6 +102,7 @@ static int lpc_cmd_vfureq(LinphoneCore *lc, char *arg);
static int lpc_cmd_states(LinphoneCore *lc, char *args);
static int lpc_cmd_identify(LinphoneCore *lc, char *args);
static int lpc_cmd_ringback(LinphoneCore *lc, char *args);
static int lpc_cmd_conference(LinphoneCore *lc, char *args);
/* Command handler helpers */
static void linphonec_proxy_add(LinphoneCore *lc);
@ -122,8 +123,7 @@ static int linphonec_friend_delete(LinphoneCore *lc, int num);
static void linphonec_codec_list(int type, LinphoneCore *lc);
static void linphonec_codec_enable(int type, LinphoneCore *lc, int index);
static void linphonec_codec_disable(int type, LinphoneCore *lc, int index);
static void lpc_display_call_states(LinphoneCore *lc);
/* Command table management */
static LPC_COMMAND *lpc_find_command(const char *name);
@ -184,6 +184,10 @@ static LPC_COMMAND commands[] = {
"'transfer <call id> <sip-uri>': transfers the call with 'id' to the destination sip-uri\n"
"'transfer <call id1> --to-call <call id2>': transfers the call with 'id1' to the destination of call 'id2' (attended transfer)\n"
},
{ "conference", lpc_cmd_conference, "Create and manage an audio conference.",
"'conference add <call id> : join the call with id 'call id' into the audio conference."
"'conference rm <call id> : remove the call with id 'call id' from the audio conference."
},
{ "mute", lpc_cmd_mute_mic,
"Mute microphone and suspend voice transmission."},
#ifdef VIDEO_ENABLED
@ -523,37 +527,6 @@ lpc_cmd_help(LinphoneCore *lc, char *arg)
static char callee_name[256]={0};
static char caller_name[256]={0};
static const char *get_call_status(LinphoneCall *call){
switch(linphone_call_get_state(call)){
case LinphoneCallPaused:
if (linphone_call_get_refer_to (call)!=NULL){
return "Paused (transfered)";
}else{
return "Paused";
}
break;
case LinphoneCallPausedByRemote:
return "Paused by remote";
break;
case LinphoneCallIncomingReceived:
return "Pending";
break;
case LinphoneCallOutgoingInit:
case LinphoneCallOutgoingProgress:
return "Dialing out";
break;
case LinphoneCallOutgoingEarlyMedia:
case LinphoneCallOutgoingRinging:
return "Remote ringing";
break;
default:
if (linphone_call_has_transfer_pending(call)){
return "Running (transfer pending)";
}else
return "Running";
}
return "";
}
static int
lpc_cmd_call(LinphoneCore *lc, char *args)
@ -599,19 +572,7 @@ lpc_cmd_calls(LinphoneCore *lc, char *args){
const MSList *calls = linphone_core_get_calls(lc);
if(calls)
{
const MSList *p_calls = calls;
linphonec_out("ID\t\tDestination\t\t\t\tStatus\n---------------------------------------------------------------------\n");
while(p_calls != NULL)
{
LinphoneCall *call=(LinphoneCall*)p_calls->data;
char *tmp=linphone_call_get_remote_address_as_string(call);
linphonec_out("%li\t%s\t\t\t%s\r\n",
(long)linphone_call_get_user_pointer (call),
tmp,
get_call_status(call));
p_calls = p_calls->next;
ms_free(tmp);
}
lpc_display_call_states(lc);
}else
{
linphonec_out("No active call.\n");
@ -1461,6 +1422,32 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
}
static int lpc_cmd_conference(LinphoneCore *lc, char *args){
long id;
char subcommand[32]={0};
int n;
if (args==NULL) return 0;
n=sscanf(args, "%31s %li", subcommand,&id);
if (n == 2){
LinphoneCall *call=linphonec_get_call(id);
if (call==NULL) return 1;
if (strcmp(subcommand,"add")==0){
linphone_core_add_to_conference(lc,call);
return 1;
}else if (strcmp(subcommand,"rm")==0){
linphone_core_remove_from_conference(lc,call);
return 1;
}else if (strcmp(subcommand,"enter")==0){
linphone_core_enter_conference(lc);
return 1;
}else if (strcmp(subcommand,"leave")==0){
linphone_core_leave_conference(lc);
return 1;
}
}
return 0;
}
/***************************************************************************
*
* Commands helper functions
@ -2403,17 +2390,21 @@ static void lpc_display_call_states(LinphoneCore *lc){
const MSList *elem;
char *tmp;
linphonec_out("Call states\n"
"Id | Destination | State\n"
"---------------------------------------------------------------\n");
"Id | Destination | State | Flags |\n"
"------------------------------------------------------------------------\n");
elem=linphone_core_get_calls(lc);
if (elem==NULL){
linphonec_out("(empty)\n");
}else{
for(;elem!=NULL;elem=elem->next){
const char *flag;
call=(LinphoneCall*)elem->data;
bool_t in_conference=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
tmp=linphone_call_get_remote_address_as_string (call);
linphonec_out("%-2i | %-35s | %s\n",(int)(long)linphone_call_get_user_pointer(call),
tmp,linphone_call_state_to_string(linphone_call_get_state(call)));
flag=in_conference ? "conferencing" : "";
flag=linphone_call_has_transfer_pending(call) ? "transfer pending" : flag;
linphonec_out("%-2i | %-35s | %-15s | %s\n",(int)(long)linphone_call_get_user_pointer(call),
tmp,linphone_call_state_to_string(linphone_call_get_state(call))+strlen("LinphoneCall"),flag);
ms_free(tmp);
}
}

View file

@ -36,7 +36,8 @@ liblinphone_la_SOURCES=\
sipsetup.c sipsetup.h \
siplogin.c \
lsd.c linphonecore_utils.h \
ec-calibrator.c
ec-calibrator.c \
conference.c
liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined

View file

@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void register_failure(SalOp *op, SalError error, SalReason reason, const char *details);
static bool_t media_parameters_changed(LinphoneCall *call, SalMediaDescription *oldmd, SalMediaDescription *newmd){
if (call->params.in_conference!=call->current_params.in_conference) return TRUE;
return !sal_media_description_equals(oldmd,newmd) || call->up_bw!=linphone_core_get_upload_bandwidth(call->core);
}
@ -194,7 +195,8 @@ static void call_received(SalOp *h){
ms_message("the local ring is already started");
}
}else{
/*TODO : play a tone within the context of the current call */
/* play a tone within the context of the current call */
linphone_core_play_tone(lc);
}
@ -680,12 +682,6 @@ static void subscribe_closed(SalOp *op, const char *from){
linphone_subscription_closed(lc,op);
}
static void internal_message(Sal *sal, const char *msg){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal);
if (lc->vtable.show)
lc->vtable.show(lc);
}
static void ping_reply(SalOp *op){
LinphoneCall *call=(LinphoneCall*) sal_op_get_user_pointer(op);
ms_message("ping reply !");
@ -721,7 +717,6 @@ SalCallbacks linphone_sal_callbacks={
notify_presence,
subscribe_received,
subscribe_closed,
internal_message,
ping_reply
};

186
coreapi/conference.c Normal file
View file

@ -0,0 +1,186 @@
/***************************************************************************
* conference.c
*
* Mon Sep 12, 2011
* Copyright 2011 Belledonne Communications
* Author: Simon Morlat
* Email simon dot morlat at linphone dot org
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "private.h"
static void conference_check_init(LinphoneConference *ctx){
if (ctx->conf==NULL){
ctx->conf=ms_audio_conference_new();
}
}
static void remove_local_endpoint(LinphoneConference *ctx){
if (ctx->local_endpoint){
ms_audio_conference_remove_member(ctx->conf,ctx->local_endpoint);
ms_audio_endpoint_release_from_stream(ctx->local_endpoint);
ctx->local_endpoint=NULL;
audio_stream_stop(ctx->local_participant);
ctx->local_participant=NULL;
}
}
static void conference_check_uninit(LinphoneConference *ctx){
if (ctx->conf){
if (ctx->conf->nmembers==0){
remove_local_endpoint(ctx);
ms_audio_conference_destroy(ctx->conf);
ctx->conf=NULL;
}
}
}
void linphone_call_add_to_conf(LinphoneCall *call){
LinphoneCore *lc=call->core;
LinphoneConference *conf=&lc->conf_ctx;
MSAudioEndpoint *ep;
ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE);
ms_audio_conference_add_member(conf->conf,ep);
call->endpoint=ep;
}
void linphone_call_remove_from_conf(LinphoneCall *call){
LinphoneCore *lc=call->core;
LinphoneConference *conf=&lc->conf_ctx;
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){
/*create a dummy audiostream in order to extract the local part of it */
/* network address and ports have no meaning and are not used here. */
AudioStream *st=audio_stream_new(65000,FALSE);
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
audio_stream_start_full(st, &av_profile,
"127.0.0.1",
65000,
65001,
0,
40,
NULL,
NULL,
playcard,
captcard,
linphone_core_echo_cancellation_enabled(lc)
);
_post_configure_audio_stream(st,lc,FALSE);
conf->local_participant=st;
conf->local_endpoint=ms_audio_endpoint_get_from_stream(st,FALSE);
ms_audio_conference_add_member(conf->conf,conf->local_endpoint);
}
int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){
LinphoneCallParams params;
LinphoneConference *conf=&lc->conf_ctx;
if (call->current_params.in_conference){
ms_error("Already in conference");
return -1;
}
conference_check_init(&lc->conf_ctx);
call->params.in_conference=TRUE;
call->params.has_video=FALSE;
params=call->params;
if (call->state==LinphoneCallPaused)
linphone_core_resume_call(lc,call);
else if (call->state==LinphoneCallStreamsRunning){
/*this will trigger a reINVITE that will later redraw the streams */
if (call->audiostream || call->videostream)
linphone_call_stop_media_streams (call); /*free the audio & video local resources*/
linphone_core_update_call(lc,call,&params);
add_local_endpoint(conf,lc);
}else{
ms_error("Call is in state %s, it cannot be added to the conference.",linphone_call_state_to_string(call->state));
return -1;
}
return 0;
}
int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){
if (!call->current_params.in_conference){
if (call->params.in_conference){
ms_warning("Not (yet) in conference, be patient");
return -1;
}else{
ms_error("Not in a conference.");
return -1;
}
}
call->params.in_conference=FALSE;
return linphone_core_pause_call(lc,call);
}
bool_t linphone_core_is_in_conference(const LinphoneCore *lc){
return lc->conf_ctx.local_participant!=NULL;
}
int linphone_core_leave_conference(LinphoneCore *lc){
LinphoneConference *conf=&lc->conf_ctx;
if (linphone_core_is_in_conference(lc))
remove_local_endpoint(conf);
return 0;
}
int linphone_core_enter_conference(LinphoneCore *lc){
LinphoneConference *conf=&lc->conf_ctx;
if (conf->local_participant==NULL) add_local_endpoint(conf,lc);
return 0;
}
int linphone_core_add_all_to_conference(LinphoneCore *lc) {
MSList *calls=lc->calls;
while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next;
if (!call->current_params.in_conference) {
linphone_core_add_to_conference(lc, call);
}
}
return 0;
}
int linphone_core_terminate_conference(LinphoneCore *lc) {
MSList *calls=lc->calls;
while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next;
if (call->current_params.in_conference) {
linphone_core_terminate_call(lc, call);
}
}
return 0;
}
int linphone_core_get_conference_size(LinphoneCore *lc) {
return ms_audio_conference_size(lc->conf_ctx.conf);
}

View file

@ -203,10 +203,6 @@ void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char
int linphone_friend_set_addr(LinphoneFriend *lf, const LinphoneAddress *addr){
LinphoneAddress *fr=linphone_address_clone(addr);
if (fr==NULL) {
ms_warning("Invalid friend sip uri: %s",addr);
return -1;
}
linphone_address_clean(fr);
if (lf->uri!=NULL) linphone_address_destroy(lf->uri);
lf->uri=fr;
@ -438,13 +434,15 @@ static bool_t username_match(const char *u1, const char *u2){
LinphoneFriend *linphone_core_get_friend_by_address(const LinphoneCore *lc, const char *uri){
LinphoneAddress *puri=linphone_address_new(uri);
const MSList *elem;
const char *username=linphone_address_get_username(puri);
const char *domain=linphone_address_get_domain(puri);
const char *username;
const char *domain;
LinphoneFriend *lf=NULL;
if (puri==NULL){
return NULL;
}
username=linphone_address_get_username(puri);
domain=linphone_address_get_domain(puri);
for(elem=lc->friends;elem!=NULL;elem=ms_list_next(elem)){
lf=(LinphoneFriend*)elem->data;
const char *it_username=linphone_address_get_username(lf->uri);

View file

@ -1,7 +1,7 @@
/*
linphone
Copyright (C) 2010 Belledonne Communications SARL
Copyright (C) 2010 Belledonne Communications SARL
(simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
@ -165,14 +165,14 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
LinphoneAddress *addr=linphone_address_new(me);
const char *username=linphone_address_get_username (addr);
SalMediaDescription *md=sal_media_description_new();
md->session_id=session_id;
md->session_ver=session_ver;
md->nstreams=1;
strncpy(md->addr,call->localip,sizeof(md->addr));
strncpy(md->username,username,sizeof(md->username));
md->bandwidth=linphone_core_get_download_bandwidth(lc);
/*set audio capabilities */
strncpy(md->streams[0].addr,call->localip,sizeof(md->streams[0].addr));
md->streams[0].port=call->audio_port;
@ -183,7 +183,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event"));
l=ms_list_append(l,pt);
md->streams[0].payloads=l;
if (call->params.has_video){
md->nstreams++;
@ -250,7 +250,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
if (port_offset==-1) return;
call->audio_port=linphone_core_get_audio_port(call->core)+port_offset;
call->video_port=linphone_core_get_video_port(call->core)+port_offset;
}
static void discover_mtu(LinphoneCore *lc, const char *remote){
@ -306,7 +306,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from,NULL),from_str);
ms_free(from_str);
}
linphone_address_clean(from);
linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip);
linphone_call_init_common(call, from, to);
@ -327,13 +327,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
static void linphone_call_set_terminated(LinphoneCall *call){
LinphoneCore *lc=call->core;
linphone_core_update_allocated_audio_bandwidth(lc);
call->owns_call_log=FALSE;
linphone_call_log_completed(call);
if (call == lc->current_call){
ms_message("Resetting the current call");
lc->current_call=NULL;
@ -342,10 +342,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
if (linphone_core_del_call(lc,call) != 0){
ms_error("Could not remove the call from the list !!!");
}
if (ms_list_size(lc->calls)==0)
linphone_core_notify_all_friends(lc,lc->presence_mode);
}
const char *linphone_call_state_to_string(LinphoneCallState cs){
@ -419,7 +419,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
if (cstate == LinphoneCallConnected) {
call->log->status=LinphoneCallSuccess;
}
if (lc->vtable.call_state_changed)
lc->vtable.call_state_changed(lc,call,cstate,message);
if (cstate==LinphoneCallReleased){
@ -588,7 +588,7 @@ const char *linphone_call_get_remote_user_agent(LinphoneCall *call){
* executed yet.
* Pending transfers are executed when this call is being paused or closed,
* locally or by remote endpoint.
* If the call is already paused while receiving the transfer request, the
* If the call is already paused while receiving the transfer request, the
* transfer immediately occurs.
**/
bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){
@ -680,6 +680,13 @@ bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams
return cp->real_early_media;
}
/**
* Returns true if the call is part of the locally managed conference.
**/
bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp){
return cp->in_conference;
}
/**
* Refine bandwidth settings for this call by setting a bandwidth limit for audio streams.
* As a consequence, codecs whose bitrates are not compatible with this limit won't be used.
@ -746,7 +753,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){
LinphoneCore *lc=call->core;
SalMediaDescription *md=call->localdesc;
AudioStream *audiostream;
call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc));
if (linphone_core_echo_limiter_enabled(lc)){
const char *type=lp_config_get_string(lc->config,"sound","el_type","mic");
@ -772,7 +779,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){
int enabled=lp_config_get_int(lc->config,"sound","noisegate",0);
audio_stream_enable_noise_gate(audiostream,enabled);
}
if (lc->a_rtp)
rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp);
@ -834,20 +841,17 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
}
}
static void post_configure_audio_streams(LinphoneCall*call){
AudioStream *st=call->audiostream;
LinphoneCore *lc=call->core;
void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted){
float mic_gain=lp_config_get_float(lc->config,"sound","mic_gain",1);
float thres = 0;
float recv_gain;
float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05);
float ng_floorgain=lp_config_get_float(lc->config,"sound","ng_floorgain",0);
int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0);
if (!call->audio_muted)
if (!muted)
audio_stream_set_mic_gain(st,mic_gain);
else
else
audio_stream_set_mic_gain(st,0);
recv_gain = lc->sound_conf.soft_play_lev;
@ -884,6 +888,12 @@ static void post_configure_audio_streams(LinphoneCall*call){
ms_filter_call_method(st->volrecv,MS_VOLUME_SET_NOISE_GATE_FLOORGAIN,&floorgain);
}
parametrize_equalizer(lc,st);
}
static void post_configure_audio_streams(LinphoneCall*call){
AudioStream *st=call->audiostream;
LinphoneCore *lc=call->core;
_post_configure_audio_stream(st,lc,call->audio_muted);
if (lc->vtable.dtmf_received!=NULL){
/* replace by our default action*/
audio_stream_play_received_dtmfs(call->audiostream,FALSE);
@ -900,11 +910,11 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
LinphoneCore *lc=call->core;
int up_ptime=0;
*used_pt=-1;
for(elem=desc->payloads;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
int number;
if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) {
if (desc->type==SalAudio){
linphone_core_update_allocated_audio_bandwidth_in_call(call,pt);
@ -921,8 +931,8 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
remote_bw=get_video_bandwidth(remote_bw,call->audio_bw);
}
}
if (desc->type==SalAudio){
if (desc->type==SalAudio){
bw=get_min_bandwidth(call->audio_bw,remote_bw);
}else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw);
if (bw>0) pt->normal_bitrate=bw*1000;
@ -953,180 +963,192 @@ static void setup_ring_player(LinphoneCore *lc, LinphoneCall *call){
ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
}
#define LINPHONE_RTCP_SDES_TOOL "Linphone-" LINPHONE_VERSION
static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cname, bool_t muted, bool_t send_ringbacktone, bool_t use_arc){
LinphoneCore *lc=call->core;
int jitt_comp=lc->rtp_conf.audio_jitt_comp;
int used_pt=-1;
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalAudio);
if (stream && stream->dir!=SalStreamInactive && stream->port!=0){
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
const char *playfile=lc->play_file;
const char *recfile=lc->rec_file;
call->audio_profile=make_profile(call,call->resultdesc,stream,&used_pt);
bool_t use_ec;
if (used_pt!=-1){
if (playcard==NULL) {
ms_warning("No card defined for playback !");
}
if (captcard==NULL) {
ms_warning("No card defined for capture !");
}
/*Replace soundcard filters by inactive file players or recorders
when placed in recvonly or sendonly mode*/
if (stream->port==0 || stream->dir==SalStreamRecvOnly){
captcard=NULL;
playfile=NULL;
}else if (stream->dir==SalStreamSendOnly){
playcard=NULL;
captcard=NULL;
recfile=NULL;
/*And we will eventually play "playfile" if set by the user*/
/*playfile=NULL;*/
}
if (send_ringbacktone){
captcard=NULL;
playfile=NULL;/* it is setup later*/
}
/*if playfile are supplied don't use soundcards*/
if (lc->use_files) {
captcard=NULL;
playcard=NULL;
}
if (call->params.in_conference){
/* first create the graph without soundcard resources*/
captcard=playcard=NULL;
}
use_ec=captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc);
audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc);
audio_stream_start_full(
call->audiostream,
call->audio_profile,
stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
stream->port,
stream->port+1,
used_pt,
jitt_comp,
playfile,
recfile,
playcard,
captcard,
use_ec
);
post_configure_audio_streams(call);
if (muted && !send_ringbacktone){
audio_stream_set_mic_gain(call->audiostream,0);
}
if (stream->dir==SalStreamSendOnly && playfile!=NULL){
int pause_time=500;
ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
}
if (send_ringbacktone){
setup_ring_player(lc,call);
}
audio_stream_set_rtcp_information(call->audiostream, cname, LINPHONE_RTCP_SDES_TOOL);
if (call->params.in_conference){
/*transform the graph to connect it to the conference filter */
linphone_call_add_to_conf(call);
}
}else ms_warning("No audio stream accepted ?");
}
}
static void linphone_call_start_video_stream(LinphoneCall *call, const char *cname,bool_t all_inputs_muted){
#ifdef VIDEO_ENABLED
LinphoneCore *lc=call->core;
int used_pt=-1;
const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalVideo);
/* shutdown preview */
if (lc->previewstream!=NULL) {
video_preview_stop(lc->previewstream);
lc->previewstream=NULL;
}
call->current_params.has_video=FALSE;
if (vstream && vstream->dir!=SalStreamInactive && vstream->port!=0) {
const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr;
call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt);
if (used_pt!=-1){
VideoStreamDir dir=VideoStreamSendRecv;
MSWebCam *cam=lc->video_conf.device;
bool_t is_inactive=FALSE;
call->current_params.has_video=TRUE;
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
if (lc->video_window_id!=0)
video_stream_set_native_window_id(call->videostream,lc->video_window_id);
if (lc->preview_window_id!=0)
video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id);
video_stream_use_preview_video_window (call->videostream,lc->use_preview_window);
if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){
cam=get_nowebcam_device();
dir=VideoStreamSendOnly;
}else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){
dir=VideoStreamRecvOnly;
}else if (vstream->dir==SalStreamSendRecv){
if (lc->video_conf.display && lc->video_conf.capture)
dir=VideoStreamSendRecv;
else if (lc->video_conf.display)
dir=VideoStreamRecvOnly;
else
dir=VideoStreamSendOnly;
}else{
ms_warning("video stream is inactive.");
/*either inactive or incompatible with local capabilities*/
is_inactive=TRUE;
}
if (call->camera_active==FALSE || all_inputs_muted){
cam=get_nowebcam_device();
}
if (!is_inactive){
video_stream_set_direction (call->videostream, dir);
ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
video_stream_set_device_rotation(call->videostream, lc->device_rotation);
video_stream_start(call->videostream,
call->video_profile, addr, vstream->port,
vstream->port+1,
used_pt, lc->rtp_conf.audio_jitt_comp, cam);
video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL);
}
}else ms_warning("No video stream accepted.");
}else{
ms_warning("No valid video stream defined.");
}
#endif
}
void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){
LinphoneCore *lc=call->core;
LinphoneAddress *me=linphone_core_get_primary_contact_parsed(lc);
const char *tool="linphone-" LINPHONE_VERSION;
char *cname;
int used_pt=-1;
bool_t use_arc;
#ifdef VIDEO_ENABLED
const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalVideo);
#endif
bool_t use_arc=linphone_core_adaptive_rate_control_enabled(lc);
if(call->audiostream == NULL)
{
ms_fatal("start_media_stream() called without prior init !");
return;
}
call->current_params = call->params;
/* adjust rtp jitter compensation. It must be at least the latency of the sound card */
int jitt_comp=MAX(lc->sound_conf.latency,lc->rtp_conf.audio_jitt_comp);
if (call->media_start_time==0) call->media_start_time=time(NULL);
cname=linphone_address_as_string_uri_only(me);
{
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalAudio);
if (stream && stream->dir!=SalStreamInactive && stream->port!=0){
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
const char *playfile=lc->play_file;
const char *recfile=lc->rec_file;
call->audio_profile=make_profile(call,call->resultdesc,stream,&used_pt);
bool_t use_ec,use_arc_audio=use_arc;
if (used_pt!=-1){
if (playcard==NULL) {
ms_warning("No card defined for playback !");
}
if (captcard==NULL) {
ms_warning("No card defined for capture !");
}
/*Replace soundcard filters by inactive file players or recorders
when placed in recvonly or sendonly mode*/
if (stream->port==0 || stream->dir==SalStreamRecvOnly){
captcard=NULL;
playfile=NULL;
}else if (stream->dir==SalStreamSendOnly){
playcard=NULL;
captcard=NULL;
recfile=NULL;
/*And we will eventually play "playfile" if set by the user*/
/*playfile=NULL;*/
}
if (send_ringbacktone){
captcard=NULL;
playfile=NULL;/* it is setup later*/
}
/*if playfile are supplied don't use soundcards*/
if (lc->use_files) {
captcard=NULL;
playcard=NULL;
}
use_ec=captcard==NULL ? FALSE : linphone_core_echo_cancellation_enabled(lc);
#if defined(VIDEO_ENABLED)
if (vstream && vstream->dir!=SalStreamInactive && vstream->payloads!=NULL){
/*when video is used, do not make adaptive rate control on audio, it is stupid.*/
use_arc_audio=FALSE;
#if defined(ANDROID)
/*On android we have to disable the echo canceller to preserve CPU for video codecs */
use_ec=FALSE;
#endif
}
#endif
audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc_audio);
audio_stream_start_full(
call->audiostream,
call->audio_profile,
stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
stream->port,
stream->port+1,
used_pt,
jitt_comp,
playfile,
recfile,
playcard,
captcard,
use_ec
);
post_configure_audio_streams(call);
if (all_inputs_muted && !send_ringbacktone){
audio_stream_set_mic_gain(call->audiostream,0);
}
if (stream->dir==SalStreamSendOnly && playfile!=NULL){
int pause_time=500;
ms_filter_call_method(call->audiostream->soundread,MS_FILE_PLAYER_LOOP,&pause_time);
}
if (send_ringbacktone){
setup_ring_player(lc,call);
}
audio_stream_set_rtcp_information(call->audiostream, cname, tool);
}else ms_warning("No audio stream accepted ?");
}
}
#ifdef VIDEO_ENABLED
{
used_pt=-1;
/* shutdown preview */
if (lc->previewstream!=NULL) {
video_preview_stop(lc->previewstream);
lc->previewstream=NULL;
}
call->current_params.has_video=FALSE;
if (vstream && vstream->dir!=SalStreamInactive && vstream->port!=0) {
const char *addr=vstream->addr[0]!='\0' ? vstream->addr : call->resultdesc->addr;
call->video_profile=make_profile(call,call->resultdesc,vstream,&used_pt);
if (used_pt!=-1){
VideoStreamDir dir=VideoStreamSendRecv;
MSWebCam *cam=lc->video_conf.device;
bool_t is_inactive=FALSE;
call->current_params.has_video=TRUE;
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
if (lc->video_window_id!=0)
video_stream_set_native_window_id(call->videostream,lc->video_window_id);
if (lc->preview_window_id!=0)
video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id);
video_stream_use_preview_video_window (call->videostream,lc->use_preview_window);
if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){
cam=get_nowebcam_device();
dir=VideoStreamSendOnly;
}else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){
dir=VideoStreamRecvOnly;
}else if (vstream->dir==SalStreamSendRecv){
if (lc->video_conf.display && lc->video_conf.capture)
dir=VideoStreamSendRecv;
else if (lc->video_conf.display)
dir=VideoStreamRecvOnly;
else
dir=VideoStreamSendOnly;
}else{
ms_warning("video stream is inactive.");
/*either inactive or incompatible with local capabilities*/
is_inactive=TRUE;
}
if (call->camera_active==FALSE || all_inputs_muted){
cam=get_nowebcam_device();
}
if (!is_inactive){
video_stream_set_direction (call->videostream, dir);
ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
video_stream_set_device_rotation(call->videostream, lc->device_rotation);
video_stream_start(call->videostream,
call->video_profile, addr, vstream->port,
vstream->port+1,
used_pt, jitt_comp, cam);
video_stream_set_rtcp_information(call->videostream, cname,tool);
}
}else ms_warning("No video stream accepted.");
}else{
ms_warning("No valid video stream defined.");
}
if (vstream && vstream->dir!=SalStreamInactive && vstream->payloads!=NULL){
/*when video is used, do not make adaptive rate control on audio, it is stupid.*/
use_arc=FALSE;
}
#endif
linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc);
linphone_call_start_video_stream(call,cname,all_inputs_muted);
call->all_muted=all_inputs_muted;
call->playing_ringbacktone=send_ringbacktone;
call->up_bw=linphone_core_get_upload_bandwidth(lc);
if (ortp_zrtp_available()) {
OrtpZrtpParams params;
params.zid=get_hexa_zrtp_identifier(lc);
@ -1155,11 +1177,14 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
const char *state_str=NULL;
ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_GET_STATE_STRING,&state_str);
if (state_str){
ms_message("Writing echo canceller state, %i bytes",strlen(state_str));
ms_message("Writing echo canceller state, %i bytes",(int)strlen(state_str));
lp_config_set_string(call->core->config,"sound","ec_state",state_str);
}
}
linphone_call_log_fill_stats (call->log,call->audiostream);
if (call->endpoint){
linphone_call_remove_from_conf(call);
}
audio_stream_stop(call->audiostream);
call->audiostream=NULL;
}
@ -1174,7 +1199,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
call->videostream=NULL;
}
ms_event_queue_skip(call->core->msevq);
#endif
if (call->audio_profile){
rtp_profile_clear_all(call->audio_profile);
@ -1231,11 +1256,11 @@ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call){
/**
* @addtogroup call_misc
* @{
**/
**/
/**
* Returns the measured sound volume played locally (received from remote)
* It is expressed in dbm0.
* It is expressed in dbm0.
**/
float linphone_call_get_play_volume(LinphoneCall *call){
AudioStream *st=call->audiostream;
@ -1243,14 +1268,14 @@ float linphone_call_get_play_volume(LinphoneCall *call){
float vol=0;
ms_filter_call_method(st->volsend,MS_VOLUME_GET,&vol);
return vol;
}
return LINPHONE_VOLUME_DB_LOWEST;
}
/**
* Returns the measured sound volume recorded locally (sent to remote)
* It is expressed in dbm0.
* It is expressed in dbm0.
**/
float linphone_call_get_record_volume(LinphoneCall *call){
AudioStream *st=call->audiostream;
@ -1258,7 +1283,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){
float vol=0;
ms_filter_call_method(st->volrecv,MS_VOLUME_GET,&vol);
return vol;
}
return LINPHONE_VOLUME_DB_LOWEST;
}
@ -1277,7 +1302,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){
* 1-2 = very poor quality <br>
* 0-1 = can't be worse, mostly unusable <br>
*
* @returns The function returns -1 if no quality measurement is available, for example if no
* @returns The function returns -1 if no quality measurement is available, for example if no
* active audio stream exist. Otherwise it returns the quality rating.
**/
float linphone_call_get_current_quality(LinphoneCall *call){
@ -1320,7 +1345,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
{
snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from);
free(from);
}
}
else
{
snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed.");
@ -1333,7 +1358,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){
int disconnect_timeout = linphone_core_get_nortp_timeout(call->core);
bool_t disconnected=FALSE;
if (call->state==LinphoneCallStreamsRunning && one_second_elapsed){
RtpSession *as=NULL,*vs=NULL;
float audio_load=0, video_load=0;
@ -1389,7 +1414,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
}
}
}
if (one_second_elapsed && call->audiostream!=NULL && disconnect_timeout>0 )
if (call->state==LinphoneCallStreamsRunning && one_second_elapsed && call->audiostream!=NULL && disconnect_timeout>0 )
disconnected=!audio_stream_alive(call->audiostream,disconnect_timeout);
if (disconnected)
linphone_core_disconnected(call->core,call);
@ -1397,9 +1422,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
void linphone_call_log_completed(LinphoneCall *call){
LinphoneCore *lc=call->core;
call->log->duration=time(NULL)-call->start_time;
if (call->log->status==LinphoneCallMissed){
char *info;
lc->missed_calls++;
@ -1426,3 +1451,5 @@ void linphone_call_log_completed(LinphoneCall *call){
}
call_logs_write_to_config_file(lc);
}

View file

@ -1431,7 +1431,7 @@ void linphone_core_set_user_agent(const char *name, const char *ver){
static void transport_error(LinphoneCore *lc, const char* transport, int port){
char *msg=ortp_strdup_printf("Could not start %s transport on port %i, maybe this port is already used.",transport,port);
ms_warning(msg);
ms_warning("%s",msg);
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,msg);
ms_free(msg);
@ -1725,6 +1725,7 @@ void linphone_core_iterate(LinphoneCore *lc){
we are going to examine is destroy and removed during
linphone_core_start_invite() */
calls=calls->next;
linphone_call_background_tasks(call,one_second_elapsed);
if (call->state==LinphoneCallOutgoingInit && (curtime-call->start_time>=2)){
/*start the call even if the OPTIONS reply did not arrive*/
linphone_core_start_invite(lc,call,NULL);
@ -1738,9 +1739,7 @@ void linphone_core_iterate(LinphoneCore *lc){
}
}
}
call = linphone_core_get_current_call(lc);
if(call)
linphone_call_background_tasks(call,one_second_elapsed);
if (linphone_core_video_preview_enabled(lc)){
if (lc->previewstream==NULL && lc->calls==NULL)
toggle_video_preview(lc,TRUE);
@ -2094,11 +2093,8 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
LinphoneProxyConfig *dest_proxy=NULL;
LinphoneCall *call;
if (linphone_core_in_call(lc)){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call first !"));
return NULL;
}
linphone_core_preempt_sound_resources(lc);
if(!linphone_core_can_we_add_call(lc)){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
@ -2219,20 +2215,27 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
int err=0;
if (params!=NULL){
const char *subject;
call->params=*params;
update_local_media_description(lc,call,&call->localdesc);
call->camera_active=params->has_video;
if (params->in_conference){
subject="Conference";
}else{
subject="Media change";
}
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Modifying call parameters..."));
sal_call_set_local_media_description (call->op,call->localdesc);
err=sal_call_update(call->op,"Media parameters update");
err=sal_call_update(call->op,subject);
}else{
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL){
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
if (call->camera_active)
call->videostream->cam=lc->video_conf.device; /*to take into account eventual cam changes*/
video_stream_update_video_params (call->videostream);
if (call->camera_active && call->videostream->cam!=lc->video_conf.device){
video_stream_change_camera(call->videostream,lc->video_conf.device);
}else video_stream_update_video_params(call->videostream);
}
#endif
}
@ -2281,25 +2284,12 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
if (rc){
ms_message("Call %p replaces call %p. This last one is going to be terminated automatically.",
call,rc);
linphone_core_terminate_call (lc,rc);
linphone_core_terminate_call(lc,rc);
}
}
if (lc->current_call!=NULL && lc->current_call!=call){
ms_warning("Cannot accept this call, there is already one running.");
return -1;
}
/*can accept a new call only if others are on hold */
{
MSList *elem;
for(elem=lc->calls;elem!=NULL;elem=elem->next){
LinphoneCall *c=(LinphoneCall*)elem->data;
if (c!=call && (c->state!=LinphoneCallPaused && c->state!=LinphoneCallPausing)){
ms_warning("Cannot accept this call as another one is running, pause it before.");
return -1;
}
}
if (lc->current_call!=call){
linphone_core_preempt_sound_resources(lc);
}
/*stop ringing */
@ -2365,6 +2355,11 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
/*stop any dtmf tone still playing */
ms_message("test");
linphone_core_stop_dtmf(lc);
linphone_call_stop_media_streams(call);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call ended") );
@ -2421,13 +2416,13 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
* @param lc The LinphoneCore
**/
int linphone_core_terminate_all_calls(LinphoneCore *lc){
while(lc->calls)
{
LinphoneCall *the_call = lc->calls->data;
linphone_core_terminate_call(lc,the_call);
MSList *calls=lc->calls;
while(calls) {
LinphoneCall *c=(LinphoneCall*)calls->data;
calls=calls->next;
linphone_core_terminate_call(lc,c);
}
ms_list_free(lc->calls);
return -1;
return 0;
}
/**
@ -2450,7 +2445,7 @@ const MSList *linphone_core_get_calls(LinphoneCore *lc)
* @ingroup call_control
**/
bool_t linphone_core_in_call(const LinphoneCore *lc){
return linphone_core_get_current_call((LinphoneCore *)lc)!=NULL;
return linphone_core_get_current_call((LinphoneCore *)lc)!=NULL || linphone_core_is_in_conference(lc);
}
/**
@ -2488,8 +2483,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
ms_error("No reason to pause this call, it is already paused or inactive.");
return -1;
}
if (sal_call_update(call->op,subject) != 0)
{
if (sal_call_update(call->op,subject) != 0){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Could not pause the call"));
}
@ -2517,6 +2511,19 @@ int linphone_core_pause_all_calls(LinphoneCore *lc){
return 0;
}
void linphone_core_preempt_sound_resources(LinphoneCore *lc){
LinphoneCall *current_call;
if (linphone_core_is_in_conference(lc)){
linphone_core_leave_conference(lc);
return;
}
current_call=linphone_core_get_current_call(lc);
if(current_call != NULL){
ms_message("Pausing automatically the current call.");
linphone_core_pause_call(lc,current_call);
}
}
/**
* Resumes the call.
*
@ -2526,20 +2533,19 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
{
char temp[255]={0};
LinphoneCall *call = the_call;
const char *subject="Call resuming";
if(call->state!=LinphoneCallPaused ){
ms_warning("we cannot resume a call that has not been established and paused before");
return -1;
}
if(linphone_core_get_current_call(lc) != NULL){
ms_warning("There is already a call in process, pause or stop it first.");
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("There is already a call in process, pause or stop it first."));
return -1;
if (call->params.in_conference==FALSE){
linphone_core_preempt_sound_resources(lc);
ms_message("Resuming call %p",call);
}
ms_message("Resuming call %p",call);
sal_media_description_set_dir(call->localdesc,SalStreamSendRecv);
if(sal_call_update(call->op,"Call resuming") != 0){
if (call->params.in_conference) subject="Resuming conference";
if(sal_call_update(call->op,subject) != 0){
return -1;
}
linphone_call_set_state (call,LinphoneCallResuming,"Resuming");
@ -3706,6 +3712,25 @@ void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms){
else ms_filter_call_method(f, MS_DTMF_GEN_START, &dtmf);
}
/**
* @ingroup media_parameters
* Plays a repeated tone to the local user until next further call to #linphone_core_stop_dtmf()
* @param lc #LinphoneCore
**/
void linphone_core_play_tone(LinphoneCore *lc){
MSFilter *f=get_dtmf_gen(lc);
MSDtmfGenCustomTone def;
if (f==NULL){
ms_error("No dtmf generator at this time !");
return;
}
def.duration=300;
def.frequency=500;
def.amplitude=1;
def.interval=800;
ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def);
}
/**
* @ingroup media_parameters
*

View file

@ -181,6 +181,7 @@ void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp);
void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
void linphone_call_params_destroy(LinphoneCallParams *cp);
@ -983,14 +984,6 @@ void *linphone_core_get_user_data(LinphoneCore *lc);
the config file with your own sections */
struct _LpConfig *linphone_core_get_config(LinphoneCore *lc);
/* attempts to wake up another linphone engine already running.
The "show" callback is called for the other linphone, causing gui to show up.
call_addr is an optional sip-uri to call immediately after waking up.
The method returns 0 if an already running linphone was found*/
int linphone_core_wake_up_possible_already_running_instance(
const char * config_file, const char * call_addr);
/*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneWaitingCallback cb, void *user_context);
@ -1025,8 +1018,15 @@ bool_t linphone_call_are_all_streams_encrypted(LinphoneCall *call);
const char* linphone_call_get_authentication_token(LinphoneCall *call);
bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call);
int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_add_all_to_conference(LinphoneCore *lc);
int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call);
bool_t linphone_core_is_in_conference(const LinphoneCore *lc);
int linphone_core_enter_conference(LinphoneCore *lc);
int linphone_core_leave_conference(LinphoneCore *lc);
int linphone_core_terminate_conference(LinphoneCore *lc);
int linphone_core_get_conference_size(LinphoneCore *lc);
#ifdef __cplusplus
}

View file

@ -1215,6 +1215,11 @@ extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_enableVideo(JNIEnv
extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_getVideoEnabled(JNIEnv *env, jobject thiz, jlong lcp){
return linphone_call_params_video_enabled((LinphoneCallParams*)lcp);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCallParamsImpl_localConferenceMode(JNIEnv *env, jobject thiz, jlong lcp){
return linphone_call_params_local_conference_mode((LinphoneCallParams*)lcp);
}
extern "C" void Java_org_linphone_core_LinphoneCallParamsImpl_destroy(JNIEnv *env, jobject thiz, jlong lc){
return linphone_call_params_destroy((LinphoneCallParams*)lc);
}
@ -1344,6 +1349,49 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_pauseAllCalls(JNIEnv *en
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_resumeCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) {
return linphone_core_resume_call((LinphoneCore *) pCore, (LinphoneCall *) pCall);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInConference(JNIEnv *env,jobject thiz,jlong pCore) {
return linphone_core_is_in_conference((LinphoneCore *) pCore);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enterConference(JNIEnv *env,jobject thiz,jlong pCore) {
linphone_core_enter_conference((LinphoneCore *) pCore);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_leaveConference(JNIEnv *env,jobject thiz,jlong pCore) {
linphone_core_leave_conference((LinphoneCore *) pCore);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addAllToConference(JNIEnv *env,jobject thiz,jlong pCore) {
linphone_core_add_all_to_conference((LinphoneCore *) pCore);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addToConference(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) {
linphone_core_add_to_conference((LinphoneCore *) pCore, (LinphoneCall *) pCall);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_removeFromConference(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall) {
linphone_core_remove_from_conference((LinphoneCore *) pCore, (LinphoneCall *) pCall);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateConference(JNIEnv *env,jobject thiz,jlong pCore) {
linphone_core_terminate_conference((LinphoneCore *) pCore);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv *env,jobject thiz,jlong pCore) {
return linphone_core_get_conference_size((LinphoneCore *) pCore);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateAllCalls(JNIEnv *env,jobject thiz,jlong pCore) {
linphone_core_terminate_all_calls((LinphoneCore *) pCore);
}
extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,jobject thiz,jlong pCore,jint position) {
return (jlong)ms_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position);
}
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,jobject thiz,jlong pCore) {
return ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore));
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_transferCall(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jstring jReferTo) {
const char* cReferTo=env->GetStringUTFChars(jReferTo, NULL);
linphone_core_transfer_call((LinphoneCore *) pCore, (LinphoneCall *) pCall, cReferTo);
env->ReleaseStringUTFChars(jReferTo, cReferTo);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_transferCallToAnother(JNIEnv *env,jobject thiz,jlong pCore, jlong pCall, jlong pDestCall) {
linphone_core_transfer_call_to_another((LinphoneCore *) pCore, (LinphoneCall *) pCall, (LinphoneCall *) pDestCall);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIEnv *env,jobject thiz,jlong pCore, jstring jFile) {
if (jFile) {

View file

@ -557,89 +557,6 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
}
}
static int extract_sip_port(const char *config){
char line[512];
char port[12];
int ret=-1;
FILE *f=fopen(config,"r");
if (f){
while(fgets(line,sizeof(line),f)!=NULL){
if (fmtp_get_value(line,"sip_port",port,sizeof(port))){
ret=atoi(port);
}
}
fclose(f);
}
return ret;
}
int linphone_core_wake_up_possible_already_running_instance(
const char * config_file, const char * addr_to_call)
{
int port=extract_sip_port(config_file);
const char *wakeup="WAKEUP sip:127.0.0.1 SIP/2.0\r\n"
"Via: SIP/2.0/UDP 127.0.0.1:%i;rport;branch=z9hG4bK%u\r\n"
"From: <sip:another_linphone@127.0.0.1>;tag=%u\r\n"
"To: <sip:you@127.0.0.1>\r\n"
"CSeq: 1 WAKEUP\r\n"
"Call-ID: %u@onsantape\r\n"
"Content-length: 0\r\n\r\n";
const char * call = "REFER sip:127.0.0.1 SIP/2.0\r\n"
"Via: SIP/2.0/UDP 127.0.0.1:%i;rport;branch=z9hG4bK%u\r\n"
"From: <sip:another_linphone@127.0.0.1>;tag=%u\r\n"
"To: <sip:you@127.0.0.1>\r\n"
"Refer-To: %s\r\n"
"CSeq: 1 WAKEUP\r\n"
"Call-ID: %u@onsantape\r\n"
"Content-length: 0\r\n\r\n";
/*make sure ortp is initialized (it initializes win32 socket api)*/
ortp_init();
if (port>0){
struct sockaddr_storage ss;
socklen_t sslen;
char tmp[100];
snprintf(tmp,sizeof(tmp),"127.0.0.1:%i",port);
if (parse_hostname_to_addr(tmp,&ss,&sslen)==0){
int locport=57123;
ortp_socket_t sock=create_socket(locport);
if (sock<0) sock=create_socket(++locport);
if (sock>=0){
char req[512];
if (addr_to_call != NULL)
snprintf(req, sizeof(req), call, locport,
random(), random(), addr_to_call, random());
else
snprintf(req, sizeof(req), wakeup, locport,
random(), random(), random());
if (connect(sock,(struct sockaddr*)&ss,sslen)<0){
fprintf(stderr,"connect failed: %s\n",getSocketError());
}else if (send(sock,req,strlen(req),0)>0){
/*wait a bit for a response*/
int i;
for(i=0;i<10;++i){
if (recv(sock,req,sizeof(req),0)>0){
close_socket(sock);
return 0;
}else if (getSocketErrorCode()!=EWOULDBLOCK){
break;
}
#ifdef WIN32
Sleep(100);
#else
usleep(100000);
#endif
}
}else{
ms_message("sendto() of WAKEUP request failed, nobody to wakeup.");
}
}
close_socket(sock);
}
}
return -1;
}
#ifdef HAVE_GETIFADDRS
#include <ifaddrs.h>

View file

@ -33,6 +33,7 @@
#include "config.h"
#endif
#include "mediastreamer2/mediastream.h"
#include "mediastreamer2/msconference.h"
#ifndef LIBLINPHONE_VERSION
#define LIBLINPHONE_VERSION LINPHONE_VERSION
@ -62,7 +63,8 @@ struct _LinphoneCallParams{
int audio_bw; /* bandwidth limit for audio stream */
bool_t has_video;
bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/
bool_t pad[2];
bool_t in_conference; /*in conference mode */
bool_t pad;
};
struct _LinphoneCall
@ -87,6 +89,7 @@ struct _LinphoneCall
int video_port;
struct _AudioStream *audiostream; /**/
struct _VideoStream *videostream;
MSAudioEndpoint *endpoint; /*used for conferencing*/
char *refer_to;
LinphoneCallParams params;
LinphoneCallParams current_params;
@ -99,12 +102,13 @@ struct _LinphoneCall
bool_t all_muted; /*this flag is set during early medias*/
bool_t playing_ringbacktone;
bool_t owns_call_log;
bool_t pad;
OrtpEvQueue *audiostream_app_evq;
bool_t audiostream_encrypted;
char *auth_token;
bool_t auth_token_verified;
OrtpEvQueue *videostream_app_evq;
bool_t videostream_encrypted;
bool_t audiostream_encrypted;
bool_t auth_token_verified;
};
@ -206,6 +210,8 @@ int linphone_proxy_config_normalize_number(LinphoneProxyConfig *cfg, const char
void linphone_core_text_received(LinphoneCore *lc, const char *from, const char *msg);
void linphone_core_play_tone(LinphoneCore *lc);
void linphone_call_init_media_streams(LinphoneCall *call);
void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone);
void linphone_call_stop_media_streams(LinphoneCall *call);
@ -388,6 +394,13 @@ typedef struct autoreplier_config
const char *message; /* the path of the file to be played */
}autoreplier_config_t;
struct _LinphoneConference{
MSAudioConference *conf;
AudioStream *local_participant;
MSAudioEndpoint *local_endpoint;
};
typedef struct _LinphoneConference LinphoneConference;
struct _LinphoneCore
{
@ -439,6 +452,8 @@ struct _LinphoneCore
time_t netup_time; /*time when network went reachable */
struct _EcCalibrator *ecc;
MSList *hooks;
LinphoneConference conf_ctx;
char* zrtp_secrets_cache;
bool_t use_files;
bool_t apply_nat_settings;
bool_t initial_subscribes_sent;
@ -449,7 +464,6 @@ struct _LinphoneCore
bool_t use_preview_window;
int device_rotation;
bool_t ringstream_autorelease;
char* zrtp_secrets_cache;
};
bool_t linphone_core_can_we_add_call(LinphoneCore *lc);
@ -493,6 +507,11 @@ LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc);
void ec_calibrator_destroy(EcCalibrator *ecc);
void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed);
void linphone_core_preempt_sound_resources(LinphoneCore *lc);
/*conferencing subsystem*/
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);
#define HOLD_OFF (0)
#define HOLD_ON (1)

View file

@ -747,7 +747,7 @@ LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core,
return NULL;
}
if (!(sip_setup_get_capabilities(ss) & SIP_SETUP_CAP_ACCOUNT_MANAGER)){
ms_error("%s cannot manage accounts.");
ms_error("%s cannot manage accounts.",type);
return NULL;
}
obj=ms_new0(LinphoneAccountCreator,1);

View file

@ -219,7 +219,6 @@ typedef void (*SalOnNotify)(SalOp *op, const char *from, const char *value);
typedef void (*SalOnNotifyPresence)(SalOp *op, SalSubscribeState ss, SalPresenceStatus status, const char *msg);
typedef void (*SalOnSubscribeReceived)(SalOp *salop, const char *from);
typedef void (*SalOnSubscribeClosed)(SalOp *salop, const char *from);
typedef void (*SalOnInternalMsg)(Sal *sal, const char *msg);
typedef void (*SalOnPingReply)(SalOp *salop);
typedef struct SalCallbacks{
@ -243,7 +242,6 @@ typedef struct SalCallbacks{
SalOnNotifyPresence notify_presence;
SalOnSubscribeReceived subscribe_received;
SalOnSubscribeClosed subscribe_closed;
SalOnInternalMsg internal_message;
SalOnPingReply ping_reply;
}SalCallbacks;

View file

@ -338,8 +338,6 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs){
ctx->callbacks.subscribe_received=(SalOnSubscribeReceived)unimplemented_stub;
if (ctx->callbacks.text_received==NULL)
ctx->callbacks.text_received=(SalOnTextReceived)unimplemented_stub;
if (ctx->callbacks.internal_message==NULL)
ctx->callbacks.internal_message=(SalOnInternalMsg)unimplemented_stub;
if (ctx->callbacks.ping_reply==NULL)
ctx->callbacks.ping_reply=(SalOnPingReply)unimplemented_stub;
}
@ -1606,11 +1604,6 @@ static void other_request(Sal *sal, eXosip_event_t *ev){
eXosip_options_build_answer(ev->tid,200,&options);
fill_options_answer(options);
eXosip_options_send_answer(ev->tid,200,options);
}else if (strcmp(ev->request->sip_method,"WAKEUP")==0
&& comes_from_local_if(ev->request)) {
eXosip_message_send_answer(ev->tid,200,NULL);
ms_message("Receiving WAKEUP request !");
sal->callbacks.internal_message(sal,"WAKEUP");
}else if (strncmp(ev->request->sip_method, "REFER", 5) == 0){
ms_message("Receiving REFER request !");
if (comes_from_local_if(ev->request)) {

View file

@ -44,12 +44,13 @@ linphone_SOURCES= \
setupwizard.c\
incall_view.c \
loginframe.c \
singleinstance.c \
linphone.h
linphone_LDADD=$(ORTP_LIBS) \
$(MEDIASTREAMER_LIBS) \
$(top_builddir)/coreapi/liblinphone.la \
$(LIBGTK_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS)
$(LIBGTK_LIBS) $(NOTIFY1_LIBS) $(NOTIFY4_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS)
if BUILD_WIN32

View file

@ -1,50 +1,24 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkListStore" id="call_logs_store">
<columns>
<!-- column-name icon -->
<column type="gchar"/>
<!-- column-name sipaddress -->
<column type="gchar"/>
</columns>
</object>
<object class="GtkDialog" id="call_logs">
<property name="width_request">500</property>
<property name="height_request">370</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Call history</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<object class="GtkVBox" id="call_logs_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTreeView" id="logs_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<signal name="row_activated" handler="linphone_gtk_history_row_activated"/>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
@ -52,6 +26,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="image">image1</property>
</object>
<packing>
@ -66,6 +41,7 @@
<property name="visible">True</property>
<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>
@ -79,6 +55,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@ -90,10 +67,32 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTreeView" id="logs_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<signal name="row-activated" handler="linphone_gtk_history_row_activated" swapped="no"/>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
@ -102,8 +101,17 @@
<action-widget response="0">call_logs_close</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="call_logs_store">
<columns>
<!-- column-name icon -->
<column type="gchar"/>
<!-- column-name sipaddress -->
<column type="gchar"/>
</columns>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-clear</property>
</object>
</interface>

View file

@ -20,6 +20,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
static void fill_renderers(GtkTreeView *v){
GtkTreeViewColumn *c;
GtkCellRenderer *r=gtk_cell_renderer_pixbuf_new ();
g_object_set(r,"stock-size",GTK_ICON_SIZE_BUTTON,NULL);
c=gtk_tree_view_column_new_with_attributes("icon",r,"stock-id",0,NULL);
gtk_tree_view_append_column (v,c);
r=gtk_cell_renderer_text_new ();
c=gtk_tree_view_column_new_with_attributes("sipaddress",r,"markup",1,NULL);
gtk_tree_view_append_column (v,c);
}
void linphone_gtk_call_log_update(GtkWidget *w){
GtkTreeView *v=GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view"));
GtkListStore *store;
@ -30,6 +43,9 @@ void linphone_gtk_call_log_update(GtkWidget *w){
store=gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING, G_TYPE_POINTER);
gtk_tree_view_set_model(v,GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
fill_renderers(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view")));
gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
}
gtk_list_store_clear (store);
@ -88,7 +104,21 @@ static bool_t put_selection_to_uribar(GtkWidget *treeview){
}
void linphone_gtk_history_row_activated(GtkWidget *treeview){
put_selection_to_uribar(treeview);
if (put_selection_to_uribar(treeview)){
GtkWidget *mw=linphone_gtk_get_main_window();
linphone_gtk_start_call(linphone_gtk_get_widget(mw,"start_call"));
}
}
void linphone_gtk_clear_call_logs(GtkWidget *button){
linphone_core_clear_call_logs (linphone_gtk_get_core());
linphone_gtk_call_log_update(gtk_widget_get_toplevel(button));
}
void linphone_gtk_call_log_callback(GtkWidget *button){
GtkWidget *mw=linphone_gtk_get_main_window();
if (put_selection_to_uribar(linphone_gtk_get_widget(mw,"logs_view")))
linphone_gtk_start_call(linphone_gtk_get_widget(mw,"start_call"));
}
void linphone_gtk_call_log_response(GtkWidget *w, guint response_id){
@ -106,27 +136,15 @@ void linphone_gtk_call_log_response(GtkWidget *w, guint response_id){
}
static void fill_renderers(GtkTreeView *v){
GtkTreeViewColumn *c;
GtkCellRenderer *r=gtk_cell_renderer_pixbuf_new ();
g_object_set(r,"stock-size",GTK_ICON_SIZE_BUTTON,NULL);
c=gtk_tree_view_column_new_with_attributes("icon",r,"stock-id",0,NULL);
gtk_tree_view_append_column (v,c);
r=gtk_cell_renderer_text_new ();
c=gtk_tree_view_column_new_with_attributes("sipaddress",r,"markup",1,NULL);
gtk_tree_view_append_column (v,c);
}
GtkWidget * linphone_gtk_show_call_logs(void){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"call_logs");
if (w==NULL){
w=linphone_gtk_create_window("call_logs");
gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
fill_renderers(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view")));
g_object_set_data(G_OBJECT(mw),"call_logs",w);
g_signal_connect(G_OBJECT(w),"response",(GCallback)linphone_gtk_call_log_response,NULL);
gtk_widget_show(w);

31
gtk/conference.c Normal file
View file

@ -0,0 +1,31 @@
/***************************************************************************
* gtk/conference.c
*
* Mon Sep 12, 2011
* Copyright 2011 Belledonne Communications
* Author: Simon Morlat
* Email simon dot morlat at linphone dot org
****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"

View file

@ -172,6 +172,70 @@ void linphone_gtk_my_presence_clicked(GtkWidget *button){
gtk_widget_show(menu);
}
static void icon_press_handler(GtkEntry *entry){
const char *text=gtk_entry_get_text(entry);
if (text && strlen(text)>0){
char *uri;
LinphoneFriend *lf;
linphone_core_interpret_friend_uri(linphone_gtk_get_core(),text,&uri);
if (uri==NULL){
return ;
}
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),uri);
if (lf==NULL)
lf=linphone_friend_new_with_addr(uri);
if (lf!=NULL){
linphone_gtk_show_contact(lf);
}
ms_free(uri);
}
}
static void update_star(GtkEntry *entry, gboolean is_known){
GdkPixbuf *active,*starred,*unstarred;
active=gtk_entry_get_icon_pixbuf(entry,GTK_ENTRY_ICON_SECONDARY);
starred=g_object_get_data(G_OBJECT(entry),"starred_icon");
unstarred=g_object_get_data(G_OBJECT(entry),"unstarred_icon");
if (is_known && (active==unstarred)){
gtk_entry_set_icon_from_pixbuf(entry,GTK_ENTRY_ICON_SECONDARY,starred);
}else if ((!is_known) && (active==starred)){
gtk_entry_set_icon_from_pixbuf(entry,GTK_ENTRY_ICON_SECONDARY,unstarred);
}
}
static void check_contact(GtkEditable *editable, LinphoneCore *lc){
char *tmp=gtk_editable_get_chars(editable,0,-1);
if (tmp!=NULL){
if (strlen(tmp)>0){
char *uri=NULL;
linphone_core_interpret_friend_uri(lc,tmp,&uri);
if (uri){
LinphoneFriend *lf=linphone_core_get_friend_by_address(lc,uri);
ms_free(uri);
if (lf) {
update_star(GTK_ENTRY(editable),TRUE);
g_free(tmp);
return;
}
}
}
g_free(tmp);
}
update_star(GTK_ENTRY(editable),FALSE);
}
static void linphone_gtk_init_bookmark_icon(void){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *entry=linphone_gtk_get_widget(mw,"uribar");
GdkPixbuf *pbuf=create_pixbuf("contact_unstarred.png");
gtk_entry_set_icon_from_pixbuf(GTK_ENTRY(entry),GTK_ENTRY_ICON_SECONDARY,pbuf);
g_object_set_data_full(G_OBJECT(entry),"unstarred_icon",pbuf,g_object_unref);
pbuf=create_pixbuf("contact_starred.png");
g_object_set_data_full(G_OBJECT(entry),"starred_icon",pbuf,g_object_unref);
gtk_entry_set_icon_activatable(GTK_ENTRY(entry),GTK_ENTRY_ICON_SECONDARY,TRUE);
g_signal_connect(G_OBJECT(entry),"icon-release",(GCallback)icon_press_handler,NULL);
g_signal_connect(G_OBJECT(GTK_EDITABLE(entry)),"changed",(GCallback)check_contact,linphone_gtk_get_core());
}
static void linphone_gtk_friend_list_init(GtkWidget *friendlist)
{
@ -179,7 +243,8 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist)
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *select;
linphone_gtk_init_bookmark_icon();
store = gtk_list_store_new(FRIEND_LIST_NCOL, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER,
G_TYPE_STRING, GDK_TYPE_PIXBUF);
@ -277,6 +342,53 @@ void linphone_gtk_directory_search_button_clicked(GtkWidget *button){
linphone_gtk_get_widget(gtk_widget_get_toplevel(button),"directory_search_entry"));
}
static int get_friend_weight(const LinphoneFriend *lf){
int w=0;
switch(linphone_friend_get_status(lf)){
case LinphoneStatusOnline:
w+=1000;
break;
case LinphoneStatusOffline:
if (linphone_friend_get_send_subscribe(lf))
w+=100;
break;
default:
w+=500;
break;
}
return w;
}
static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *lf2){
int w1,w2;
w1=get_friend_weight(lf1);
w2=get_friend_weight(lf2);
if (w1==w2){
const char *u1,*u2;
const LinphoneAddress *addr1,*addr2;
addr1=linphone_friend_get_address(lf1);
addr2=linphone_friend_get_address(lf2);
u1=linphone_address_get_username(addr1);
u2=linphone_address_get_username(addr2);
if (u1 && u2) return strcasecmp(u1,u2);
if (u1) return 1;
else return -1;
}
return w2-w1;
}
static MSList *sort_friend_list(const MSList *friends){
MSList *ret=NULL;
const MSList *elem;
LinphoneFriend *lf;
for(elem=friends;elem!=NULL;elem=elem->next){
lf=(LinphoneFriend*)elem->data;
ret=ms_list_insert_sorted(ret,lf,(MSCompareFunc)friend_compare_func);
}
return ret;
}
void linphone_gtk_show_friends(void){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *friendlist=linphone_gtk_get_widget(mw,"contact_list");
@ -288,6 +400,7 @@ void linphone_gtk_show_friends(void){
LinphoneCore *core=linphone_gtk_get_core();
const gchar *search=NULL;
gboolean online_only=FALSE,lookup=FALSE;
MSList *sorted;
linphone_gtk_show_directory_search();
@ -303,7 +416,9 @@ void linphone_gtk_show_friends(void){
lookup=FALSE;
else lookup=TRUE;
for(itf=linphone_core_get_friend_list(core);itf!=NULL;itf=ms_list_next(itf)){
sorted=sort_friend_list(linphone_core_get_friend_list(core));
for(itf=sorted;itf!=NULL;itf=ms_list_next(itf)){
LinphoneFriend *lf=(LinphoneFriend*)itf->data;
const LinphoneAddress *f_uri=linphone_friend_get_address(lf);
char *uri=linphone_address_as_string(f_uri);
@ -318,14 +433,15 @@ void linphone_gtk_show_friends(void){
}
if (!online_only || (linphone_friend_get_status(lf)!=LinphoneStatusOffline)){
BuddyInfo *bi;
gboolean send_subscribe=linphone_friend_get_send_subscribe(lf);
if (name==NULL || name[0]=='\0') display=uri;
gtk_list_store_append(store,&iter);
gtk_list_store_set(store,&iter,FRIEND_NAME, display,
FRIEND_PRESENCE_STATUS, linphone_online_status_to_string(linphone_friend_get_status(lf)),
FRIEND_ID,lf,-1);
gtk_list_store_set(store,&iter,
FRIEND_PRESENCE_IMG, create_status_picture(linphone_friend_get_status(lf)),
-1);
FRIEND_PRESENCE_STATUS,
send_subscribe ? linphone_online_status_to_string(linphone_friend_get_status(lf)) : "",
FRIEND_ID,lf,
FRIEND_PRESENCE_IMG, send_subscribe ? create_status_picture(linphone_friend_get_status(lf)) : NULL,
-1);
escaped=g_markup_escape_text(uri,-1);
gtk_list_store_set(store,&iter,FRIEND_SIP_ADDRESS,escaped,-1);
g_free(escaped);
@ -341,9 +457,10 @@ void linphone_gtk_show_friends(void){
}
ms_free(uri);
}
ms_list_free(sorted);
}
void linphone_gtk_add_contact(void){
void linphone_gtk_add_contact(){
GtkWidget *w=linphone_gtk_create_window("contact");
int presence_enabled=linphone_gtk_get_ui_config_int("use_subscribe_notify",1);

View file

@ -66,6 +66,33 @@ static GtkWidget *make_tab_header(int number){
return w;
}
static void linphone_gtk_in_call_set_animation_image(GtkWidget *callview, const char *image_name, gboolean is_stock){
GtkWidget *container=linphone_gtk_get_widget(callview,"in_call_animation");
GList *elem=gtk_container_get_children(GTK_CONTAINER(container));
GtkWidget *image;
if (!is_stock)
image=create_pixmap(image_name);
else
image=gtk_image_new_from_stock(image_name,GTK_ICON_SIZE_DIALOG);
if (elem)
gtk_widget_destroy((GtkWidget*)elem->data);
gtk_widget_show(image);
gtk_container_add(GTK_CONTAINER(container),image);
}
static void linphone_gtk_in_call_set_animation_spinner(GtkWidget *callview){
GtkWidget *container=linphone_gtk_get_widget(callview,"in_call_animation");
GList *elem=gtk_container_get_children(GTK_CONTAINER(container));
GtkWidget *spinner=gtk_spinner_new();
if (elem)
gtk_widget_destroy((GtkWidget*)elem->data);
gtk_widget_show(spinner);
gtk_container_add(GTK_CONTAINER(container),spinner);
gtk_spinner_start(GTK_SPINNER(spinner));
}
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);
@ -99,6 +126,8 @@ static void transfer_button_clicked(GtkWidget *button, gpointer call_ref){
gtk_widget_show(menu);
}
void linphone_gtk_enable_transfer_button(LinphoneCore *lc, gboolean value){
const MSList *elem=linphone_core_get_calls(lc);
for(;elem!=NULL;elem=elem->next){
@ -120,6 +149,31 @@ void linphone_gtk_enable_transfer_button(LinphoneCore *lc, gboolean value){
}
}
static void conference_button_clicked(GtkWidget *button, gpointer call_ref){
}
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 *box=linphone_gtk_get_widget (call_view,"mute_pause_buttons");
GtkWidget *button=(GtkWidget*)g_object_get_data(G_OBJECT(box),"conference");
if (button && value==FALSE){
gtk_widget_destroy(button);
button=NULL;
}else if (!button && value==TRUE){
button=gtk_button_new_with_label (_("Conference"));
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);
gtk_container_add(GTK_CONTAINER(box),button);
}
g_object_set_data(G_OBJECT(box),"conference",button);
}
}
void linphone_gtk_create_in_call_view(LinphoneCall *call){
GtkWidget *call_view=linphone_gtk_create_widget("main","in_call_frame");
GtkWidget *main_window=linphone_gtk_get_main_window ();
@ -181,25 +235,18 @@ void linphone_gtk_in_call_view_set_calling(LinphoneCall *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);
linphone_gtk_in_call_set_animation_spinner(callview);
}
void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_pause){
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 *animation=linphone_gtk_get_widget(callview,"in_call_animation");
GdkPixbufAnimation *pbuf=create_pixbuf_animation("calling_anim.gif");
GtkWidget *answer_button;
GtkWidget *image;
@ -210,10 +257,7 @@ void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_paus
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_label(GTK_BUTTON(answer_button),_("Answer"));
gtk_button_set_image(GTK_BUTTON(answer_button),image);
gtk_widget_show(image);
@ -221,10 +265,7 @@ void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_paus
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);
linphone_gtk_in_call_set_animation_image(callview,GTK_STOCK_DIALOG_INFO,TRUE);
}
static void rating_to_color(float rating, GdkColor *color){
@ -283,8 +324,6 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *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));
@ -294,10 +333,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
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_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")),TRUE);
if (taskid==0){
@ -309,10 +345,9 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *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");
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);
linphone_gtk_in_call_set_animation_image(callview,GTK_STOCK_MEDIA_PAUSE,TRUE);
}
void linphone_gtk_in_call_view_update_duration(LinphoneCall *call){
@ -335,8 +370,6 @@ static gboolean in_call_view_terminated(LinphoneCall *call){
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)
@ -346,10 +379,9 @@ void linphone_gtk_in_call_view_terminate(LinphoneCall *call, const char *error_m
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));
}
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"));
linphone_gtk_enable_mute_button(
GTK_BUTTON(linphone_gtk_get_widget(callview,"incall_mute")),FALSE);

View file

@ -72,8 +72,10 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room, const
void linphone_gtk_call_log_update(GtkWidget *w);
void linphone_gtk_create_log_window(void);
void linphone_gtk_log_show(void);
void linphone_gtk_show_main_window(void);
void linphone_gtk_log_push(OrtpLogLevel lev, const char *fmt, va_list args);
void linphone_gtk_destroy_log_window(void);
void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to);
gboolean linphone_gtk_check_logs();
void linphone_gtk_buddy_info_updated(LinphoneCore *lc, LinphoneFriend *lf);
const gchar *linphone_gtk_get_ui_config(const char *key, const char *def);
@ -100,11 +102,12 @@ 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_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_incoming(LinphoneCall *call);
void linphone_gtk_in_call_view_set_paused(LinphoneCall *call);
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_show_login_frame(LinphoneProxyConfig *cfg);
void linphone_gtk_exit_login_frame(void);
@ -112,4 +115,5 @@ void linphone_gtk_set_ui_config(const char *key, const char *value);
void linphone_gtk_log_uninit();
bool_t linphone_gtk_init_instance(const char *app_name, const char *addr_to_call);
void linphone_gtk_uninit_instance(void);

View file

@ -36,6 +36,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define chdir _chdir
#endif
#if defined HAVE_NOTIFY1 || defined HAVE_NOTIFIED4
#define HAVE_NOTIFY
#endif
#ifdef HAVE_NOTIFY
#include <libnotify/notify.h>
#endif
#define LINPHONE_ICON "linphone.png"
const char *this_program_ident_string="linphone_ident_string=" LINPHONE_VERSION;
@ -53,9 +61,9 @@ static void linphone_gtk_display_message(LinphoneCore *lc, const char *msg);
static void linphone_gtk_display_warning(LinphoneCore *lc, const char *warning);
static void linphone_gtk_display_url(LinphoneCore *lc, const char *msg, const char *url);
static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl);
static void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to);
static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg);
static gboolean linphone_gtk_auto_answer(LinphoneCall *call);
static void linphone_gtk_status_icon_set_blinking(gboolean val);
static gboolean verbose=0;
@ -622,6 +630,24 @@ static void completion_add_text(GtkEntry *entry, const char *text){
save_uri_history();
}
void linphone_gtk_show_main_window(){
GtkWidget *w=linphone_gtk_get_main_window();
LinphoneCore *lc=linphone_gtk_get_core();
if (linphone_core_video_enabled(lc)){
linphone_core_enable_video_preview(lc,linphone_gtk_get_ui_config_int("videoselfview",
VIDEOSELFVIEW_DEFAULT));
}
gtk_widget_show(w);
gtk_window_present(GTK_WINDOW(w));
}
static void linphone_gtk_show(LinphoneCore *lc){
#ifndef HAVE_NOTIFY
linphone_gtk_show_main_window();
#endif
}
void linphone_gtk_call_terminated(LinphoneCall *call, const char *error){
GtkWidget *mw=linphone_gtk_get_main_window();
if (linphone_core_get_calls(linphone_gtk_get_core())==NULL){
@ -633,18 +659,6 @@ void linphone_gtk_call_terminated(LinphoneCall *call, const char *error){
update_video_title();
}
static bool_t all_other_calls_paused(LinphoneCall *refcall, const MSList *calls){
for(;calls!=NULL;calls=calls->next){
LinphoneCall *call=(LinphoneCall*)calls->data;
LinphoneCallState cs=linphone_call_get_state(call);
if (refcall!=call){
if (cs!=LinphoneCallPaused && cs!=LinphoneCallPausing)
return FALSE;
}
}
return TRUE;
}
static void linphone_gtk_update_call_buttons(LinphoneCall *call){
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *mw=linphone_gtk_get_main_window();
@ -659,21 +673,9 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
start_active=TRUE;
stop_active=FALSE;
}else{
stop_active=TRUE;
if (all_other_calls_paused(NULL,calls)){
start_active=TRUE;
add_call=TRUE;
}else if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived && all_other_calls_paused(call,calls)){
if (call_list_size>1){
start_active=TRUE;
add_call=TRUE;
}else{
start_active=TRUE;
add_call=FALSE;
}
}else{
start_active=FALSE;
}
stop_active=TRUE;
start_active=TRUE;
add_call=TRUE;
}
button=linphone_gtk_get_widget(mw,"start_call");
gtk_widget_set_sensitive(button,start_active);
@ -686,6 +688,7 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),stop_active);
linphone_gtk_enable_transfer_button(lc,call_list_size>1);
linphone_gtk_enable_conference_button(lc,call_list_size>1);
update_video_title();
}
@ -715,7 +718,7 @@ void linphone_gtk_start_call(GtkWidget *w){
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();
if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived){
linphone_core_accept_call(lc,call);
}else{
@ -749,6 +752,7 @@ void linphone_gtk_answer_clicked(GtkWidget *button){
if (call){
linphone_core_pause_all_calls(linphone_gtk_get_core());
linphone_core_accept_call(linphone_gtk_get_core(),call);
linphone_gtk_show_main_window(); /* useful when the button is clicked on a notification */
}
}
@ -759,7 +763,7 @@ void linphone_gtk_enable_video(GtkWidget *w){
gtk_widget_set_sensitive(selfview_item,val);
if (val){
linphone_core_enable_video_preview(linphone_gtk_get_core(),
linphone_gtk_get_ui_config_int("videoselfview",VIDEOSELFVIEW_DEFAULT));
linphone_gtk_get_ui_config_int("videoselfview",VIDEOSELFVIEW_DEFAULT));
}else{
linphone_core_enable_video_preview(linphone_gtk_get_core(),FALSE);
}
@ -783,21 +787,6 @@ void linphone_gtk_used_identity_changed(GtkWidget *w){
if (sel) g_free(sel);
}
static void linphone_gtk_show_main_window(){
GtkWidget *w=linphone_gtk_get_main_window();
LinphoneCore *lc=linphone_gtk_get_core();
if (linphone_core_video_enabled(lc)){
linphone_core_enable_video_preview(lc,linphone_gtk_get_ui_config_int("videoselfview",
VIDEOSELFVIEW_DEFAULT));
}
gtk_widget_show(w);
gtk_window_present(GTK_WINDOW(w));
}
static void linphone_gtk_show(LinphoneCore *lc){
linphone_gtk_show_main_window();
}
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){
linphone_gtk_show_friends();
}
@ -936,6 +925,94 @@ static void linphone_gtk_display_url(LinphoneCore *lc, const char *msg, const ch
static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl){
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"call_logs");
if (w) linphone_gtk_call_log_update(w);
linphone_gtk_call_log_update(linphone_gtk_get_main_window());
}
#ifdef HAVE_NOTIFY
static bool_t notify_actions_supported() {
bool_t accepts_actions = FALSE;
GList *capabilities = notify_get_server_caps();
GList *c;
if(capabilities != NULL) {
for(c = capabilities; c != NULL; c = c->next) {
if(strcmp((char*)c->data, "actions") == 0 ) {
accepts_actions = TRUE;
break;
}
}
g_list_foreach(capabilities, (GFunc)g_free, NULL);
g_list_free(capabilities);
}
return accepts_actions;
}
static NotifyNotification* build_notification(const char *title, const char *body){
return notify_notification_new(title,body,linphone_gtk_get_ui_config("icon",LINPHONE_ICON)
#ifdef HAVE_NOTIFY1
,NULL
#endif
);
}
static void show_notification(NotifyNotification* n){
if (n && !notify_notification_show(n,NULL))
ms_error("Failed to send notification.");
}
static void make_notification(const char *title, const char *body){
show_notification(build_notification(title,body));
}
#endif
static void linphone_gtk_notify(LinphoneCall *call, const char *msg){
#ifdef HAVE_NOTIFY
if (!notify_is_initted())
if (!notify_init ("Linphone")) ms_error("Libnotify failed to init.");
#endif
if (!call) {
#ifdef HAVE_NOTIFY
if (!notify_notification_show(notify_notification_new("Linphone",msg,NULL
#ifdef HAVE_NOTIFY1
,NULL
#endif
),NULL))
ms_error("Failed to send notification.");
#else
linphone_gtk_show_main_window();
#endif
} else if (!gtk_window_is_active((GtkWindow*)linphone_gtk_get_main_window())) {
#ifdef HAVE_NOTIFY
char *body=NULL;
char *remote=call!=NULL ? linphone_call_get_remote_address_as_string(call) : NULL;
NotifyNotification *n;
switch(linphone_call_get_state(call)){
case LinphoneCallError:
make_notification(_("Call error"),body=g_markup_printf_escaped("<span size=\"large\">%s</span>\n%s",msg,remote));
break;
case LinphoneCallEnd:
make_notification(_("Call ended"),body=g_markup_printf_escaped("<span size=\"large\">%s</span>",remote));
break;
case LinphoneCallIncomingReceived:
n=build_notification(_("Incoming call"),body=g_markup_printf_escaped("<span size=\"large\">%s</span>",remote));
if (notify_actions_supported()) {
notify_notification_add_action (n,"answer", _("Answer"),
NOTIFY_ACTION_CALLBACK(linphone_gtk_answer_clicked),NULL,NULL);
notify_notification_add_action (n,"decline",_("Decline"),
NOTIFY_ACTION_CALLBACK(linphone_gtk_decline_clicked),NULL,NULL);
}
show_notification(n);
break;
case LinphoneCallPausedByRemote:
make_notification(_("Call paused"),body=g_markup_printf_escaped(_("<span size=\"large\">by %s</span>"),remote));
break;
default:
break;
}
if (body) g_free(body);
if (remote) g_free(remote);
#endif
}
}
static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg){
@ -954,10 +1031,12 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
break;
case LinphoneCallEnd:
linphone_gtk_in_call_view_terminate(call,NULL);
linphone_gtk_status_icon_set_blinking(FALSE);
break;
case LinphoneCallIncomingReceived:
linphone_gtk_create_in_call_view (call);
linphone_gtk_in_call_view_set_incoming(call,!all_other_calls_paused (call,linphone_core_get_calls(lc)));
linphone_gtk_in_call_view_set_incoming(call);
linphone_gtk_status_icon_set_blinking(TRUE);
if (auto_answer) {
linphone_call_ref(call);
g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer ,call);
@ -974,10 +1053,12 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call
break;
case LinphoneCallConnected:
linphone_gtk_enable_hold_button (call,TRUE,TRUE);
linphone_gtk_status_icon_set_blinking(FALSE);
break;
default:
break;
}
linphone_gtk_notify(call, msg);
linphone_gtk_update_call_buttons (call);
}
@ -1099,20 +1180,60 @@ static GtkWidget *create_icon_menu(){
static GtkStatusIcon *icon=NULL;
static void handle_icon_click() {
GtkWidget *mw=linphone_gtk_get_main_window();
if (!gtk_window_is_active((GtkWindow*)mw)) {
linphone_gtk_show_main_window();
} else {
gtk_widget_hide(mw);
}
}
static void linphone_gtk_init_status_icon(){
const char *icon_path=linphone_gtk_get_ui_config("icon",LINPHONE_ICON);
const char *call_icon_path=linphone_gtk_get_ui_config("start_call_icon","startcall-green.png");
GdkPixbuf *pbuf=create_pixbuf(icon_path);
GtkWidget *menu=create_icon_menu();
const char *title;
icon=gtk_status_icon_new_from_pixbuf(pbuf);
g_object_unref(G_OBJECT(pbuf));
g_signal_connect_swapped(G_OBJECT(icon),"activate",(GCallback)linphone_gtk_show_main_window,linphone_gtk_get_main_window());
g_signal_connect(G_OBJECT(icon),"popup-menu",(GCallback)icon_popup_menu,NULL);
title=linphone_gtk_get_ui_config("title",_("Linphone - a video internet phone"));
icon=gtk_status_icon_new_from_pixbuf(pbuf);
gtk_status_icon_set_name(icon,title);
g_signal_connect_swapped(G_OBJECT(icon),"activate",(GCallback)handle_icon_click,NULL);
g_signal_connect(G_OBJECT(icon),"popup-menu",(GCallback)icon_popup_menu,NULL);
gtk_status_icon_set_tooltip(icon,title);
gtk_status_icon_set_visible(icon,TRUE);
g_object_set_data(G_OBJECT(icon),"menu",menu);
g_object_weak_ref(G_OBJECT(icon),(GWeakNotify)gtk_widget_destroy,menu);
g_object_set_data(G_OBJECT(icon),"icon",pbuf);
g_object_weak_ref(G_OBJECT(icon),(GWeakNotify)g_object_unref,pbuf);
pbuf=create_pixbuf(call_icon_path);
g_object_set_data(G_OBJECT(icon),"call_icon",pbuf);
}
static gboolean do_icon_blink(GtkStatusIcon *gi){
GdkPixbuf *call_icon=g_object_get_data(G_OBJECT(gi),"call_icon");
GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(gi),"icon");
GdkPixbuf *cur_icon=gtk_status_icon_get_pixbuf(gi);
if (cur_icon==call_icon){
gtk_status_icon_set_from_pixbuf(gi,normal_icon);
}else{
gtk_status_icon_set_from_pixbuf(gi,call_icon);
}
return TRUE;
}
static void linphone_gtk_status_icon_set_blinking(gboolean val){
guint tout;
tout=(unsigned)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(icon),"timeout"));
if (val && tout==0){
tout=g_timeout_add(500,(GSourceFunc)do_icon_blink,icon);
g_object_set_data(G_OBJECT(icon),"timeout",GINT_TO_POINTER(tout));
}else if (!val && tout!=0){
GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(icon),"icon");
g_source_remove(tout);
g_object_set_data(G_OBJECT(icon),"timeout",NULL);
gtk_status_icon_set_from_pixbuf(icon,normal_icon);
}
}
static void init_identity_combo(GtkComboBox *box){
@ -1271,11 +1392,13 @@ static void linphone_gtk_configure_main_window(){
g_object_set_data(G_OBJECT(menu_item),"home",tmp);
}
{
/*
GdkPixbuf *pbuf=create_pixbuf("contact-orange.png");
if (pbuf) {
gtk_image_set_from_pixbuf(GTK_IMAGE(linphone_gtk_get_widget(w,"contact_tab_icon")),pbuf);
g_object_unref(G_OBJECT(pbuf));
}
*/
}
{
GdkPixbuf *pbuf=create_pixbuf("dialer-orange.png");
@ -1350,7 +1473,8 @@ static void linphone_gtk_init_main_window(){
linphone_gtk_show_friends();
linphone_gtk_connect_digits();
main_window=linphone_gtk_get_main_window();
linphone_gtk_call_log_update(main_window);
linphone_gtk_update_call_buttons (NULL);
/*prevent the main window from being destroyed by a user click on WM controls, instead we hide it*/
g_signal_connect (G_OBJECT (main_window), "delete-event",
@ -1358,7 +1482,6 @@ static void linphone_gtk_init_main_window(){
#ifdef HAVE_GTK_OSX
{
GtkWidget *menubar=linphone_gtk_get_widget(main_window,"menubar1");
gtk_widget_destroy(linphone_gtk_get_widget(main_window,"imagemenuitem5"));
GtkOSXApplication *theMacApp = (GtkOSXApplication*)g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
gtk_osxapplication_set_menu_bar(theMacApp,GTK_MENU_SHELL(menubar));
gtk_widget_hide(menubar);
@ -1410,10 +1533,12 @@ void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
}
static void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to){
GtkEntry * uri_bar =GTK_ENTRY(linphone_gtk_get_widget(
void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to){
GtkEntry * uri_bar =GTK_ENTRY(linphone_gtk_get_widget(
linphone_gtk_get_main_window(), "uribar"));
linphone_gtk_show_main_window();
char *text;
linphone_gtk_notify(NULL,(text=ms_strdup_printf(_("We are transferred to %s"),refer_to)));
g_free(text);
gtk_entry_set_text(uri_bar, refer_to);
linphone_gtk_start_call(linphone_gtk_get_main_window());
}
@ -1422,16 +1547,20 @@ static void linphone_gtk_check_soundcards(){
const char **devices=linphone_core_get_sound_devices(linphone_gtk_get_core());
if (devices==NULL || devices[0]==NULL){
linphone_gtk_display_something(GTK_MESSAGE_WARNING,
_("No sound cards have been detected on this computer.\n"
"You won't be able to send or receive audio calls."));
_("No sound cards have been detected on this computer.\n"
"You won't be able to send or receive audio calls."));
}
}
static void linphone_gtk_quit(void){
linphone_gtk_uninit_instance();
gdk_threads_leave();
linphone_gtk_destroy_log_window();
linphone_core_destroy(the_core);
linphone_gtk_log_uninit();
linphone_gtk_destroy_log_window();
linphone_core_destroy(the_core);
linphone_gtk_log_uninit();
#ifdef HAVE_NOTIFY
notify_uninit();
#endif
}
#ifdef HAVE_GTK_OSX
@ -1458,6 +1587,7 @@ int main(int argc, char *argv[]){
const char *lang;
GtkSettings *settings;
GdkPixbuf *pbuf;
const char *app_name="Linphone";
g_thread_init(NULL);
gdk_threads_init();
@ -1465,6 +1595,7 @@ int main(int argc, char *argv[]){
progpath = strdup(argv[0]);
config_file=linphone_gtk_get_config_file();
#ifdef WIN32
/*workaround for windows: sometimes LANG is defined to an integer value, not understood by gtk */
@ -1526,9 +1657,7 @@ int main(int argc, char *argv[]){
the options, in case we needed to access the working directory */
factory_config_file = linphone_gtk_get_factory_config_file();
if (linphone_core_wake_up_possible_already_running_instance(
config_file, addr_to_call) == 0){
g_message("addr_to_call=%s",addr_to_call);
if (linphone_gtk_init_instance(app_name, addr_to_call) == FALSE){
g_warning("Another running instance of linphone has been detected. It has been woken-up.");
g_warning("This instance is going to exit now.");
gdk_threads_leave();
@ -1553,7 +1682,7 @@ int main(int argc, char *argv[]){
linphone_gtk_init_liblinphone(config_file, factory_config_file);
g_set_application_name(linphone_gtk_get_ui_config("title","Linphone"));
g_set_application_name(app_name);
pbuf=create_pixbuf(linphone_gtk_get_ui_config("icon",LINPHONE_ICON));
if (pbuf!=NULL) gtk_window_set_default_icon(pbuf);

View file

@ -2,6 +2,66 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="dummy_conf_window">
<property name="can_focus">False</property>
<child>
<object class="GtkFrame" id="callee_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="conf_alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkHBox" id="conf_hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkProgressBar" id="sound_indicator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="hangup_button">
<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"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</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">&lt;b&gt;Callee name&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
</child>
</object>
<object class="GtkWindow" id="dummy_in_call_window">
<property name="can_focus">False</property>
<child>
@ -20,11 +80,12 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="in_call_animation">
<object class="GtkHBox" id="in_call_animation">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-info</property>
<property name="icon-size">5</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -87,10 +148,9 @@
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="mute_pause_buttons">
<object class="GtkHButtonBox" id="incall_hbuttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">spread</property>
<child>
<object class="GtkButton" id="incall_mute">
<property name="label" translatable="yes">Mute</property>
@ -106,6 +166,19 @@
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="mute_pause_buttons">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">center</property>
<child>
<object class="GtkButton" id="hold_call">
<property name="label" translatable="yes">Pause</property>
@ -118,14 +191,14 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
</object>
@ -191,6 +264,11 @@
<property name="can_focus">False</property>
<property name="stock">gtk-add</property>
</object>
<object class="GtkImage" id="image11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-clear</property>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -244,26 +322,16 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="main_menu">
<object class="GtkMenuItem" id="options_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Views</property>
<property name="label" translatable="yes">_Options</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu1">
<object class="GtkMenu" id="menu2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="assistant_item">
<property name="label">_Assistant</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">image3</property>
<property name="use_stock">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="settings_menu">
<property name="label">gtk-preferences</property>
@ -275,18 +343,6 @@
<signal name="activate" handler="linphone_gtk_show_parameters" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="call_history_item">
<property name="label" translatable="yes">_Call history</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="image">image2</property>
<property name="use_stock">False</property>
<signal name="activate" handler="linphone_gtk_show_call_logs" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="disconnect_item">
<property name="label">gtk-disconnect</property>
@ -303,32 +359,6 @@
<property name="can_focus">False</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem5">
<property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="gtk_main_quit" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="options_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_action_appearance">False</property>
<property name="label" translatable="yes">_Options</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckMenuItem" id="enable_video_item">
<property name="visible">True</property>
@ -795,7 +825,7 @@
<object class="GtkImage" id="contact_tab_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
<property name="stock">gtk-directory</property>
</object>
<packing>
<property name="expand">True</property>
@ -825,279 +855,77 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkFrame" id="frame3">
<object class="GtkVBox" id="call_logs_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0.5</property>
<property name="shadow_type">none</property>
<property name="spacing">2</property>
<child>
<object class="GtkAlignment" id="alignment5">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="layout_style">end</property>
<child>
<object class="GtkAspectFrame" id="aspectframe1">
<object class="GtkButton" id="erase_call_logs_button">
<property name="label">gtk-clear</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkTable" id="dtmf_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">4</property>
<property name="n_rows">4</property>
<property name="n_columns">4</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="dtmf_D">
<property name="label" translatable="yes">D</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_hash">
<property name="label" translatable="yes">#</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_0">
<property name="label" translatable="yes">0</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_star">
<property name="label" translatable="yes">*</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_C">
<property name="label" translatable="yes">C</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_9">
<property name="label" translatable="yes">9</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_8">
<property name="label" translatable="yes">8</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_7">
<property name="label" translatable="yes">7</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_B">
<property name="label" translatable="yes">B</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_6">
<property name="label" translatable="yes">6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_5">
<property name="label" translatable="yes">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_4">
<property name="label" translatable="yes">4</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_A">
<property name="label" translatable="yes">A</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_3">
<property name="label" translatable="yes">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_2">
<property name="label" translatable="yes">2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_1">
<property name="label" translatable="yes">1</property>
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
</child>
</object>
</child>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="linphone_gtk_clear_call_logs" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="call_back_button">
<property name="label" translatable="yes">Call back</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_call_log_callback" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkTreeView" id="logs_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<signal name="row-activated" handler="linphone_gtk_history_row_activated" swapped="no"/>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
@ -1111,6 +939,321 @@
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage" id="history_tab_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-refresh</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0.49000000953674316</property>
<property name="label" translatable="yes">Recent calls</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0.5</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkAspectFrame" id="aspectframe1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkTable" id="dtmf_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">4</property>
<property name="n_rows">4</property>
<property name="n_columns">4</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="dtmf_D">
<property name="label" translatable="yes">D</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_hash">
<property name="label" translatable="yes">#</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_0">
<property name="label" translatable="yes">0</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_star">
<property name="label" translatable="yes">*</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_C">
<property name="label" translatable="yes">C</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_9">
<property name="label" translatable="yes">9</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_8">
<property name="label" translatable="yes">8</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_7">
<property name="label" translatable="yes">7</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_B">
<property name="label" translatable="yes">B</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_6">
<property name="label" translatable="yes">6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_5">
<property name="label" translatable="yes">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_4">
<property name="label" translatable="yes">4</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_A">
<property name="label" translatable="yes">A</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_3">
<property name="label" translatable="yes">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_2">
<property name="label" translatable="yes">2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="dtmf_1">
<property name="label" translatable="yes">1</property>
<property name="width_request">40</property>
<property name="height_request">40</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_action_appearance">False</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
@ -1141,16 +1284,10 @@
</child>
</object>
<packing>
<property name="position">1</property>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child type="tab">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>

99
gtk/singleinstance.c Normal file
View file

@ -0,0 +1,99 @@
/*
linphone, gtk interface.
Copyright (C) 2011 Belledonne Communications SARL
Author: Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
static ms_thread_t pipe_thread;
static ortp_pipe_t server_pipe=-1;
static gboolean server_pipe_running=TRUE;
static char *pipe_name;
static gboolean execute_wakeup(char *uri){
linphone_gtk_show_main_window();
if (strlen(uri)>0)
linphone_gtk_refer_received(linphone_gtk_get_core(),uri);
g_free(uri);
return FALSE;
}
static void * server_pipe_thread(void *pointer){
ortp_pipe_t child;
do{
child=ortp_server_pipe_accept_client(server_pipe);
if (server_pipe_running && child!=-1){
char buf[256]={0};
if (ortp_pipe_read(child,(uint8_t*)buf,sizeof(buf))>0){
g_message("Received wakeup command with arg %s",buf);
gdk_threads_enter();
g_timeout_add(20,(GSourceFunc)execute_wakeup,g_strdup(buf));
gdk_threads_leave();
}
ortp_server_pipe_close_client(child);
}
}while(server_pipe_running);
ortp_server_pipe_close(server_pipe);
return NULL;
}
static void linphone_gtk_init_pipe(const char *name){
pipe_name=g_strdup(name);
server_pipe=ortp_server_pipe_create(name);
if (server_pipe==-1){
g_warning("Fail to create server pipe for name %s: %s",name,strerror(errno));
}
ms_thread_create(&pipe_thread,NULL,server_pipe_thread,NULL);
}
bool_t linphone_gtk_init_instance(const char *app_name, const char *addr_to_call){
ortp_pipe_t p=ortp_client_pipe_connect(app_name);
if (p!=-1){
uint8_t buf[256]={0};
g_message("There is already a running instance.");
if (addr_to_call!=NULL){
strncpy((char*)buf,addr_to_call,sizeof(buf)-1);
}
if (ortp_pipe_write(p,buf,sizeof(buf))==-1){
g_error("Fail to send wakeup command to running instance: %s",strerror(errno));
}else{
g_message("Message to running instance sent.");
}
ortp_client_pipe_close(p);
return FALSE;
}else{
linphone_gtk_init_pipe(app_name);
}
return TRUE;
}
void linphone_gtk_uninit_instance(void){
if (server_pipe!=-1){
ortp_pipe_t client;
server_pipe_running=FALSE;
/*this is to unblock the accept() of the server pipe*/
client=ortp_client_pipe_connect(pipe_name);
ortp_pipe_write(client,(uint8_t*)" ",1);
ortp_client_pipe_close(client);
ms_thread_join(pipe_thread,NULL);
server_pipe=-1;
g_free(pipe_name);
pipe_name=NULL;
}
}

View file

@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
import java.util.Vector;
/**
* Object representing a Call. calls are created using {@link LinphoneCore#invite(LinphoneAddress)} or passed to the application by listener {@link LinphoneCoreListener#callState(LinphoneCore, LinphoneCall, State, String)}
@ -29,97 +30,107 @@ public interface LinphoneCall {
* Linphone call states
*
*/
enum State {
static class State {
@SuppressWarnings("unchecked")
static private Vector values = new Vector();
private final int mValue;
public final int value() {return mValue;}
private final String mStringValue;
/**
* Idle
*/
Idle(0, "Idle"),
public final static State Idle = new State(0,"Idle");
/**
* Incoming call received.
*/
IncomingReceived(1, "IncomingReceived"),
public final static State IncomingReceived = new State(1,"IncomingReceived");
/**
* Outgoing call initialized.
* Outgoing call initialiazed.
*/
OutgoingInit(2, "OutgoingInit"),
public final static State OutgoingInit = new State(2,"OutgoingInit");
/**
* Outgoing call in progress.
*/
OutgoingProgress(3, "OutgoingProgress"),
public final static State OutgoingProgress = new State(3,"OutgoingProgress");
/**
* Outgoing call ringing.
*/
OutgoingRinging(4, "OutgoingRinging"),
public final static State OutgoingRinging = new State(4,"OutgoingRinging");
/**
* Outgoing call early media
*/
OutgoingEarlyMedia(5, "OutgoingEarlyMedia"),
public final static State OutgoingEarlyMedia = new State(5,"OutgoingEarlyMedia");
/**
* Connected
*/
Connected(6, "Connected"),
public final static State Connected = new State(6,"Connected");
/**
* Streams running
*/
StreamsRunning(7, "StreamsRunning"),
public final static State StreamsRunning = new State(7,"StreamsRunning");
/**
* Pausing
*/
Pausing(8, "Pausing"),
public final static State Pausing = new State(8,"Pausing");
/**
* Paused
*/
Paused(9, "Paused"),
public final static State Paused = new State(9,"Paused");
/**
* Resuming
*/
Resuming(10, "Resuming"),
public final static State Resuming = new State(10,"Resuming");
/**
* Refered
*/
Refered(11,"Refered"),
public final static State Refered = new State(11,"Refered");
/**
* Error
*/
Error(12,"Error"),
public final static State Error = new State(12,"Error");
/**
* Call end
*/
CallEnd(13,"CallEnd"),
public final static State CallEnd = new State(13,"CallEnd");
/**
* Paused by remote
*/
PausedByRemote(14,"PausedByRemote"),
public final static State PausedByRemote = new State(14,"PausedByRemote");
/**
* The call's parameters are updated, used for example when video is asked by remote
*/
CallUpdatedByRemote(15, "CallUpdatedByRemote"),
public static final State CallUpdatedByRemote = new State(15, "CallUpdatedByRemote");
/**
* We are proposing early media to an incoming call
*/
CallIncomingEarlyMedia(16,"CallIncomingEarlyMedia"),
public static final State CallIncomingEarlyMedia = new State(16,"CallIncomingEarlyMedia");
/**
* The remote accepted the call update initiated by us
*/
CallUpdated(17, "CallUpdated"),
public static final State CallUpdated = new State(17, "CallUpdated");
/**
* The call object is now released.
*/
CallReleased(18,"CallReleased");
public static final State CallReleased = new State(18,"CallReleased");
private final int mValue;
private final String mStringValue;
private State(int v, String desc) {
this.mValue = v;
this.mStringValue = desc;
@SuppressWarnings("unchecked")
private State(int value,String stringValue) {
mValue = value;
values.addElement(this);
mStringValue=stringValue;
}
public static State fromInt(int value) {
State[] allStates = State.values();
for (int i=0; i<allStates.length;i++) {
if (allStates[i].mValue == value)
return allStates[i];
for (int i=0; i<values.size();i++) {
State state = (State) values.elementAt(i);
if (state.mValue == value) return state;
}
throw new RuntimeException("state not found ["+value+"]");
}
@ -213,4 +224,5 @@ public interface LinphoneCall {
String getAuthenticationToken();
boolean isAuthenticationTokenVerified();
boolean areStreamsEncrypted();
boolean isInConference();
}

View file

@ -599,6 +599,24 @@ public interface LinphoneCore {
boolean pauseAllCalls();
void setZrtpSecretsCache(String file);
public void enableEchoLimiter(boolean val);
void enableEchoLimiter(boolean val);
boolean isInConference();
void enterConference();
void leaveConference();
void addToConference(LinphoneCall call);
void addAllToConference();
void removeFromConference(LinphoneCall call);
void terminateConference();
int getConferenceSize();
void terminateAllCalls();
@SuppressWarnings("unchecked") List getCalls();
int getCallsNb();
void transferCall(LinphoneCall call, String referTo);
void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination);
}

@ -1 +1 @@
Subproject commit 4ae0903143af9ab2d149909e8ac66ca600119e4a
Subproject commit e52635ac0d64eeec2670ce05566644fe5f296a47

View file

@ -12,6 +12,7 @@ status-orange.png \
status-red.png \
status-offline.png \
contact-orange.png dialer-orange.png history-orange.png\
startcall-green.png stopcall-red.png addcall-green.png linphone.icns
startcall-green.png stopcall-red.png addcall-green.png linphone.icns \
contact_starred.png contact_unstarred.png
EXTRA_DIST=$(pixmap_DATA)

BIN
pixmaps/contact_starred.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -30,4 +30,5 @@ coreapi/friend.c
coreapi/proxy.c
coreapi/callbacks.c
coreapi/sal_eXosip2.c
coreapi/linphonecall.c

View file

@ -44,4 +44,5 @@ mediastreamer2/src/winvideo.c
mediastreamer2/src/winvideo2.c
mediastreamer2/src/winvideods.c
mediastreamer2/src/x11video.c
mediastreamer2/src/vp8.c

View file

@ -398,7 +398,7 @@ msgstr "<b>Appel en cours</b>"
#: ../gtk/incall_view.c:260
msgid "<b>Paused call</b>"
msgstr "<b>Appel en attente<b>"
msgstr "<b>Appel en attente</b>"
#: ../gtk/incall_view.c:272
#, c-format