Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
|
#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 |
#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_allowed_tel_uri_request (pjsip_rx_data *rdata) |
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 |
Definition at line 182 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.
#define MOD_DATA_RESTRICTIONS "restrictions" |
Definition at line 29 of file pjsip_message_filter.c.
enum uri_type |
Enumerator | |
---|---|
URI_TYPE_REQUEST | |
URI_TYPE_TO | |
URI_TYPE_FROM | |
URI_TYPE_CONTACT |
Definition at line 373 of file pjsip_message_filter.c.
void ast_res_pjsip_cleanup_message_filter | ( | void | ) |
Definition at line 604 of file pjsip_message_filter.c.
References ast_sip_session_unregister_supplement(), ast_sip_unregister_service(), ast_sip_unregister_supplement(), filter_module_transport, filter_module_tsx, filter_session_supplement, and filter_supplement.
Referenced by ast_res_pjsip_init_message_filter(), and unload_pjsip().
int ast_res_pjsip_init_message_filter | ( | void | ) |
Definition at line 612 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, filter_session_supplement, filter_supplement, and LOG_ERROR.
Referenced by load_module().
|
static |
Definition at line 587 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_uri_sip_sips(), 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, pjsip_media_type_application_sdp, 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, get_restrictions(), and session.
|
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 |
Definition at line 466 of file pjsip_message_filter.c.
Referenced by on_rx_process_uris().
|
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 544 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 484 of file pjsip_message_filter.c.
References ast_sip_get_pjsip_endpoint(), ast_sip_is_allowed_uri(), is_allowed_tel_uri_request(), 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, and voicemailpwcheck::context.
Referenced by sanitize_tdata().
|
static |
Definition at line 380 of file pjsip_message_filter.c.
References ast_debug, ast_strdupa, voicemailpwcheck::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 435 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_is_uri_sip_sips(), AST_SIP_X_AST_TXP, AST_SIP_X_AST_TXP_LEN, 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.
Referenced by ast_res_pjsip_cleanup_message_filter(), and ast_res_pjsip_init_message_filter().
|
static |
PJSIP Supplement for tagging messages with restrictions.
Definition at line 80 of file pjsip_message_filter.c.
Referenced by ast_res_pjsip_cleanup_message_filter(), and ast_res_pjsip_init_message_filter().