From c61a2b4b1e8299be77811a1927d1084b184250a2 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 6 Apr 2011 14:01:50 +0200 Subject: [PATCH 1/6] fix macosx compilation --- .cproject | 3 ++- gtk/linphone.h | 1 + mediastreamer2 | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.cproject b/.cproject index 3ccb25959..82c15ae49 100644 --- a/.cproject +++ b/.cproject @@ -211,13 +211,14 @@ make - all + install true false true make + install true true diff --git a/gtk/linphone.h b/gtk/linphone.h index d726c0db1..2b91749b5 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define _(String) gettext (String) #else # define _(String) (String) +# define ngettext(singular,plural,number) ((number>1) ? (plural) : (singular) ) #endif #undef N_ diff --git a/mediastreamer2 b/mediastreamer2 index 208f4f6e3..591183568 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 208f4f6e36444261ad96a62eada2c1abcdf344e2 +Subproject commit 591183568886238180c1ae56df9650dd79c0fbaa From 6fde352364127eec92490b2a7f88d856f60342a6 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 20 May 2011 12:54:23 +0200 Subject: [PATCH 2/6] Mirroring in Android video capture. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f8564922f..75c826078 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f8564922fae5080ebd03d4bf9be591a4a6765840 +Subproject commit 75c826078efb2002afaa93b30a97290ce973af6a From 71b77319f9b76a1f14bd4be67d4fc201f5fa827a Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 20 May 2011 14:18:06 +0200 Subject: [PATCH 3/6] fix silent ring mode for iphone --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 75c826078..0781bd574 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 75c826078efb2002afaa93b30a97290ce973af6a +Subproject commit 0781bd574fc09a43bcadcb55d8f1563d6493629c From 27ab8107ef5a0174bd328239e374591b46e8cfb8 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 23 May 2011 13:16:35 +0200 Subject: [PATCH 4/6] fix call log status in case of incoming call canceled by remote --- coreapi/linphonecall.c | 51 +++++++++++++++++++++++++++++++++--------- coreapi/linphonecore.c | 40 ++++++--------------------------- coreapi/private.h | 4 ++-- 3 files changed, 50 insertions(+), 45 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index be0cc7cad..4230a156b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -228,19 +228,12 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro */ static void linphone_call_set_terminated(LinphoneCall *call){ - LinphoneCallStatus status=LinphoneCallAborted; LinphoneCore *lc=call->core; linphone_core_update_allocated_audio_bandwidth(lc); - if (call->state==LinphoneCallEnd){ - if (call->reason==LinphoneReasonDeclined){ - status=LinphoneCallDeclined; - } - else status=LinphoneCallSuccess; - - } + call->owns_call_log=FALSE; - linphone_call_log_completed(call->log,call, status); + linphone_call_log_completed(call); if (call == lc->current_call){ @@ -320,8 +313,14 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const call->state=cstate; } if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){ - linphone_call_set_terminated (call); + if (call->reason==LinphoneReasonDeclined){ + call->log->status=LinphoneCallDeclined; + } + linphone_call_set_terminated (call); } + if (cstate == LinphoneCallConnected) { + call->log->status=LinphoneCallSuccess; + } if (lc->vtable.call_state_changed) lc->vtable.call_state_changed(lc,call,cstate,message); @@ -1179,3 +1178,35 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse linphone_core_disconnected(call->core,call); } +void linphone_call_log_completed(LinphoneCall *call){ + LinphoneCore *lc=call->core; + + call->log->duration=time(NULL)-call->start_time; + + if (call->log->status==LinphoneCallMissed){ + char *info; + lc->missed_calls++; + info=ortp_strdup_printf(ngettext("You have missed %i call.", + "You have missed %i calls.", lc->missed_calls), + lc->missed_calls); + if (lc->vtable.display_status!=NULL) + lc->vtable.display_status(lc,info); + ms_free(info); + } + lc->call_logs=ms_list_prepend(lc->call_logs,(void *)call->log); + if (ms_list_size(lc->call_logs)>lc->max_call_logs){ + MSList *elem,*prevelem=NULL; + /*find the last element*/ + for(elem=lc->call_logs;elem!=NULL;elem=elem->next){ + prevelem=elem; + } + elem=prevelem; + linphone_call_log_destroy((LinphoneCallLog*)elem->data); + lc->call_logs=ms_list_remove_link(lc->call_logs,elem); + } + if (lc->vtable.call_log_updated!=NULL){ + lc->vtable.call_log_updated(lc,call->log); + } + call_logs_write_to_config_file(lc); +} + diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 43f662bb7..d075517c8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -97,10 +97,11 @@ LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *fro set_call_log_date(cl,&loctime); cl->from=from; cl->to=to; + cl->status=LinphoneCallAborted; /*default status*/ return cl; } -static void call_logs_write_to_config_file(LinphoneCore *lc){ +void call_logs_write_to_config_file(LinphoneCore *lc){ MSList *elem; char logsection[32]; int i; @@ -156,37 +157,6 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){ } -void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call, LinphoneCallStatus status){ - LinphoneCore *lc=call->core; - - calllog->duration=time(NULL)-call->start_time; - - if (status==LinphoneCallMissed){ - char *info; - lc->missed_calls++; - info=ortp_strdup_printf(ngettext("You have missed %i call.", - "You have missed %i calls.", lc->missed_calls), - lc->missed_calls); - if (lc->vtable.display_status!=NULL) - lc->vtable.display_status(lc,info); - ms_free(info); - }else calllog->status=status; - lc->call_logs=ms_list_prepend(lc->call_logs,(void *)calllog); - if (ms_list_size(lc->call_logs)>lc->max_call_logs){ - MSList *elem,*prevelem=NULL; - /*find the last element*/ - for(elem=lc->call_logs;elem!=NULL;elem=elem->next){ - prevelem=elem; - } - elem=prevelem; - linphone_call_log_destroy((LinphoneCallLog*)elem->data); - lc->call_logs=ms_list_remove_link(lc->call_logs,elem); - } - if (lc->vtable.call_log_updated!=NULL){ - lc->vtable.call_log_updated(lc,calllog); - } - call_logs_write_to_config_file(lc); -} /** * @addtogroup call_logs @@ -914,6 +884,10 @@ void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const lc->vtable.global_state_changed(lc,gstate,message); } } +static void misc_config_read (LinphoneCore *lc) { + LpConfig *config=lc->config; + lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15); +} static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path, const char *factory_config_path, void * userdata) @@ -993,7 +967,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta video_config_read(lc); //autoreplier_config_init(&lc->autoreplier_conf); lc->presence_mode=LinphoneStatusOnline; - lc->max_call_logs=15; + misc_config_read(lc); ui_config_read(lc); if (lc->vtable.display_status) lc->vtable.display_status(lc,_("Ready")); diff --git a/coreapi/private.h b/coreapi/private.h index 7f6367211..aea7e2e42 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -108,7 +108,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const /* private: */ LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *local, LinphoneAddress * remote); -void linphone_call_log_completed(LinphoneCallLog *calllog, LinphoneCall *call, LinphoneCallStatus status); +void linphone_call_log_completed(LinphoneCall *call); void linphone_call_log_destroy(LinphoneCallLog *cl); void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos); @@ -489,5 +489,5 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse #ifndef NB_MAX_CALLS #define NB_MAX_CALLS (10) #endif - +void call_logs_write_to_config_file(LinphoneCore *lc); #endif /* _PRIVATE_H */ From 58dca09f9bca63c599e96b9269ac1dc9ae0e8e94 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Mon, 23 May 2011 16:32:28 +0200 Subject: [PATCH 5/6] Custom sample rate for echo calibration. New "echo_cancellation_rate" config file key. --- coreapi/ec-calibrator.c | 16 ++++++++++++---- coreapi/private.h | 1 + coreapi/test_ecc.c | 13 ++++++++++++- mediastreamer2 | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index 4c8a37586..38b83f0d6 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -23,15 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "mediastreamer2/mstonedetector.h" #include "mediastreamer2/dtmfgen.h" - +#include "lpconfig.h" static void ecc_init_filters(EcCalibrator *ecc){ + unsigned int rate; ecc->ticker=ms_ticker_new(); ecc->sndread=ms_snd_card_create_reader(ecc->play_card); + ms_filter_call_method(ecc->sndread,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ecc->det=ms_filter_new(MS_TONE_DETECTOR_ID); + ms_filter_call_method(ecc->det,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ecc->rec=ms_filter_new(MS_FILE_REC_ID); ms_filter_link(ecc->sndread,0,ecc->det,0); @@ -39,14 +42,17 @@ static void ecc_init_filters(EcCalibrator *ecc){ ecc->play=ms_filter_new(MS_FILE_PLAYER_ID); ecc->gen=ms_filter_new(MS_DTMF_GEN_ID); + ms_filter_call_method(ecc->gen,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ecc->resampler=ms_filter_new(MS_RESAMPLE_ID); ecc->sndwrite=ms_snd_card_create_writer(ecc->capt_card); ms_filter_link(ecc->play,0,ecc->gen,0); ms_filter_link(ecc->gen,0,ecc->resampler,0); ms_filter_link(ecc->resampler,0,ecc->sndwrite,0); - unsigned int rate; + + ms_filter_call_method(ecc->sndwrite,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ms_filter_call_method(ecc->sndwrite,MS_FILTER_GET_SAMPLE_RATE,&rate); + ms_filter_call_method(ecc->resampler,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ms_filter_call_method(ecc->resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&rate); ms_ticker_attach(ecc->ticker,ecc->play); @@ -149,9 +155,10 @@ static void * ecc_thread(void *p){ return NULL; } -EcCalibrator * ec_calibrator_new(MSSndCard *play_card, MSSndCard *capt_card, LinphoneEcCalibrationCallback cb, void *cb_data ){ +EcCalibrator * ec_calibrator_new(MSSndCard *play_card, MSSndCard *capt_card, unsigned int rate, LinphoneEcCalibrationCallback cb, void *cb_data ){ EcCalibrator *ecc=ms_new0(EcCalibrator,1); + ecc->rate=rate; ecc->cb=cb; ecc->cb_data=cb_data; ecc->capt_card=capt_card; @@ -174,6 +181,7 @@ int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibration ms_error("Echo calibration is still on going !"); return -1; } - lc->ecc=ec_calibrator_new(lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard,cb,cb_data); + unsigned int rate = lp_config_get_int(lc->config,"sound","echo_cancellation_rate",8000); + lc->ecc=ec_calibrator_new(lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard,rate,cb,cb_data); return 0; } diff --git a/coreapi/private.h b/coreapi/private.h index aea7e2e42..b9d79776e 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -472,6 +472,7 @@ struct _EcCalibrator{ int sent_count; int64_t acc; int delay; + unsigned int rate; LinphoneEcCalibratorStatus status; }; diff --git a/coreapi/test_ecc.c b/coreapi/test_ecc.c index 7553c2018..43ae0dcb2 100644 --- a/coreapi/test_ecc.c +++ b/coreapi/test_ecc.c @@ -27,10 +27,21 @@ static void calibration_finished(LinphoneCore *lc, LinphoneEcCalibratorStatus st if (status==LinphoneEcCalibratorDone) ms_message("Measured delay is %i",delay); } + +static char config_file[1024]; +void parse_args(int argc, char *argv[]){ + if (argc != 3 || strncmp("-c",argv[1], 2) || access(argv[2],F_OK)!=0) { + printf("Usage: test_ecc [-c config_file] where config_file will be written with the detected value\n"); + exit(-1); + } + strncpy(config_file,argv[2],1024); +} + int main(int argc, char *argv[]){ + if (argc>1) parse_args(argc,argv); int count=0; LinphoneCoreVTable vtable={0}; - LinphoneCore *lc=linphone_core_new(&vtable,NULL,NULL,NULL); + LinphoneCore *lc=linphone_core_new(&vtable,config_file,NULL,NULL); linphone_core_enable_logs(NULL); diff --git a/mediastreamer2 b/mediastreamer2 index 0781bd574..45a3e4586 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 0781bd574fc09a43bcadcb55d8f1563d6493629c +Subproject commit 45a3e458669ae7d3f5537665d7549d82469cf96f From 3981cdd2646427468fbe549c02354542b61d51a4 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 23 May 2011 17:27:28 +0200 Subject: [PATCH 6/6] add use_101 option to disable 101 dialog established --- coreapi/linphonecore.c | 1 + coreapi/sal.h | 1 + coreapi/sal_eXosip2.c | 8 +++++++- coreapi/sal_eXosip2.h | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d075517c8..1b9647f37 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -464,6 +464,7 @@ static void sip_config_read(LinphoneCore *lc) } sal_use_rport(lc->sal,lp_config_get_int(lc->config,"sip","use_rport",1)); + sal_use_101(lc->sal,lp_config_get_int(lc->config,"sip","use_101",1)); tmp=lp_config_get_int(lc->config,"sip","use_rfc2833",0); linphone_core_set_use_rfc2833_for_dtmf(lc,tmp); diff --git a/coreapi/sal.h b/coreapi/sal.h index ecb140b71..a89b862c0 100644 --- a/coreapi/sal.h +++ b/coreapi/sal.h @@ -263,6 +263,7 @@ void sal_use_session_timers(Sal *ctx, int expires); void sal_use_double_registrations(Sal *ctx, bool_t enabled); void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec); void sal_use_rport(Sal *ctx, bool_t use_rports); +void sal_use_101(Sal *ctx, bool_t use_101); int sal_iterate(Sal *sal); MSList * sal_get_pending_auths(Sal *sal); diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 34cfd44f5..a0622226c 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -274,6 +274,7 @@ Sal * sal_init(){ sal->keepalive_period=30; sal->double_reg=TRUE; sal->use_rports=TRUE; + sal->use_101=TRUE; return sal; } @@ -369,6 +370,9 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i /*see if it looks like an IPv6 address*/ int use_rports = ctx->use_rports; // Copy char to int to avoid bad alignment eXosip_set_option(EXOSIP_OPT_USE_RPORT,&use_rports); + int dont_use_101 = !ctx->use_101; // Copy char to int to avoid bad alignment + eXosip_set_option(EXOSIP_OPT_DONT_SEND_101,&dont_use_101); + ipv6=strchr(addr,':')!=NULL; eXosip_enable_ipv6(ipv6); @@ -417,7 +421,9 @@ void sal_use_double_registrations(Sal *ctx, bool_t enabled){ void sal_use_rport(Sal *ctx, bool_t use_rports){ ctx->use_rports=use_rports; } - +void sal_use_101(Sal *ctx, bool_t use_101){ + ctx->use_101=use_101; +} static int extract_received_rport(osip_message_t *msg, const char **received, int *rportval){ osip_via_t *via=NULL; osip_generic_param_t *param=NULL; diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h index 1f83a85eb..a050f5133 100644 --- a/coreapi/sal_eXosip2.h +++ b/coreapi/sal_eXosip2.h @@ -43,6 +43,7 @@ struct Sal{ bool_t one_matching_codec; bool_t double_reg; bool_t use_rports; + bool_t use_101; }; struct SalOp{