[Asterisk-code-review] res pjsip refer.c: Delay sending the initial SIP Notify with... (asterisk[13])
Joshua Colp
asteriskteam at digium.com
Tue Mar 15 08:47:37 CDT 2016
Joshua Colp has submitted this change and it was merged.
Change subject: res_pjsip_refer.c: Delay sending the initial SIP Notify with frag 100
......................................................................
res_pjsip_refer.c: Delay sending the initial SIP Notify with frag 100
During the transfer process, some phones (okay it was the Jitsi softphone,
but maybe others are out there) send a "bye" immediately after receiving a
SIP Notify. When a "bye" is received early for some types of transfers the
transferer channel may no longer be available during late stage transfer
processing.
For instance, during an attended transfer involving stasis bridging at one
point the created local channel looks for an associated swap channel in
order to retrieve the stasis application name. If the transferer has hung
up then the local channel will fail to find it. The local channel then has
no way to know which stasis app to enter, so it fails and hangs up as well.
Thus the transfer does not complete as expected.
This patch delays the sending of the initial notify in order to give the
transfer process enough time to gather the necessary data for a successful
transfer.
ASTERISK-25771
Change-Id: I09cfc9a5d6ed4c007bc70625e0972b470393bf16
---
M res/res_pjsip_refer.c
1 file changed, 14 insertions(+), 7 deletions(-)
Approvals:
Mark Michelson: Looks good to me, approved
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Verified
Objections:
Joshua Colp: I would prefer this is not merged as is
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index c23097e..3766f9b 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -59,6 +59,8 @@
struct transfer_channel_data *transfer_data;
/*! \brief Uniqueid of transferee channel */
char *transferee;
+ /*! \brief Non-zero if the 100 notify has been sent */
+ int sent_100;
};
/*! \brief REFER Progress notification structure */
@@ -131,6 +133,18 @@
ao2_cleanup(notification->progress);
notification->progress->sub = NULL;
+ }
+
+ /* Send a deferred initial 100 Trying SIP frag NOTIFY if we haven't already. */
+ if (!notification->progress->sent_100) {
+ notification->progress->sent_100 = 1;
+ if (notification->response != 100) {
+ ast_debug(3, "Sending initial 100 Trying NOTIFY for progress monitor '%p'\n",
+ notification->progress);
+ if (pjsip_xfer_notify(sub, PJSIP_EVSUB_STATE_ACTIVE, 100, NULL, &tdata) == PJ_SUCCESS) {
+ pjsip_xfer_send_request(sub, tdata);
+ }
+ }
}
ast_debug(3, "Sending NOTIFY with response '%d' and state '%u' on subscription '%p' and progress monitor '%p'\n",
@@ -340,7 +354,6 @@
const pj_str_t str_refer_sub = { "Refer-Sub", 9 };
pjsip_generic_string_hdr *refer_sub = NULL;
const pj_str_t str_true = { "true", 4 };
- pjsip_tx_data *tdata;
pjsip_hdr hdr_list;
char tps_name[AST_TASKPROCESSOR_MAX_NAME + 1];
@@ -391,12 +404,6 @@
/* Accept the REFER request */
ast_debug(3, "Accepting REFER request for progress monitor '%p'\n", *progress);
pjsip_xfer_accept((*progress)->sub, rdata, 202, &hdr_list);
-
- /* Send initial NOTIFY Request */
- ast_debug(3, "Sending initial 100 Trying NOTIFY for progress monitor '%p'\n", *progress);
- if (pjsip_xfer_notify((*progress)->sub, PJSIP_EVSUB_STATE_ACTIVE, 100, NULL, &tdata) == PJ_SUCCESS) {
- pjsip_xfer_send_request((*progress)->sub, tdata);
- }
return 0;
--
To view, visit https://gerrit.asterisk.org/2321
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I09cfc9a5d6ed4c007bc70625e0972b470393bf16
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-code-review
mailing list