mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-02 02:18:31 +00:00
Merge "channels/chan_pjsip: fix HANGUPCAUSE function bug."
This commit is contained in:
@@ -2370,6 +2370,21 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
|
|||||||
return;
|
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) {
|
switch (status.code) {
|
||||||
case 180:
|
case 180:
|
||||||
ast_queue_control(session->channel, AST_CONTROL_RINGING);
|
ast_queue_control(session->channel, AST_CONTROL_RINGING);
|
||||||
@@ -2388,21 +2403,6 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
|
|||||||
default:
|
default:
|
||||||
break;
|
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)
|
static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
|
||||||
|
Reference in New Issue
Block a user