From 0965d49f7a4611ddd86655f3d3f0e4c85062ff8e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 26 Jan 2016 17:24:54 +0100 Subject: [PATCH] handle expired client dialogs for p2p presence, and report them for LinphoneEvent. remove deprecation of LinphoneChatMessageStateCb, since it is already marked as deprecated in all functions using it. fix a few warnings --- console/commands.c | 7 ++++--- console/linphonec.c | 2 +- coreapi/bellesip_sal/sal_op_events.c | 11 ++++++++++- coreapi/bellesip_sal/sal_op_presence.c | 11 ++++++++++- coreapi/linphonecore.h | 2 +- mediastreamer2 | 2 +- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/console/commands.c b/console/commands.c index cf462b990..6f527831e 100644 --- a/console/commands.c +++ b/console/commands.c @@ -414,7 +414,8 @@ linphonec_parse_command_line(LinphoneCore *lc, char *cl) { while ( isdigit(*cl) || *cl == '#' || *cl == '*' ) { - linphone_core_send_dtmf(lc, *cl); + if (linphone_core_get_current_call(lc)) + linphone_call_send_dtmf(linphone_core_get_current_call(lc), *cl); linphone_core_play_dtmf (lc,*cl,100); ms_sleep(1); // be nice ++cl; @@ -2336,12 +2337,12 @@ static int lpc_cmd_echolimiter(LinphoneCore *lc, char *args){ static int lpc_cmd_mute_mic(LinphoneCore *lc, char *args) { - linphone_core_mute_mic(lc, 1); + linphone_core_enable_mic(lc, 0); return 1; } static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){ - linphone_core_mute_mic(lc, 0); + linphone_core_enable_mic(lc, 1); return 1; } diff --git a/console/linphonec.c b/console/linphonec.c index 709940269..ee7b76617 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -102,7 +102,7 @@ static int linphonec_main_loop (LinphoneCore * opm); static int linphonec_idle_call (void); #ifdef HAVE_READLINE static int linphonec_initialize_readline(void); -static int linphonec_finish_readline(); +static int linphonec_finish_readline(void); static char **linephonec_readline_completion(const char *text, int start, int end); #endif diff --git a/coreapi/bellesip_sal/sal_op_events.c b/coreapi/bellesip_sal/sal_op_events.c index 631e23b36..802e5d334 100644 --- a/coreapi/bellesip_sal/sal_op_events.c +++ b/coreapi/bellesip_sal/sal_op_events.c @@ -61,10 +61,20 @@ static void subscribe_process_io_error(void *user_ctx, const belle_sip_io_error_ } static void subscribe_process_dialog_terminated(void *ctx, const belle_sip_dialog_terminated_event_t *event) { + belle_sip_dialog_t *dialog = belle_sip_dialog_terminated_event_get_dialog(event); SalOp* op= (SalOp*)ctx; if (op->dialog) { op->dialog=NULL; + if (!belle_sip_dialog_is_server(dialog) && belle_sip_dialog_terminated_event_is_expired(event)){ + /*notify the app that our subscription is dead*/ + const char *eventname = NULL; + if (op->event){ + eventname = belle_sip_header_get_unparsed_value(op->event); + } + op->base.root->callbacks.notify(op, SalSubscribeTerminated, eventname, NULL); + } sal_op_unref(op); + } } @@ -198,7 +208,6 @@ int sal_subscribe(SalOp *op, const char *from, const char *to, const char *event if (!op->dialog){ sal_op_subscribe_fill_cbs(op); - /*???sal_exosip_fix_route(op); make sure to ha ;lr*/ req=sal_op_build_request(op,"SUBSCRIBE"); if( req == NULL ) { return -1; diff --git a/coreapi/bellesip_sal/sal_op_presence.c b/coreapi/bellesip_sal/sal_op_presence.c index f5ec79ad8..dab484b1a 100644 --- a/coreapi/bellesip_sal/sal_op_presence.c +++ b/coreapi/bellesip_sal/sal_op_presence.c @@ -58,8 +58,17 @@ static void presence_process_dialog_terminated(void *ctx, const belle_sip_dialog if (!op->op_released){ op->base.root->callbacks.subscribe_presence_closed(op, sal_op_get_from(op)); } + set_or_update_dialog(op, NULL); + }else{ + if (belle_sip_dialog_terminated_event_is_expired(event)){ + ms_warning("Outgoing presence subscription expired."); + if (op->refresher){ + /*send a new SUBSCRIBE, that will attempt to establish a new dialog*/ + sal_subscribe_presence(op,NULL,NULL,-1); + } + } } - set_or_update_dialog(op, NULL); + } } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d4925f50a..255dbcf2b 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1252,7 +1252,7 @@ typedef enum _LinphoneChatMessageState { * @param ud application user data * @deprecated */ -typedef LINPHONE_DEPRECATED void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); +typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); /** * Call back used to notify message delivery status diff --git a/mediastreamer2 b/mediastreamer2 index b49feebe9..f3651d2c5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b49feebe9e76ea8605bee0ca4f5803083c119f01 +Subproject commit f3651d2c516ca74edd310e3868fa74d1149744c8