summaryrefslogtreecommitdiff
path: root/res/res_pjsip_refer.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2017-06-13 14:17:29 -0500
committerKevin Harwell <kharwell@digium.com>2017-06-13 14:28:21 -0500
commit9e53c30610945fa0c16e9954ccb549c70d74f923 (patch)
treedf8c48e08d55c593b315dd7f82e5a04d8eefd7d5 /res/res_pjsip_refer.c
parentabe1dd303909416a1b57747bdb162b82fb08f72b (diff)
res_pjsip_refer/session: Calls dropped during transfer
When doing an attended transfer it's possible for the transferer, after receiving an accepted response from Asterisk, to send a BYE to Asterisk, which can then be processed before Asterisk has time to start and/or complete the transfer process. This of course causes the transfer to not complete successfully, thus dropping the call. This patch makes it so any BYEs received from the transferer, after the REFER, that initiate a session end are deferred until the transfer is complete. This allows the channel that would have otherwise been hung up by Asterisk to remain available throughout the transfer process. ASTERISK-27053 #close Change-Id: I43586db79079457d92d71f1fd993be9a3b409d5a
Diffstat (limited to 'res/res_pjsip_refer.c')
-rw-r--r--res/res_pjsip_refer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 46295387d..456e09dd8 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -543,6 +543,7 @@ static int refer_attended_task(void *data)
}
}
+ ast_sip_session_end_if_deferred(attended->transferer);
if (response != 200) {
if (!ast_sip_push_task(attended->transferer->serializer,
defer_termination_cancel, attended->transferer)) {
@@ -772,6 +773,7 @@ static int refer_incoming_attended_request(struct ast_sip_session *session, pjsi
/* Push it to the other session, which will have both channels with minimal locking */
if (ast_sip_push_task(other_session->serializer, refer_attended_task, attended)) {
+ ast_sip_session_end_if_deferred(session);
ast_sip_session_defer_termination_cancel(session);
ao2_cleanup(attended);
return 500;
@@ -810,9 +812,12 @@ static int refer_incoming_attended_request(struct ast_sip_session *session, pjsi
response = xfer_response_code2sip(ast_bridge_transfer_blind(1, session->channel,
"external_replaces", context, refer_blind_callback, &refer));
+
+ ast_sip_session_end_if_deferred(session);
if (response != 200) {
ast_sip_session_defer_termination_cancel(session);
}
+
return response;
}
}
@@ -865,9 +870,12 @@ static int refer_incoming_blind_request(struct ast_sip_session *session, pjsip_r
response = xfer_response_code2sip(ast_bridge_transfer_blind(1, session->channel,
exten, context, refer_blind_callback, &refer));
+
+ ast_sip_session_end_if_deferred(session);
if (response != 200) {
ast_sip_session_defer_termination_cancel(session);
}
+
return response;
}