mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
chan_pjsip, app_transfer: Add TRANSFERSTATUSPROTOCOL variable
When a Transfer/REFER is executed, TRANSFERSTATUSPROTOCOL variable is 0 when no protocl specific error SIP example of failure, 3xx-6xx for the SIP error code received This allows applications to perform actions based on the failure reason. ASTERISK-29252 #close Reported-by: Dan Cropp Change-Id: Ia6a94784b4925628af122409cdd733c9f29abfc4
This commit is contained in:
committed by
Friendly Automation
parent
176274caa4
commit
088816284a
@@ -1982,12 +1982,17 @@ static void xfer_client_on_evsub_state(pjsip_evsub *sub, pjsip_event *event)
|
||||
rdata = event->body.tsx_state.src.rdata;
|
||||
msg = rdata->msg_info.msg;
|
||||
|
||||
if (!pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())) {
|
||||
body = msg->body;
|
||||
if (body && !pj_stricmp2(&body->content_type.type, "message")
|
||||
&& !pj_stricmp2(&body->content_type.subtype, "sipfrag")) {
|
||||
pjsip_parse_status_line((char *)body->data, body->len, &status_line);
|
||||
if (msg->type == PJSIP_REQUEST_MSG) {
|
||||
if (!pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())) {
|
||||
body = msg->body;
|
||||
if (body && !pj_stricmp2(&body->content_type.type, "message")
|
||||
&& !pj_stricmp2(&body->content_type.subtype, "sipfrag")) {
|
||||
pjsip_parse_status_line((char *)body->data, body->len, &status_line);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
status_line.code = msg->line.status.code;
|
||||
status_line.reason = msg->line.status.reason;
|
||||
}
|
||||
} else {
|
||||
status_line.code = 500;
|
||||
@@ -2000,12 +2005,16 @@ static void xfer_client_on_evsub_state(pjsip_evsub *sub, pjsip_event *event)
|
||||
res = -1;
|
||||
|
||||
/* If the subscription has terminated, return AST_TRANSFER_SUCCESS for 2XX.
|
||||
* Any other status code returns AST_TRANSFER_FAILED.
|
||||
* Return AST_TRANSFER_FAILED for any code < 200.
|
||||
* Otherwise, return the status code.
|
||||
* The subscription should not terminate for any code < 200,
|
||||
* but if it does, that constitutes a failure. */
|
||||
if (status_line.code < 200 || status_line.code >= 300) {
|
||||
if (status_line.code < 200) {
|
||||
message = AST_TRANSFER_FAILED;
|
||||
} else if (status_line.code >= 300) {
|
||||
message = status_line.code;
|
||||
}
|
||||
|
||||
/* If subscription not terminated and subscription is finished (status code >= 200)
|
||||
* terminate it */
|
||||
if (!is_last) {
|
||||
|
Reference in New Issue
Block a user