Add specific callback to perform action (in this case re-INVITE) on cancel response.

This commit is contained in:
Ghislain MARY 2016-10-24 14:27:45 +02:00
parent e310831d7d
commit cadf505786
5 changed files with 14 additions and 2 deletions

View file

@ -344,8 +344,7 @@ static void call_process_response(void *op_base, const belle_sip_response_event_
}else if (strcmp("UPDATE",method)==0){
op->base.root->callbacks.call_accepted(op); /*INVITE*/
}else if (strcmp("CANCEL",method)==0){
sal_op_set_error_info_from_response(op,response);
op->base.root->callbacks.call_failure(op);
op->base.root->callbacks.call_cancel_done(op);
}
break;
case SalOpStateTerminating:

View file

@ -1005,6 +1005,14 @@ static void call_released(SalOp *op){
}
}
static void call_cancel_done(SalOp *op) {
LinphoneCall *call = (LinphoneCall *)sal_op_get_user_pointer(op);
if (call->reinvite_on_cancel_response_requested == TRUE) {
call->reinvite_on_cancel_response_requested = FALSE;
linphone_call_reinvite_to_recover_from_connection_loss(call);
}
}
static void auth_failure(SalOp *op, SalAuthInfo* info) {
LinphoneCore *lc = (LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneAuthInfo *ai = NULL;
@ -1470,6 +1478,7 @@ SalCallbacks linphone_sal_callbacks={
call_terminated,
call_failure,
call_released,
call_cancel_done,
auth_failure,
register_success,
register_failure,

View file

@ -5138,6 +5138,7 @@ void linphone_call_repair_if_broken(LinphoneCall *call){
if (sal_call_dialog_request_pending(call->op)) {
/* Need to cancel first re-INVITE as described in section 5.5 of RFC 6141 */
sal_call_cancel_invite(call->op);
call->reinvite_on_cancel_response_requested = TRUE;
}
break;
case LinphoneCallStreamsRunning:

View file

@ -371,6 +371,7 @@ struct _LinphoneCall{
bool_t broken; /*set to TRUE when the call is in broken state due to network disconnection or transport */
bool_t defer_notify_incoming;
bool_t need_localip_refresh;
bool_t reinvite_on_cancel_response_requested;
};
BELLE_SIP_DECLARE_VPTR(LinphoneCall);

View file

@ -491,6 +491,7 @@ typedef void (*SalOnCallUpdating)(SalOp *op, bool_t is_update);/*< Called when a
typedef void (*SalOnCallTerminated)(SalOp *op, const char *from);
typedef void (*SalOnCallFailure)(SalOp *op);
typedef void (*SalOnCallReleased)(SalOp *salop);
typedef void (*SalOnCallCancelDone)(SalOp *salop);
typedef void (*SalOnAuthRequestedLegacy)(SalOp *op, const char *realm, const char *username);
typedef bool_t (*SalOnAuthRequested)(Sal *sal,SalAuthInfo* info);
typedef void (*SalOnAuthFailure)(SalOp *op, SalAuthInfo* info);
@ -530,6 +531,7 @@ typedef struct SalCallbacks{
SalOnCallTerminated call_terminated;
SalOnCallFailure call_failure;
SalOnCallReleased call_released;
SalOnCallCancelDone call_cancel_done;
SalOnAuthFailure auth_failure;
SalOnRegisterSuccess register_success;
SalOnRegisterFailure register_failure;