Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "asterisk/module.h"
#include "asterisk/res_stir_shaken.h"
Go to the source code of this file.
Macros | |
#define | AST_BUILDOPT_SUM "" |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static void | add_date_header (const struct ast_sip_session *session, pjsip_tx_data *tdata) |
static int | add_identity_header (const struct ast_sip_session *session, pjsip_tx_data *tdata) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | compare_caller_id (char *caller_id, const char *json_str) |
Compare the caller ID from the INVITE with the one in the payload. More... | |
static int | compare_timestamp (const char *json_str) |
Compare the current timestamp with the one in the payload. If the difference is greater than the signature timeout, it's not valid anymore. More... | |
static char * | get_attestation_from_payload (const char *json_str) |
Get the attestation from the payload. More... | |
static int | load_module (void) |
static int | stir_shaken_incoming_request (struct ast_sip_session *session, pjsip_rx_data *rdata) |
static void | stir_shaken_outgoing_request (struct ast_sip_session *session, pjsip_tx_data *tdata) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "PJSIP STIR/SHAKEN Module for Asterisk" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .requires = "res_pjsip,res_pjsip_session,res_stir_shaken", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_sip_session_supplement | stir_shaken_supplement |
#define AST_BUILDOPT_SUM "" |
Definition at line 373 of file res_pjsip_stir_shaken.c.
|
static |
Definition at line 381 of file res_pjsip_stir_shaken.c.
|
static |
Definition at line 381 of file res_pjsip_stir_shaken.c.
|
static |
Definition at line 320 of file res_pjsip_stir_shaken.c.
References ast_debug, ast_sip_add_date_header(), and NULL.
Referenced by stir_shaken_outgoing_request().
|
static |
Definition at line 211 of file res_pjsip_stir_shaken.c.
References ast_base64url_encode_string(), ast_calloc, ast_copy_pj_str(), ast_free, ast_json_dump_string, ast_json_free(), ast_json_object_get(), ast_json_pack(), ast_log, ast_malloc, ast_stir_shaken_payload_free(), ast_stir_shaken_payload_get_public_cert_url(), ast_stir_shaken_payload_get_signature(), ast_stir_shaken_sign(), ast_sip_session::id, LOG_ERROR, NULL, ast_party_id::number, ast_stir_shaken_payload::public_cert_url, RAII_VAR, ast_stir_shaken_payload::signature, STIR_SHAKEN_ENCRYPTION_ALGORITHM, STIR_SHAKEN_PPT, and ast_party_number::str.
Referenced by stir_shaken_outgoing_request().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 381 of file res_pjsip_stir_shaken.c.
|
static |
Compare the caller ID from the INVITE with the one in the payload.
json_str | The JSON string represntation of the payload |
-1 | on failure |
0 | on success |
Definition at line 66 of file res_pjsip_stir_shaken.c.
References ast_json_free(), ast_json_load_string(), ast_json_object_get(), ast_json_string_get(), NULL, and RAII_VAR.
Referenced by stir_shaken_incoming_request().
|
static |
Compare the current timestamp with the one in the payload. If the difference is greater than the signature timeout, it's not valid anymore.
json_str | The JSON string representation of the payload |
-1 | on failure |
0 | on success |
Definition at line 91 of file res_pjsip_stir_shaken.c.
References ast_debug, ast_json_free(), ast_json_integer_get(), ast_json_load_string(), ast_json_object_get(), ast_stir_shaken_get_signature_timeout(), ast_tvnow(), NULL, and RAII_VAR.
Referenced by stir_shaken_incoming_request().
|
static |
Get the attestation from the payload.
json_str | The JSON string representation of the payload |
Empty | string on failure |
The | attestation on success |
Definition at line 43 of file res_pjsip_stir_shaken.c.
References ast_json_free(), ast_json_load_string(), ast_json_object_get(), ast_json_string_get(), ast_strlen_zero, NULL, and RAII_VAR.
Referenced by stir_shaken_incoming_request().
|
static |
Definition at line 366 of file res_pjsip_stir_shaken.c.
References AST_MODULE_LOAD_SUCCESS, and ast_sip_session_register_supplement.
|
static |
Definition at line 122 of file res_pjsip_stir_shaken.c.
References ast_base64url_decode_string(), ast_begins_with(), ast_free, ast_sip_rdata_get_header_value(), ast_stir_shaken_add_verification(), ast_stir_shaken_payload_free(), ast_stir_shaken_verify(), AST_STIR_SHAKEN_VERIFY_MISMATCH, AST_STIR_SHAKEN_VERIFY_NOT_PRESENT, AST_STIR_SHAKEN_VERIFY_PASSED, AST_STIR_SHAKEN_VERIFY_SIGNATURE_FAILED, ast_strlen_zero, ast_sip_session::channel, compare_caller_id(), compare_timestamp(), ast_sip_session::endpoint, get_attestation_from_payload(), ast_sip_session::id, NULL, ast_party_id::number, ast_stir_shaken_payload::payload, RAII_VAR, ast_sip_endpoint::stir_shaken, and ast_party_number::str.
|
static |
Definition at line 334 of file res_pjsip_stir_shaken.c.
References add_date_header(), add_identity_header(), ast_strlen_zero, ast_sip_session::endpoint, ast_sip_session::id, ast_party_id::number, ast_sip_endpoint::stir_shaken, ast_party_number::str, and ast_party_number::valid.
|
static |
Definition at line 360 of file res_pjsip_stir_shaken.c.
References ast_sip_session_unregister_supplement().
|
static |
Definition at line 381 of file res_pjsip_stir_shaken.c.
|
static |
Definition at line 381 of file res_pjsip_stir_shaken.c.
|
static |
Definition at line 353 of file res_pjsip_stir_shaken.c.