[Asterisk-code-review] channels/chan pjsip: fix HANGUPCAUSE function bug. (asterisk[13])
George Joseph
asteriskteam at digium.com
Fri Sep 23 14:11:05 CDT 2016
George Joseph has uploaded a new change for review.
https://gerrit.asterisk.org/3970
Change subject: channels/chan_pjsip: fix HANGUPCAUSE function bug.
......................................................................
channels/chan_pjsip: fix HANGUPCAUSE function bug.
HANGUPCAUSE not return 'SIP 200 Ok' when dialed channel answered.
This patch change the call order of ast_queue_control_data
and ast_queue_control in chan_pjsip_incoming_response.
ASTERISK-26396 #close
Reported by: AaronAn
Tested by: AaronAn
Change-Id: Ide2d31723d8d425961e985de7de625694580be61
---
M channels/chan_pjsip.c
1 file changed, 15 insertions(+), 15 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/70/3970/1
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 82f716f..2354511 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -2321,6 +2321,21 @@
return;
}
+ /* Build and send the tech-specific cause information */
+ /* size of the string making up the cause code is "SIP " number + " " + reason length */
+ data_size += 4 + 4 + pj_strlen(&status.reason);
+ cause_code = ast_alloca(data_size);
+ memset(cause_code, 0, data_size);
+
+ ast_copy_string(cause_code->chan_name, ast_channel_name(session->channel), AST_CHANNEL_NAME);
+
+ snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "SIP %d %.*s", status.code,
+ (int) pj_strlen(&status.reason), pj_strbuf(&status.reason));
+
+ cause_code->ast_cause = hangup_sip2cause(status.code);
+ ast_queue_control_data(session->channel, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
+ ast_channel_hangupcause_hash_set(session->channel, cause_code, data_size);
+
switch (status.code) {
case 180:
ast_queue_control(session->channel, AST_CONTROL_RINGING);
@@ -2339,21 +2354,6 @@
default:
break;
}
-
- /* Build and send the tech-specific cause information */
- /* size of the string making up the cause code is "SIP " number + " " + reason length */
- data_size += 4 + 4 + pj_strlen(&status.reason);
- cause_code = ast_alloca(data_size);
- memset(cause_code, 0, data_size);
-
- ast_copy_string(cause_code->chan_name, ast_channel_name(session->channel), AST_CHANNEL_NAME);
-
- snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "SIP %d %.*s", status.code,
- (int) pj_strlen(&status.reason), pj_strbuf(&status.reason));
-
- cause_code->ast_cause = hangup_sip2cause(status.code);
- ast_queue_control_data(session->channel, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
- ast_channel_hangupcause_hash_set(session->channel, cause_code, data_size);
}
static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
--
To view, visit https://gerrit.asterisk.org/3970
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide2d31723d8d425961e985de7de625694580be61
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Aaron An <anjb at ti-net.com.cn>
More information about the asterisk-code-review
mailing list