mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
STIR/SHAKEN: Option split and response codes.
The stir_shaken configuration option now has 4 different choices to pick from: off, attest, verify, and on. Off and on behave the same way they do now. Attest will only perform attestation on the endpoint, and verify will only perform verification on the endpoint. Certain responses are required to be sent based on certain conditions for STIR/SHAKEN. For example, if we get a Date header that is outside of the time range that is considered valid, a 403 Stale Date response should be sent. This and several other responses have been added. Change-Id: I4ac1ecf652cd0e336006b0ca638dc826b5b1ebf7
This commit is contained in:
committed by
Friendly Automation
parent
56ecf7005b
commit
1031a1805b
@@ -4051,6 +4051,11 @@ static void handle_new_invite_request(pjsip_rx_data *rdata)
|
||||
{
|
||||
RAII_VAR(struct ast_sip_endpoint *, endpoint,
|
||||
ast_pjsip_rdata_get_endpoint(rdata), ao2_cleanup);
|
||||
static const pj_str_t identity_str = { "Identity", 8 };
|
||||
const pj_str_t use_identity_header_str = {
|
||||
AST_STIR_SHAKEN_RESPONSE_STR_USE_IDENTITY_HEADER,
|
||||
strlen(AST_STIR_SHAKEN_RESPONSE_STR_USE_IDENTITY_HEADER)
|
||||
};
|
||||
pjsip_inv_session *inv_session = NULL;
|
||||
struct ast_sip_session *session;
|
||||
struct new_invite invite;
|
||||
@@ -4060,6 +4065,14 @@ static void handle_new_invite_request(pjsip_rx_data *rdata)
|
||||
|
||||
ast_assert(endpoint != NULL);
|
||||
|
||||
if ((endpoint->stir_shaken & AST_SIP_STIR_SHAKEN_VERIFY) &&
|
||||
!ast_sip_rdata_get_header_value(rdata, identity_str)) {
|
||||
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,
|
||||
AST_STIR_SHAKEN_RESPONSE_CODE_USE_IDENTITY_HEADER, &use_identity_header_str, NULL, NULL);
|
||||
ast_debug(3, "No Identity header when we require one\n");
|
||||
return;
|
||||
}
|
||||
|
||||
inv_session = pre_session_setup(rdata, endpoint);
|
||||
if (!inv_session) {
|
||||
/* pre_session_setup() returns a response on failure */
|
||||
|
Reference in New Issue
Block a user