From 98c4a9bb5e893ff6eac575d150971a4daf71c967 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 12 Sep 2011 22:42:53 +0200 Subject: [PATCH 01/21] wip - conferencing --- coreapi/Makefile.am | 3 +- coreapi/conference.c | 108 ++++++++++++++ coreapi/linphonecall.c | 320 ++++++++++++++++++++++------------------- coreapi/linphonecore.c | 16 ++- coreapi/linphonecore.h | 5 +- coreapi/private.h | 24 +++- mediastreamer2 | 2 +- 7 files changed, 316 insertions(+), 162 deletions(-) create mode 100644 coreapi/conference.c diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 6ea151e0a..e9cfe715b 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -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 diff --git a/coreapi/conference.c b/coreapi/conference.c new file mode 100644 index 000000000..e97f2588c --- /dev/null +++ b/coreapi/conference.c @@ -0,0 +1,108 @@ +/*************************************************************************** + * 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 conference_check_uninit(LinphoneConference *ctx){ + if (ctx->conf){ + if (ctx->conf->nmembers==0){ + 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); +} + +int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){ + LinphoneCallParams params; + 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 */ + linphone_core_update_call(lc,call,¶ms); + }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); +} + +int linphone_core_pause_conference(LinphoneCore *lc){ + return 0; +} + + +int linphone_core_resume_conference(LinphoneCore *lc){ + return 0; +} + diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 210c2c453..80f681f44 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -834,10 +834,7 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){ } } - -static void post_configure_audio_streams(LinphoneCall*call){ - AudioStream *st=call->audiostream; - LinphoneCore *lc=call->core; +static 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; @@ -845,7 +842,7 @@ static void post_configure_audio_streams(LinphoneCall*call){ 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 audio_stream_set_mic_gain(st,0); @@ -884,6 +881,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); @@ -953,18 +956,167 @@ 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); + 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) { @@ -972,155 +1124,18 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut 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 ?"); - } + 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; } -#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; +#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->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); - 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."); - } - } -#endif call->all_muted=all_inputs_muted; call->playing_ringbacktone=send_ringbacktone; call->up_bw=linphone_core_get_upload_bandwidth(lc); @@ -1158,6 +1173,9 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ } } 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; } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6abe85101..17cb06d9d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2219,13 +2219,20 @@ 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){ @@ -2486,8 +2493,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")); } @@ -2524,6 +2530,7 @@ 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"); @@ -2537,7 +2544,8 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_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"); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 010b15851..b2b09f855 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1023,7 +1023,10 @@ 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_remove_from_conference(LinphoneCore *lc, LinphoneCall *call); +int linphone_core_pause_conference(LinphoneCore *lc); +int linphone_core_resume_conference(LinphoneCore *lc); #ifdef __cplusplus diff --git a/coreapi/private.h b/coreapi/private.h index 373079885..e5ce1fd0d 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -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; }; @@ -388,6 +392,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 +450,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; @@ -448,7 +461,6 @@ struct _LinphoneCore bool_t network_reachable; bool_t use_preview_window; bool_t ringstream_autorelease; - char* zrtp_secrets_cache; }; bool_t linphone_core_can_we_add_call(LinphoneCore *lc); @@ -493,6 +505,10 @@ void ec_calibrator_destroy(EcCalibrator *ecc); void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed); +/*conferencing subsystem*/ +void linphone_call_add_to_conf(LinphoneCall *call); +void linphone_call_remove_from_conf(LinphoneCall *call); + #define HOLD_OFF (0) #define HOLD_ON (1) diff --git a/mediastreamer2 b/mediastreamer2 index a82dcdbf8..a8ca8f204 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a82dcdbf8a4e8364bdcaa6f6fb88ca087f48a780 +Subproject commit a8ca8f204ca57d18f6e1c0515adaf7edb0c905dd From 41029c78b13f62975fc6cee3658cfe28b9de6007 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 13 Sep 2011 14:43:20 +0200 Subject: [PATCH 02/21] conferencing in progress --- console/commands.c | 30 +++++++++++++++++++++++++++--- coreapi/linphonecall.c | 9 ++++++++- coreapi/linphonecore.c | 19 ++++++++++--------- coreapi/linphonecore.h | 1 + mediastreamer2 | 2 +- 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/console/commands.c b/console/commands.c index 32482bad7..27ea8dc5c 100644 --- a/console/commands.c +++ b/console/commands.c @@ -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); @@ -124,7 +125,6 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int index); static void linphonec_codec_disable(int type, LinphoneCore *lc, int index); - /* Command table management */ static LPC_COMMAND *lpc_find_command(const char *name); @@ -184,6 +184,10 @@ static LPC_COMMAND commands[] = { "'transfer ': transfers the call with 'id' to the destination sip-uri\n" "'transfer --to-call ': 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 : join the call with id 'call id' into the audio conference." + "'conference rm : 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 @@ -1461,6 +1465,24 @@ 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); + }else if (strcmp(subcommand,"rm")==0){ + linphone_core_remove_from_conference(lc,call); + } + } + return 0; +} + /*************************************************************************** * * Commands helper functions @@ -2411,9 +2433,11 @@ static void lpc_display_call_states(LinphoneCore *lc){ }else{ for(;elem!=NULL;elem=elem->next){ 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))); + linphonec_out("%-2i | %-35s | %s %s\n",(int)(long)linphone_call_get_user_pointer(call), + tmp,linphone_call_state_to_string(linphone_call_get_state(call)), + in_conference ? "(conferencing)" : ""); ms_free(tmp); } } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 80f681f44..a568b8ba9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -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. @@ -1405,7 +1412,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); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 17cb06d9d..1d985f544 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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); @@ -2536,13 +2535,15 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call) 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){ + 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; + } + ms_message("Resuming call %p",call); } - ms_message("Resuming call %p",call); sal_media_description_set_dir(call->localdesc,SalStreamSendRecv); if (call->params.in_conference) subject="Resuming conference"; if(sal_call_update(call->op,subject) != 0){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index b2b09f855..e0f3145ff 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -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); diff --git a/mediastreamer2 b/mediastreamer2 index a8ca8f204..228168085 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a8ca8f204ca57d18f6e1c0515adaf7edb0c905dd +Subproject commit 22816808514255867ae8fa5347b854f4570784f7 From 0a9e2d37388439bfcdbe9d386d39a003a4ffa030 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 13 Sep 2011 21:40:35 +0200 Subject: [PATCH 03/21] audio conferencing is working. Not all cases are tested yet. --- console/commands.c | 67 +++++++++++------------------------------- coreapi/callbacks.c | 1 + coreapi/conference.c | 55 ++++++++++++++++++++++++++++++++-- coreapi/linphonecall.c | 2 +- coreapi/linphonecore.c | 4 +-- coreapi/linphonecore.h | 5 ++-- coreapi/private.h | 1 + 7 files changed, 78 insertions(+), 57 deletions(-) diff --git a/console/commands.c b/console/commands.c index 27ea8dc5c..84639ada8 100644 --- a/console/commands.c +++ b/console/commands.c @@ -123,7 +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); @@ -527,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) @@ -603,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"); @@ -1476,8 +1433,16 @@ static int lpc_cmd_conference(LinphoneCore *lc, char *args){ 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; @@ -2425,19 +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 %s\n",(int)(long)linphone_call_get_user_pointer(call), - tmp,linphone_call_state_to_string(linphone_call_get_state(call)), - in_conference ? "(conferencing)" : ""); + 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); } } diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index a101dbc8e..1f00b1995 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -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); } diff --git a/coreapi/conference.c b/coreapi/conference.c index e97f2588c..c1058233b 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -32,9 +32,20 @@ static void conference_check_init(LinphoneConference *ctx){ } } +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; } @@ -61,8 +72,36 @@ void linphone_call_remove_from_conf(LinphoneCall *call){ 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; @@ -75,7 +114,10 @@ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){ 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,¶ms); + 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; @@ -97,12 +139,21 @@ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call){ return linphone_core_pause_call(lc,call); } -int linphone_core_pause_conference(LinphoneCore *lc){ +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_resume_conference(LinphoneCore *lc){ +int linphone_core_enter_conference(LinphoneCore *lc){ + LinphoneConference *conf=&lc->conf_ctx; + if (conf->local_participant==NULL) add_local_endpoint(conf,lc); return 0; } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a568b8ba9..085cde973 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -841,7 +841,7 @@ static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){ } } -static void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted){ +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; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1d985f544..b042a1398 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2095,7 +2095,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const 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 !")); + lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call or conference first !")); return NULL; } if(!linphone_core_can_we_add_call(lc)){ @@ -2454,7 +2454,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); } /** diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index e0f3145ff..dbf698fad 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1026,8 +1026,9 @@ bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call); int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call); int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call); -int linphone_core_pause_conference(LinphoneCore *lc); -int linphone_core_resume_conference(LinphoneCore *lc); +bool_t linphone_core_is_in_conference(const LinphoneCore *lc); +int linphone_core_enter_conference(LinphoneCore *lc); +int linphone_core_leave_conference(LinphoneCore *lc); #ifdef __cplusplus diff --git a/coreapi/private.h b/coreapi/private.h index e5ce1fd0d..bb1fb883b 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -506,6 +506,7 @@ void ec_calibrator_destroy(EcCalibrator *ecc); void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed); /*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); From b07b784570695a7177c92c89b8fa25cd36da088b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 14 Sep 2011 10:27:11 +0200 Subject: [PATCH 04/21] Conferencing JNI + Android support. Conflicts: coreapi/conference.c coreapi/linphonecore.h --- build/android/Android.mk | 1 + coreapi/conference.c | 3 ++ coreapi/linphonecore.h | 3 ++ coreapi/linphonecore_jni.cc | 40 +++++++++++++++++++ .../org/linphone/core/LinphoneCall.java | 21 +++++++--- .../org/linphone/core/LinphoneCore.java | 16 +++++++- mediastreamer2 | 2 +- 7 files changed, 78 insertions(+), 8 deletions(-) diff --git a/build/android/Android.mk b/build/android/Android.mk index 1c7a611bf..3946dca89 100755 --- a/build/android/Android.mk +++ b/build/android/Android.mk @@ -47,6 +47,7 @@ LOCAL_SRC_FILES := \ offeranswer.c \ callbacks.c \ linphonecall.c \ + conference.c \ ec-calibrator.c ifndef MY_LOG_DOMAIN diff --git a/coreapi/conference.c b/coreapi/conference.c index c1058233b..695fc6121 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -157,3 +157,6 @@ int linphone_core_enter_conference(LinphoneCore *lc){ return 0; } +int linphone_core_add_all_to_conference(LinphoneCore *lc) {return 0;} +int linphone_core_terminate_conference(LinphoneCore *lc) {return 0;} +int linphone_core_get_conference_size(LinphoneCore *lc) {return 0;} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index dbf698fad..0cd5a232c 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1025,11 +1025,14 @@ 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 } diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 7ce1959ff..d5bd4ef46 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1198,6 +1198,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); } @@ -1323,6 +1328,41 @@ 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_setZrtpSecretsCache(JNIEnv *env,jobject thiz,jlong pCore, jstring jFile) { if (jFile) { diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index a6edf1b7e..5f8745979 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -34,6 +34,14 @@ public interface LinphoneCall { @SuppressWarnings("unchecked") static private Vector values = new Vector(); private final int mValue; + public final int value() {return mValue;} + public static final int ID_INCOMING_RECEIVED=1; + public static final int ID_OUTGOING_RINGING=4; + public static final int ID_STREAMS_RUNNING=7; + public static final int ID_PAUSED=9; + public static final int ID_CALL_END=13; + public static final int ID_PAUSED_BY_REMOTE=14; + private final String mStringValue; /** * Idle @@ -42,7 +50,7 @@ public interface LinphoneCall { /** * Incoming call received. */ - public final static State IncomingReceived = new State(1,"IncomingReceived"); + public final static State IncomingReceived = new State(ID_INCOMING_RECEIVED,"IncomingReceived"); /** * Outgoing call initialiazed. */ @@ -54,7 +62,7 @@ public interface LinphoneCall { /** * Outgoing call ringing. */ - public final static State OutgoingRinging = new State(4,"OutgoingRinging"); + public final static State OutgoingRinging = new State(ID_OUTGOING_RINGING,"OutgoingRinging"); /** * Outgoing call early media */ @@ -66,7 +74,7 @@ public interface LinphoneCall { /** * Streams running */ - public final static State StreamsRunning = new State(7,"StreamsRunning"); + public final static State StreamsRunning = new State(ID_STREAMS_RUNNING,"StreamsRunning"); /** * Paussing */ @@ -74,7 +82,7 @@ public interface LinphoneCall { /** * Paused */ - public final static State Paused = new State(9,"Paused"); + public final static State Paused = new State(ID_PAUSED,"Paused"); /** * Resuming */ @@ -90,12 +98,12 @@ public interface LinphoneCall { /** * Call end */ - public final static State CallEnd = new State(13,"CallEnd"); + public final static State CallEnd = new State(ID_CALL_END,"CallEnd"); /** * Paused by remote */ - public final static State PausedByRemote = new State(14,"PausedByRemote"); + public final static State PausedByRemote = new State(ID_PAUSED_BY_REMOTE,"PausedByRemote"); /** * The call's parameters are updated, used for example when video is asked by remote @@ -219,4 +227,5 @@ public interface LinphoneCall { String getAuthenticationToken(); boolean isAuthenticationTokenVerified(); boolean areStreamsEncrypted(); + boolean isInConference(); } diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 457a7c34a..9f4e3d5a7 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -594,6 +594,20 @@ 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(); } diff --git a/mediastreamer2 b/mediastreamer2 index 228168085..88baea603 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 22816808514255867ae8fa5347b854f4570784f7 +Subproject commit 88baea6036b1831228cc9deff92acb944e373ce0 From fb0dfb524bfa3ae9f04ec3951b626b3cb5e7fc95 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 14 Sep 2011 11:35:50 +0200 Subject: [PATCH 05/21] Fix Android build. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 88baea603..90be72f66 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 88baea6036b1831228cc9deff92acb944e373ce0 +Subproject commit 90be72f669f3c5067c571b0f29f22eda21166006 From 981ddd03e436ad2fc6d9927532fd5a1ce2509ec5 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 16 Sep 2011 15:50:33 +0200 Subject: [PATCH 06/21] New ms2 version --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index af7bb8b24..a8a63acdc 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit af7bb8b24da40d653a89bc61cd7832db773fa48c +Subproject commit a8a63acdc6eb6a9658782e41ad382df2b4ee081d From 26df0c6d83cee874790adc9af8e7a65841d8a46d Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 16 Sep 2011 17:17:00 +0200 Subject: [PATCH 07/21] merge patch for notification bubbles + 2nd call incoming tone notification --- configure.ac | 22 ++++++ coreapi/callbacks.c | 3 +- coreapi/linphonecore.c | 25 ++++++- coreapi/private.h | 2 + gtk/Makefile.am | 2 +- gtk/main.c | 147 ++++++++++++++++++++++++++++++++++------- gtk/main.ui | 77 ++++++++++++++++++++- mediastreamer2 | 2 +- 8 files changed, 249 insertions(+), 31 deletions(-) diff --git a/configure.ac b/configure.ac index 5fe32ef33..7c231b20a 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,28 @@ 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([NOTIFY], [libnotify >= 0.7.0 ], [found_notify=yes], foo=bar) + case "$found_notify" in + yes) + AC_SUBST(NOTIFY_CFLAGS) + AC_SUBST(NOTIFY_LIBS) + AC_DEFINE([HAVE_NOTIFY],[1],[NOTIFY support]) + esac + else + echo "Libnotify support is disabled." + fi +fi dnl os-specific problems not handled by existing macros. case "$host_os" in diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 1f00b1995..a49c1a968 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -195,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); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b042a1398..bf656c810 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2313,7 +2313,6 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call) ms_message("ring stopped"); lc->ringstream=NULL; } - linphone_core_get_default_proxy(lc,&cfg); dest_proxy=cfg; dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to); @@ -2369,6 +2368,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") ); @@ -3684,6 +3688,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 * diff --git a/coreapi/private.h b/coreapi/private.h index bb1fb883b..47592514f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -210,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); diff --git a/gtk/Makefile.am b/gtk/Makefile.am index c51234eb3..56ac4a336 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -49,7 +49,7 @@ linphone_SOURCES= \ linphone_LDADD=$(ORTP_LIBS) \ $(MEDIASTREAMER_LIBS) \ $(top_builddir)/coreapi/liblinphone.la \ - $(LIBGTK_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS) + $(LIBGTK_LIBS) $(NOTIFY_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS) if BUILD_WIN32 diff --git a/gtk/main.c b/gtk/main.c index e8313628f..ac4e632aa 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -36,6 +36,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define chdir _chdir #endif +#ifdef HAVE_NOTIFY +#include +#endif + #define LINPHONE_ICON "linphone.png" const char *this_program_ident_string="linphone_ident_string=" LINPHONE_VERSION; @@ -56,6 +60,7 @@ 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 +627,24 @@ static void completion_add_text(GtkEntry *entry, const char *text){ save_uri_history(); } + +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){ +#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){ @@ -749,6 +772,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 +783,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 +807,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(); } @@ -938,6 +947,54 @@ static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl) if (w) linphone_gtk_call_log_update(w); } +#ifdef HAVE_NOTIFY +static void make_notification(const char *title, const char *body){ + NotifyNotification *n; + n = notify_notification_new(title,body,linphone_gtk_get_ui_config("icon",LINPHONE_ICON)); + if (n && !notify_notification_show(n,NULL)) + ms_error("Failed to send notification."); +} + +#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),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; + switch(linphone_call_get_state(call)){ + case LinphoneCallError: + make_notification(_("Call error"),body=g_markup_printf_escaped("%s\n%s",msg,remote)); + break; + case LinphoneCallEnd: + make_notification(_("Call ended"),body=g_markup_printf_escaped("%s",remote)); + break; + case LinphoneCallIncomingReceived: + make_notification(_("Incoming call"),body=g_markup_printf_escaped("%s",remote)); + break; + case LinphoneCallPausedByRemote: + make_notification(_("Call paused"),body=g_markup_printf_escaped("by %s",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){ switch(cs){ case LinphoneCallOutgoingInit: @@ -954,10 +1011,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_status_icon_set_blinking(TRUE); if (auto_answer) { linphone_call_ref(call); g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer ,call); @@ -974,10 +1033,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); } @@ -1060,18 +1121,49 @@ static GtkStatusIcon *icon=NULL; 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; + title=linphone_gtk_get_ui_config("title",_("Linphone - a video internet phone")); icon=gtk_status_icon_new_from_pixbuf(pbuf); - g_object_unref(G_OBJECT(pbuf)); + gtk_status_icon_set_name(icon,title); 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")); 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(1000,(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); + } } void linphone_gtk_load_identities(void){ @@ -1348,9 +1440,11 @@ 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( + 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()); } @@ -1359,16 +1453,19 @@ 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){ 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 diff --git a/gtk/main.ui b/gtk/main.ui index ea9c596b0..7a57073ac 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -2,6 +2,66 @@ + + False + + + True + False + 0 + none + + + True + False + 12 + + + True + False + + + True + False + + + True + True + 0 + + + + + + + + True + True + True + False + + + + True + True + 2 + + + + + + + + + True + False + <b>Callee name</b> + True + + + + + False @@ -90,7 +150,6 @@ True False - spread Mute @@ -106,6 +165,20 @@ 0 + + + Merge to conference + True + True + False + + + + True + True + 1 + + Pause @@ -118,7 +191,7 @@ False False - 1 + 2 diff --git a/mediastreamer2 b/mediastreamer2 index 90be72f66..a73e55293 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 90be72f669f3c5067c571b0f29f22eda21166006 +Subproject commit a73e55293ed2b551cf12bfc85d812fa659fb25da From 44f05cd15787b4bc6d9e3bbd375fd21a3680e0df Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 16 Sep 2011 21:52:45 +0200 Subject: [PATCH 08/21] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index a8a63acdc..964f9bcca 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a8a63acdc6eb6a9658782e41ad382df2b4ee081d +Subproject commit 964f9bcca69967fccab626af4407efce9165a5be From b6a5ffcec94e10b026982fbccc29031e811c519c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 17 Sep 2011 00:20:09 +0200 Subject: [PATCH 09/21] GTK: provides call logs in a tab Better icons for incall view + spinner --- NEWS | 8 + configure.ac | 2 +- gtk/call_logs.ui | 70 +++-- gtk/calllogs.c | 46 ++- gtk/incall_view.c | 60 ++-- gtk/main.c | 6 +- gtk/main.ui | 715 +++++++++++++++++++++++++--------------------- mediastreamer2 | 2 +- po/fr.po | 2 +- 9 files changed, 511 insertions(+), 400 deletions(-) diff --git a/NEWS b/NEWS index 4d5bcf7c5..d7c8f5559 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/configure.ac b/configure.ac index 7c231b20a..85b581977 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/gtk/call_logs.ui b/gtk/call_logs.ui index 00c2dfbda..34c6ba3b2 100644 --- a/gtk/call_logs.ui +++ b/gtk/call_logs.ui @@ -1,50 +1,24 @@ - + - - - - - - - - 500 370 + False 5 Call history center-on-parent dialog - False - + True - vertical + False 2 - - - True - True - never - automatic - - - True - True - False - - - - - - 1 - - True + False end @@ -52,6 +26,7 @@ True True True + False image1 @@ -66,6 +41,7 @@ True True True + False False @@ -79,6 +55,7 @@ True True True + False True @@ -90,10 +67,32 @@ False + True end 0 + + + True + True + never + automatic + + + True + True + False + + + + + + True + True + 1 + + @@ -102,8 +101,17 @@ call_logs_close + + + + + + + + True + False gtk-clear diff --git a/gtk/calllogs.c b/gtk/calllogs.c index f336992d7..1700077ed 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -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); diff --git a/gtk/incall_view.c b/gtk/incall_view.c index 919adaa3c..659f4b30d 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -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); @@ -181,25 +208,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),_("Calling...")); 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){ 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; @@ -221,10 +241,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 +300,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 +309,7 @@ void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){ gtk_label_set_markup(GTK_LABEL(status),_("In 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_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 +321,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),_("Paused call")); - 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 +346,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 +355,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); diff --git a/gtk/main.c b/gtk/main.c index fe7824b09..a2d4abe52 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -945,6 +945,7 @@ 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 @@ -1363,11 +1364,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"); @@ -1442,7 +1445,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", diff --git a/gtk/main.ui b/gtk/main.ui index 7a57073ac..c86d12fc4 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -80,11 +80,12 @@ True False - + True False - gtk-info - 5 + + + True @@ -264,6 +265,11 @@ False gtk-add + + True + False + gtk-clear + True False @@ -317,26 +323,16 @@ True False - + True False False - Views + _Options True - + True False - - - _Assistant - False - False - True - image3 - False - - gtk-preferences @@ -348,18 +344,6 @@ - - - _Call history - True - False - False - True - image2 - False - - - gtk-disconnect @@ -376,32 +360,6 @@ False - - - gtk-quit - True - False - False - True - True - - - - - - - - - - True - False - False - _Options - True - - - True - False True @@ -868,7 +826,7 @@ True False - gtk-missing-image + gtk-directory True @@ -898,279 +856,77 @@ True False - + True False - 0.5 - none + 2 - + True False - 0 - 0 + end - + + gtk-clear True - False - 0 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - 4 - 4 - True - - - D - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - 3 - 4 - - - - - # - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - 3 - 4 - - - - - 0 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - 3 - 4 - - - - - * - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - - - - - C - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - 2 - 3 - - - - - 9 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - 2 - 3 - - - - - 8 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - 2 - 3 - - - - - 7 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - - - - - B - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - 1 - 2 - - - - - 6 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - 1 - 2 - - - - - 5 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - 1 - 2 - - - - - 4 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - - - - - A - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 3 - 4 - - - - - 3 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 2 - 3 - - - - - 2 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 - - - - - 1 - 40 - 40 - True - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - - + True + True + False + True + + + + False + False + 0 + + + + + Call back + True + True + True + False + + + + False + False + 1 + + + + + + + + False + True + end + 0 + + + + + True + True + never + automatic + + + True + True + False + - - - + + True + True + 1 + @@ -1184,6 +940,321 @@ 1 + + + True + False + + + True + False + gtk-refresh + + + True + True + 0 + + + + + True + False + 0.49000000953674316 + Recent calls + + + True + True + 1 + + + + + 1 + False + + + + + True + False + 0.5 + none + + + True + False + 0 + 0 + + + True + False + 0 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 4 + 4 + 4 + True + + + D + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + 3 + 4 + + + + + # + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + 3 + 4 + + + + + 0 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 3 + 4 + + + + + * + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + + + + + C + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + 2 + 3 + + + + + 9 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + 2 + 3 + + + + + 8 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + + 7 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + + + + + B + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + 1 + 2 + + + + + 6 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + 1 + 2 + + + + + 5 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 1 + 2 + + + + + 4 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + + + + + A + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 3 + 4 + + + + + 3 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 2 + 3 + + + + + 2 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + + + + + 1 + 40 + 40 + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + + + + + + + + + + + + 2 + + True @@ -1214,16 +1285,10 @@ - 1 + 2 False - - - - - - True diff --git a/mediastreamer2 b/mediastreamer2 index 964f9bcca..40e4fefd4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 964f9bcca69967fccab626af4407efce9165a5be +Subproject commit 40e4fefd4c76843f7d822c8013307cf230def10b diff --git a/po/fr.po b/po/fr.po index 0db922e67..14ad5edd1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -398,7 +398,7 @@ msgstr "Appel en cours" #: ../gtk/incall_view.c:260 msgid "Paused call" -msgstr "Appel en attente" +msgstr "Appel en attente" #: ../gtk/incall_view.c:272 #, c-format From c33fa844a76652a4dca6061757f6993d0f105908 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 17 Sep 2011 23:09:55 +0200 Subject: [PATCH 10/21] implement better system for "single instance application" requirement. --- coreapi/callbacks.c | 7 ---- coreapi/linphonecore.h | 8 ---- coreapi/misc.c | 83 ------------------------------------------ coreapi/sal.h | 2 - coreapi/sal_eXosip2.c | 7 ---- gtk/Makefile.am | 1 + gtk/linphone.h | 5 ++- gtk/main.c | 14 +++---- 8 files changed, 12 insertions(+), 115 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index a49c1a968..be84c6341 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -682,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 !"); @@ -723,7 +717,6 @@ SalCallbacks linphone_sal_callbacks={ notify_presence, subscribe_received, subscribe_closed, - internal_message, ping_reply }; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 42309bbc5..af3978402 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -983,14 +983,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); diff --git a/coreapi/misc.c b/coreapi/misc.c index 5bd573203..7aeaf0f33 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -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: ;tag=%u\r\n" - "To: \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: ;tag=%u\r\n" - "To: \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 diff --git a/coreapi/sal.h b/coreapi/sal.h index 01bf3c71a..140c14d04 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -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; diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 9720d27c4..da78f4bfe 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -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)) { diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 56ac4a336..8e216f5f8 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -44,6 +44,7 @@ linphone_SOURCES= \ setupwizard.c\ incall_view.c \ loginframe.c \ + singleinstance.c \ linphone.h linphone_LDADD=$(ORTP_LIBS) \ diff --git a/gtk/linphone.h b/gtk/linphone.h index 6cc443f25..01bf71265 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -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); @@ -112,4 +114,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); diff --git a/gtk/main.c b/gtk/main.c index a2d4abe52..dccc09cfb 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -57,7 +57,6 @@ 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); @@ -628,7 +627,7 @@ static void completion_add_text(GtkEntry *entry, const char *text){ } -static void linphone_gtk_show_main_window(){ +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)){ @@ -1506,7 +1505,7 @@ 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){ +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")); char *text; @@ -1526,6 +1525,7 @@ static void linphone_gtk_check_soundcards(){ } static void linphone_gtk_quit(void){ + linphone_gtk_uninit_instance(); gdk_threads_leave(); linphone_gtk_destroy_log_window(); linphone_core_destroy(the_core); @@ -1559,6 +1559,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(); @@ -1566,6 +1567,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 */ @@ -1627,9 +1629,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(); @@ -1654,7 +1654,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); From b031fb162c86c0b1a58797710052eecd96bbed63 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 18 Sep 2011 17:14:31 +0200 Subject: [PATCH 11/21] add missing file, simplify 2nd call/pause/resume behavior by automatically pausing running call. --- coreapi/linphonecore.c | 46 ++++++++------------ coreapi/private.h | 2 +- gtk/incall_view.c | 34 ++++++++++++--- gtk/linphone.h | 3 +- gtk/main.c | 35 +++------------ gtk/main.ui | 33 +++++++------- gtk/singleinstance.c | 99 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 172 insertions(+), 80 deletions(-) create mode 100644 gtk/singleinstance.c diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4fd1d700d..d2ac2c524 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2093,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 or conference 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")); @@ -2287,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 */ @@ -2527,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. * @@ -2543,12 +2540,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call) return -1; } if (call->params.in_conference==FALSE){ - 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; - } + linphone_core_preempt_sound_resources(lc); ms_message("Resuming call %p",call); } sal_media_description_set_dir(call->localdesc,SalStreamSendRecv); diff --git a/coreapi/private.h b/coreapi/private.h index 2424d68be..b8aba9d1f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -507,7 +507,7 @@ 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); diff --git a/gtk/incall_view.c b/gtk/incall_view.c index 659f4b30d..6a2dc0cda 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -126,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){ @@ -147,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 (); @@ -216,7 +243,7 @@ void linphone_gtk_in_call_view_set_calling(LinphoneCall *call){ 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"); @@ -230,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); diff --git a/gtk/linphone.h b/gtk/linphone.h index 01bf71265..db25bbdd2 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -102,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); diff --git a/gtk/main.c b/gtk/main.c index dccc09cfb..6675af430 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -655,18 +655,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(); @@ -681,21 +669,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); @@ -708,6 +684,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(); } @@ -737,7 +714,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{ @@ -1015,7 +992,7 @@ static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call 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); diff --git a/gtk/main.ui b/gtk/main.ui index c86d12fc4..6bd4cf9da 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -148,7 +148,7 @@ - + True False @@ -166,20 +166,19 @@ 0 - - - Merge to conference - True - True - False - - - - True - True - 1 - - + + + False + False + 3 + + + + + True + False + True + center Pause @@ -192,14 +191,14 @@ False False - 2 + 0 False False - 3 + 4 diff --git a/gtk/singleinstance.c b/gtk/singleinstance.c new file mode 100644 index 000000000..d92749e95 --- /dev/null +++ b/gtk/singleinstance.c @@ -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; + } +} From 2d0315761c9e7e21608f8f8c6ee29771b99e3129 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 19 Sep 2011 09:46:17 +0200 Subject: [PATCH 12/21] add star icon in the uri bar to add contacts --- coreapi/friend.c | 6 ++- gtk/conference.c | 31 +++++++++++++ gtk/friendlist.c | 80 +++++++++++++++++++++++++++++++--- pixmaps/contact_starred.png | Bin 0 -> 2978 bytes pixmaps/contact_unstarred.png | Bin 0 -> 3243 bytes 5 files changed, 108 insertions(+), 9 deletions(-) create mode 100644 gtk/conference.c create mode 100644 pixmaps/contact_starred.png create mode 100644 pixmaps/contact_unstarred.png diff --git a/coreapi/friend.c b/coreapi/friend.c index 527e29bd5..03332d689 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -438,13 +438,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); diff --git a/gtk/conference.c b/gtk/conference.c new file mode 100644 index 000000000..c3df39593 --- /dev/null +++ b/gtk/conference.c @@ -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" + + + + + \ No newline at end of file diff --git a/gtk/friendlist.c b/gtk/friendlist.c index d1b116272..1ebc9c15c 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -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); @@ -318,14 +383,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); @@ -343,7 +409,7 @@ void linphone_gtk_show_friends(void){ } } -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); diff --git a/pixmaps/contact_starred.png b/pixmaps/contact_starred.png new file mode 100644 index 0000000000000000000000000000000000000000..45b5d620625fcf15fffa10e5a6b33427886969c3 GIT binary patch literal 2978 zcmV;T3tjYyP)V{ohyKxkIyc;Xwy5^yy1y{GWLhR`cLZpy8+m-h0eFO z5TeOy~_-rILQM16A}VAo@m zg|;{KuDneLm4guR5&HYF=;E7|OW=cZ9w1`%o<*x})Q|{}GL-H>t+*3?7u;q6y5pz! zQ)2D{+)GLkJ~8l$4<*9tVGwyxx&vYLkI*KAo`H=f+l5VY7GTFpyd~RrdB!G}fTPnO z6$2=pM6L8|46J!yT4{6VoCQ$Yd}!I)yE>xUaey?S5+IcZsT9J>v*_sA0Bh&1+`fg@ z%sGH(9;JR|=dDY3UjY}Mgdz(?iP!@w3BVx=hOp$)e@Z~<_sux~E$Y_gYwuL-^7WN1 zNO{mY4W*MHokZk6hwdfUYXWZCzm>c>1V99+4|FfN&T=#gA`_dkP&y5zQ_w02j!r|{ z1?cX-LXDSk{hR^Vu?27IU4Cts@p>Sx1X8vR;MH>=SvLV^KOckttpV;O zMcRIK$t8EBT{I3-(^sF!1F0mGN)#Y$_k(12tWKq_Ixdb z$oC`&Ke_Hba`c=6JpBl*v{1JJcyDI@n#8h8Kbq<2-2iqu2p2(Q8^Xtc^n5_7;NTEM z0tnaOxC-GaAQmRM8ZIhe^vDy@iT#g8g7BA77~SVq;71!bO7vF&*!>_`-@_(t=)=l% zuI{_wT0MWoChMiogK!z_@*rSZG}-#xLYV~s0!VlW&c(vn`7ua+B;5;b2LLiCzPJq| z&u=Xk$M!jZ23hzU8*Y;4{w#oJ{(}}Mt!^j6?U~+-yangICEe9`HAp4Ft_VoAL9Ce) z-3ow%=fPZqxGI=^2v^Spay|qa%JxCqK7{@V#*Y6u8awt>;G*hoiR3fuZ;>Zo62Q(u zdZlQ6m$sSfdX~Ia_bz*rXH&~SL||70k(v?-vQU$Pm6-xSeXh&`fUDr(4-kpKt_J2w z;q{UI`se->AgNAhuOA9Y6i)BL_zS-&`GuizX8wF(0)yAwF0~l|JGWAbYWgcW(Q`}x zh5wlBTC`q~?u2j!E-HeQnGy_TpvVKr#7R39J`JV}lvxO{kEpf}!cjdBg4i2eZ2+2v zV6Mg>&IiCSiDfWeA3}cuqeq{rOq||32Ip>Aca!Wq17OEv-h=a({lmK#uf91+DgkyS zhzr3I0_@_es=QdZ@}MYDKd7clWIRrX5GV`JjkMF;Oa{@rrSOg97c>W(Ljdxk7h-ERd;3i;vh*2AX? zq7aZU_6Aq$qYvQy4bq-Dd9;dl?16tfH)^o-Pggfhuo#U2!IHJ2#^3IAxIgR!~nGE zLll-!I=z?2PyD_d1=T!Q?h6E)H{K%ozqpmy_HF7`5pD$0hqX;E>{)zCI=kpHrL{$^ zytjU^O<#SGMk;$1BBxN!{bI@k0tOI)z(}N5!FY>M&OeLsyEO z{k-It3W1P(DoSF@#&<~RoHTPpGjBeAu^E?nhQ5(qc;2Ob7rrU!Pdp7G0!V|Pk;uFT z&H;Y$w;&P_#pTpXUkrAPqkFznWs!e5HI9FK=SNYUTvuMkRh<=}mFVfGhwE}L8s~5OASN8k*GG@;@s;U;b7gQ;hI3`OC=VCqAY6e&We8WGZ7=-70r-Up z_v<5kf17n_7A@@o&LX^V69qs|j@$O&>(%@SN3{|FGj$NTU>qFfAW^yAK9oT^i~Pw0 z)mkK9{m4D2G_2DK;;bO5O}J1S@sq-J$656WZ5g+#+7 zdZBa*MyFv+1}3oxxl@N~;}dvfv;u130o6u$%P^Ysf@($8!fmZ!n!R9tx(oh9S^qFU zeApRpA+$|Hn+_P;4UmV4;lp_BC;aFvvEM9|&Z6&SKiFyoF=-Zn_uVJM!O`Q-hDvqD z$!s&w-h32>54)02PyP4LkZ)6US_ys0Pv)9WJ83aW)893MOohYd|G~*}g`X{r4T-fq z(54g0WHB=IyYPR189mexcFnQgZr|DT&G3MFN}K(;jh-{w3^mI_t%OgSYqF?ejPCh&>?js02VWf8?I46>`=0cF z@=WmQ$?u!~hnwcE#op3JXWY!SIScR-PGi$ljV4Fh^kxjaf0O-=R+JeYlLz1ak??^g z@!SHQ&vNCZxyhUAMrS#V(WV!orb;y90J?lF($`;!m3KXWeRYx2!i(G_oZE<&RvqdY z?R1M~sa-i!vp`WpZc$T6PR?D^XWaDtS%uGfKQIeO^IWxr!N!9?W&i*H07*qoM6N<$f@f8eYybcN literal 0 HcmV?d00001 diff --git a/pixmaps/contact_unstarred.png b/pixmaps/contact_unstarred.png new file mode 100644 index 0000000000000000000000000000000000000000..ad041095b4696747d24dbc5d4392a74efb589bd1 GIT binary patch literal 3243 zcmV;c3{>-pP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2ipk~ z2OceNK&fK@01PWhL_t(&-qo0Ua9q`W$G^YdIp^-(hgL7kvSee+JYvVjIK@+%+9n8+ zG;!;|KuU4bU|blOBn^bn0BH%u9+I?4$^;5YYY$HB0*wbJ&}335<4zIaN1Vh?9I&a4 z!SYLzU)q&cyZ7$yJ-^dGB-zV)B|{oF&d&VioZYK?&i8YFkMp}C=N!)NhX^=(o9MH( z@UHdbWsAHTjy~ut-LPPpd*y8G!)FU16X45}-m~QT*&lwojkNjEPydyge`f$TucZr& zNq*+MOa37iPhX5_bML4t6aMLU27rJsOuO_R-$@Pwz5jyN8TTmTHGF*Qz3uP)T&x_v*-PX-#47nhIehD0rBg?n+B(?S^2Fn!Znntjdzyz(Tqv1yo}Xna3xxd%*UJ5#L8Dk;o90Q=ujsT)%+`BV(7 zK7GysD91NXn|n8l%>uwSu-Q)RL8$~-`Ao`xAPV-NamqD{fTg?ElXngQ5CQyGjZ>~R z5*-JT?jq72u>q?DSj9!L?@M&7OPLllw!NSG^SI`m0oc42*ELUDT(7+*I6JhB*lZxu zabnL9CqV3j*k4ZUt+1v2U2U^&O)71^It>2X23SE%$~-jX;yV&H>IbpzBGMa)O`gar z6Z>F}gO%US%I~tJ{VP*Ve+WO(*0yO4uKle7Y+FTU^K`zyvHhx6ziuYP9tV-yN2KBe zW5FI+#lb2D;uwfLzy<&5WbkOmW%nmZn{U3nhA#U52UtP8aV;$^CDg&X=9%|QzwB$i zl=}c@R}!fofOJ5t9FZP*`f)J(AmxF`1m)nhy{YDfcKW4vO*Y#5)s`o`r#7#qX}?zX zy_*-Bm!F{N27D`k+fox|$EIF#S1Q@O5MncMl3Ph+?j_O##0Eqfq$U6^gp~Hexe}Zd zVI?Fd;UYNmp!R3Ywb7tDzVGSi@UAB#hw@LNa`cGpz>hmSUGy6P*tUvH;9-f#O5%OiE05z=?#b!;cN(z08TIyck z%av(GIXHq72md2Fap0wrjlyj%at|(8<~F<|fGulij#KJBWl~o+P5FJ*JoO`v55E=Ev$SA?c?*W_*|3)PE zOX4~xudR*Yrv{I0MgO6n4+VqW{UY+!!2zsUbh|5_2C!v4#i^+NQN@~;wO#Zle*L5c zOsWn}3b0WQ#QIr~xs%ECg0;uw2}lRb1{jU`N@ESy69EYj6?ei(G?E9UVQ)xS0dx{# zj!5V^8;aQAQ-EBlV^iC-*P1E^1313_rNY3m9VcMz4fB_}EpG$Z{FJw9!qgAlIC<7h zK5-0Uhu~}(;>s%_b_G~#V(%c62e1dG7>K>$@;Fi=hsRSP1o8n8oRr{PaoB7Ckpi3) zAa-cjq8yy$AW;rB8j3j?g0;C8iE^z(yqr~RvG!VEV&@^u9d>VR|4v?PID5g3?tnhk z4AAc->smZl-iKo0briz`uyzO%g{wqLz2rP7Q_rj$M43jVbc3gKW5Bu|N~gi99<1v? zoCI?Mq~ahd!V0u=V&TL&SBA4ihz%ez1c?SAHVYeNAvObvGM+?PPohkVMA<%D&SY8X z-K=7Z#ZCaTf)`JaW<%w2*a6@aK)F=<#DSgP+fdhc!Nk@Ju8PN!m!cf(MX~hyZBovx z5F38TMu{F)iOsAMO{@|nR`K9eosWZ549p{*A%l41wGbDlY~K&uaQK8EDg&-O>|$V2mQaxb5j#Jkp$mks%D zBHW!wPf^X&=B51f6qJK*ghRiA*xWW&@h;}X3|8^CSj9Im$Db$VTV@}`qX5G>5pTR2 zRy>vIecBQnh%A8U6o4yf=fVgQbV96I zer`+A9Sd)EJH{=eyVjG}pT`YK>-&}GPimSxCso%xgG6$ON{2AqaT<{F!5qJmmESci z-W$nZg#uh^+C4j30laYFF4R2rCX-E^u(D7zy5qkbON^A3m0X(i2W7JUe|C^ zdmz#PDa7kPOxAKdcjAQtK>#=a5ga1Gl@^jK-$JZAb*#NZ=~hJLAq*YcA^nG6%}1p$ z3vrK>99DNObJ_oME3xt4sF5Rl5=3_@<4QNq5t5vd_HrS2=3pV!(*dm@;BNGorGCS z^Ayup0J^-n<9&Y9+%lt zwab^eZ;rR`nP7M<;Z@?P!nksN-Dfdi#XWp{|Mq}&6RgdDK%)GG*5=bT%Ce0zNhbx* zMfr@A!W?Cqp9}_HpArlX*q`l_N5@!~#?dl1z!`*BZo&Z6=(uq^9uBidBq|O8(ASDB zd`WEKI$P?mmnajuC~t?`hrCBBjcm{BVKH(KeSSF#73V~#%nXEBsHhM(@hn(B2b_Mq`VP6MbR z9yNqlo2sbhHg!-Y_2*u^qqC6hg$Oo&@eyQ3a!^-^ z=W#$zgWz`%GGmF>m3G^5?6##sZz&jn7e5bLry5zAkd+5zk{w#7m+M#?vVHq6twrti&A$J(HDYLZs5kFxgDN~bPOkWH?8(2LYV}VPC}bT zfIJNJy@{uulPAZC{c53f27OR9Za9+{s8$k>c)|Fd?4LQg|N4m?e~=`S4pwFk>&8FL z_Uvu#>*;y%ix0~)6?=^yQm)3l@_Xf2vy4_>taY=i`nyV~li{%XS@h%!^4ide?xZnI ziNlynen#QrzR-*VQa$GybE;9d$10Vm5RUO; deXRF_{{;vjA1VGm?-u|7002ovPDHLkV1kA$8;Sq` literal 0 HcmV?d00001 From 8e4aed0888bf276330e4715c76484297a8faa607 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 19 Sep 2011 10:20:55 +0200 Subject: [PATCH 13/21] fix compil errors and fix make distcheck --- coreapi/friend.c | 4 ---- coreapi/linphonecall.c | 2 +- coreapi/linphonecore.c | 2 +- coreapi/proxy.c | 2 +- mediastreamer2 | 2 +- oRTP | 2 +- pixmaps/Makefile.am | 3 ++- po/POTFILES.in | 1 + po/POTFILES.skip | 1 + 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/coreapi/friend.c b/coreapi/friend.c index 03332d689..2afcc4217 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -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; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2f5ca46ec..7f33de828 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1177,7 +1177,7 @@ 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); } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d2ac2c524..22de34ae4 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index dda1bc789..ab5fd3977 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -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); diff --git a/mediastreamer2 b/mediastreamer2 index 40e4fefd4..37e592118 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 40e4fefd4c76843f7d822c8013307cf230def10b +Subproject commit 37e5921186a8591b7b63eaf517e4c44b8561f752 diff --git a/oRTP b/oRTP index a4e50eedc..5b231b8e0 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit a4e50eedc1d6b6f8855d1c600b56b116e95c5060 +Subproject commit 5b231b8e0b9d82ccb93463ef4c2c28e15d68ba76 diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am index ec0b5ae3c..8a9201275 100644 --- a/pixmaps/Makefile.am +++ b/pixmaps/Makefile.am @@ -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) diff --git a/po/POTFILES.in b/po/POTFILES.in index af9a0602e..ce473f9be 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -30,4 +30,5 @@ coreapi/friend.c coreapi/proxy.c coreapi/callbacks.c coreapi/sal_eXosip2.c +coreapi/linphonecall.c diff --git a/po/POTFILES.skip b/po/POTFILES.skip index c965d6c49..d1c11e80e 100755 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -44,4 +44,5 @@ mediastreamer2/src/winvideo.c mediastreamer2/src/winvideo2.c mediastreamer2/src/winvideods.c mediastreamer2/src/x11video.c +mediastreamer2/src/vp8.c From 9f88a8a7c6c328f7facb744f9bbc6903ddbb10ff Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 19 Sep 2011 11:29:45 +0200 Subject: [PATCH 14/21] trayicon minimize, libnotify 0.7+0.5, notify actions --- configure.ac | 19 ++++++++++---- gtk/Makefile.am | 2 +- gtk/main.c | 68 +++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 75 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 85b581977..7bafc4393 100644 --- a/configure.ac +++ b/configure.ac @@ -156,14 +156,23 @@ AC_ARG_ENABLE(notify, dnl conditionnal build of the notify library if test "$gtk_ui" = "true" ; then if test "$notify" = "true"; then - PKG_CHECK_MODULES([NOTIFY], [libnotify >= 0.7.0 ], [found_notify=yes], foo=bar) - case "$found_notify" in + PKG_CHECK_MODULES([NOTIFY4], [libnotify >= 0.7.0 ], [found_notify4=yes], foo=bar) + case "$found_notify4" in yes) - AC_SUBST(NOTIFY_CFLAGS) - AC_SUBST(NOTIFY_LIBS) - AC_DEFINE([HAVE_NOTIFY],[1],[NOTIFY support]) + 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 diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 8e216f5f8..828468144 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -50,7 +50,7 @@ linphone_SOURCES= \ linphone_LDADD=$(ORTP_LIBS) \ $(MEDIASTREAMER_LIBS) \ $(top_builddir)/coreapi/liblinphone.la \ - $(LIBGTK_LIBS) $(NOTIFY_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS) + $(LIBGTK_LIBS) $(NOTIFY1_LIBS) $(NOTIFY4_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS) if BUILD_WIN32 diff --git a/gtk/main.c b/gtk/main.c index 6675af430..84b2d8a9a 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -36,6 +36,10 @@ 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 #endif @@ -925,11 +929,38 @@ static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl) } #ifdef HAVE_NOTIFY -static void make_notification(const char *title, const char *body){ - NotifyNotification *n; - n = notify_notification_new(title,body,linphone_gtk_get_ui_config("icon",LINPHONE_ICON)); +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."); + ms_error("Failed to send notification."); +} + +static void make_notification(const char *title, const char *body){ + show_notification(build_notification(title,body)); } #endif @@ -941,7 +972,11 @@ static void linphone_gtk_notify(LinphoneCall *call, const char *msg){ #endif if (!call) { #ifdef HAVE_NOTIFY - if (!notify_notification_show(notify_notification_new("Linphone",msg,NULL),NULL)) + 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(); @@ -950,6 +985,7 @@ static void linphone_gtk_notify(LinphoneCall *call, const char *msg){ #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("%s\n%s",msg,remote)); @@ -958,10 +994,17 @@ static void linphone_gtk_notify(LinphoneCall *call, const char *msg){ make_notification(_("Call ended"),body=g_markup_printf_escaped("%s",remote)); break; case LinphoneCallIncomingReceived: - make_notification(_("Incoming call"),body=g_markup_printf_escaped("%s",remote)); + n=build_notification(_("Incoming call"),body=g_markup_printf_escaped("%s",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("by %s",remote)); + make_notification(_("Call paused"),body=g_markup_printf_escaped(_("by %s"),remote)); break; default: break; @@ -1137,6 +1180,15 @@ 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"); @@ -1146,7 +1198,7 @@ static void linphone_gtk_init_status_icon(){ 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)linphone_gtk_show_main_window,linphone_gtk_get_main_window()); + 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); From e1edf5d7ef1f112cf202c6f1be9e3fc3e29526c4 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 19 Sep 2011 11:44:15 +0200 Subject: [PATCH 15/21] remove imagemenuitem5 from macosx --- gtk/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gtk/main.c b/gtk/main.c index 6675af430..6f9c4da62 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1430,7 +1430,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); From 30a91cefbc8906f3f61be6e6a62d12409f26ac65 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 19 Sep 2011 11:45:28 +0200 Subject: [PATCH 16/21] update ms2 to fix crash in macosx --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 37e592118..ed88d302d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 37e5921186a8591b7b63eaf517e4c44b8561f752 +Subproject commit ed88d302d5c3ab8c4dec32e24f5ef375e81654f7 From ce9780dcb8114a3d4def3ed14fbb129ff786fba2 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 19 Sep 2011 12:27:09 +0200 Subject: [PATCH 17/21] implement sorting of friend list in gtk interface --- gtk/friendlist.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/gtk/friendlist.c b/gtk/friendlist.c index 1ebc9c15c..075bbd99a 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -342,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"); @@ -353,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(); @@ -368,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); @@ -407,6 +457,7 @@ void linphone_gtk_show_friends(void){ } ms_free(uri); } + ms_list_free(sorted); } void linphone_gtk_add_contact(){ From 605ab9b8421402aec2ca7f4c2f86e271f75356a9 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 20 Sep 2011 11:28:37 +0200 Subject: [PATCH 18/21] fix compile warning in ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index ed88d302d..4add780c3 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ed88d302d5c3ab8c4dec32e24f5ef375e81654f7 +Subproject commit 4add780c3789f470a05974fa2a448b36d2e81475 From 5afb15345761cbf8adc37c2d7498d697bfe71806 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 20 Sep 2011 12:55:12 +0200 Subject: [PATCH 19/21] fix for dynamic camera change --- coreapi/linphonecore.c | 6 +++--- mediastreamer2 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 22de34ae4..f12bb6200 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2233,9 +2233,9 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho #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 } diff --git a/mediastreamer2 b/mediastreamer2 index ed88d302d..9e7e1e64e 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit ed88d302d5c3ab8c4dec32e24f5ef375e81654f7 +Subproject commit 9e7e1e64ef6287184f8d1642a52e60ad1838b30e From 038190233cba68d004c9aaead77ebef0678fd35f Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 20 Sep 2011 14:41:48 +0200 Subject: [PATCH 20/21] Implement some conference functions. --- coreapi/conference.c | 30 +++++++++++++++++-- coreapi/linphonecore.c | 12 ++++---- coreapi/linphonecore_jni.cc | 8 +++++ .../org/linphone/core/LinphoneCall.java | 18 ++++------- .../org/linphone/core/LinphoneCore.java | 4 +++ mediastreamer2 | 2 +- 6 files changed, 52 insertions(+), 22 deletions(-) diff --git a/coreapi/conference.c b/coreapi/conference.c index 695fc6121..53abfab81 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -157,6 +157,30 @@ int linphone_core_enter_conference(LinphoneCore *lc){ return 0; } -int linphone_core_add_all_to_conference(LinphoneCore *lc) {return 0;} -int linphone_core_terminate_conference(LinphoneCore *lc) {return 0;} -int linphone_core_get_conference_size(LinphoneCore *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); +} diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b042a1398..f7e1d129b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2425,13 +2425,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; } /** diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index d5bd4ef46..0642e141f 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1363,6 +1363,14 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,j 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) { diff --git a/java/common/org/linphone/core/LinphoneCall.java b/java/common/org/linphone/core/LinphoneCall.java index 5f8745979..bac236dff 100644 --- a/java/common/org/linphone/core/LinphoneCall.java +++ b/java/common/org/linphone/core/LinphoneCall.java @@ -35,12 +35,6 @@ public interface LinphoneCall { static private Vector values = new Vector(); private final int mValue; public final int value() {return mValue;} - public static final int ID_INCOMING_RECEIVED=1; - public static final int ID_OUTGOING_RINGING=4; - public static final int ID_STREAMS_RUNNING=7; - public static final int ID_PAUSED=9; - public static final int ID_CALL_END=13; - public static final int ID_PAUSED_BY_REMOTE=14; private final String mStringValue; /** @@ -50,7 +44,7 @@ public interface LinphoneCall { /** * Incoming call received. */ - public final static State IncomingReceived = new State(ID_INCOMING_RECEIVED,"IncomingReceived"); + public final static State IncomingReceived = new State(1,"IncomingReceived"); /** * Outgoing call initialiazed. */ @@ -62,7 +56,7 @@ public interface LinphoneCall { /** * Outgoing call ringing. */ - public final static State OutgoingRinging = new State(ID_OUTGOING_RINGING,"OutgoingRinging"); + public final static State OutgoingRinging = new State(4,"OutgoingRinging"); /** * Outgoing call early media */ @@ -74,7 +68,7 @@ public interface LinphoneCall { /** * Streams running */ - public final static State StreamsRunning = new State(ID_STREAMS_RUNNING,"StreamsRunning"); + public final static State StreamsRunning = new State(7,"StreamsRunning"); /** * Paussing */ @@ -82,7 +76,7 @@ public interface LinphoneCall { /** * Paused */ - public final static State Paused = new State(ID_PAUSED,"Paused"); + public final static State Paused = new State(9,"Paused"); /** * Resuming */ @@ -98,12 +92,12 @@ public interface LinphoneCall { /** * Call end */ - public final static State CallEnd = new State(ID_CALL_END,"CallEnd"); + public final static State CallEnd = new State(13,"CallEnd"); /** * Paused by remote */ - public final static State PausedByRemote = new State(ID_PAUSED_BY_REMOTE,"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 diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 9f4e3d5a7..aec4e60af 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -610,4 +610,8 @@ public interface LinphoneCore { void terminateAllCalls(); @SuppressWarnings("unchecked") List getCalls(); int getCallsNb(); + + + void transferCall(LinphoneCall call, String referTo); + void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination); } diff --git a/mediastreamer2 b/mediastreamer2 index 90be72f66..bd3e6772c 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 90be72f669f3c5067c571b0f29f22eda21166006 +Subproject commit bd3e6772c9636002aed44f3056b20f265fd35281 From 51ee80ec2b0ce934e44c73ad4931ca98a6798fa8 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 20 Sep 2011 21:32:25 +0200 Subject: [PATCH 21/21] update ms2 for android crash (neon usage) --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 560d2143d..26f255173 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 560d2143d79f2f6555eb9c0f84733b5db61c0fa2 +Subproject commit 26f255173f3ec9ccaf5b1edece25b9e797fa560b