Asterisk - The Open Source Telephony Project
18.5.0
|
#include <pjsip.h>
#include <pjsip_simple.h>
#include <pjsip/sip_transaction.h>
#include <pj/timer.h>
#include <pjlib.h>
#include "asterisk/stringfields.h"
#include "asterisk/netsock2.h"
#include "asterisk/linkedlists.h"
#include "asterisk/channel.h"
#include "asterisk/sorcery.h"
#include "asterisk/dnsmgr.h"
#include "asterisk/endpoints.h"
#include "asterisk/udptl.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/vector.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_endpoints.h"
#include "asterisk/stream.h"
Go to the source code of this file.
Data Structures | |
struct | ast_sip_ami |
AMI variable container. More... | |
struct | ast_sip_aor |
A SIP address of record. More... | |
struct | ast_sip_auth |
struct | ast_sip_auth_vector |
struct | ast_sip_authenticator |
An interchangeable way of handling digest authentication for SIP. More... | |
struct | ast_sip_body |
SIP body description. More... | |
struct | ast_sip_contact |
Contact associated with an address of record. More... | |
struct | ast_sip_contact_status |
A contact's status. More... | |
struct | ast_sip_contact_wrapper |
A wrapper for contact that adds the aor_id and a consistent contact id. Used by ast_sip_for_each_contact. More... | |
struct | ast_sip_direct_media_configuration |
Direct media options for SIP endpoints. More... | |
struct | ast_sip_domain_alias |
struct | ast_sip_endpoint |
An entity with which Asterisk communicates. More... | |
struct | ast_sip_endpoint_extensions |
Endpoint configuration for SIP extensions. More... | |
struct | ast_sip_endpoint_formatter |
An entity responsible formatting endpoint information. More... | |
struct | ast_sip_endpoint_id_configuration |
Party identification options for endpoints. More... | |
struct | ast_sip_endpoint_identifier |
An entity responsible for identifying the source of a SIP message. More... | |
struct | ast_sip_endpoint_info_configuration |
Endpoint configuration options for INFO packages. More... | |
struct | ast_sip_endpoint_media_configuration |
Media configuration for SIP endpoints. More... | |
struct | ast_sip_endpoint_nat_configuration |
NAT configuration options for endpoints. More... | |
struct | ast_sip_endpoint_pickup_configuration |
Call pickup configuration options for endpoints. More... | |
struct | ast_sip_endpoint_subscription_configuration |
Endpoint subscription configuration. More... | |
struct | ast_sip_identify_by_vector |
struct | ast_sip_info_recording_configuration |
Configuration for one-touch INFO recording. More... | |
struct | ast_sip_media_rtp_configuration |
RTP configuration for SIP endpoints. More... | |
struct | ast_sip_mwi_configuration |
Endpoint configuration for unsolicited MWI. More... | |
struct | ast_sip_nat_hook |
Structure for SIP nat hook information. More... | |
struct | ast_sip_outbound_authenticator |
an interchangeable way of responding to authentication challenges More... | |
struct | ast_sip_supplement |
A supplement to SIP message processing. More... | |
struct | ast_sip_t38_configuration |
struct | ast_sip_timer_options |
Session timers options. More... | |
struct | ast_sip_tpmgr_state_callback |
struct | ast_sip_transport |
Transport to bind to. More... | |
struct | ast_sip_transport_state |
Structure for SIP transport information. More... | |
Macros | |
#define | ast_sip_cleanup_auth_objects_vector(auth_objects) AST_VECTOR_RESET(auth_objects, ao2_cleanup) |
Clean up retrieved auth objects in vector. More... | |
#define | ast_sip_mod_data_get(mod_data, id, key) ast_sip_dict_get(mod_data[id], key) |
Using the dictionary stored in mod_data array at a given id, retrieve the value associated with the given key. More... | |
#define | ast_sip_mod_data_set(pool, mod_data, id, key, val) mod_data[id] = ast_sip_dict_set(pool, mod_data[id], key, val) |
Utilizing a mod_data array for a given id, set the value associated with the given key. More... | |
#define | ast_sip_transport_is_local(transport_state, addr) (transport_state->localnet && ast_apply_ha(transport_state->localnet, addr) != AST_SENSE_ALLOW) |
#define | ast_sip_transport_is_nonlocal(transport_state, addr) (!transport_state->localnet || ast_apply_ha(transport_state->localnet, addr) == AST_SENSE_ALLOW) |
#define | AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(str) |
Truncate the URI user field options string if enabled. More... | |
#define | AST_SIP_X_AST_TXP "x-ast-txp" |
#define | AST_SIP_X_AST_TXP_LEN 9 |
#define | MAX_RX_CHALLENGES 10 |
#define | PJSIP_EXPIRES_NOT_SPECIFIED ((pj_uint32_t)-1) |
#define | PJSIP_MINVERSION(m, n, p) (((m << 24) | (n << 16) | (p << 8)) >= PJ_VERSION_NUM) |
#define | SIP_SORCERY_DOMAIN_ALIAS_TYPE "domain_alias" |
#define | SIP_TLS_MAX_CIPHERS 64 |
Maximum number of ciphers supported for a TLS transport. More... | |
Typedefs | |
typedef int(* | ast_sip_dialog_outbound_auth_cb) (pjsip_dialog *dlg, pjsip_tx_data *tdata, void *user_data) |
Callback called when an outbound request with authentication credentials is to be sent in dialog. More... | |
typedef int(* | ast_sip_task) (void *user_data) |
typedef int(* | ast_transport_monitor_data_matcher) (void *a, void *b) |
Transport shutdown monitor data matcher. More... | |
typedef void(* | ast_transport_monitor_shutdown_cb) (void *data) |
Transport shutdown monitor callback. More... | |
Functions | |
void | ast_copy_pj_str (char *dest, const pj_str_t *src, size_t size) |
Copy a pj_str_t into a standard character buffer. More... | |
int | ast_copy_pj_str2 (char **dest, const pj_str_t *src) |
Create and copy a pj_str_t into a standard character buffer. More... | |
struct ast_sip_endpoint * | ast_pjsip_rdata_get_endpoint (pjsip_rx_data *rdata) |
Get the looked-up endpoint on an out-of dialog request or response. More... | |
int | ast_sip_add_body (pjsip_tx_data *tdata, const struct ast_sip_body *body) |
Add a body to an outbound SIP message. More... | |
int | ast_sip_add_body_multipart (pjsip_tx_data *tdata, const struct ast_sip_body *bodies[], int num_bodies) |
Add a multipart body to an outbound SIP message. More... | |
void | ast_sip_add_date_header (pjsip_tx_data *tdata) |
Adds a Date header to the tdata, formatted like: Date: Wed, 01 Jan 2021 14:53:01 GMT. More... | |
int | ast_sip_add_global_request_header (const char *name, const char *value, int replace) |
int | ast_sip_add_global_response_header (const char *name, const char *value, int replace) |
int | ast_sip_add_header (pjsip_tx_data *tdata, const char *name, const char *value) |
Add a header to an outbound SIP message. More... | |
void | ast_sip_add_usereqphone (const struct ast_sip_endpoint *endpoint, pj_pool_t *pool, pjsip_uri *uri) |
Add 'user=phone' parameter to URI if enabled and user is a phone number. More... | |
int | ast_sip_append_body (pjsip_tx_data *tdata, const char *body_text) |
Append body data to a SIP message. More... | |
const char * | ast_sip_auth_type_to_str (enum ast_sip_auth_type type) |
Converts the given auth type to a string. More... | |
void | ast_sip_auth_vector_destroy (struct ast_sip_auth_vector *vector) |
Free contents of an auth vector. More... | |
int | ast_sip_auth_vector_init (struct ast_sip_auth_vector *vector, const char *auth_names) |
Initialize an auth vector with the configured values. More... | |
int | ast_sip_auths_to_str (const struct ast_sip_auth_vector *auths, char **buf) |
Converts an auths array to a string of comma separated values. More... | |
const char * | ast_sip_call_codec_pref_to_str (struct ast_flags pref) |
Convert the call codec preference flags to a string. More... | |
int | ast_sip_call_codec_str_to_pref (struct ast_flags *pref, const char *pref_str, int is_outgoing) |
Convert a call codec preference string to preference flags. More... | |
enum ast_sip_check_auth_result | ast_sip_check_authentication (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, pjsip_tx_data *tdata) |
Method to determine authentication status of an incoming request. More... | |
void | ast_sip_cleanup_auths (struct ast_sip_auth *auths[], size_t num_auths) |
Clean up retrieved auth structures from memory. More... | |
int | ast_sip_contact_to_str (void *object, void *arg, int flags) |
Handler used to convert a contact to a string. More... | |
struct ast_str * | ast_sip_create_ami_event (const char *event, struct ast_sip_ami *ami) |
Creates a string to store AMI event data in. More... | |
pjsip_dialog * | ast_sip_create_dialog_uac (const struct ast_sip_endpoint *endpoint, const char *aor_name, const char *request_user) |
General purpose method for creating a UAC dialog with an endpoint. More... | |
pjsip_dialog * | ast_sip_create_dialog_uas (const struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, pj_status_t *status) |
General purpose method for creating a UAS dialog with an endpoint. More... | |
pjsip_dialog * | ast_sip_create_dialog_uas_locked (const struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, pj_status_t *status) |
General purpose method for creating a UAS dialog with an endpoint. More... | |
int | ast_sip_create_rdata (pjsip_rx_data *rdata, char *packet, const char *src_name, int src_port, char *transport_type, const char *local_name, int local_port) |
General purpose method for creating an rdata structure using specific information. More... | |
int | ast_sip_create_rdata_with_contact (pjsip_rx_data *rdata, char *packet, const char *src_name, int src_port, char *transport_type, const char *local_name, int local_port, const char *contact_uri) |
General purpose method for creating an rdata structure using specific information. More... | |
int | ast_sip_create_request (const char *method, struct pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint, const char *uri, struct ast_sip_contact *contact, pjsip_tx_data **tdata) |
General purpose method for creating a SIP request. More... | |
int | ast_sip_create_request_with_auth (const struct ast_sip_auth_vector *auths, pjsip_rx_data *challenge, pjsip_tx_data *tdata, pjsip_tx_data **new_request) |
Create a response to an authentication challenge. More... | |
int | ast_sip_create_response (const pjsip_rx_data *rdata, int st_code, struct ast_sip_contact *contact, pjsip_tx_data **p_tdata) |
General purpose method for creating a SIP response. More... | |
struct ast_taskprocessor * | ast_sip_create_serializer (const char *name) |
Create a new serializer for SIP tasks. More... | |
struct ast_taskprocessor * | ast_sip_create_serializer_group (const char *name, struct ast_serializer_shutdown_group *shutdown_group) |
Create a new serializer for SIP tasks. More... | |
struct ast_sip_endpoint * | ast_sip_default_outbound_endpoint (void) |
Retrieve the default outbound endpoint. More... | |
struct ast_sip_endpoint * | ast_sip_dialog_get_endpoint (pjsip_dialog *dlg) |
Get the endpoint associated with this dialog. More... | |
void | ast_sip_dialog_set_endpoint (pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint) |
Set an endpoint on a SIP dialog so in-dialog requests do not undergo endpoint lookup. More... | |
void | ast_sip_dialog_set_serializer (pjsip_dialog *dlg, struct ast_taskprocessor *serializer) |
Set a serializer on a SIP dialog so requests and responses are automatically serialized. More... | |
int | ast_sip_dialog_setup_outbound_authentication (pjsip_dialog *dlg, const struct ast_sip_endpoint *endpoint, ast_sip_dialog_outbound_auth_cb cb, void *user_data) |
Set up outbound authentication on a SIP dialog. More... | |
void * | ast_sip_dict_get (void *ht, const char *key) |
Retrieves the value associated with the given key. More... | |
void * | ast_sip_dict_set (pj_pool_t *pool, void *ht, const char *key, void *val) |
Set the value for the given key. More... | |
int | ast_sip_dlg_set_transport (const struct ast_sip_endpoint *endpoint, pjsip_dialog *dlg, pjsip_tpselector *selector) |
Set the transport on a dialog. More... | |
int | ast_sip_dtmf_to_str (const enum ast_sip_dtmf_mode dtmf, char *buf, size_t buf_len) |
Convert the DTMF mode enum value into a string. More... | |
void * | ast_sip_endpoint_alloc (const char *name) |
Allocate a new SIP endpoint. More... | |
int | ast_sip_failover_request (pjsip_tx_data *tdata) |
Set a request to use the next value in the list of resolved addresses. More... | |
int | ast_sip_for_each_aor (const char *aors, ao2_callback_fn on_aor, void *arg) |
For every aor in the comma separated aors string call the given 'on_aor' handler. More... | |
int | ast_sip_for_each_auth (const struct ast_sip_auth_vector *array, ao2_callback_fn on_auth, void *arg) |
For every auth in the array call the given 'on_auth' handler. More... | |
int | ast_sip_for_each_channel (const struct ast_sip_endpoint *endpoint, ao2_callback_fn on_channel_snapshot, void *arg) |
For every channel snapshot on an endpoint all the given 'on_channel_snapshot' handler. More... | |
int | ast_sip_for_each_channel_snapshot (const struct ast_endpoint_snapshot *endpoint_snapshot, ao2_callback_fn on_channel_snapshot, void *arg) |
For every channel snapshot on an endpoint snapshot call the given 'on_channel_snapshot' handler. More... | |
int | ast_sip_for_each_contact (const struct ast_sip_aor *aor, ao2_callback_fn on_contact, void *arg) |
For every contact on an AOR call the given 'on_contact' handler. More... | |
int | ast_sip_format_auths_ami (const struct ast_sip_auth_vector *auths, struct ast_sip_ami *ami) |
Format auth details for AMI. More... | |
int | ast_sip_format_contact_ami (void *obj, void *arg, int flags) |
Formats the contact and sends over AMI. More... | |
int | ast_sip_format_endpoint_ami (struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami, int *count) |
Formats the endpoint and sends over AMI. More... | |
struct ast_sip_auth * | ast_sip_get_artificial_auth (void) |
Retrieves a reference to the artificial auth. More... | |
struct ast_sip_endpoint * | ast_sip_get_artificial_endpoint (void) |
Retrieves a reference to the artificial endpoint. More... | |
unsigned int | ast_sip_get_contact_expiration_check_interval (void) |
Retrieve the system contact expiration check interval setting. More... | |
const char * | ast_sip_get_contact_short_status_label (const enum ast_sip_contact_status_type status) |
struct ast_sip_contact_status * | ast_sip_get_contact_status (const struct ast_sip_contact *contact) |
Retrieve the current status for a contact. More... | |
const char * | ast_sip_get_contact_status_label (const enum ast_sip_contact_status_type status) |
translate ast_sip_contact_status_type to character string. More... | |
char * | ast_sip_get_debug (void) |
Retrieve the system debug setting (yes|no|host). More... | |
void | ast_sip_get_default_from_user (char *from_user, size_t size) |
Retrieve the global default from user. More... | |
void | ast_sip_get_default_realm (char *realm, size_t size) |
Retrieve the global default realm. More... | |
char * | ast_sip_get_default_voicemail_extension (void) |
Retrieve the default voicemail extension. More... | |
const char * | ast_sip_get_device_state (const struct ast_sip_endpoint *endpoint) |
Retrieve the device state for an endpoint. More... | |
unsigned int | ast_sip_get_disable_multi_domain (void) |
Retrieve the system setting 'disable multi domain'. More... | |
struct ast_taskprocessor * | ast_sip_get_distributor_serializer (pjsip_rx_data *rdata) |
Determine the distributor serializer for the SIP message. More... | |
char * | ast_sip_get_endpoint_identifier_order (void) |
Retrieve the global endpoint_identifier_order setting. More... | |
struct ast_endpoint_snapshot * | ast_sip_get_endpoint_snapshot (const struct ast_sip_endpoint *endpoint) |
Retrieve the endpoint snapshot for an endpoint. More... | |
struct ao2_container * | ast_sip_get_endpoints (void) |
Retrieve any endpoints available to sorcery. More... | |
int | ast_sip_get_host_ip (int af, pj_sockaddr *addr) |
Retrieve the local host address in IP form. More... | |
const char * | ast_sip_get_host_ip_string (int af) |
Retrieve the local host address in string form. More... | |
unsigned int | ast_sip_get_ignore_uri_user_options (void) |
Retrieve the global setting 'ignore_uri_user_options'. More... | |
unsigned int | ast_sip_get_keep_alive_interval (void) |
Retrieve the system keep alive interval setting. More... | |
unsigned int | ast_sip_get_max_initial_qualify_time (void) |
Retrieve the system max initial qualify time. More... | |
unsigned int | ast_sip_get_mwi_disable_initial_unsolicited (void) |
Retrieve the global setting 'disable sending unsolicited mwi on startup'. More... | |
unsigned int | ast_sip_get_mwi_tps_queue_high (void) |
Retrieve the global MWI taskprocessor high water alert trigger level. More... | |
int | ast_sip_get_mwi_tps_queue_low (void) |
Retrieve the global MWI taskprocessor low water clear alert level. More... | |
unsigned int | ast_sip_get_norefersub (void) |
Retrieve the global setting 'norefersub'. More... | |
pjsip_endpoint * | ast_sip_get_pjsip_endpoint (void) |
Get a pointer to the PJSIP endpoint. More... | |
char * | ast_sip_get_regcontext (void) |
Retrieve the global regcontext setting. More... | |
unsigned int | ast_sip_get_send_contact_status_on_update_registration (void) |
Retrieve the global setting 'send_contact_status_on_update_registration'. More... | |
struct ast_sorcery * | ast_sip_get_sorcery (void) |
Get a pointer to the SIP sorcery structure. More... | |
int | ast_sip_get_transport_name (const struct ast_sip_endpoint *endpoint, pjsip_sip_uri *sip_uri, char *buf, size_t buf_len) |
Get the transport name from an endpoint or request uri. More... | |
struct ast_sip_transport_state * | ast_sip_get_transport_state (const char *transport_id) |
Retrieve transport state. More... | |
struct ao2_container * | ast_sip_get_transport_states (void) |
Retrieves all transport states. More... | |
void | ast_sip_get_unidentified_request_thresholds (unsigned int *count, unsigned int *period, unsigned int *prune_interval) |
Retrieve the unidentified request security event thresholds. More... | |
unsigned int | ast_sip_get_use_callerid_contact (void) |
Retrieve the global setting 'use_callerid_contact'. More... | |
struct ast_sip_endpoint * | ast_sip_identify_endpoint (pjsip_rx_data *rdata) |
Determine the endpoint that has sent a SIP message. More... | |
int | ast_sip_is_content_type (pjsip_media_type *content_type, char *type, char *subtype) |
Checks if the given content type matches type/subtype. More... | |
int | ast_sip_location_add_contact (struct ast_sip_aor *aor, const char *uri, struct timeval expiration_time, const char *path_info, const char *user_agent, const char *via_addr, int via_port, const char *call_id, struct ast_sip_endpoint *endpoint) |
Add a new contact to an AOR. More... | |
int | ast_sip_location_add_contact_nolock (struct ast_sip_aor *aor, const char *uri, struct timeval expiration_time, const char *path_info, const char *user_agent, const char *via_addr, int via_port, const char *call_id, struct ast_sip_endpoint *endpoint) |
Add a new contact to an AOR without locking the AOR. More... | |
struct ast_sip_contact * | ast_sip_location_create_contact (struct ast_sip_aor *aor, const char *uri, struct timeval expiration_time, const char *path_info, const char *user_agent, const char *via_addr, int via_port, const char *call_id, int prune_on_boot, struct ast_sip_endpoint *endpoint) |
Create a new contact for an AOR without locking the AOR. More... | |
int | ast_sip_location_delete_contact (struct ast_sip_contact *contact) |
Delete a contact. More... | |
void | ast_sip_location_prune_boot_contacts (void) |
Prune the prune_on_boot contacts. More... | |
struct ast_sip_aor * | ast_sip_location_retrieve_aor (const char *aor_name) |
Retrieve a named AOR. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts (const struct ast_sip_aor *aor) |
Retrieve all contacts currently available for an AOR. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts_filtered (const struct ast_sip_aor *aor, unsigned int flags) |
Retrieve all contacts currently available for an AOR and filter based on flags. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts_nolock (const struct ast_sip_aor *aor) |
Retrieve all contacts currently available for an AOR without locking the AOR. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts_nolock_filtered (const struct ast_sip_aor *aor, unsigned int flags) |
Retrieve all contacts currently available for an AOR without locking the AOR and filter based on flags. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_contact (const char *contact_name) |
Retrieve a named contact. More... | |
void | ast_sip_location_retrieve_contact_and_aor_from_list (const char *aor_list, struct ast_sip_aor **aor, struct ast_sip_contact **contact) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs. More... | |
void | ast_sip_location_retrieve_contact_and_aor_from_list_filtered (const char *aor_list, unsigned int flags, struct ast_sip_aor **aor, struct ast_sip_contact **contact) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs and filter based on flags. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_contact_from_aor_list (const char *aor_list) |
Retrieve the first bound contact from a list of AORs. More... | |
struct ao2_container * | ast_sip_location_retrieve_contacts_from_aor_list (const char *aor_list) |
Retrieve all contacts from a list of AORs. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_first_aor_contact (const struct ast_sip_aor *aor) |
Retrieve the first bound contact for an AOR. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_first_aor_contact_filtered (const struct ast_sip_aor *aor, unsigned int flags) |
Retrieve the first bound contact for an AOR and filter based on flags. More... | |
int | ast_sip_location_update_contact (struct ast_sip_contact *contact) |
Update a contact. More... | |
void | ast_sip_message_apply_transport (const char *transport_name, pjsip_tx_data *tdata) |
Apply the configuration for a transport to an outgoing message. More... | |
void | ast_sip_modify_id_header (pj_pool_t *pool, pjsip_fromto_hdr *id_hdr, const struct ast_party_id *id) |
Set name and number information on an identity header. More... | |
void | ast_sip_persistent_endpoint_publish_contact_state (const char *endpoint_name, const struct ast_sip_contact_status *contact_status) |
Publish the change of state for a contact. More... | |
int | ast_sip_persistent_endpoint_update_state (const char *endpoint_name, enum ast_endpoint_state state) |
Change state of a persistent endpoint. More... | |
int | ast_sip_push_task (struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data) |
Pushes a task to SIP servants. More... | |
int | ast_sip_push_task_synchronous (struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data) |
Push a task to SIP servants and wait for it to complete. More... | |
int | ast_sip_push_task_wait_serializer (struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data) |
Push a task to the serializer and wait for it to complete. More... | |
int | ast_sip_push_task_wait_servant (struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data) |
Push a task to SIP servants and wait for it to complete. More... | |
char * | ast_sip_rdata_get_header_value (pjsip_rx_data *rdata, const pj_str_t str) |
Get a specific header value from rdata. More... | |
int | ast_sip_register_authenticator (struct ast_sip_authenticator *auth) |
Register a SIP authenticator. More... | |
void | ast_sip_register_endpoint_formatter (struct ast_sip_endpoint_formatter *obj) |
Register an endpoint formatter. More... | |
int | ast_sip_register_endpoint_identifier (struct ast_sip_endpoint_identifier *identifier) |
Register a SIP endpoint identifier. More... | |
int | ast_sip_register_endpoint_identifier_with_name (struct ast_sip_endpoint_identifier *identifier, const char *name) |
Register a SIP endpoint identifier with a name. More... | |
int | ast_sip_register_outbound_authenticator (struct ast_sip_outbound_authenticator *outbound_auth) |
Register an outbound SIP authenticator. More... | |
int | ast_sip_register_service (pjsip_module *module) |
Register a SIP service in Asterisk. More... | |
void | ast_sip_register_supplement (struct ast_sip_supplement *supplement) |
Register a supplement to SIP out of dialog processing. More... | |
void | ast_sip_report_auth_challenge_sent (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, pjsip_tx_data *tdata) |
Send a security event notification for when an authentication challenge is sent. More... | |
void | ast_sip_report_auth_failed_challenge_response (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata) |
Send a security event notification for when a challenge response has failed. More... | |
void | ast_sip_report_auth_success (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata) |
Send a security event notification for when authentication succeeds. More... | |
void | ast_sip_report_failed_acl (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *name) |
Send a security event notification for when an ACL check fails. More... | |
void | ast_sip_report_invalid_endpoint (const char *name, pjsip_rx_data *rdata) |
Send a security event notification for when an invalid endpoint is requested. More... | |
void | ast_sip_report_mem_limit (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata) |
Send a security event notification for when a memory limit is hit. More... | |
void | ast_sip_report_req_no_support (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *req_type) |
Send a security event notification for when a request is not supported. More... | |
int | ast_sip_requires_authentication (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata) |
Determine if an incoming request requires authentication. More... | |
int | ast_sip_retrieve_auths (const struct ast_sip_auth_vector *auths, struct ast_sip_auth **out) |
Retrieve relevant SIP auth structures from sorcery. More... | |
int | ast_sip_retrieve_auths_vector (const struct ast_sip_auth_vector *auth_ids, struct ast_sip_auth_objects_vector *auth_objects) |
int | ast_sip_sched_is_task_running (struct ast_sip_sched_task *schtd) |
Checks if the task is currently running. More... | |
int | ast_sip_sched_is_task_running_by_name (const char *name) |
Checks if the task is currently running. More... | |
int | ast_sip_sched_task_cancel (struct ast_sip_sched_task *schtd) |
Cancels the next invocation of a task. More... | |
int | ast_sip_sched_task_cancel_by_name (const char *name) |
Cancels the next invocation of a task by name. More... | |
int | ast_sip_sched_task_get_name (struct ast_sip_sched_task *schtd, char *name, size_t maxlen) |
Gets the task name. More... | |
int | ast_sip_sched_task_get_next_run (struct ast_sip_sched_task *schtd) |
Gets the number of milliseconds until the next invocation. More... | |
int | ast_sip_sched_task_get_next_run_by_name (const char *name) |
Gets the number of milliseconds until the next invocation. More... | |
int | ast_sip_sched_task_get_times (struct ast_sip_sched_task *schtd, struct timeval *when_queued, struct timeval *last_start, struct timeval *last_end) |
Gets the last start and end times of the task. More... | |
int | ast_sip_sched_task_get_times2 (struct ast_sip_sched_task *schtd, struct timeval *when_queued, struct timeval *last_start, struct timeval *last_end, int *interval, int *time_left, struct timeval *next_start) |
Gets the queued, last start, last_end, time left, interval, next run. More... | |
int | ast_sip_sched_task_get_times_by_name (const char *name, struct timeval *when_queued, struct timeval *last_start, struct timeval *last_end) |
Gets the last start and end times of the task by name. More... | |
int | ast_sip_sched_task_get_times_by_name2 (const char *name, struct timeval *when_queued, struct timeval *last_start, struct timeval *last_end, int *interval, int *time_left, struct timeval *next_start) |
Gets the queued, last start, last_end, time left, interval, next run by task name. More... | |
struct ast_sip_sched_task * | ast_sip_schedule_task (struct ast_taskprocessor *serializer, int interval, ast_sip_task sip_task, const char *name, void *task_data, enum ast_sip_scheduler_task_flags flags) |
Schedule a task to run in the res_pjsip thread pool. More... | |
int | ast_sip_send_out_of_dialog_request (pjsip_tx_data *tdata, struct ast_sip_endpoint *endpoint, int timeout, void *token, void(*callback)(void *token, pjsip_event *e)) |
General purpose method for sending an Out-Of-Dialog SIP request. More... | |
int | ast_sip_send_request (pjsip_tx_data *tdata, struct pjsip_dialog *dlg, struct ast_sip_endpoint *endpoint, void *token, void(*callback)(void *token, pjsip_event *e)) |
General purpose method for sending a SIP request. More... | |
int | ast_sip_send_response (pjsip_response_addr *res_addr, pjsip_tx_data *tdata, struct ast_sip_endpoint *sip_endpoint) |
Send a response to an out of dialog request. More... | |
int | ast_sip_send_stateful_response (pjsip_rx_data *rdata, pjsip_tx_data *tdata, struct ast_sip_endpoint *sip_endpoint) |
Send a stateful response to an out of dialog request. More... | |
struct ast_sip_service_route_vector * | ast_sip_service_route_vector_alloc (void) |
Allocate a vector of service routes. More... | |
void | ast_sip_service_route_vector_destroy (struct ast_sip_service_route_vector *service_routes) |
Destroy a vector of service routes. More... | |
int | ast_sip_set_outbound_proxy (pjsip_tx_data *tdata, const char *proxy) |
Set the outbound proxy for an outbound SIP message. More... | |
int | ast_sip_set_tpselector_from_ep_or_uri (const struct ast_sip_endpoint *endpoint, pjsip_sip_uri *sip_uri, pjsip_tpselector *selector) |
Sets pjsip_tpselector from an endpoint or uri. More... | |
int | ast_sip_set_tpselector_from_transport (const struct ast_sip_transport *transport, pjsip_tpselector *selector) |
Sets pjsip_tpselector from ast_sip_transport. More... | |
int | ast_sip_set_tpselector_from_transport_name (const char *transport_name, pjsip_tpselector *selector) |
Sets pjsip_tpselector from ast_sip_transport. More... | |
int | ast_sip_sorcery_object_to_ami (const void *obj, struct ast_str **buf) |
Converts a sorcery object to a string of object properties. More... | |
int | ast_sip_str_to_dtmf (const char *dtmf_mode) |
Convert the DTMF mode name into an enum. More... | |
int | ast_sip_thread_is_servant (void) |
Determine if the current thread is a SIP servant thread. More... | |
struct ast_threadpool * | ast_sip_threadpool (void) |
Retrieve the SIP threadpool object. More... | |
long | ast_sip_threadpool_queue_size (void) |
Return the size of the SIP threadpool's task queue. More... | |
void | ast_sip_tpselector_unref (pjsip_tpselector *selector) |
Unreference a pjsip_tpselector. More... | |
enum ast_transport_monitor_reg | ast_sip_transport_monitor_register (pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb, void *ao2_data) |
Register a reliable transport shutdown monitor callback. More... | |
enum ast_transport_monitor_reg | ast_sip_transport_monitor_register_replace (pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb, void *ao2_data, ast_transport_monitor_data_matcher matches) |
Register a reliable transport shutdown monitor callback replacing any duplicate. More... | |
void | ast_sip_transport_monitor_unregister (pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches) |
Unregister a reliable transport shutdown monitor. More... | |
void | ast_sip_transport_monitor_unregister_all (ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches) |
Unregister a transport shutdown monitor from all reliable transports. More... | |
void | ast_sip_transport_state_register (struct ast_sip_tpmgr_state_callback *element) |
Register a transport state notification callback element. More... | |
int | ast_sip_transport_state_set_preferred_identity (const char *transport_name, const char *identity) |
Sets the P-Preferred-Identity on a child transport. More... | |
int | ast_sip_transport_state_set_service_routes (const char *transport_name, struct ast_sip_service_route_vector *service_routes) |
Sets the service routes on a child transport. More... | |
int | ast_sip_transport_state_set_transport (const char *transport_name, pjsip_transport *transport) |
Sets the PJSIP transport on a child transport. More... | |
void | ast_sip_transport_state_unregister (struct ast_sip_tpmgr_state_callback *element) |
Unregister a transport state notification callback element. More... | |
void | ast_sip_unregister_authenticator (struct ast_sip_authenticator *auth) |
Unregister a SIP authenticator. More... | |
void | ast_sip_unregister_endpoint_formatter (struct ast_sip_endpoint_formatter *obj) |
Unregister an endpoint formatter. More... | |
void | ast_sip_unregister_endpoint_identifier (struct ast_sip_endpoint_identifier *identifier) |
Unregister a SIP endpoint identifier. More... | |
void | ast_sip_unregister_outbound_authenticator (struct ast_sip_outbound_authenticator *auth) |
Unregister an outbound SIP authenticator. More... | |
void | ast_sip_unregister_service (pjsip_module *module) |
void | ast_sip_unregister_supplement (struct ast_sip_supplement *supplement) |
Unregister a an supplement to SIP out of dialog processing. More... | |
AST_VECTOR (ast_sip_service_route_vector, char *) | |
AST_VECTOR (ast_sip_auth_objects_vector, struct ast_sip_auth *) | |
Retrieve relevant SIP auth structures from sorcery as a vector. More... | |
#define ast_sip_cleanup_auth_objects_vector | ( | auth_objects | ) | AST_VECTOR_RESET(auth_objects, ao2_cleanup) |
Clean up retrieved auth objects in vector.
Call this function once you have completed operating on auths retrieved from ast_sip_retrieve_auths_vector. All auth objects will have their reference counts decremented and the vector size will be reset to 0. You must still call AST_VECTOR_FREE() on the vector itself.
auth_objects | A vector of auth structures to clean up |
Definition at line 2538 of file res_pjsip.h.
Referenced by digest_create_request_with_auth().
#define ast_sip_mod_data_get | ( | mod_data, | |
id, | |||
key | |||
) | ast_sip_dict_get(mod_data[id], key) |
Using the dictionary stored in mod_data array at a given id, retrieve the value associated with the given key.
mod_data | a module data array |
id | the mod_data array index |
key | the key to find |
the | value associated with the key, NULL otherwise. |
Definition at line 2638 of file res_pjsip.h.
Referenced by ast_sip_send_out_of_dialog_request(), ast_sip_send_stateful_response(), ast_sip_subscription_get_header(), create_subscription_tree(), filter_on_tx_message(), get_restrictions(), session_inv_on_tsx_state_changed(), session_outgoing_nat_hook(), sip_subscription_accept(), and supplement_outgoing_response().
#define ast_sip_mod_data_set | ( | pool, | |
mod_data, | |||
id, | |||
key, | |||
val | |||
) | mod_data[id] = ast_sip_dict_set(pool, mod_data[id], key, val) |
Utilizing a mod_data array for a given id, set the value associated with the given key.
For a given structure's mod_data array set the element indexed by id to be a dictionary containing the key/val pair.
pool | a memory allocation pool |
mod_data | a module data array |
id | the mod_data array index |
key | the key to find |
val | the value to associate with a key |
Definition at line 2670 of file res_pjsip.h.
Referenced by ast_sip_create_response(), ast_sip_send_out_of_dialog_request(), ast_sip_send_stateful_response(), ast_sip_session_send_request_with_cb(), create_out_of_dialog_request(), create_subscription_tree(), get_restrictions(), session_outgoing_nat_hook(), sub_persistence_recreate(), and supplement_outgoing_response().
#define ast_sip_transport_is_local | ( | transport_state, | |
addr | |||
) | (transport_state->localnet && ast_apply_ha(transport_state->localnet, addr) != AST_SENSE_ALLOW) |
Definition at line 165 of file res_pjsip.h.
Referenced by process_nat(), and session_outgoing_nat_hook().
#define ast_sip_transport_is_nonlocal | ( | transport_state, | |
addr | |||
) | (!transport_state->localnet || ast_apply_ha(transport_state->localnet, addr) == AST_SENSE_ALLOW) |
Definition at line 162 of file res_pjsip.h.
Referenced by change_outgoing_sdp_stream_media_address().
#define AST_SIP_USER_OPTIONS_TRUNCATE_CHECK | ( | str | ) |
Truncate the URI user field options string if enabled.
str | URI user field string to truncate if enabled |
We need to be able to handle URI's looking like "sip:1235557890;[email protected];user=phone"
Where the URI user field is: "1235557890;phone-context=national"
When truncated the string will become: "1235557890"
Definition at line 3036 of file res_pjsip.h.
Referenced by find_aor(), get_destination(), handle_atsign(), options_on_rx_request(), publish_request_initial(), pubsub_on_rx_subscribe_request(), refer_incoming_blind_request(), rx_data_to_ast_msg(), session_inv_on_redirected(), sub_persistence_recreate(), and username_identify().
#define AST_SIP_X_AST_TXP "x-ast-txp" |
URI parameter for symmetric transport
Definition at line 909 of file res_pjsip.h.
Referenced by ast_sip_get_transport_name(), on_rx_process_symmetric_transport(), sanitize_tdata(), and transport_apply().
#define AST_SIP_X_AST_TXP_LEN 9 |
Definition at line 910 of file res_pjsip.h.
Referenced by ast_sip_get_transport_name(), on_rx_process_symmetric_transport(), sanitize_tdata(), and transport_apply().
#define MAX_RX_CHALLENGES 10 |
Maximum number of challenges before assuming that we are in a loop
Definition at line 80 of file res_pjsip.h.
Referenced by check_request_status(), outbound_invite_auth(), and session_inv_on_tsx_state_changed().
#define PJSIP_EXPIRES_NOT_SPECIFIED ((pj_uint32_t)-1) |
Definition at line 63 of file res_pjsip.h.
Referenced by initial_notify_task(), pubsub_on_rx_subscribe_request(), registrar_add_contact(), and registrar_get_expiration().
#define PJSIP_MINVERSION | ( | m, | |
n, | |||
p | |||
) | (((m << 24) | (n << 16) | (p << 8)) >= PJ_VERSION_NUM) |
Definition at line 54 of file res_pjsip.h.
#define SIP_SORCERY_DOMAIN_ALIAS_TYPE "domain_alias" |
Definition at line 254 of file res_pjsip.h.
Referenced by ast_sip_initialize_sorcery_domain_alias(), and domain_alias_apply().
#define SIP_TLS_MAX_CIPHERS 64 |
Maximum number of ciphers supported for a TLS transport.
Definition at line 77 of file res_pjsip.h.
typedef int(* ast_sip_dialog_outbound_auth_cb) (pjsip_dialog *dlg, pjsip_tx_data *tdata, void *user_data) |
Callback called when an outbound request with authentication credentials is to be sent in dialog.
This callback will have the created request on it. The callback's purpose is to do any extra housekeeping that needs to be done as well as to send the request out.
This callback is only necessary if working with a PJSIP API that sits between the application and the dialog layer.
dlg | The dialog to which the request belongs |
tdata | The created request to be sent out |
user_data | Data supplied with the callback |
0 | Success |
-1 | Failure |
Definition at line 1468 of file res_pjsip.h.
Transport shutdown monitor data matcher.
a | User data to compare. |
b | User data to compare. |
1 | The data objects match |
0 | The data objects don't match |
Definition at line 3457 of file res_pjsip.h.
typedef void(* ast_transport_monitor_shutdown_cb) (void *data) |
Transport shutdown monitor callback.
data | User data to know what to do when transport shuts down. |
Definition at line 3445 of file res_pjsip.h.
enum ast_sip_auth_type |
Methods of storing SIP digest authentication credentials.
Note that both methods result in MD5 digest authentication being used. The two methods simply alter how Asterisk determines the credentials for a SIP authentication
Definition at line 431 of file res_pjsip.h.
Incoming/Outgoing call offer/answer joint codec preference.
The default is INTERSECT ALL LOCAL.
Definition at line 529 of file res_pjsip.h.
Possible returns from ast_sip_check_authentication.
Definition at line 932 of file res_pjsip.h.
Contact retrieval filtering flags.
Enumerator | |
---|---|
AST_SIP_CONTACT_FILTER_DEFAULT | Default filter flags. |
AST_SIP_CONTACT_FILTER_REACHABLE | Return only reachable or unknown contacts. |
Definition at line 1004 of file res_pjsip.h.
Status type for a contact.
Definition at line 323 of file res_pjsip.h.
Definition at line 491 of file res_pjsip.h.
enum ast_sip_dtmf_mode |
DTMF modes for SIP endpoints.
Definition at line 408 of file res_pjsip.h.
Different methods by which incoming requests can be matched to endpoints.
Definition at line 472 of file res_pjsip.h.
Definition at line 504 of file res_pjsip.h.
Definition at line 515 of file res_pjsip.h.
Enumerator | |
---|---|
AST_SIP_SESSION_REFRESH_METHOD_INVITE | Use reinvite to negotiate direct media |
AST_SIP_SESSION_REFRESH_METHOD_UPDATE | Use UPDATE to negotiate direct media |
Definition at line 484 of file res_pjsip.h.
Definition at line 2869 of file res_pjsip.h.
Definition at line 3459 of file res_pjsip.h.
void ast_copy_pj_str | ( | char * | dest, |
const pj_str_t * | src, | ||
size_t | size | ||
) |
Copy a pj_str_t into a standard character buffer.
pj_str_t is not NULL-terminated. Any place that expects a NULL- terminated string needs to have the pj_str_t copied into a separate buffer.
This method copies the pj_str_t contents into the destination buffer and NULL-terminates the buffer.
dest | The destination buffer |
src | The pj_str_t to copy |
size | The size of the destination buffer. |
Definition at line 5240 of file res_pjsip.c.
References MIN.
Referenced by add_identity_header(), apply_dtls_attrib(), apply_negotiated_sdp_stream(), assign_uuid(), ast_sip_get_transport_name(), ast_sip_report_auth_challenge_sent(), ast_sip_report_auth_failed_challenge_response(), chan_pjsip_get_uniqueid(), change_outgoing_sdp_stream_media_address(), channel_read_pjsip(), cli_complete_subscription_common(), cli_list_subscriptions_detail(), cli_show_subscriptions_detail(), determine_sip_publish_type(), dialog_info_generate_body_content(), endpoint_lookup(), evaluate_like(), extract_contact_addr(), find_aor(), find_aor_name(), find_challenge(), get_auth_header(), get_codecs(), get_destination(), get_endpoint_details(), get_from_header(), get_mid_bundle_group(), get_user_agent(), handle_incoming_sdp(), handle_negotiated_sdp_session_media(), handle_registration_response(), headers_to_vars(), incoming_in_dialog_request(), log_failed_request(), negotiate_incoming_sdp_stream(), options_on_rx_request(), parse_uri_cb(), process_extmap_attributes(), process_ice_attributes(), process_ice_auth_attrb(), process_ssrc_attributes(), publish_request_initial(), pubsub_on_rx_publish_request(), pubsub_on_rx_subscribe_request(), refer_blind_callback(), refer_incoming_blind_request(), refer_incoming_refer_request(), register_aor_core(), rfc3326_use_reason_header(), rx_data_to_ast_msg(), save_response_fields_to_transport(), sdp_requires_deferral(), security_event_populate(), session_inv_on_redirected(), session_outgoing_nat_hook(), set_id_from_hdr(), set_id_from_oli(), set_mid_and_bundle_group(), set_redirecting_value(), set_remote_mslabel_and_stream_group(), set_sipdomain_variable(), sip_resolve(), sip_subscription_to_ami(), sub_persistence_recreate(), subscription_get_generator_from_rdata(), subscription_get_handler_from_rdata(), subscription_persistence_create(), subscription_persistence_update(), and transfer_refer().
int ast_copy_pj_str2 | ( | char ** | dest, |
const pj_str_t * | src | ||
) |
Create and copy a pj_str_t into a standard character buffer.
pj_str_t is not NULL-terminated. Any place that expects a NULL- terminated string needs to have the pj_str_t copied into a separate buffer.
Copies the pj_str_t contents into a newly allocated buffer pointed to by dest. NULL-terminates the buffer.
dest | [out] The destination buffer |
src | The pj_str_t to copy |
Number | of characters copied or negative value on error |
Definition at line 5247 of file res_pjsip.c.
References ast_asprintf, and NULL.
struct ast_sip_endpoint* ast_pjsip_rdata_get_endpoint | ( | pjsip_rx_data * | rdata | ) |
Get the looked-up endpoint on an out-of dialog request or response.
The function may ONLY be called on out-of-dialog requests or responses. For in-dialog requests and responses, it is required that the user of the dialog has the looked-up endpoint stored locally.
This function should never return NULL if the message is out-of-dialog. It will always return NULL if the message is in-dialog.
This function will increase the reference count of the returned endpoint by one. Release your reference using the ao2_ref function when finished.
rdata | Out-of-dialog request or response |
Definition at line 969 of file pjsip_distributor.c.
References ao2_ref, and endpoint_mod.
Referenced by authenticate(), handle_new_invite_request(), nat_on_rx_message(), options_on_rx_request(), pubsub_on_rx_mwi_notify_request(), pubsub_on_rx_publish_request(), pubsub_on_rx_subscribe_request(), registrar_on_rx_request(), rx_data_to_ast_msg(), send_options_response(), send_response(), and supplement_on_rx_request().
int ast_sip_add_body | ( | pjsip_tx_data * | tdata, |
const struct ast_sip_body * | body | ||
) |
Add a body to an outbound SIP message.
If this is called multiple times, the latest body will replace the current body.
tdata | The message to add the body to |
body | The message body to add |
0 | Success |
-1 | Failure |
Definition at line 5091 of file res_pjsip.c.
References ast_body_to_pjsip_body().
Referenced by build_notify_body(), msg_send(), send_unsolicited_mwi_notify_to_contact(), sendtext(), sip_publisher_service_queue(), transmit_info_dtmf(), and transmit_info_with_vidupdate().
int ast_sip_add_body_multipart | ( | pjsip_tx_data * | tdata, |
const struct ast_sip_body * | bodies[], | ||
int | num_bodies | ||
) |
Add a multipart body to an outbound SIP message.
This will treat each part of the input vector as part of a multipart body and add each part to the SIP message.
tdata | The message to add the body to |
bodies | The parts of the body to add |
0 | Success |
-1 | Failure |
Definition at line 5098 of file res_pjsip.c.
References ast_body_to_pjsip_body(), and NULL.
void ast_sip_add_date_header | ( | pjsip_tx_data * | tdata | ) |
Adds a Date header to the tdata, formatted like: Date: Wed, 01 Jan 2021 14:53:01 GMT.
Definition at line 3288 of file res_pjsip.c.
References ast_sip_add_header(), and NULL.
Referenced by add_date_header(), and register_aor_core().
int ast_sip_add_global_request_header | ( | const char * | name, |
const char * | value, | ||
int | replace | ||
) |
Definition at line 153 of file pjsip_global_headers.c.
References add_header(), and request_headers.
Referenced by global_apply().
int ast_sip_add_global_response_header | ( | const char * | name, |
const char * | value, | ||
int | replace | ||
) |
Definition at line 158 of file pjsip_global_headers.c.
References add_header(), and response_headers.
Referenced by global_apply().
int ast_sip_add_header | ( | pjsip_tx_data * | tdata, |
const char * | name, | ||
const char * | value | ||
) |
Add a header to an outbound SIP message.
tdata | The message to add the header to |
name | The header name |
value | The header value |
0 | Success |
-1 | Failure |
Definition at line 5063 of file res_pjsip.c.
Referenced by add_header_from_channel_var(), add_headers_to_message(), ast_sip_add_date_header(), ast_sip_message_apply_transport(), build_notify(), notify_channel(), notify_contact(), notify_uri(), options_incoming_request(), rfc3326_add_reason_header(), send_options_response(), sip_publication_respond(), transfer_refer(), and vars_to_headers().
void ast_sip_add_usereqphone | ( | const struct ast_sip_endpoint * | endpoint, |
pj_pool_t * | pool, | ||
pjsip_uri * | uri | ||
) |
Add 'user=phone' parameter to URI if enabled and user is a phone number.
endpoint | The endpoint to use for configuration |
pool | The memory pool to allocate the parameter from |
uri | The URI to check for user and to add parameter to |
Definition at line 3994 of file res_pjsip.c.
References AST_DIGIT_ANY, and ast_sip_endpoint::usereqphone.
Referenced by ast_sip_create_dialog_uac(), create_out_of_dialog_request(), and set_from_header().
int ast_sip_append_body | ( | pjsip_tx_data * | tdata, |
const char * | body_text | ||
) |
Append body data to a SIP message.
This acts mostly the same as ast_sip_add_body, except that rather than replacing a body if it currently exists, it appends data to an existing body.
tdata | The message to append the body to |
body | The string to append to the end of the current body |
0 | Success |
-1 | Failure |
Definition at line 5114 of file res_pjsip.c.
References ast_str_alloca, ast_str_buffer(), and ast_str_set().
const char* ast_sip_auth_type_to_str | ( | enum ast_sip_auth_type | type | ) |
Converts the given auth type to a string.
type | the auth type to convert |
a | string representative of the auth type |
Definition at line 80 of file config_auth.c.
References ARRAY_IN_BOUNDS, auth_types_map, and type.
Referenced by auth_type_to_str().
void ast_sip_auth_vector_destroy | ( | struct ast_sip_auth_vector * | vector | ) |
Free contents of an auth vector.
array | Vector whose contents are to be freed |
Definition at line 249 of file pjsip_configuration.c.
References ast_free, AST_VECTOR_FREE, AST_VECTOR_REMOVE_UNORDERED, AST_VECTOR_SIZE, and name.
Referenced by ast_sip_auth_vector_init(), endpoint_destructor(), handle_client_state_destruction(), sip_outbound_publish_destroy(), sip_outbound_registration_destroy(), and sip_outbound_registration_perform().
int ast_sip_auth_vector_init | ( | struct ast_sip_auth_vector * | vector, |
const char * | auth_names | ||
) |
Initialize an auth vector with the configured values.
vector | Vector to initialize |
auth_names | Comma-separated list of names to set in the array |
0 | Success |
non-zero | Failure |
Definition at line 267 of file pjsip_configuration.c.
References ast_assert, ast_free, ast_sip_auth_vector_destroy(), ast_strdup, ast_strdupa, ast_strip(), ast_strlen_zero, AST_VECTOR_APPEND, AST_VECTOR_INIT, AST_VECTOR_SIZE, NULL, and strsep().
Referenced by inbound_auth_handler(), and outbound_auth_handler().
int ast_sip_auths_to_str | ( | const struct ast_sip_auth_vector * | auths, |
char ** | buf | ||
) |
Converts an auths array to a string of comma separated values.
auths | an auth array |
buf | the string buffer to write the object data |
0 | Success, non-zero on failure |
Definition at line 317 of file pjsip_configuration.c.
References ast_calloc, ast_join_delim(), AST_VECTOR_SIZE, ast_sip_auth_vector::elems, and MAX_OBJECT_FIELD.
Referenced by format_str_append_auth(), inbound_auths_to_str(), and outbound_auths_to_str().
const char* ast_sip_call_codec_pref_to_str | ( | struct ast_flags | pref | ) |
Convert the call codec preference flags to a string.
pref | the call codec preference setting |
Definition at line 5534 of file res_pjsip.c.
References value.
Referenced by incoming_call_offer_pref_to_str(), log_caps(), and outgoing_call_offer_pref_to_str().
int ast_sip_call_codec_str_to_pref | ( | struct ast_flags * | pref, |
const char * | pref_str, | ||
int | is_outgoing | ||
) |
Convert a call codec preference string to preference flags.
pref | A pointer to an ast_flags structure to receive the preference flags |
pref_str | The call codec preference setting string |
is_outgoing | Is for outgoing calls? |
0 | The string was parsed successfully |
-1 | The string option was invalid |
Definition at line 5557 of file res_pjsip.c.
References ast_set_flag, AST_SIP_CALL_CODEC_PREF_ALL, AST_SIP_CALL_CODEC_PREF_FIRST, AST_SIP_CALL_CODEC_PREF_INTERSECT, AST_SIP_CALL_CODEC_PREF_LOCAL, AST_SIP_CALL_CODEC_PREF_REMOTE, AST_SIP_CALL_CODEC_PREF_UNION, and ast_flags::flags.
Referenced by call_offer_pref_handler(), and test_create_joint().
enum ast_sip_check_auth_result ast_sip_check_authentication | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata, | ||
pjsip_tx_data * | tdata | ||
) |
Method to determine authentication status of an incoming request.
This will call into a registered authenticator. The registered authenticator will do what is necessary to determine whether the incoming request passes authentication. A tentative response is passed into this function so that if, say, a digest authentication challenge should be sent in the ensuing response, it can be added to the response.
endpoint | The endpoint from the request was sent |
rdata | The request to potentially authenticate |
tdata | Tentative response to the request |
Definition at line 3377 of file res_pjsip.c.
References ast_log, AST_SIP_AUTHENTICATION_SUCCESS, ast_sip_authenticator::check_authentication, and LOG_WARNING.
Referenced by authenticate().
void ast_sip_cleanup_auths | ( | struct ast_sip_auth * | auths[], |
size_t | num_auths | ||
) |
Clean up retrieved auth structures from memory.
Call this function once you have completed operating on auths retrieved from ast_sip_retrieve_auths
auths | An array of auth object pointers to clean up |
num_auths | The number of auths in the array |
Definition at line 2377 of file pjsip_configuration.c.
References ao2_cleanup.
Referenced by digest_check_auth(), and set_outbound_initial_authentication_credentials().
int ast_sip_contact_to_str | ( | void * | object, |
void * | arg, | ||
int | flags | ||
) |
Handler used to convert a contact to a string.
object | the ast_sip_aor_contact_pair containing a list of contacts to iterate and the contact |
arg | user data passed to handler |
flags |
0 | Success, non-zero on failure |
Definition at line 767 of file location.c.
References ast_str_append(), buf, and ast_sip_contact_wrapper::contact_id.
Referenced by contacts_to_str(), sip_contact_to_str(), and sip_endpoints_aors_ami().
struct ast_str* ast_sip_create_ami_event | ( | const char * | event, |
struct ast_sip_ami * | ami | ||
) |
Creates a string to store AMI event data in.
event | the event to set |
ami | AMI session and message container |
an | initialized ast_str or NULL on error. |
Definition at line 1584 of file pjsip_configuration.c.
References ast_sip_ami::action_id, AMI_DEFAULT_STR_SIZE, ast_str_append(), ast_str_create, ast_str_set(), ast_strlen_zero, astman_send_error_va(), buf, ast_sip_ami::m, NULL, and ast_sip_ami::s.
Referenced by ami_outbound_registration_task(), ami_registrations_aor(), ami_subscription_detail(), ast_sip_format_contact_ami(), format_ami_aor_handler(), format_ami_aorlist_handler(), format_ami_auth_handler(), format_ami_authlist_handler(), format_ami_contactlist_handler(), format_ami_endpoint(), format_ami_endpoint_transport(), format_ami_endpoints(), format_ami_resource_lists(), and send_identify_ami_event().
pjsip_dialog* ast_sip_create_dialog_uac | ( | const struct ast_sip_endpoint * | endpoint, |
const char * | aor_name, | ||
const char * | request_user | ||
) |
General purpose method for creating a UAC dialog with an endpoint.
endpoint | A pointer to the endpoint |
aor_name | Optional name of the AOR to target, may even be an explicit SIP URI |
request_user | Optional user to place into the target URI |
non-NULL | success |
NULL | failure |
Definition at line 4028 of file res_pjsip.c.
References ast_log, ast_sip_add_usereqphone(), ast_sip_dlg_set_transport(), ast_sip_tpselector_unref(), ast_sorcery_object_get_id(), ast_strlen_zero, ast_sip_endpoint::contact_user, ast_sip_endpoint::fromdomain, ast_sip_endpoint::fromuser, ast_sip_endpoint::info, LOG_ERROR, NULL, ast_sip_endpoint::outbound_proxy, sip_dialog_create_from(), and tmp().
Referenced by ast_sip_create_subscription(), and ast_sip_session_create_outgoing().
pjsip_dialog* ast_sip_create_dialog_uas | ( | const struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata, | ||
pj_status_t * | status | ||
) |
General purpose method for creating a UAS dialog with an endpoint.
endpoint | A pointer to the endpoint | |
rdata | The request that is starting the dialog | |
[out] | status | On failure, the reason for failure in creating the dialog |
Definition at line 4233 of file res_pjsip.c.
References create_dialog_uas().
pjsip_dialog* ast_sip_create_dialog_uas_locked | ( | const struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata, | ||
pj_status_t * | status | ||
) |
General purpose method for creating a UAS dialog with an endpoint.
This function creates and returns a locked, and referenced counted pjsip dialog object. The caller is thus responsible for freeing the allocated memory, decrementing the reference, and releasing the lock when done with the returned object.
The dialog is returned locked and with a reference in order to ensure that the dialog object, and any of its associated objects (e.g. transaction) are not untimely destroyed. For instance, that could happen when a transport error occurs.
As long as the caller maintains a reference to the dialog there should be no worry that it might unknowningly be destroyed. However, once the caller unlocks the dialog there is a danger that some of the dialog's internal objects could be lost and/or compromised. For example, when the aforementioned transport error occurs the dialog's associated transaction gets destroyed (see pjsip_dlg_on_tsx_state in sip_dialog.c, and mod_inv_on_tsx_state in sip_inv.c).
In this case and before using the dialog again the caller should re-lock the dialog, check to make sure the dialog is still established, and the transaction still exists and has not been destroyed.
endpoint | A pointer to the endpoint | |
rdata | The request that is starting the dialog | |
[out] | status | On failure, the reason for failure in creating the dialog |
A | locked, and reference counted pjsip_dialog object. |
NULL | on failure |
Definition at line 4249 of file res_pjsip.c.
References create_dialog_uas().
Referenced by create_subscription_tree(), and pre_session_setup().
int ast_sip_create_rdata | ( | pjsip_rx_data * | rdata, |
char * | packet, | ||
const char * | src_name, | ||
int | src_port, | ||
char * | transport_type, | ||
const char * | local_name, | ||
int | local_port | ||
) |
General purpose method for creating an rdata structure using specific information.
rdata[out] | The rdata structure that will be populated |
packet | A SIP message |
src_name | The source IP address of the message |
src_port | The source port of the message |
transport_type | The type of transport the message was received on |
local_name | The local IP address the message was received on |
local_port | The local port the message was received on |
0 | success |
-1 | failure |
Definition at line 4323 of file res_pjsip.c.
References ast_sip_create_rdata_with_contact(), and NULL.
int ast_sip_create_rdata_with_contact | ( | pjsip_rx_data * | rdata, |
char * | packet, | ||
const char * | src_name, | ||
int | src_port, | ||
char * | transport_type, | ||
const char * | local_name, | ||
int | local_port, | ||
const char * | contact_uri | ||
) |
General purpose method for creating an rdata structure using specific information.
rdata[out] | The rdata structure that will be populated |
packet | A SIP message |
src_name | The source IP address of the message |
src_port | The source port of the message |
transport_type | The type of transport the message was received on |
local_name | The local IP address the message was received on |
local_port | The local port the message was received on |
contact_uri | The contact URI of the message |
0 | success |
-1 | failure |
Definition at line 4271 of file res_pjsip.c.
References ast_copy_string(), ast_log, ast_strlen_zero, LOG_WARNING, NULL, and tmp().
Referenced by ast_sip_create_rdata(), and subscription_persistence_recreate().
int ast_sip_create_request | ( | const char * | method, |
struct pjsip_dialog * | dlg, | ||
struct ast_sip_endpoint * | endpoint, | ||
const char * | uri, | ||
struct ast_sip_contact * | contact, | ||
pjsip_tx_data ** | tdata | ||
) |
General purpose method for creating a SIP request.
Its typical use would be to create one-off requests such as an out of dialog SIP MESSAGE.
The request can either be in- or out-of-dialog. If in-dialog, the dlg parameter MUST be present. If out-of-dialog the endpoint parameter MUST be present. If both are present, then we will assume that the message is to be sent in-dialog.
The uri parameter can be specified if the request should be sent to an explicit URI rather than one configured on the endpoint.
method | The method of the SIP request to send | |
dlg | Optional. If specified, the dialog on which to request the message. | |
endpoint | Optional. If specified, the request will be created out-of-dialog to the endpoint. | |
uri | Optional. If specified, the request will be sent to this URI rather than one configured for the endpoint. | |
contact | The contact with which this request is associated for out-of-dialog requests. | |
[out] | tdata | The newly-created request |
The provided contact is attached to tdata with its reference bumped, but will not survive for the entire lifetime of tdata since the contact is cleaned up when all supplements have completed execution.
0 | Success |
-1 | Failure |
Definition at line 4490 of file res_pjsip.c.
References ast_assert, ast_log, create_in_dialog_request(), create_out_of_dialog_request(), get_pjsip_method(), LOG_WARNING, NULL, and pmethod.
Referenced by msg_send(), notify_channel(), notify_contact(), notify_uri(), send_unsolicited_mwi_notify_to_contact(), sendtext(), sip_options_qualify_contact(), transmit_info_dtmf(), and transmit_info_with_vidupdate().
int ast_sip_create_request_with_auth | ( | const struct ast_sip_auth_vector * | auths, |
pjsip_rx_data * | challenge, | ||
pjsip_tx_data * | tdata, | ||
pjsip_tx_data ** | new_request | ||
) |
Create a response to an authentication challenge.
This will call into an outbound authenticator's create_request_with_auth callback to create a new request with authentication credentials. See the create_request_with_auth callback in the ast_sip_outbound_authenticator structure for details about the parameters and return values.
Definition at line 3412 of file res_pjsip.c.
References ast_log, ast_sip_outbound_authenticator::create_request_with_auth, and LOG_WARNING.
Referenced by check_request_status(), handle_registration_response(), outbound_invite_auth(), session_inv_on_tsx_state_changed(), and sip_outbound_publish_callback().
int ast_sip_create_response | ( | const pjsip_rx_data * | rdata, |
int | st_code, | ||
struct ast_sip_contact * | contact, | ||
pjsip_tx_data ** | p_tdata | ||
) |
General purpose method for creating a SIP response.
Its typical use would be to create responses for out of dialog requests.
rdata | The rdata from the incoming request. | |
st_code | The response code to transmit. | |
contact | The contact with which this request is associated. | |
[out] | tdata | The newly-created response |
The provided contact is attached to tdata with its reference bumped, but will not survive for the entire lifetime of tdata since the contact is cleaned up when all supplements have completed execution.
0 | Success |
-1 | Failure |
Definition at line 5448 of file res_pjsip.c.
References ao2_bump, ast_sip_get_pjsip_endpoint(), ast_sip_mod_data_set, MOD_DATA_CONTACT, NULL, and supplement_module.
Referenced by register_aor_core(), send_options_response(), and send_response().
struct ast_sip_endpoint* ast_sip_default_outbound_endpoint | ( | void | ) |
Retrieve the default outbound endpoint.
The | default outbound endpoint, NULL if not found. |
Definition at line 2353 of file pjsip_configuration.c.
References ast_free, ast_sip_global_default_outbound_endpoint(), ast_sorcery_retrieve_by_id(), ast_strlen_zero, name, NULL, and RAII_VAR.
Referenced by get_outbound_endpoint(), handle_atsign(), handle_single_token(), and notify_uri().
int ast_sip_dialog_setup_outbound_authentication | ( | pjsip_dialog * | dlg, |
const struct ast_sip_endpoint * | endpoint, | ||
ast_sip_dialog_outbound_auth_cb | cb, | ||
void * | user_data | ||
) |
Set up outbound authentication on a SIP dialog.
This sets up the infrastructure so that all requests associated with a created dialog can be re-sent with authentication credentials if the original request is challenged.
dlg | The dialog on which requests will be authenticated |
endpoint | The endpoint whom this dialog pertains to |
cb | Callback to call to send requests with authentication |
user_data | Data to be provided to the callback when it is called |
0 | Success |
-1 | Failure |
void* ast_sip_dict_get | ( | void * | ht, |
const char * | key | ||
) |
Retrieves the value associated with the given key.
ht | the hash table/dictionary to search |
key | the key to find |
the | value associated with the key, NULL otherwise. |
Definition at line 5338 of file res_pjsip.c.
References NULL.
void* ast_sip_dict_set | ( | pj_pool_t * | pool, |
void * | ht, | ||
const char * | key, | ||
void * | val | ||
) |
Set the value for the given key.
Note - if the hash table does not exist one is created first, the key/value pair is set, and the hash table returned.
pool | the pool to allocate memory in |
ht | the hash table/dictionary in which to store the key/value pair |
key | the key to associate a value with |
val | the value to associate with a key |
the | given, or newly created, hash table. |
Definition at line 5349 of file res_pjsip.c.
int ast_sip_dlg_set_transport | ( | const struct ast_sip_endpoint * | endpoint, |
pjsip_dialog * | dlg, | ||
pjsip_tpselector * | selector | ||
) |
Set the transport on a dialog.
endpoint | |
dlg | |
selector | (optional) |
Definition at line 3791 of file res_pjsip.c.
References ast_sip_set_tpselector_from_ep_or_uri(), and ast_sip_tpselector_unref().
Referenced by ast_sip_create_dialog_uac().
int ast_sip_dtmf_to_str | ( | const enum ast_sip_dtmf_mode | dtmf, |
char * | buf, | ||
size_t | buf_len | ||
) |
Convert the DTMF mode enum value into a string.
dtmf | the dtmf mode |
buf | Buffer to receive dtmf mode string |
buf_len | Buffer length |
0 | Success |
-1 | Failure |
Definition at line 5484 of file res_pjsip.c.
References ast_copy_string(), AST_SIP_DTMF_AUTO, AST_SIP_DTMF_AUTO_INFO, AST_SIP_DTMF_INBAND, AST_SIP_DTMF_INFO, AST_SIP_DTMF_NONE, and AST_SIP_DTMF_RFC_4733.
Referenced by dtmf_to_str(), and pjsip_acf_dtmf_mode_read().
void* ast_sip_endpoint_alloc | ( | const char * | name | ) |
Allocate a new SIP endpoint.
This will return an endpoint with its refcount increased by one. This reference can be released using ao2_ref().
name | The name of the endpoint. |
NULL | Endpoint allocation failed |
non-NULL | The newly allocated endpoint |
Definition at line 2306 of file pjsip_configuration.c.
References ao2_cleanup, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_party_id_init(), ast_sorcery_generic_alloc(), ast_strdup, ast_string_field_init, AST_VECTOR_INIT, ast_sip_endpoint_media_configuration::codecs, sip_persistent_endpoint::endpoint, endpoint_destructor(), ast_sip_endpoint::id, ast_sip_endpoint::ident_method_order, ast_sip_endpoint::info, init_info_configuration(), init_media_configuration(), init_subscription_configuration(), ast_sip_endpoint::media, NULL, ast_sip_endpoint_id_configuration::self, ast_sip_endpoint::subscription, and ast_party_id::tag.
Referenced by ast_res_pjsip_initialize_configuration().
int ast_sip_failover_request | ( | pjsip_tx_data * | tdata | ) |
Set a request to use the next value in the list of resolved addresses.
tdata | the tx data from the original request |
0 | No more addresses to try |
1 | The request was successfully re-intialized |
Definition at line 4871 of file res_pjsip.c.
References NULL, and send_request_cb().
Referenced by check_request_status(), and handle_registration_response().
int ast_sip_for_each_aor | ( | const char * | aors, |
ao2_callback_fn | on_aor, | ||
void * | arg | ||
) |
For every aor in the comma separated aors string call the given 'on_aor' handler.
aors | a comma separated list of aors |
on_aor | callback for each aor |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 684 of file location.c.
References ao2_ref, ast_sip_location_retrieve_aor(), ast_strdupa, ast_strip(), ast_strlen_zero, copy(), name, and strsep().
Referenced by ami_registrations_endpoint(), ast_sip_location_retrieve_contacts_from_aor_list(), cli_aor_iterate(), format_ami_contact_status(), format_ami_endpoint_aor(), format_ami_endpoints(), mwi_new_subscribe(), and mwi_subscribe_all().
int ast_sip_for_each_auth | ( | const struct ast_sip_auth_vector * | array, |
ao2_callback_fn | on_auth, | ||
void * | arg | ||
) |
For every auth in the array call the given 'on_auth' handler.
array | an array of auths |
on_auth | callback for each auth |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 135 of file config_auth.c.
References ao2_cleanup, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), AST_VECTOR_GET, AST_VECTOR_SIZE, and RAII_VAR.
Referenced by ast_sip_format_auths_ami(), and cli_iterator().
int ast_sip_for_each_channel | ( | const struct ast_sip_endpoint * | endpoint, |
ao2_callback_fn | on_channel_snapshot, | ||
void * | arg | ||
) |
For every channel snapshot on an endpoint all the given 'on_channel_snapshot' handler.
endpoint | endpoint |
on_channel_snapshot | callback for each channel snapshot |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 1550 of file pjsip_configuration.c.
References ao2_cleanup, ast_sip_for_each_channel_snapshot(), ast_sip_get_endpoint_snapshot(), and RAII_VAR.
Referenced by cli_channel_iterate(), and cli_channelstats_iterate().
int ast_sip_for_each_channel_snapshot | ( | const struct ast_endpoint_snapshot * | endpoint_snapshot, |
ao2_callback_fn | on_channel_snapshot, | ||
void * | arg | ||
) |
For every channel snapshot on an endpoint snapshot call the given 'on_channel_snapshot' handler.
endpoint_snapshot | snapshot of an endpoint |
on_channel_snapshot | callback for each channel snapshot |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 1523 of file pjsip_configuration.c.
References ao2_cleanup, ast_channel_snapshot_get_latest(), ast_endpoint_snapshot::channel_ids, NULL, ast_endpoint_snapshot::num_channels, and RAII_VAR.
Referenced by active_channels_to_str(), and ast_sip_for_each_channel().
int ast_sip_for_each_contact | ( | const struct ast_sip_aor * | aor, |
ao2_callback_fn | on_contact, | ||
void * | arg | ||
) |
For every contact on an AOR call the given 'on_contact' handler.
aor | the aor containing a list of contacts to iterate |
on_contact | callback on each contact on an AOR. The object received by the callback will be a ast_sip_contact_wrapper structure. |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 719 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_malloc, ast_sip_location_retrieve_aor_contacts(), ast_sorcery_object_get_id(), ast_strdup, contact_wrapper_destroy(), NULL, and RAII_VAR.
Referenced by ami_registrations_aor(), cli_aor_gather_contacts(), cli_contact_iterate(), contacts_to_str(), contacts_to_var_list(), format_contact_status_for_aor(), and sip_endpoints_aors_ami().
int ast_sip_format_auths_ami | ( | const struct ast_sip_auth_vector * | auths, |
struct ast_sip_ami * | ami | ||
) |
Format auth details for AMI.
auths | an auth array |
ami | ami variable container |
0 | Success, non-zero on failure |
Definition at line 195 of file config_auth.c.
References ast_sip_for_each_auth(), and format_ami_auth_handler().
Referenced by ami_outbound_registration_task(), and format_ami_endpoint_auth().
int ast_sip_format_contact_ami | ( | void * | obj, |
void * | arg, | ||
int | flags | ||
) |
Formats the contact and sends over AMI.
obj | a pointer an ast_sip_contact_wrapper structure |
arg | a pointer to an ast_sip_ami structure |
flags | ignored |
0 | Success, otherwise non-zero on error |
Definition at line 2717 of file pjsip_options.c.
References ao2_cleanup, ast_sip_contact_wrapper::aor_id, ast_sip_ami::arg, ast_free, ast_sip_create_ami_event(), ast_sip_get_contact_status(), ast_sip_get_contact_status_label(), ast_sorcery_object_get_id(), ast_str_append(), ast_str_buffer(), ast_strlen_zero, astman_append(), ast_sip_contact::authenticate_qualify, AVAILABLE, buf, ast_sip_contact::call_id, ast_sip_contact_wrapper::contact, ast_sip_ami::count, ast_sip_contact::endpoint_name, ast_sip_contact::expiration_time, ast_sip_contact::outbound_proxy, ast_sip_contact::path, ast_sip_contact::qualify_frequency, ast_sip_contact::qualify_timeout, ast_sip_contact_status::rtt, ast_sip_ami::s, S_OR, status, ast_sip_contact_status::status, UNKNOWN, ast_sip_contact::uri, ast_sip_contact::user_agent, ast_sip_contact::via_addr, and ast_sip_contact::via_port.
Referenced by ami_show_registration_contact_statuses(), and format_contact_status_for_aor().
int ast_sip_format_endpoint_ami | ( | struct ast_sip_endpoint * | endpoint, |
struct ast_sip_ami * | ami, | ||
int * | count | ||
) |
Formats the endpoint and sends over AMI.
endpoint | the endpoint to format and send |
endpoint | ami AMI variable container |
count | the number of formatters operated on |
0 | Success, otherwise non-zero on error |
Definition at line 3699 of file res_pjsip.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_sip_endpoint_formatter::format_ami, lock, and SCOPED_LOCK.
Referenced by ami_show_endpoint().
struct ast_sip_auth* ast_sip_get_artificial_auth | ( | void | ) |
Retrieves a reference to the artificial auth.
The | artificial auth |
Definition at line 631 of file pjsip_distributor.c.
References ao2_global_obj_ref.
Referenced by digest_check_auth(), and global_loaded().
struct ast_sip_endpoint* ast_sip_get_artificial_endpoint | ( | void | ) |
Retrieves a reference to the artificial endpoint.
The | artificial endpoint |
Definition at line 654 of file pjsip_distributor.c.
References ao2_ref, and artificial_endpoint.
Referenced by digest_check_auth(), digest_requires_authentication(), endpoint_lookup(), and get_account_id().
unsigned int ast_sip_get_contact_expiration_check_interval | ( | void | ) |
Retrieve the system contact expiration check interval setting.
the | contact expiration check interval. |
Definition at line 309 of file config_global.c.
References ao2_ref, global_config::contact_expiration_check_interval, DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL, and get_global_cfg().
Referenced by expiration_global_loaded().
const char* ast_sip_get_contact_short_status_label | ( | const enum ast_sip_contact_status_type | status | ) |
Definition at line 342 of file pjsip_options.c.
References ARRAY_LEN, ast_assert, short_status_map, and status.
Referenced by cli_contact_print_body().
struct ast_sip_contact_status* ast_sip_get_contact_status | ( | const struct ast_sip_contact * | contact | ) |
Retrieve the current status for a contact.
contact | The contact. |
non-NULL | Success |
NULL | Status information not found |
Definition at line 523 of file pjsip_options.c.
References ao2_find, AO2_STRING_FIELD_CMP_FN(), AO2_STRING_FIELD_HASH_FN(), ast_sorcery_object_get_id(), sip_options_endpoint_aor_status::name, and OBJ_SEARCH_KEY.
Referenced by ast_sip_format_contact_ami(), cli_contact_print_body(), contact_remove_unreachable(), format_ami_contactlist_handler(), pjsip_contact_function_read(), and sip_options_contact_update_task().
const char* ast_sip_get_contact_status_label | ( | const enum ast_sip_contact_status_type | status | ) |
translate ast_sip_contact_status_type to character string.
the | character string equivalent. |
Definition at line 336 of file pjsip_options.c.
References ARRAY_LEN, ast_assert, status, and status_map.
Referenced by ast_res_pjsip_find_or_create_contact_status(), ast_sip_format_contact_ami(), ast_sip_initialize_sorcery_location(), ast_sip_persistent_endpoint_publish_contact_state(), format_ami_contactlist_handler(), pjsip_contact_function_read(), sip_options_contact_status_notify_task(), sip_options_remove_contact_status(), and sip_options_set_contact_status().
char* ast_sip_get_debug | ( | void | ) |
Retrieve the system debug setting (yes|no|host).
the | system debug setting. |
Definition at line 232 of file config_global.c.
References ao2_ref, ast_strdup, global_config::debug, DEFAULT_DEBUG, and get_global_cfg().
Referenced by check_debug().
void ast_sip_get_default_from_user | ( | char * | from_user, |
size_t | size | ||
) |
Retrieve the global default from user.
This is the value placed in outbound requests' From header if there is no better option (such as an endpoint-configured from_user or caller ID number).
[out] | from_user | The default from user |
size | The buffer size of from_user |
Definition at line 388 of file config_global.c.
References ao2_ref, ast_copy_string(), DEFAULT_FROM_USER, global_config::default_from_user, and get_global_cfg().
Referenced by sip_dialog_create_from().
void ast_sip_get_default_realm | ( | char * | realm, |
size_t | size | ||
) |
Retrieve the global default realm.
This is the value placed in outbound challenges' realm if there is no better option (such as an auth-configured realm).
[out] | realm | The default realm |
size | The buffer size of realm |
Definition at line 375 of file config_global.c.
References ao2_ref, ast_copy_string(), DEFAULT_REALM, global_config::default_realm, and get_global_cfg().
Referenced by create_artificial_auth(), and global_loaded().
char* ast_sip_get_default_voicemail_extension | ( | void | ) |
Retrieve the default voicemail extension.
the | default voicemail extension |
Definition at line 263 of file config_global.c.
References ao2_ref, ast_strdup, DEFAULT_VOICEMAIL_EXTENSION, global_config::default_voicemail_extension, and get_global_cfg().
Referenced by global_loaded().
const char* ast_sip_get_device_state | ( | const struct ast_sip_endpoint * | endpoint | ) |
Retrieve the device state for an endpoint.
endpoint | The endpoint whose state is to be retrieved. |
The | device state. |
Definition at line 1507 of file pjsip_configuration.c.
References ast_devstate2str(), ast_sorcery_object_get_id(), and MAX_OBJECT_FIELD.
Referenced by cli_endpoint_print_body(), format_ami_endpoints(), and sip_endpoint_to_ami().
unsigned int ast_sip_get_disable_multi_domain | ( | void | ) |
Retrieve the system setting 'disable multi domain'.
non | zero if disable multi domain. |
Definition at line 324 of file config_global.c.
References ao2_ref, DEFAULT_DISABLE_MULTI_DOMAIN, global_config::disable_multi_domain, and get_global_cfg().
Referenced by anonymous_identify(), find_endpoint(), request(), and sip_dialog_create_from().
char* ast_sip_get_endpoint_identifier_order | ( | void | ) |
Retrieve the global endpoint_identifier_order setting.
Specifies the order by which endpoint identifiers should be regarded.
the | global endpoint_identifier_order value |
Definition at line 279 of file config_global.c.
References ao2_ref, ast_strdup, DEFAULT_ENDPOINT_IDENTIFIER_ORDER, global_config::endpoint_identifier_order, and get_global_cfg().
Referenced by ast_sip_register_endpoint_identifier_with_name(), and global_loaded().
struct ast_endpoint_snapshot* ast_sip_get_endpoint_snapshot | ( | const struct ast_sip_endpoint * | endpoint | ) |
Retrieve the endpoint snapshot for an endpoint.
endpoint | The endpoint whose snapshot is to be retreieved. |
The | endpoint snapshot |
Definition at line 1515 of file pjsip_configuration.c.
References ast_endpoint_get_resource(), ast_endpoint_get_tech(), ast_endpoint_latest_snapshot(), and ast_sip_endpoint::persistent.
Referenced by active_channels_to_str(), ast_sip_for_each_channel(), and cli_endpoint_print_body().
struct ao2_container* ast_sip_get_endpoints | ( | void | ) |
Retrieve any endpoints available to sorcery.
Endpoints | available to sorcery, NULL if no endpoints found. |
Definition at line 2344 of file pjsip_configuration.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), endpoints, and NULL.
Referenced by ami_registrations_endpoints(), ami_show_endpoints(), and load_module().
int ast_sip_get_host_ip | ( | int | af, |
pj_sockaddr * | addr | ||
) |
Retrieve the local host address in IP form.
af | The address family to retrieve |
addr | A place to store the local host address |
0 | success |
-1 | failure |
Definition at line 5460 of file res_pjsip.c.
References ast_strlen_zero, host_ip_ipv4, host_ip_ipv4_string, host_ip_ipv6, and host_ip_ipv6_string.
const char* ast_sip_get_host_ip_string | ( | int | af | ) |
Retrieve the local host address in string form.
af | The address family to retrieve |
non-NULL | success |
NULL | failure |
Definition at line 5473 of file res_pjsip.c.
References host_ip_ipv4_string, host_ip_ipv6_string, and NULL.
Referenced by create_local_sdp(), create_outgoing_sdp_stream(), and multihomed_rewrite_sdp().
unsigned int ast_sip_get_ignore_uri_user_options | ( | void | ) |
Retrieve the global setting 'ignore_uri_user_options'.
non | zero if ignore the user field options. |
Definition at line 447 of file config_global.c.
References ao2_ref, DEFAULT_IGNORE_URI_USER_OPTIONS, get_global_cfg(), and global_config::ignore_uri_user_options.
Referenced by find_registrar_aor().
unsigned int ast_sip_get_keep_alive_interval | ( | void | ) |
Retrieve the system keep alive interval setting.
the | keep alive interval. |
Definition at line 294 of file config_global.c.
References ao2_ref, DEFAULT_KEEPALIVE_INTERVAL, get_global_cfg(), and global_config::keep_alive_interval.
Referenced by keepalive_global_loaded().
unsigned int ast_sip_get_max_initial_qualify_time | ( | void | ) |
Retrieve the system max initial qualify time.
the | maximum initial qualify time. |
Definition at line 339 of file config_global.c.
References ao2_ref, DEFAULT_MAX_INITIAL_QUALIFY_TIME, get_global_cfg(), and global_config::max_initial_qualify_time.
Referenced by sip_options_determine_initial_qualify_time().
unsigned int ast_sip_get_mwi_disable_initial_unsolicited | ( | void | ) |
Retrieve the global setting 'disable sending unsolicited mwi on startup'.
non | zero if disable. |
Definition at line 432 of file config_global.c.
References ao2_ref, DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED, global_config::disable_initial_unsolicited, get_global_cfg(), and global_config::mwi.
Referenced by load_module(), and reload().
unsigned int ast_sip_get_mwi_tps_queue_high | ( | void | ) |
Retrieve the global MWI taskprocessor high water alert trigger level.
the | system MWI taskprocessor high water alert trigger level |
Definition at line 402 of file config_global.c.
References ao2_ref, DEFAULT_MWI_TPS_QUEUE_HIGH, get_global_cfg(), global_config::mwi, and global_config::tps_queue_high.
Referenced by global_loaded().
int ast_sip_get_mwi_tps_queue_low | ( | void | ) |
Retrieve the global MWI taskprocessor low water clear alert level.
the | system MWI taskprocessor low water clear alert level |
Definition at line 417 of file config_global.c.
References ao2_ref, DEFAULT_MWI_TPS_QUEUE_LOW, get_global_cfg(), global_config::mwi, and global_config::tps_queue_low.
Referenced by global_loaded().
unsigned int ast_sip_get_norefersub | ( | void | ) |
Retrieve the global setting 'norefersub'.
non | zero if norefersub is to be sent in "Supported" Headers |
Definition at line 507 of file config_global.c.
References ao2_ref, DEFAULT_NOREFERSUB, get_global_cfg(), and global_config::norefersub.
Referenced by load_module().
pjsip_endpoint* ast_sip_get_pjsip_endpoint | ( | void | ) |
Get a pointer to the PJSIP endpoint.
This is useful when modules have specific information they need to register with the PJSIP core.
NULL | endpoint has not been created yet. |
non-NULL | PJSIP endpoint. |
Definition at line 3718 of file res_pjsip.c.
References ast_pjsip_endpoint.
Referenced by acl_on_rx_msg(), ast_res_pjsip_cleanup_options_handling(), ast_res_pjsip_init_options_handling(), ast_sip_create_response(), ast_sip_destroy_transport_events(), ast_sip_initialize_transport_events(), ast_sip_pubsub_register_body_generator(), ast_sip_send_response(), ast_sip_session_defer_termination(), ast_sip_session_resume_reinvite(), authenticate(), cancel_publish_refresh(), cancel_registration(), channel_read_pjsip(), create_out_of_dialog_request(), digest_create_request_with_auth(), distribute(), distributor(), do_cli_dump_endpt(), endpoint_lookup(), endpt_send_request(), endpt_send_request_cb(), exten_state_data_alloc(), exten_state_data_destructor(), exten_state_publisher_cb(), filter_on_tx_message(), find_registrar_aor(), keepalive_transport_send_keepalive(), load_module(), logging_on_rx_msg(), logging_on_tx_msg(), notify_task(), on_rx_process_uris(), options_incoming_request(), parse_uri_cb(), pre_session_setup(), publish_request_initial(), pubsub_on_rx_mwi_notify_request(), pubsub_on_rx_publish_request(), pubsub_on_rx_subscribe_request(), register_aor(), register_aor_core(), registrar_on_rx_request(), reschedule_reinvite(), schedule_publish_refresh(), schedule_registration(), send_options_response(), session_reinvite_on_rx_request(), sip_check_transport(), sip_dialog_create_contact(), sip_dialog_create_from(), sip_outbound_publisher_init(), sip_outbound_registration_regc_alloc(), sip_publication_respond(), sip_replace_resolver(), sip_session_defer_termination_stop_timer(), subscription_persistence_load(), system_create_resolver_and_set_nameservers(), t38_change_state(), transport_apply(), and transport_create().
char* ast_sip_get_regcontext | ( | void | ) |
Retrieve the global regcontext setting.
the | global regcontext setting |
Definition at line 247 of file config_global.c.
References ao2_ref, ast_strdup, DEFAULT_REGCONTEXT, get_global_cfg(), and global_config::regcontext.
Referenced by ast_sip_persistent_endpoint_update_state().
unsigned int ast_sip_get_send_contact_status_on_update_registration | ( | void | ) |
Retrieve the global setting 'send_contact_status_on_update_registration'.
non | zero if need to send AMI ContactStatus event when a contact is updated. |
Definition at line 477 of file config_global.c.
References ao2_ref, DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION, get_global_cfg(), and global_config::send_contact_status_on_update_registration.
Referenced by contact_observer_updated().
struct ast_sorcery* ast_sip_get_sorcery | ( | void | ) |
Get a pointer to the SIP sorcery structure.
NULL | sorcery has not been initialized |
non-NULL | sorcery structure |
Definition at line 2404 of file pjsip_configuration.c.
References sip_sorcery.
Referenced by acl_change_stasis_cb(), acl_on_rx_msg(), alloc_artificial_auth(), ami_show_endpoint(), ami_show_registration_contact_statuses(), ami_show_resource_lists(), ami_sip_qualify(), anonymous_identify(), aor_deleted_observer(), ast_res_pjsip_cleanup_options_handling(), ast_sip_cli_print_sorcery_objectset(), ast_sip_destroy_distributor(), ast_sip_destroy_sorcery_global(), ast_sip_destroy_sorcery_location(), ast_sip_destroy_transport_management(), ast_sip_for_each_auth(), ast_sip_initialize_distributor(), ast_sip_initialize_sorcery_auth(), ast_sip_initialize_sorcery_domain_alias(), ast_sip_initialize_sorcery_global(), ast_sip_initialize_sorcery_location(), ast_sip_initialize_sorcery_transport(), ast_sip_initialize_transport_management(), ast_sip_location_create_contact(), ast_sip_location_delete_contact(), ast_sip_location_prune_boot_contacts(), ast_sip_location_retrieve_aor(), ast_sip_location_retrieve_aor_contacts_nolock_filtered(), ast_sip_location_retrieve_contact(), ast_sip_location_update_contact(), ast_sip_retrieve_auths(), ast_sip_retrieve_auths_vector(), ast_sip_set_tpselector_from_transport_name(), ast_sip_sorcery_object_to_ami(), asterisk_publication_devicestate_state_change(), asterisk_publication_mwi_state_change(), asterisk_publication_new(), asterisk_publication_send_refresh(), auth_observer(), can_reuse_registration(), chan_pjsip_devicestate(), check_expiration_thread(), check_state(), cleanup_resource_list(), cli_aor_get_container(), cli_aor_retrieve_by_id(), cli_complete_endpoint(), cli_complete_registration(), cli_contact_get_container(), cli_endpoint_retrieve_by_id(), cli_get_aors(), cli_get_auths(), cli_get_container(), cli_iterate(), cli_iterator(), cli_qualify(), cli_reload_qualify_aor(), cli_reload_qualify_endpoint(), cli_retrieve_by_id(), cli_show_qualify_endpoint(), common_identify(), contact_observer_updated(), create_artificial_endpoint(), create_mwi_subscriptions(), create_resource_list(), create_rtp(), find_aor(), find_aor_name(), find_endpoint(), format_ami_endpoint_identify(), format_ami_endpoint_transport(), get_all_contacts(), get_publishes_and_update_state(), get_registrations(), get_write_timeout(), handle_atsign(), handle_export_primitives(), handle_single_token(), handle_slash(), line_identify(), load_module(), mwi_contact_changed(), mwi_contact_deleted(), mwi_subscription_shutdown(), on_rx_process_symmetric_transport(), permanent_uri_handler(), pjsip_acf_dial_contacts_read(), pjsip_aor_function_read(), pjsip_contact_function_read(), pjsip_endpoint_function_read(), pjsip_outbound_registration_metrics_init(), pjsip_outbound_registration_metrics_unload_cb(), process_nat(), publish_request_initial(), push_notify(), register_aor_core(), registration_deleted_observer(), registration_loaded_observer(), reload_module(), request(), reregister_all(), retrieve_resource_list(), send_unsolicited_mwi_notify(), sip_aor_to_ami(), sip_cli_print_global(), sip_options_aor_observer_modified_task(), sip_options_apply_aor_configuration(), sip_options_contact_add_management_task(), sip_options_init_task(), sip_options_qualify_contact(), sip_options_synchronize_task(), sub_persistence_recreate(), subscription_persistence_create(), subscription_persistence_load(), subscription_persistence_recreate(), subscription_persistence_remove(), subscription_persistence_update(), transfer(), and unload_module().
int ast_sip_get_transport_name | ( | const struct ast_sip_endpoint * | endpoint, |
pjsip_sip_uri * | sip_uri, | ||
char * | buf, | ||
size_t | buf_len | ||
) |
Get the transport name from an endpoint or request uri.
endpoint | |
sip_uri | |
buf | Buffer to receive transport name |
buf_len | Buffer length |
0 | Success |
-1 | Failure |
Definition at line 3762 of file res_pjsip.c.
References ast_alloca, ast_copy_pj_str(), ast_copy_string(), AST_SIP_X_AST_TXP, AST_SIP_X_AST_TXP_LEN, ast_sockaddr_parse(), ast_strlen_zero, host, NULL, PARSE_PORT_FORBID, and ast_sip_endpoint::transport.
Referenced by ast_sip_set_tpselector_from_ep_or_uri().
struct ast_sip_transport_state* ast_sip_get_transport_state | ( | const char * | transport_id | ) |
Retrieve transport state.
transport_id |
Definition at line 1564 of file config_transport.c.
References ao2_bump, ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_sip_transport_state::flow, NULL, OBJ_SEARCH_KEY, internal_state::state, and ast_sip_transport_state::transport.
Referenced by ast_sip_message_apply_transport(), ast_sip_set_tpselector_from_transport(), ast_sip_transport_state_set_preferred_identity(), ast_sip_transport_state_set_service_routes(), ast_sip_transport_state_set_transport(), change_outgoing_sdp_stream_media_address(), create_rtp(), and session_outgoing_nat_hook().
struct ao2_container* ast_sip_get_transport_states | ( | void | ) |
Retrieves all transport states.
Definition at line 1604 of file config_transport.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_callback, ao2_container_alloc_hash, DEFAULT_STATE_BUCKETS, NULL, OBJ_MULTIPLE, OBJ_NODATA, populate_transport_states(), transport_state_cmp(), and transport_state_hash().
Referenced by anonymous_identify(), find_endpoint(), get_udp_transport(), get_write_timeout(), and process_nat().
void ast_sip_get_unidentified_request_thresholds | ( | unsigned int * | count, |
unsigned int * | period, | ||
unsigned int * | prune_interval | ||
) |
Retrieve the unidentified request security event thresholds.
count | The maximum number of unidentified requests per source ip to accumulate before emitting a security event |
period | The period in seconds over which to accumulate unidentified requests |
prune_interval | The interval in seconds at which expired entries will be pruned |
Definition at line 354 of file config_global.c.
References ao2_ref, DEFAULT_UNIDENTIFIED_REQUEST_COUNT, DEFAULT_UNIDENTIFIED_REQUEST_PERIOD, DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL, get_global_cfg(), global_config::unidentified_request_count, global_config::unidentified_request_period, and global_config::unidentified_request_prune_interval.
Referenced by global_loaded(), and prune_task().
unsigned int ast_sip_get_use_callerid_contact | ( | void | ) |
Retrieve the global setting 'use_callerid_contact'.
non | zero if CALLERID(num) is to be used as the default username in the contact |
Definition at line 462 of file config_global.c.
References ao2_ref, DEFAULT_USE_CALLERID_CONTACT, get_global_cfg(), and global_config::use_callerid_contact.
Referenced by set_from_header().
struct ast_sip_endpoint* ast_sip_identify_endpoint | ( | pjsip_rx_data * | rdata | ) |
Determine the endpoint that has sent a SIP message.
This will call into each of the registered endpoint identifiers' identify_endpoint() callbacks until one returns a non-NULL endpoint. This will return an ao2 object. Its reference count will need to be decremented when completed using the endpoint.
rdata | The inbound SIP message to use when identifying the endpoint. |
NULL | No matching endpoint |
non-NULL | The matching endpoint |
Definition at line 3528 of file res_pjsip.c.
References ast_assert, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, endpoint_identifier_list::identifier, ast_sip_endpoint_identifier::identify_endpoint, lock, NULL, and SCOPED_LOCK.
Referenced by endpoint_lookup().
int ast_sip_is_content_type | ( | pjsip_media_type * | content_type, |
char * | type, | ||
char * | subtype | ||
) |
Checks if the given content type matches type/subtype.
Compares the pjsip_media_type with the passed type and subtype and returns the result of that comparison. The media type parameters are ignored.
content_type | The pjsip_media_type structure to compare |
type | The media type to compare |
subtype | The media subtype to compare |
0 | No match |
-1 | Match |
Definition at line 5259 of file res_pjsip.c.
References compare().
Referenced by asterisk_publication_devicestate_state_change(), asterisk_publication_mwi_state_change(), check_content_type(), filter_on_tx_message(), pubsub_on_rx_notify_request(), session_outgoing_nat_hook(), and video_info_incoming_request().
int ast_sip_location_add_contact | ( | struct ast_sip_aor * | aor, |
const char * | uri, | ||
struct timeval | expiration_time, | ||
const char * | path_info, | ||
const char * | user_agent, | ||
const char * | via_addr, | ||
int | via_port, | ||
const char * | call_id, | ||
struct ast_sip_endpoint * | endpoint | ||
) |
Add a new contact to an AOR.
aor | Pointer to the AOR |
uri | Full contact URI |
expiration_time | Optional expiration time of the contact |
path_info | Path information |
user_agent | User-Agent header from REGISTER request |
via_addr | |
via_port | |
call_id | |
endpoint | The endpoint that resulted in the contact being added |
-1 | failure |
0 | success |
Definition at line 429 of file location.c.
References ao2_lock, ao2_unlock, and ast_sip_location_add_contact_nolock().
int ast_sip_location_add_contact_nolock | ( | struct ast_sip_aor * | aor, |
const char * | uri, | ||
struct timeval | expiration_time, | ||
const char * | path_info, | ||
const char * | user_agent, | ||
const char * | via_addr, | ||
int | via_port, | ||
const char * | call_id, | ||
struct ast_sip_endpoint * | endpoint | ||
) |
Add a new contact to an AOR without locking the AOR.
aor | Pointer to the AOR |
uri | Full contact URI |
expiration_time | Optional expiration time of the contact |
path_info | Path information |
user_agent | User-Agent header from REGISTER request |
via_addr | |
via_port | |
call_id | |
endpoint | The endpoint that resulted in the contact being added |
-1 | failure |
0 | success |
Definition at line 416 of file location.c.
References ao2_cleanup, and ast_sip_location_create_contact().
Referenced by ast_sip_location_add_contact().
struct ast_sip_contact* ast_sip_location_create_contact | ( | struct ast_sip_aor * | aor, |
const char * | uri, | ||
struct timeval | expiration_time, | ||
const char * | path_info, | ||
const char * | user_agent, | ||
const char * | via_addr, | ||
int | via_port, | ||
const char * | call_id, | ||
int | prune_on_boot, | ||
struct ast_sip_endpoint * | endpoint | ||
) |
Create a new contact for an AOR without locking the AOR.
aor | Pointer to the AOR |
uri | Full contact URI |
expiration_time | Optional expiration time of the contact |
path_info | Path information |
user_agent | User-Agent header from REGISTER request |
via_addr | |
via_port | |
call_id | |
prune_on_boot | Non-zero if the contact cannot survive a restart/boot. |
endpoint | The endpoint that resulted in the contact being added |
Definition at line 355 of file location.c.
References ao2_bump, ao2_ref, ast_config_AST_SYSTEM_NAME, ast_md5_hash(), ast_sip_get_sorcery(), ast_sorcery_alloc(), ast_sorcery_create(), ast_sorcery_object_get_id(), ast_string_field_set, ast_strlen_zero, ast_sip_contact::authenticate_qualify, ast_sip_aor::authenticate_qualify, ast_sip_contact::endpoint, ast_sip_contact::endpoint_name, ast_sip_contact::expiration_time, MAX_OBJECT_FIELD, name, NULL, ast_sip_contact::outbound_proxy, ast_sip_aor::outbound_proxy, ast_sip_contact::path, ast_sip_contact::prune_on_boot, ast_sip_contact::qualify_frequency, ast_sip_aor::qualify_frequency, ast_sip_contact::qualify_timeout, ast_sip_aor::qualify_timeout, ast_sip_contact::reg_server, ast_sip_aor::support_path, and ast_sip_contact::via_port.
Referenced by ast_sip_location_add_contact_nolock(), and register_aor_core().
int ast_sip_location_delete_contact | ( | struct ast_sip_contact * | contact | ) |
Delete a contact.
contact | Contact object to delete |
-1 | failure |
0 | success |
Definition at line 450 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_delete().
Referenced by contact_expire(), destroy_contact(), prune_boot_contacts_cb(), and registrar_contact_delete().
void ast_sip_location_prune_boot_contacts | ( | void | ) |
Prune the prune_on_boot contacts.
Definition at line 469 of file location.c.
References ao2_callback, ao2_ref, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), NULL, and prune_boot_contacts_cb().
Referenced by ast_res_pjsip_initialize_configuration().
struct ast_sip_aor* ast_sip_location_retrieve_aor | ( | const char * | aor_name | ) |
Retrieve a named AOR.
aor_name | Name of the AOR |
NULL | if not found |
non-NULL | if found |
Definition at line 147 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_retrieve_by_id().
Referenced by ast_sip_for_each_aor(), ast_sip_location_retrieve_contact_and_aor_from_list_filtered(), find_aor(), find_aor_for_resource(), find_registrar_aor(), handle_slash(), notify_endpoint(), pjsip_acf_dial_contacts_read(), register_contact_transport_remove_cb(), and send_unsolicited_mwi_notify().
struct ao2_container* ast_sip_location_retrieve_aor_contacts | ( | const struct ast_sip_aor * | aor | ) |
Retrieve all contacts currently available for an AOR.
aor | Pointer to the AOR |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 247 of file location.c.
References AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_aor_contacts_filtered().
Referenced by ast_sip_for_each_contact(), format_ami_aor_handler(), gather_contacts_for_aor(), notify_endpoint(), pjsip_aor_function_read(), and send_unsolicited_mwi_notify().
struct ao2_container* ast_sip_location_retrieve_aor_contacts_filtered | ( | const struct ast_sip_aor * | aor, |
unsigned int | flags | ||
) |
Retrieve all contacts currently available for an AOR and filter based on flags.
aor | Pointer to the AOR |
flags | Filtering flags |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 252 of file location.c.
References ao2_lock, ao2_unlock, and ast_sip_location_retrieve_aor_contacts_nolock_filtered().
Referenced by ast_sip_location_retrieve_aor_contacts(), ast_sip_location_retrieve_first_aor_contact_filtered(), and pjsip_acf_dial_contacts_read().
struct ao2_container* ast_sip_location_retrieve_aor_contacts_nolock | ( | const struct ast_sip_aor * | aor | ) |
Retrieve all contacts currently available for an AOR without locking the AOR.
aor | Pointer to the AOR |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 214 of file location.c.
References AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_aor_contacts_nolock_filtered().
Referenced by register_aor().
struct ao2_container* ast_sip_location_retrieve_aor_contacts_nolock_filtered | ( | const struct ast_sip_aor * | aor, |
unsigned int | flags | ||
) |
Retrieve all contacts currently available for an AOR without locking the AOR and filter based on flags.
aor | Pointer to the AOR |
flags | Filtering flags |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 219 of file location.c.
References ao2_callback, AST_SIP_CONTACT_FILTER_REACHABLE, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_prefix(), contact_expire(), contact_link_static(), contact_remove_unreachable(), NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, ast_sip_aor::permanent_contacts, and prefix.
Referenced by ast_sip_location_retrieve_aor_contacts_filtered(), and ast_sip_location_retrieve_aor_contacts_nolock().
struct ast_sip_contact* ast_sip_location_retrieve_contact | ( | const char * | contact_name | ) |
Retrieve a named contact.
contact_name | Name of the contact |
NULL | if not found |
non-NULL | if found |
Definition at line 350 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_retrieve_by_id().
Referenced by register_contact_transport_remove_cb().
void ast_sip_location_retrieve_contact_and_aor_from_list | ( | const char * | aor_list, |
struct ast_sip_aor ** | aor, | ||
struct ast_sip_contact ** | contact | ||
) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs.
aor_list | A comma-separated list of AOR names |
aor | The chosen AOR |
contact | The chosen contact |
Definition at line 266 of file location.c.
References AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_contact_and_aor_from_list_filtered().
Referenced by ast_sip_location_retrieve_contact_from_aor_list().
void ast_sip_location_retrieve_contact_and_aor_from_list_filtered | ( | const char * | aor_list, |
unsigned int | flags, | ||
struct ast_sip_aor ** | aor, | ||
struct ast_sip_contact ** | contact | ||
) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs and filter based on flags.
aor_list | A comma-separated list of AOR names |
flags | Filtering flags |
aor | The chosen AOR |
contact | The chosen contact |
Definition at line 272 of file location.c.
References ao2_ref, ast_log, ast_sip_location_retrieve_aor(), ast_sip_location_retrieve_first_aor_contact_filtered(), ast_strdupa, ast_strip(), ast_strlen_zero, LOG_WARNING, NULL, and strsep().
Referenced by ast_sip_location_retrieve_contact_and_aor_from_list(), and ast_sip_session_create_outgoing().
struct ast_sip_contact* ast_sip_location_retrieve_contact_from_aor_list | ( | const char * | aor_list | ) |
Retrieve the first bound contact from a list of AORs.
aor_list | A comma-separated list of AOR names |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 304 of file location.c.
References ao2_cleanup, ast_sip_location_retrieve_contact_and_aor_from_list(), cli_contact_populate_container(), and permanent_uri_sort_fn().
Referenced by ast_sip_create_subscription(), create_out_of_dialog_request(), handle_atsign(), handle_single_token(), insert_user_in_contact_uri(), mwi_contact_deleted(), and transfer().
struct ao2_container* ast_sip_location_retrieve_contacts_from_aor_list | ( | const char * | aor_list | ) |
Retrieve all contacts from a list of AORs.
aor_list | A comma-separated list of AOR names |
NULL | if no contacts available |
non-NULL | container (which must be freed) if contacts available |
Definition at line 335 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ast_sip_for_each_aor(), gather_contacts_for_aor(), NULL, and permanent_uri_sort_fn().
struct ast_sip_contact* ast_sip_location_retrieve_first_aor_contact | ( | const struct ast_sip_aor * | aor | ) |
Retrieve the first bound contact for an AOR.
aor | Pointer to the AOR |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 194 of file location.c.
References AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_first_aor_contact_filtered().
Referenced by handle_slash().
struct ast_sip_contact* ast_sip_location_retrieve_first_aor_contact_filtered | ( | const struct ast_sip_aor * | aor, |
unsigned int | flags | ||
) |
Retrieve the first bound contact for an AOR and filter based on flags.
aor | Pointer to the AOR |
flags | Filtering flags |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 199 of file location.c.
References ao2_callback, ao2_cleanup, ao2_container_count(), ast_sip_location_retrieve_aor_contacts_filtered(), and NULL.
Referenced by ast_sip_location_retrieve_contact_and_aor_from_list_filtered(), and ast_sip_location_retrieve_first_aor_contact().
int ast_sip_location_update_contact | ( | struct ast_sip_contact * | contact | ) |
Update a contact.
contact | New contact object with details |
-1 | failure |
0 | success |
Definition at line 445 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_update().
Referenced by register_aor_core().
void ast_sip_message_apply_transport | ( | const char * | transport_name, |
pjsip_tx_data * | tdata | ||
) |
Apply the configuration for a transport to an outgoing message.
transport_name | The name of the transport to apply configuration from |
tdata | The SIP message |
Definition at line 301 of file config_transport.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_sip_add_header(), ast_sip_get_transport_state(), ast_strlen_zero, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_transport_state::flow, ast_sip_transport_state::preferred_identity, and ast_sip_transport_state::service_routes.
Referenced by ast_sip_send_out_of_dialog_request(), handle_outgoing_request(), handle_outgoing_response(), and supplement_outgoing_response().
void ast_sip_modify_id_header | ( | pj_pool_t * | pool, |
pjsip_fromto_hdr * | id_hdr, | ||
const struct ast_party_id * | id | ||
) |
Set name and number information on an identity header.
pool | Memory pool to use for string duplication |
id_hdr | A From, P-Asserted-Identity, or Remote-Party-ID header to modify |
id | The identity information to apply to the header |
Definition at line 5587 of file res_pjsip.c.
References ast_alloca, ast_escape_quoted(), ast_strlen_zero, ast_party_id::name, NULL, ast_party_id::number, ast_party_name::str, ast_party_number::str, ast_party_name::valid, and ast_party_number::valid.
Referenced by add_pai_header(), add_rpid_header(), and set_from_header().
void ast_sip_persistent_endpoint_publish_contact_state | ( | const char * | endpoint_name, |
const struct ast_sip_contact_status * | contact_status | ||
) |
Publish the change of state for a contact.
endpoint_name | The SIP endpoint name. |
contact_status | The contact status. |
Definition at line 1386 of file pjsip_configuration.c.
References ao2_find, ao2_ref, ast_sip_contact_status::aor, ast_endpoint_blob_publish(), ast_endpoint_contact_state_type(), ast_endpoint_get_resource(), ast_json_pack(), ast_json_unref(), ast_sip_get_contact_status_label(), sip_persistent_endpoint::endpoint, OBJ_SEARCH_KEY, ast_sip_contact_status::rtt, ast_sip_contact_status::status, and ast_sip_contact_status::uri.
Referenced by sip_options_publish_contact_state().
int ast_sip_persistent_endpoint_update_state | ( | const char * | endpoint_name, |
enum ast_endpoint_state | state | ||
) |
Change state of a persistent endpoint.
endpoint_name | The SIP endpoint name to change state. |
state | The new state |
0 | Success |
-1 | Endpoint not found |
Definition at line 1329 of file pjsip_configuration.c.
References ao2_find, ao2_ref, ast_add_extension(), ast_context_remove_extension(), AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, ast_devstate_changed(), ast_endpoint_blob_publish(), ast_endpoint_get_resource(), ast_endpoint_get_state(), AST_ENDPOINT_OFFLINE, AST_ENDPOINT_ONLINE, ast_endpoint_set_state(), ast_endpoint_state_type(), ast_exists_extension(), ast_free, ast_free_ptr(), ast_json_pack(), ast_json_unref(), ast_sip_get_regcontext(), ast_strdup, ast_strlen_zero, ast_verb, E_MATCH, sip_persistent_endpoint::endpoint, NULL, OBJ_SEARCH_KEY, pbx_find_extension(), regcontext, and pbx_find_info::stacklen.
Referenced by sip_options_synchronize_endpoint(), sip_options_unused_endpoint_state_compositor(), and sip_options_update_endpoint_state_compositor_aor().
char* ast_sip_rdata_get_header_value | ( | pjsip_rx_data * | rdata, |
const pj_str_t | str | ||
) |
Get a specific header value from rdata.
rdata | The rdata |
str | The header to find |
NULL | on failure |
The | header value on success |
Definition at line 3543 of file res_pjsip.c.
References NULL.
Referenced by stir_shaken_incoming_request().
int ast_sip_register_authenticator | ( | struct ast_sip_authenticator * | auth | ) |
Register a SIP authenticator.
An authenticator has three main purposes: 1) Determining if authentication should be performed on an incoming request 2) Gathering credentials necessary for issuing an authentication challenge 3) Authenticating a request that has credentials
Asterisk provides a default authenticator, but it may be replaced by a custom one if desired.
auth | The authenticator to register |
0 | Success |
-1 | Failure |
Definition at line 3338 of file res_pjsip.c.
References ast_debug, ast_log, and LOG_WARNING.
Referenced by load_module().
void ast_sip_register_endpoint_formatter | ( | struct ast_sip_endpoint_formatter * | obj | ) |
Register an endpoint formatter.
obj | the formatter to register |
Definition at line 3679 of file res_pjsip.c.
References AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, lock, ast_cli_entry::next, and SCOPED_LOCK.
Referenced by ast_res_pjsip_init_options_handling(), ast_sip_initialize_sorcery_auth(), ast_sip_initialize_sorcery_location(), ast_sip_initialize_sorcery_transport(), and load_module().
int ast_sip_register_endpoint_identifier | ( | struct ast_sip_endpoint_identifier * | identifier | ) |
Register a SIP endpoint identifier.
An endpoint identifier's purpose is to determine which endpoint a given SIP message has come from.
Multiple endpoint identifiers may be registered so that if an endpoint cannot be identified by one identifier, it may be identified by another.
Asterisk provides two endpoint identifiers. One identifies endpoints based on the user part of the From header URI. The other identifies endpoints based on the source IP address.
If the order in which endpoint identifiers is run is important to you, then be sure to load individual endpoint identifier modules in the order you wish for them to be run in modules.conf
identifier | The SIP endpoint identifier to register |
0 | Success |
-1 | Failure |
Definition at line 3508 of file res_pjsip.c.
References ast_sip_register_endpoint_identifier_with_name(), and NULL.
Referenced by load_module().
int ast_sip_register_endpoint_identifier_with_name | ( | struct ast_sip_endpoint_identifier * | identifier, |
const char * | name | ||
) |
Register a SIP endpoint identifier with a name.
An endpoint identifier's purpose is to determine which endpoint a given SIP message has come from.
Multiple endpoint identifiers may be registered so that if an endpoint cannot be identified by one identifier, it may be identified by another.
identifier | The SIP endpoint identifier to register |
name | The name of the endpoint identifier |
0 | Success |
-1 | Failure |
Definition at line 3431 of file res_pjsip.c.
References ast_calloc, ast_debug, ast_free, ast_log, AST_RWLIST_EMPTY, AST_RWLIST_INSERT_AFTER, AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_HEAD, AST_RWLIST_INSERT_TAIL, AST_RWLIST_NEXT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sip_get_endpoint_identifier_order(), ast_strlen_zero, endpoint_identifier_list::identifier, lock, LOG_ERROR, endpoint_identifier_list::name, endpoint_identifier_list::priority, and SCOPED_LOCK.
Referenced by ast_sip_register_endpoint_identifier(), and load_module().
int ast_sip_register_outbound_authenticator | ( | struct ast_sip_outbound_authenticator * | outbound_auth | ) |
Register an outbound SIP authenticator.
An outbound authenticator is responsible for creating responses to authentication challenges by remote endpoints.
auth | The authenticator to register |
0 | Success |
-1 | Failure |
Definition at line 3389 of file res_pjsip.c.
References ast_debug, ast_log, and LOG_WARNING.
Referenced by load_module().
int ast_sip_register_service | ( | pjsip_module * | module | ) |
Register a SIP service in Asterisk.
This is more-or-less a wrapper around pjsip_endpt_register_module(). Registering a service makes it so that PJSIP will call into the service at appropriate times. For more information about PJSIP module callbacks, see the PJSIP documentation. Asterisk modules that call this function will likely do so at module load time.
module | The module that is to be registered with PJSIP |
0 | Success |
-1 | Failure |
Definition at line 3315 of file res_pjsip.c.
References ast_sip_push_task_wait_servant(), NULL, and register_service().
Referenced by ast_res_pjsip_init_message_filter(), ast_sip_initialize_distributor(), ast_sip_initialize_global_headers(), ast_sip_initialize_transport_management(), and load_module().
void ast_sip_register_supplement | ( | struct ast_sip_supplement * | supplement | ) |
Register a supplement to SIP out of dialog processing.
This allows for someone to insert themselves in the processing of out of dialog SIP requests and responses. This, for example could allow for a module to set channel data based on headers in an incoming message. Similarly, a module could reject an incoming request if desired.
supplement | The supplement to register |
0 | Success |
-1 | Failure |
Definition at line 4511 of file res_pjsip.c.
References AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, lock, ast_sip_supplement::next, ast_sip_supplement::priority, and SCOPED_LOCK.
Referenced by ast_res_pjsip_init_message_filter(), and load_module().
void ast_sip_report_auth_challenge_sent | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata, | ||
pjsip_tx_data * | tdata | ||
) |
Send a security event notification for when an authentication challenge is sent.
endpoint | Pointer to the endpoint in use |
rdata | Received message |
tdata | Sent message |
Definition at line 197 of file res/res_pjsip/security_events.c.
References ast_copy_pj_str(), AST_SEC_EVT, AST_SECURITY_EVENT_CHAL_SENT, AST_SECURITY_EVENT_CHAL_SENT_VERSION, ast_security_event_report(), ast_security_event_chal_sent::common, ast_security_event_common::event_type, get_account_id(), NULL, security_event_get_transport(), and security_event_populate().
Referenced by authenticate().
void ast_sip_report_auth_failed_challenge_response | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata | ||
) |
Send a security event notification for when a challenge response has failed.
endpoint | Pointer to the endpoint in use |
rdata | Received message |
Definition at line 130 of file res/res_pjsip/security_events.c.
References ast_copy_pj_str(), AST_SEC_EVT, AST_SECURITY_EVENT_CHAL_RESP_FAILED, AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION, ast_security_event_report(), ast_security_event_chal_resp_failed::common, ast_security_event_common::event_type, get_account_id(), NULL, ast_security_event_chal_resp_failed::response, security_event_get_transport(), and security_event_populate().
Referenced by authenticate().
void ast_sip_report_auth_success | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata | ||
) |
Send a security event notification for when authentication succeeds.
endpoint | Pointer to the endpoint in use |
rdata | Received message |
Definition at line 168 of file res/res_pjsip/security_events.c.
References AST_SEC_EVT, ast_security_event_report(), AST_SECURITY_EVENT_SUCCESSFUL_AUTH, AST_SECURITY_EVENT_SUCCESSFUL_AUTH_VERSION, ast_security_event_successful_auth::common, ast_security_event_common::event_type, get_account_id(), NULL, security_event_get_transport(), and security_event_populate().
Referenced by authenticate().
void ast_sip_report_failed_acl | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata, | ||
const char * | name | ||
) |
Send a security event notification for when an ACL check fails.
endpoint | Pointer to the endpoint in use |
rdata | Received message |
name | Name of the ACL |
Definition at line 102 of file res/res_pjsip/security_events.c.
References AST_SEC_EVT, AST_SECURITY_EVENT_FAILED_ACL, AST_SECURITY_EVENT_FAILED_ACL_VERSION, ast_security_event_report(), ast_security_event_failed_acl::common, ast_security_event_common::event_type, get_account_id(), name, security_event_get_transport(), and security_event_populate().
Referenced by apply_endpoint_acl(), apply_endpoint_contact_acl(), register_aor_core(), and registrar_on_rx_request().
void ast_sip_report_invalid_endpoint | ( | const char * | name, |
pjsip_rx_data * | rdata | ||
) |
Send a security event notification for when an invalid endpoint is requested.
name | Name of the endpoint requested |
rdata | Received message |
Definition at line 75 of file res/res_pjsip/security_events.c.
References AST_SEC_EVT, AST_SECURITY_EVENT_INVAL_ACCT_ID, AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION, ast_security_event_report(), ast_security_event_inval_acct_id::common, ast_security_event_common::event_type, name, security_event_get_transport(), and security_event_populate().
Referenced by check_endpoint(), and endpoint_lookup().
void ast_sip_report_mem_limit | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata | ||
) |
Send a security event notification for when a memory limit is hit.
endpoint | Pointer to the endpoint in use |
rdata | Received message |
Definition at line 259 of file res/res_pjsip/security_events.c.
References AST_SEC_EVT, AST_SECURITY_EVENT_MEM_LIMIT, AST_SECURITY_EVENT_MEM_LIMIT_VERSION, ast_security_event_report(), ast_security_event_mem_limit::common, ast_security_event_common::event_type, get_account_id(), security_event_get_transport(), and security_event_populate().
void ast_sip_report_req_no_support | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata, | ||
const char * | req_type | ||
) |
Send a security event notification for when a request is not supported.
endpoint | Pointer to the endpoint in use |
rdata | Received message |
req_type | the type of request |
Definition at line 230 of file res/res_pjsip/security_events.c.
References AST_SEC_EVT, ast_security_event_report(), AST_SECURITY_EVENT_REQ_NO_SUPPORT, AST_SECURITY_EVENT_REQ_NO_SUPPORT_VERSION, ast_security_event_req_no_support::common, ast_security_event_common::event_type, get_account_id(), security_event_get_transport(), and security_event_populate().
Referenced by find_registrar_aor(), and registrar_on_rx_request().
int ast_sip_requires_authentication | ( | struct ast_sip_endpoint * | endpoint, |
pjsip_rx_data * | rdata | ||
) |
Determine if an incoming request requires authentication.
This calls into the registered authenticator's requires_authentication callback in order to determine if the request requires authentication.
If there is no registered authenticator, then authentication will be assumed not to be required.
endpoint | The endpoint from which the request originates |
rdata | The incoming SIP request |
non-zero | The request requires authentication |
0 | The request does not require authentication |
Definition at line 3361 of file res_pjsip.c.
References ast_sip_endpoint::allow_unauthenticated_options, ast_debug, ast_log, LOG_WARNING, and ast_sip_authenticator::requires_authentication.
Referenced by authenticate().
int ast_sip_retrieve_auths | ( | const struct ast_sip_auth_vector * | auths, |
struct ast_sip_auth ** | out | ||
) |
Retrieve relevant SIP auth structures from sorcery.
auths | Vector of sorcery IDs of auth credentials to retrieve | |
[out] | out | The retrieved auths are stored here |
Definition at line 2360 of file pjsip_configuration.c.
References ast_log, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), AST_VECTOR_GET, AST_VECTOR_SIZE, LOG_NOTICE, and name.
Referenced by digest_check_auth(), and set_outbound_initial_authentication_credentials().
int ast_sip_retrieve_auths_vector | ( | const struct ast_sip_auth_vector * | auth_ids, |
struct ast_sip_auth_objects_vector * | auth_objects | ||
) |
Definition at line 2385 of file pjsip_configuration.c.
References ast_log, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_SIZE, LOG_WARNING, and name.
Referenced by digest_create_request_with_auth().
int ast_sip_send_out_of_dialog_request | ( | pjsip_tx_data * | tdata, |
struct ast_sip_endpoint * | endpoint, | ||
int | timeout, | ||
void * | token, | ||
void(*)(void *token, pjsip_event *e) | callback | ||
) |
General purpose method for sending an Out-Of-Dialog SIP request.
This is a companion function for ast_sip_create_request. The request created there can be passed to this function, though any request may be passed in.
This will automatically set up handling outbound authentication challenges if they arrive.
tdata | The request to send |
endpoint | Optional. If specified, the out-of-dialog request is sent to the endpoint. |
timeout. | If non-zero, after the timeout the transaction will be terminated and the callback will be called with the PJSIP_EVENT_TIMER type. |
token | Data to be passed to the callback upon receipt of out-of-dialog response. |
callback | Callback to be called upon receipt of out-of-dialog response. |
0 | Success |
-1 | Failure (out-of-dialog callback will not be called.) |
Definition at line 4993 of file res_pjsip.c.
References ao2_cleanup, AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_sip_message_apply_transport(), ast_sip_mod_data_get, ast_sip_mod_data_set, does_method_match(), endpt_send_request(), ast_sip_supplement::method, MOD_DATA_CONTACT, NULL, ast_sip_supplement::outgoing_request, send_request_data_alloc(), supplement_module, and ast_sip_endpoint::transport.
Referenced by ast_sip_send_request(), and sip_options_qualify_contact().
int ast_sip_send_request | ( | pjsip_tx_data * | tdata, |
struct pjsip_dialog * | dlg, | ||
struct ast_sip_endpoint * | endpoint, | ||
void * | token, | ||
void(*)(void *token, pjsip_event *e) | callback | ||
) |
General purpose method for sending a SIP request.
This is a companion function for ast_sip_create_request. The request created there can be passed to this function, though any request may be passed in.
This will automatically set up handling outbound authentication challenges if they arrive.
tdata | The request to send |
dlg | Optional. The dialog in which the request is sent. Otherwise it is out-of-dialog. |
endpoint | Optional. If specified, the out-of-dialog request is sent to the endpoint. |
token | Data to be passed to the callback upon receipt of out-of-dialog response. |
callback | Callback to be called upon receipt of out-of-dialog response. |
0 | Success |
-1 | Failure (out-of-dialog callback will not be called.) |
Definition at line 5034 of file res_pjsip.c.
References ast_assert, ast_sip_send_out_of_dialog_request(), and send_in_dialog_request().
Referenced by msg_send(), notify_channel(), notify_contact(), notify_uri(), send_unsolicited_mwi_notify_to_contact(), and sendtext().
int ast_sip_send_response | ( | pjsip_response_addr * | res_addr, |
pjsip_tx_data * | tdata, | ||
struct ast_sip_endpoint * | sip_endpoint | ||
) |
Send a response to an out of dialog request.
Use this function sparingly, since this does not create a transaction within PJSIP. This means that if the request is retransmitted, it is your responsibility to detect this and not process the same request twice, and to send the same response for each retransmission.
res_addr | The response address for this response |
tdata | The response to send |
endpoint | The ast_sip_endpoint associated with this response |
0 | Success |
-1 | Failure |
Definition at line 5407 of file res_pjsip.c.
References ast_sip_get_pjsip_endpoint(), NULL, status, and supplement_outgoing_response().
int ast_sip_send_stateful_response | ( | pjsip_rx_data * | rdata, |
pjsip_tx_data * | tdata, | ||
struct ast_sip_endpoint * | sip_endpoint | ||
) |
Send a stateful response to an out of dialog request.
This creates a transaction within PJSIP, meaning that if the request that we are responding to is retransmitted, we will not attempt to re-handle the request.
rdata | The request that is being responded to |
tdata | The response to send |
endpoint | The ast_sip_endpoint associated with this response |
0 | Success |
-1 | Failure |
Definition at line 5420 of file res_pjsip.c.
References ao2_cleanup, ast_sip_mod_data_get, ast_sip_mod_data_set, MOD_DATA_CONTACT, NULL, supplement_module, and supplement_outgoing_response().
Referenced by register_aor(), send_options_response(), and send_response().
struct ast_sip_service_route_vector* ast_sip_service_route_vector_alloc | ( | void | ) |
Allocate a vector of service routes.
non-NULL | success |
NULL | failure |
Definition at line 352 of file config_transport.c.
References ast_calloc, AST_VECTOR_INIT, and NULL.
Referenced by save_response_fields_to_transport().
void ast_sip_service_route_vector_destroy | ( | struct ast_sip_service_route_vector * | service_routes | ) |
Destroy a vector of service routes.
service_routes | A vector of service routes |
Definition at line 366 of file config_transport.c.
References ast_free, and AST_VECTOR_CALLBACK_VOID.
Referenced by ast_sip_transport_state_set_service_routes(), and save_response_fields_to_transport().
int ast_sip_set_outbound_proxy | ( | pjsip_tx_data * | tdata, |
const char * | proxy | ||
) |
Set the outbound proxy for an outbound SIP message.
tdata | The message to set the outbound proxy on |
proxy | SIP uri of the proxy |
0 | Success |
-1 | Failure |
Definition at line 5047 of file res_pjsip.c.
Referenced by create_out_of_dialog_request(), path_outgoing_request(), and sip_options_qualify_contact().
int ast_sip_set_tpselector_from_ep_or_uri | ( | const struct ast_sip_endpoint * | endpoint, |
pjsip_sip_uri * | sip_uri, | ||
pjsip_tpselector * | selector | ||
) |
Sets pjsip_tpselector from an endpoint or uri.
endpoint | If endpoint->transport is set, it's used |
sip_uri | If sip_uri contains a x-ast-txp parameter, it's used |
selector | The selector to be populated |
0 | success |
-1 | failure |
Definition at line 3975 of file res_pjsip.c.
References ast_sip_get_transport_name(), and ast_sip_set_tpselector_from_transport_name().
Referenced by ast_sip_dlg_set_transport(), create_dialog_uas(), and create_out_of_dialog_request().
int ast_sip_set_tpselector_from_transport | ( | const struct ast_sip_transport * | transport, |
pjsip_tpselector * | selector | ||
) |
Sets pjsip_tpselector from ast_sip_transport.
transport | The transport to be used |
selector | The selector to be populated |
0 | success |
-1 | failure |
Definition at line 3907 of file res_pjsip.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_log, ast_sip_get_transport_state(), ast_sorcery_object_get_id(), AST_TRANSPORT_WS, AST_TRANSPORT_WSS, ast_sip_transport_state::factory, ast_sip_transport_state::flow, ast_sip_transport::flow, LOG_ERROR, LOG_WARNING, ast_sip_transport_state::transport, and ast_sip_transport::type.
Referenced by ast_sip_set_tpselector_from_transport_name().
int ast_sip_set_tpselector_from_transport_name | ( | const char * | transport_name, |
pjsip_tpselector * | selector | ||
) |
Sets pjsip_tpselector from ast_sip_transport.
transport_name | The name of the transport to be used |
selector | The selector to be populated |
0 | success |
-1 | failure |
Definition at line 3957 of file res_pjsip.c.
References ao2_cleanup, ast_log, ast_sip_get_sorcery(), ast_sip_set_tpselector_from_transport(), ast_sorcery_retrieve_by_id(), ast_strlen_zero, LOG_ERROR, NULL, RAII_VAR, and ast_sip_transport_state::transport.
Referenced by ast_sip_set_tpselector_from_ep_or_uri(), registration_client_send(), set_transport(), and sip_outbound_registration_regc_alloc().
int ast_sip_sorcery_object_to_ami | ( | const void * | obj, |
struct ast_str ** | buf | ||
) |
Converts a sorcery object to a string of object properties.
obj | the sorcery object to convert |
str | the string buffer to write the object data |
0 | Success, non-zero on failure |
Definition at line 1609 of file pjsip_configuration.c.
References ast_free, AST_HANDLER_ONLY_STRING, ast_sip_get_sorcery(), ast_sorcery_objectset_create2(), ast_str_append(), ast_to_camel_case, ast_variables_destroy(), ast_variable::name, ast_variable::next, RAII_VAR, sip_sorcery_object_ami_set_type_name(), and ast_variable::value.
Referenced by ami_outbound_registration_task(), ami_registrations_aor(), format_ami_resource_lists(), sip_auth_to_ami(), sip_contact_to_ami(), sip_endpoint_to_ami(), sip_identify_to_ami(), and sip_transport_to_ami().
int ast_sip_str_to_dtmf | ( | const char * | dtmf_mode | ) |
Convert the DTMF mode name into an enum.
dtmf_mode | dtmf mode as a string |
>= | 0 The enum value |
-1 | Failure |
Definition at line 5513 of file res_pjsip.c.
References AST_SIP_DTMF_AUTO, AST_SIP_DTMF_AUTO_INFO, AST_SIP_DTMF_INBAND, AST_SIP_DTMF_INFO, AST_SIP_DTMF_NONE, AST_SIP_DTMF_RFC_4733, and result.
Referenced by dtmf_handler(), and pjsip_acf_dtmf_mode_write().
struct ast_threadpool* ast_sip_threadpool | ( | void | ) |
Retrieve the SIP threadpool object.
Definition at line 5630 of file res_pjsip.c.
References sip_threadpool.
Referenced by load_module().
long ast_sip_threadpool_queue_size | ( | void | ) |
Return the size of the SIP threadpool's task queue.
Definition at line 5625 of file res_pjsip.c.
References ast_threadpool_queue_size().
void ast_sip_tpselector_unref | ( | pjsip_tpselector * | selector | ) |
Unreference a pjsip_tpselector.
selector | The selector to be unreffed |
Definition at line 3987 of file res_pjsip.c.
Referenced by ast_sip_create_dialog_uac(), ast_sip_dlg_set_transport(), create_dialog_uas(), create_out_of_dialog_request(), registration_client_send(), set_transport(), and sip_outbound_registration_regc_alloc().
enum ast_transport_monitor_reg ast_sip_transport_monitor_register | ( | pjsip_transport * | transport, |
ast_transport_monitor_shutdown_cb | cb, | ||
void * | ao2_data | ||
) |
Register a reliable transport shutdown monitor callback.
transport | Transport to monitor for shutdown. |
cb | Who to call when transport is shutdown. |
ao2_data | Data to pass with the callback. |
There is no checking for duplicate registrations.
Definition at line 306 of file pjsip_transport_events.c.
References ast_sip_transport_monitor_register_replace(), and NULL.
Referenced by registration_transport_monitor_setup(), and subscription_persistence_update().
enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace | ( | pjsip_transport * | transport, |
ast_transport_monitor_shutdown_cb | cb, | ||
void * | ao2_data, | ||
ast_transport_monitor_data_matcher | matches | ||
) |
Register a reliable transport shutdown monitor callback replacing any duplicate.
transport | Transport to monitor for shutdown. |
cb | Who to call when transport is shutdown. |
ao2_data | Data to pass with the callback. |
matches | Matcher function that returns true if data matches a previously registered data object |
This function checks for duplicates, and overwrites/replaces the old monitor with the given one.
Definition at line 312 of file pjsip_transport_events.c.
References ao2_bump, ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_assert, ast_debug, AST_TRANSPORT_MONITOR_REG_FAILED, AST_TRANSPORT_MONITOR_REG_NOT_FOUND, AST_TRANSPORT_MONITOR_REG_SUCCESS, AST_VECTOR_APPEND, transport_monitor_notifier::cb, callback_data::cb, transport_monitor_notifier::data, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, ptr_matcher(), and transport_monitor_unregister_cb().
Referenced by ast_sip_transport_monitor_register(), and register_aor_core().
void ast_sip_transport_monitor_unregister | ( | pjsip_transport * | transport, |
ast_transport_monitor_shutdown_cb | cb, | ||
void * | data, | ||
ast_transport_monitor_data_matcher | matches | ||
) |
Unregister a reliable transport shutdown monitor.
transport | Transport to monitor for shutdown. |
cb | The callback that was used for the original register. |
data | Data to pass to the matcher. May be NULL and does NOT need to be an ao2 object. If NULL, all monitors with the provided callbck are unregistered. |
matches | Matcher function that returns true if data matches the previously registered data object. If NULL, a simple pointer comparison is done. |
Definition at line 277 of file pjsip_transport_events.c.
References ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_assert, transport_monitor_notifier::cb, callback_data::cb, transport_monitor_notifier::data, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, ptr_matcher(), and transport_monitor_unregister_cb().
Referenced by handle_registration_response(), registrar_contact_delete(), and subscription_persistence_remove().
void ast_sip_transport_monitor_unregister_all | ( | ast_transport_monitor_shutdown_cb | cb, |
void * | data, | ||
ast_transport_monitor_data_matcher | matches | ||
) |
Unregister a transport shutdown monitor from all reliable transports.
cb | The callback that was used for the original register. |
data | Data to pass to the matcher. May be NULL and does NOT need to be an ao2 object. If NULL, all monitors with the provided callbck are unregistered. |
matches | Matcher function that returns true if ao2_data matches the previously registered data object. If NULL, a simple pointer comparison is done. |
Definition at line 257 of file pjsip_transport_events.c.
References ao2_callback, ao2_global_obj_ref, ao2_ref, ast_assert, transport_monitor_notifier::cb, callback_data::cb, transport_monitor_notifier::data, NULL, OBJ_MULTIPLE, OBJ_NODATA, ptr_matcher(), and transport_monitor_unregister_cb().
Referenced by registrar_contact_delete(), and unload_module().
void ast_sip_transport_state_register | ( | struct ast_sip_tpmgr_state_callback * | element | ) |
Register a transport state notification callback element.
element | What we are registering. |
Definition at line 366 of file pjsip_transport_events.c.
References AST_LIST_INSERT_HEAD, AST_LIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and transport_state_list.
Referenced by ast_sip_initialize_transport_management().
int ast_sip_transport_state_set_preferred_identity | ( | const char * | transport_name, |
const char * | identity | ||
) |
Sets the P-Preferred-Identity on a child transport.
transport_name | The name of the transport to be set on |
identity | The P-Preferred-Identity to use on requests on this transport |
0 | success |
-1 | failure |
Definition at line 242 of file config_transport.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_free, ast_sip_get_transport_state(), ast_strdup, ast_strlen_zero, ast_sip_transport_state::flow, and ast_sip_transport_state::preferred_identity.
Referenced by save_response_fields_to_transport().
int ast_sip_transport_state_set_service_routes | ( | const char * | transport_name, |
struct ast_sip_service_route_vector * | service_routes | ||
) |
Sets the service routes on a child transport.
transport_name | The name of the transport to be set on |
service_routes | A vector of service routes |
0 | success |
-1 | failure |
Definition at line 270 of file config_transport.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_sip_get_transport_state(), ast_sip_service_route_vector_destroy(), ast_strlen_zero, ast_sip_transport_state::flow, and ast_sip_transport_state::service_routes.
Referenced by save_response_fields_to_transport().
int ast_sip_transport_state_set_transport | ( | const char * | transport_name, |
pjsip_transport * | transport | ||
) |
Sets the PJSIP transport on a child transport.
transport_name | The name of the transport to be updated |
transport | The PJSIP transport |
0 | success |
-1 | failure |
Definition at line 206 of file config_transport.c.
References ao2_lock, ao2_ref, ao2_unlock, ast_sip_get_transport_state(), ast_strlen_zero, ast_sip_transport_state::flow, internal_state::transport, and ast_sip_transport_state::transport.
Referenced by save_response_fields_to_transport().
void ast_sip_transport_state_unregister | ( | struct ast_sip_tpmgr_state_callback * | element | ) |
Unregister a transport state notification callback element.
element | What we are unregistering. |
Definition at line 359 of file pjsip_transport_events.c.
References AST_LIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and transport_state_list.
Referenced by ast_sip_destroy_transport_management().
void ast_sip_unregister_authenticator | ( | struct ast_sip_authenticator * | auth | ) |
Unregister a SIP authenticator.
When there is no authenticator registered, requests cannot be challenged or authenticated.
auth | The authenticator to unregister |
Definition at line 3350 of file res_pjsip.c.
References ast_debug, ast_log, LOG_WARNING, and NULL.
Referenced by unload_module().
void ast_sip_unregister_endpoint_formatter | ( | struct ast_sip_endpoint_formatter * | obj | ) |
Unregister an endpoint formatter.
obj | the formatter to unregister |
Definition at line 3685 of file res_pjsip.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, lock, and SCOPED_LOCK.
Referenced by ast_res_pjsip_cleanup_options_handling(), ast_sip_destroy_sorcery_auth(), ast_sip_destroy_sorcery_location(), ast_sip_destroy_sorcery_transport(), and unload_module().
void ast_sip_unregister_endpoint_identifier | ( | struct ast_sip_endpoint_identifier * | identifier | ) |
Unregister a SIP endpoint identifier.
This stops an endpoint identifier from being used.
identifier | The SIP endoint identifier to unregister |
Definition at line 3513 of file res_pjsip.c.
References ast_debug, ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, endpoint_identifier_list::identifier, lock, and SCOPED_LOCK.
Referenced by unload_module().
void ast_sip_unregister_outbound_authenticator | ( | struct ast_sip_outbound_authenticator * | auth | ) |
Unregister an outbound SIP authenticator.
When there is no outbound authenticator registered, authentication challenges will be handled as any other final response would be.
auth | The authenticator to unregister |
Definition at line 3401 of file res_pjsip.c.
References ast_debug, ast_log, LOG_WARNING, and NULL.
Referenced by unload_module().
void ast_sip_unregister_service | ( | pjsip_module * | module | ) |
This is the opposite of ast_sip_register_service(). Unregistering a service means that PJSIP will no longer call into the module any more. This will likely occur when an Asterisk module is unloaded.
module | The PJSIP module to unregister |
Definition at line 3331 of file res_pjsip.c.
References ast_sip_push_task_wait_servant(), NULL, and unregister_service().
Referenced by ast_res_pjsip_cleanup_message_filter(), ast_sip_destroy_distributor(), ast_sip_destroy_global_headers(), ast_sip_destroy_transport_management(), load_module(), unload_module(), and unload_pjsip().
void ast_sip_unregister_supplement | ( | struct ast_sip_supplement * | supplement | ) |
Unregister a an supplement to SIP out of dialog processing.
supplement | The supplement to unregister |
Definition at line 4531 of file res_pjsip.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, lock, ast_sip_supplement::next, and SCOPED_LOCK.
Referenced by ast_res_pjsip_cleanup_message_filter(), and unload_module().
AST_VECTOR | ( | ast_sip_service_route_vector | , |
char * | |||
) |
AST_VECTOR | ( | ast_sip_auth_objects_vector | , |
struct ast_sip_auth * | |||
) |
Retrieve relevant SIP auth structures from sorcery as a vector.
auth_ids | Vector of sorcery IDs of auth credentials to retrieve | |
[out] | auth_objects | A pointer ast_sip_auth_objects_vector to hold the objects |
0 | Success |
-1 | Number of auth objects found is less than the number of names supplied. |
The number of auth objects retrieved may be less than the number of auth ids supplied if auth objects couldn't be found for some of them.
Since the ref count on all auith objects returned has been bumped, you must call ast_sip_cleanup_auth_objects_vector() to decrement the ref count on all of the auth objects in the vector, then call AST_VECTOR_FREE() on the vector itself.