res_stir_shaken: Allow missing or anonymous CID to continue to the dialplan.

The verification check for missing or anonymous callerid was happening before
the endpoint's profile was retrieved which meant that the failure_action
parameter wasn't available.  Therefore, if verification was enabled and there
was no callerid or it was "anonymous", the call was immediately terminated
instead of giving the dialplan the ability to decide what to do with the call.

* The callerid check now happens after the verification context is created and
  the endpoint's stir_shaken_profile is available.

* The check now processes the callerid failure just as it does for other
  verification failures and respects the failure_action parameter.  If set
  to "continue" or "continue_return_reason", `STIR_SHAKEN(0,verify_result)`
  in the dialplan will return "invalid_or_no_callerid".

* If the endpoint's failure_action is "reject_request", the call will be
  rejected with `433 "Anonymity Disallowed"`.

* If the endpoint's failure_action is "continue_return_reason", the call will
  continue but a `Reason: STIR; cause=433; text="Anonymity Disallowed"`
  header will be added to the next provisional or final response.

Resolves: #1112
This commit is contained in:
George Joseph
2025-02-05 10:33:10 -07:00
parent 5267c17645
commit 71551013c4
3 changed files with 36 additions and 12 deletions

View File

@@ -55,6 +55,7 @@ enum ast_stir_shaken_vs_response_code {
AST_STIR_SHAKEN_VS_NO_DEST_TN,
AST_STIR_SHAKEN_VS_INVALID_HEADER,
AST_STIR_SHAKEN_VS_INVALID_GRANT,
AST_STIR_SHAKEN_VS_INVALID_OR_NO_CID,
AST_STIR_SHAKEN_VS_RESPONSE_CODE_MAX
};
@@ -233,6 +234,16 @@ enum stir_shaken_failure_action_enum
int ast_stir_shaken_vs_get_use_rfc9410_responses(
struct ast_stir_shaken_vs_ctx *ctx);
/*!
* \brief Get caller_id from context
*
* \param ctx VS context
*
* \retval Caller ID or NULL
*/
const char *ast_stir_shaken_vs_get_caller_id(
struct ast_stir_shaken_vs_ctx *ctx);
/*!
* \brief Add a STIR/SHAKEN verification result to a channel
*