summaryrefslogtreecommitdiff
path: root/res/res_pjsip_refer.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2017-05-08 16:56:32 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2017-05-11 10:50:35 -0500
commit808f2998085b78225addfd73289fdc6c473b7fa1 (patch)
treeff08924c182b081b4a6f418aa360daa9e57a41e9 /res/res_pjsip_refer.c
parent8b15719a11f9ea6e72cf941a7da03ffd97228c7d (diff)
res_pjsip: New endpoint option "refer_blind_progress"
This option was added to turn off notifying the progress details on Blind Transfer. If this option is not set then the chan_pjsip will send NOTIFY "200 OK" immediately after "202 Accepted". Some SIP phones like Mitel/Aastra or Snom keep the line busy until receive "200 OK". ASTERISK-26333 #close Change-Id: Id606fbff2e02e967c02138457badc399144720f2
Diffstat (limited to 'res/res_pjsip_refer.c')
-rw-r--r--res/res_pjsip_refer.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 0f4a95c77..46295387d 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -61,6 +61,8 @@ struct refer_progress {
char *transferee;
/*! \brief Non-zero if the 100 notify has been sent */
int sent_100;
+ /*! \brief Whether to notifies all the progress details on blind transfer */
+ unsigned int refer_blind_progress;
};
/*! \brief REFER Progress notification structure */
@@ -372,6 +374,8 @@ static int refer_progress_alloc(struct ast_sip_session *session, pjsip_rx_data *
ast_debug(3, "Created progress monitor '%p' for transfer occurring from channel '%s' and endpoint '%s'\n",
progress, ast_channel_name(session->channel), ast_sorcery_object_get_id(session->endpoint));
+ (*progress)->refer_blind_progress = session->endpoint->refer_blind_progress;
+
(*progress)->framehook = -1;
/* To prevent a potential deadlock we need the dialog so we can lock/unlock */
@@ -563,6 +567,8 @@ struct refer_blind {
pjsip_replaces_hdr *replaces;
/*! \brief Optional Refer-To header */
pjsip_sip_uri *refer_to;
+ /*! \brief Attended transfer flag */
+ unsigned int attended:1;
};
/*! \brief Blind transfer callback function */
@@ -577,8 +583,16 @@ static void refer_blind_callback(struct ast_channel *chan, struct transfer_chann
pbx_builtin_setvar_helper(chan, "SIPTRANSFER", "yes");
- /* If progress monitoring is being done attach a frame hook so we can monitor it */
- if (refer->progress) {
+ if (refer->progress && !refer->attended && !refer->progress->refer_blind_progress) {
+ /* If blind transfer and endpoint doesn't want to receive all the progress details */
+ struct refer_progress_notification *notification = refer_progress_notification_alloc(refer->progress, 200,
+ PJSIP_EVSUB_STATE_TERMINATED);
+
+ if (notification) {
+ refer_progress_notify(notification);
+ }
+ } else if (refer->progress) {
+ /* If attended transfer and progress monitoring is being done attach a frame hook so we can monitor it */
struct ast_framehook_interface hook = {
.version = AST_FRAMEHOOK_INTERFACE_VERSION,
.event_cb = refer_progress_framehook,
@@ -785,6 +799,7 @@ static int refer_incoming_attended_request(struct ast_sip_session *session, pjsi
refer.rdata = rdata;
refer.replaces = replaces;
refer.refer_to = target_uri;
+ refer.attended = 1;
if (ast_sip_session_defer_termination(session)) {
ast_log(LOG_ERROR, "Received REFER for remote session on channel '%s' from endpoint '%s' but could not defer termination, rejecting\n",
@@ -839,6 +854,7 @@ static int refer_incoming_blind_request(struct ast_sip_session *session, pjsip_r
refer.progress = progress;
refer.rdata = rdata;
refer.refer_to = target;
+ refer.attended = 0;
if (ast_sip_session_defer_termination(session)) {
ast_log(LOG_ERROR, "Channel '%s' from endpoint '%s' attempted blind transfer but could not defer termination, rejecting\n",