Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "include/res_pjsip_private.h"
#include "asterisk/module.h"
Go to the source code of this file.
Data Structures | |
struct | filter_message_restrictions |
Outgoing message modification restrictions. More... | |
Macros | |
#define | FUNC_ATTRS __attribute__ ((noinline)) |
#define | is_sip_uri(uri) (PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri)) |
#define | MOD_DATA_RESTRICTIONS "restrictions" |
Enumerations | |
enum | uri_type { URI_TYPE_REQUEST = -1, URI_TYPE_TO = PJSIP_H_TO, URI_TYPE_FROM = PJSIP_H_FROM, URI_TYPE_CONTACT = PJSIP_H_CONTACT } |
Functions | |
void | ast_res_pjsip_cleanup_message_filter (void) |
int | ast_res_pjsip_init_message_filter (void) |
static pj_bool_t | filter_on_rx_message (pjsip_rx_data *rdata) |
static pj_status_t | filter_on_tx_message (pjsip_tx_data *tdata) |
static void | filter_outgoing_message (struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, struct pjsip_tx_data *tdata) |
Callback invoked on non-session outgoing messages. More... | |
static void | filter_session_outgoing_message (struct ast_sip_session *session, struct pjsip_tx_data *tdata) |
Callback invoked on session outgoing messages. More... | |
static struct filter_message_restrictions * | get_restrictions (pjsip_tx_data *tdata) |
Helper function to get (or allocate if not already present) restrictions on a message. More... | |
static pjsip_transport * | get_udp_transport (pj_str_t *address, int port) |
Helper function which returns a UDP transport bound to the given address and port. More... | |
static int | is_bound_any (pjsip_transport *transport) |
Helper function which determines if a transport is bound to any. More... | |
static int | multihomed_rewrite_sdp (struct pjmedia_sdp_session *sdp) |
Helper function which determines if the address within SDP should be rewritten. More... | |
static pj_bool_t | on_rx_process_symmetric_transport (pjsip_rx_data *rdata) |
static pj_bool_t | on_rx_process_uris (pjsip_rx_data *rdata) |
static void | print_sanitize_debug (char *msg, pjsip_uri_context_e context, pjsip_sip_uri *uri) |
static void | print_uri_debug (enum uri_type ut, pjsip_rx_data *rdata, pjsip_hdr *hdr) |
static void | remove_x_ast_params (pjsip_uri *header_uri) |
static void FUNC_ATTRS | sanitize_tdata (pjsip_tx_data *tdata) |
Variables | |
static pjsip_module | filter_module_transport |
static pjsip_module | filter_module_tsx |
static struct ast_sip_session_supplement | filter_session_supplement |
PJSIP Session Supplement for tagging messages with restrictions. More... | |
static struct ast_sip_supplement | filter_supplement |
PJSIP Supplement for tagging messages with restrictions. More... | |
#define FUNC_ATTRS __attribute__ ((noinline)) |
Definition at line 180 of file pjsip_message_filter.c.
#define is_sip_uri | ( | uri | ) | (PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri)) |
Definition at line 163 of file pjsip_message_filter.c.
Referenced by on_rx_process_uris(), and sanitize_tdata().
#define MOD_DATA_RESTRICTIONS "restrictions" |
Definition at line 29 of file pjsip_message_filter.c.
Referenced by filter_on_tx_message(), and get_restrictions().
enum uri_type |
Enumerator | |
---|---|
URI_TYPE_REQUEST | |
URI_TYPE_TO | |
URI_TYPE_FROM | |
URI_TYPE_CONTACT |
Definition at line 358 of file pjsip_message_filter.c.
void ast_res_pjsip_cleanup_message_filter | ( | void | ) |
Definition at line 565 of file pjsip_message_filter.c.
References ast_sip_session_unregister_supplement(), ast_sip_unregister_service(), ast_sip_unregister_supplement(), filter_module_transport, and filter_module_tsx.
Referenced by ast_res_pjsip_init_message_filter(), and unload_pjsip().
int ast_res_pjsip_init_message_filter | ( | void | ) |
Definition at line 573 of file pjsip_message_filter.c.
References ast_log, ast_res_pjsip_cleanup_message_filter(), ast_sip_register_service(), ast_sip_register_supplement(), ast_sip_session_register_supplement, filter_module_transport, filter_module_tsx, and LOG_ERROR.
Referenced by load_module().
|
static |
Definition at line 548 of file pjsip_message_filter.c.
References on_rx_process_symmetric_transport(), and on_rx_process_uris().
|
static |
Definition at line 225 of file pjsip_message_filter.c.
References ast_debug, ast_sip_get_pjsip_endpoint(), ast_sip_is_content_type(), ast_sip_mod_data_get, filter_message_restrictions::disallow_from_domain_modification, filter_module_transport, get_udp_transport(), is_bound_any(), MOD_DATA_RESTRICTIONS, multihomed_rewrite_sdp(), NULL, and sanitize_tdata().
|
static |
Callback invoked on non-session outgoing messages.
Definition at line 72 of file pjsip_message_filter.c.
References ast_strlen_zero, filter_message_restrictions::disallow_from_domain_modification, ast_sip_endpoint::fromdomain, and get_restrictions().
|
static |
Callback invoked on session outgoing messages.
Definition at line 87 of file pjsip_message_filter.c.
References ast_strlen_zero, filter_message_restrictions::disallow_from_domain_modification, ast_sip_session::endpoint, ast_sip_endpoint::fromdomain, and get_restrictions().
|
static |
Helper function to get (or allocate if not already present) restrictions on a message.
Definition at line 56 of file pjsip_message_filter.c.
References ast_sip_mod_data_get, ast_sip_mod_data_set, filter_module_tsx, and MOD_DATA_RESTRICTIONS.
Referenced by filter_outgoing_message(), and filter_session_outgoing_message().
|
static |
Helper function which returns a UDP transport bound to the given address and port.
Definition at line 102 of file pjsip_message_filter.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_sip_get_transport_states(), AST_TRANSPORT_UDP, ast_sip_transport_state::flow, NULL, ast_sip_transport_state::transport, transport_states, and ast_sip_transport_state::type.
Referenced by filter_on_tx_message().
|
static |
Helper function which determines if a transport is bound to any.
Definition at line 131 of file pjsip_message_filter.c.
Referenced by filter_on_tx_message().
|
static |
Helper function which determines if the address within SDP should be rewritten.
Definition at line 146 of file pjsip_message_filter.c.
References ast_sip_get_host_ip_string().
Referenced by filter_on_tx_message().
|
static |
Definition at line 505 of file pjsip_message_filter.c.
References ao2_cleanup, ast_begins_with(), ast_debug, ast_sip_get_sorcery(), AST_SIP_X_AST_TXP, AST_SIP_X_AST_TXP_LEN, ast_sorcery_retrieve_by_id(), NULL, and ast_sip_transport::symmetric_transport.
Referenced by filter_on_rx_message().
|
static |
Definition at line 446 of file pjsip_message_filter.c.
References ast_sip_get_pjsip_endpoint(), is_sip_uri, NULL, print_uri_debug(), remove_x_ast_params(), URI_TYPE_CONTACT, URI_TYPE_FROM, URI_TYPE_REQUEST, and URI_TYPE_TO.
Referenced by filter_on_rx_message().
|
static |
Definition at line 166 of file pjsip_message_filter.c.
References ast_debug.
Referenced by sanitize_tdata().
|
static |
Definition at line 365 of file pjsip_message_filter.c.
References ast_debug, ast_strdupa, context, NULL, and URI_TYPE_REQUEST.
Referenced by on_rx_process_uris().
|
static |
/internal
We want to make sure that any incoming requests don't already have x-ast-* parameters in any URIs or we may get confused if symmetric transport (x-ast-txp) or rewrite_contact (x-ast-orig-host) is used later on.
Definition at line 420 of file pjsip_message_filter.c.
Referenced by on_rx_process_uris().
|
static |
Definition at line 185 of file pjsip_message_filter.c.
References AST_SIP_X_AST_TXP, AST_SIP_X_AST_TXP_LEN, is_sip_uri, and print_sanitize_debug().
Referenced by filter_on_tx_message().
|
static |
Definition at line 40 of file pjsip_message_filter.c.
Referenced by ast_res_pjsip_cleanup_message_filter(), ast_res_pjsip_init_message_filter(), and filter_on_tx_message().
|
static |
Definition at line 47 of file pjsip_message_filter.c.
Referenced by ast_res_pjsip_cleanup_message_filter(), ast_res_pjsip_init_message_filter(), and get_restrictions().
|
static |
PJSIP Session Supplement for tagging messages with restrictions.
Definition at line 95 of file pjsip_message_filter.c.
|
static |
PJSIP Supplement for tagging messages with restrictions.
Definition at line 80 of file pjsip_message_filter.c.