From 28903fc8a1a36bb47e68825966e42f0ce472126e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 31 Jan 2011 15:51:10 +0100 Subject: [PATCH] schedule call release after sending the bye, to allow possible authentication challenge --- NEWS | 4 +++- console/Makefile.am | 11 ----------- coreapi/callbacks.c | 6 ++++++ coreapi/linphonecall.c | 22 +++++++++++----------- coreapi/linphonecore.c | 2 ++ coreapi/linphonecore.h | 3 ++- coreapi/sal.h | 2 ++ coreapi/sal_eXosip2.c | 11 +++++------ mediastreamer2 | 2 +- 9 files changed, 32 insertions(+), 31 deletions(-) diff --git a/NEWS b/NEWS index 2f74239aa..ab77e8202 100644 --- a/NEWS +++ b/NEWS @@ -6,8 +6,10 @@ linphone-3.4.0 -- XXXXX - creation of another outgoing call while already in call - blind call transfer - attended call transfer + **CAUTION**: LinphoneCoreVTable has changed: pay attention to this when upgrading an old application to a newer liblinphone. * improve bandwidth management (one b=AS line is used for audio+video) - * improvements in the echo limiter + * improvements in the echo limiter performance + * implement a echo calibration feature (see linphone_core_start_echo_calibration()). * stun support bugfixes * possibility to use two video windows, one for local preview, one for remote video (linphonec only) * optimize by not re-creating streams when SDP is unchanged during a reinvite diff --git a/console/Makefile.am b/console/Makefile.am index cf6a336ed..4ae2c7947 100644 --- a/console/Makefile.am +++ b/console/Makefile.am @@ -33,17 +33,6 @@ linphoned_LDADD=$(linphonec_LDADD) endif -sipomatic_SOURCES=\ - sipomatic.c sipomatic.h -sipomatic_CFLAGS= $(COMMON_CFLAGS) $(CONSOLE_FLAGS) - -sipomatic_LDADD= $(INTLLIBS) \ - $(top_builddir)/coreapi/liblinphone.la \ - $(MEDIASTREAMER_LIBS) \ - $(ORTP_LIBS) \ - $(SPEEX_LIBS) \ - $(OSIP_LIBS) - linphonecsh_SOURCES = shell.c linphonecsh_CFLAGS = $(CONSOLE_FLAGS) linphonecsh_LDADD = $(ORTP_LIBS) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index bf60f4c0d..f92047913 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -501,6 +501,11 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de } } +static void call_released(SalOp *op){ + LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op); + linphone_call_set_state(call,LinphoneCallReleased,"Call released"); +} + static void auth_requested(SalOp *h, const char *realm, const char *username){ LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h)); LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username); @@ -676,6 +681,7 @@ SalCallbacks linphone_sal_callbacks={ call_updating, call_terminated, call_failure, + call_released, auth_requested, auth_success, register_success, diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index cea826a25..a92609637 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -236,13 +236,6 @@ static void linphone_call_set_terminated(LinphoneCall *call){ if (ms_list_size(lc->calls)==0) linphone_core_notify_all_friends(lc,lc->presence_mode); - if (call->op!=NULL) { - /* so that we cannot have anymore upcalls for SAL - concerning this call*/ - sal_op_release(call->op); - call->op=NULL; - } - linphone_call_unref(call); } const char *linphone_call_state_to_string(LinphoneCallState cs){ @@ -283,13 +276,15 @@ const char *linphone_call_state_to_string(LinphoneCallState cs){ return "LinphoneCallIncomingEarlyMedia"; case LinphoneCallUpdated: return "LinphoneCallUpdated"; + case LinphoneCallReleased: + return "LinphoneCallReleased"; } return "undefined state"; } void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message){ LinphoneCore *lc=call->core; - bool_t finalize_call=FALSE; + if (call->state!=cstate){ ms_message("Call %p: moving from state %s to %s",call,linphone_call_state_to_string(call->state), linphone_call_state_to_string(cstate)); @@ -299,14 +294,19 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const call->state=cstate; } if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){ - finalize_call=TRUE; - linphone_call_ref(call); linphone_call_set_terminated (call); } if (lc->vtable.call_state_changed) lc->vtable.call_state_changed(lc,call,cstate,message); - if (finalize_call) + if (cstate==LinphoneCallReleased){ + if (call->op!=NULL) { + /* so that we cannot have anymore upcalls for SAL + concerning this call*/ + sal_op_release(call->op); + call->op=NULL; + } linphone_call_unref(call); + } } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 7861632cf..72bc5e2d0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -590,6 +590,8 @@ static void rtp_config_read(LinphoneCore *lc) jitt_comp=lp_config_get_int(lc->config,"rtp","audio_jitt_comp",60); linphone_core_set_audio_jittcomp(lc,jitt_comp); jitt_comp=lp_config_get_int(lc->config,"rtp","video_jitt_comp",60); + if (jitt_comp==0) jitt_comp=60; + lc->rtp_conf.video_jitt_comp=jitt_comp; nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30); linphone_core_set_nortp_timeout(lc,nortp_timeout); rtp_no_xmit_on_audio_mute=lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE); diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 6ad65d8d4..04be47483 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -221,7 +221,8 @@ typedef enum _LinphoneCallState{ LinphoneCallPausedByRemote, /**callbacks.call_failure=(SalOnCallFailure)unimplemented_stub; if (ctx->callbacks.call_terminated==NULL) ctx->callbacks.call_terminated=(SalOnCallTerminated)unimplemented_stub; + if (ctx->callbacks.call_released==NULL) + ctx->callbacks.call_released=(SalOnCallReleased)unimplemented_stub; if (ctx->callbacks.call_updating==NULL) ctx->callbacks.call_updating=(SalOnCallUpdating)unimplemented_stub; if (ctx->callbacks.auth_requested==NULL) @@ -764,8 +766,6 @@ int sal_call_terminate(SalOp *h){ if (err!=0){ ms_warning("Exosip could not terminate the call: cid=%i did=%i", h->cid,h->did); } - sal_remove_call(h->base.root,h); - h->cid=-1; return 0; } @@ -1054,8 +1054,6 @@ static void call_terminated(Sal *sal, eXosip_event_t *ev){ if (ev->request){ osip_from_to_str(ev->request->from,&from); } - sal_remove_call(sal,op); - op->cid=-1; sal->callbacks.call_terminated(op,from!=NULL ? from : sal_op_get_from(op)); if (from) osip_free(from); } @@ -1066,9 +1064,10 @@ static void call_released(Sal *sal, eXosip_event_t *ev){ ms_warning("No op associated to this call_released()"); return; } - op->cid=-1; - if (op->did==-1) + if (op->did==-1) { sal->callbacks.call_failure(op,SalErrorNoResponse,SalReasonUnknown,NULL, 487); + } + sal->callbacks.call_released(op); } static int get_auth_data_from_response(osip_message_t *resp, const char **realm, const char **username){ diff --git a/mediastreamer2 b/mediastreamer2 index fa8cbea18..664e9338c 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit fa8cbea18aae52d4bafc948687d678dfe453b628 +Subproject commit 664e9338cf0f963ef6ab6caad9679abcdfeb60c9