Asterisk - The Open Source Telephony Project GIT-master-b023714
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_cli.h"
#include "asterisk/module.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/cli.h"
#include "asterisk/stasis_system.h"
#include "asterisk/threadstorage.h"
#include "asterisk/threadpool.h"
#include "asterisk/statsd.h"
#include "res_pjsip/include/res_pjsip_private.h"
#include "asterisk/vector.h"
#include "asterisk/pbx.h"
Go to the source code of this file.
Data Structures | |
struct | pjsip_generic_string_hdr_vector |
struct | registration_response |
Structure for registration response. More... | |
struct | sip_ami_outbound |
struct | sip_outbound_registration |
Outbound registration information. More... | |
struct | sip_outbound_registration_client_state |
Outbound registration client state information (persists for lifetime of regc) More... | |
struct | sip_outbound_registration_state |
Outbound registration state information (persists for lifetime that registration should exist) More... | |
Macros | |
#define | DEFAULT_STATE_BUCKETS 53 |
Default number of state container buckets. | |
#define | LINE_PARAMETER_SIZE 8 |
Size of the buffer for creating a unique string for the line. | |
#define | MAX_UNLOAD_TIMEOUT_TIME 35 /* Seconds */ |
#define | REGISTRATION_URI_FIELD_LEN 53 |
#define | REREGISTER_BUFFER_TIME 10 |
Amount of buffer time (in seconds) before expiration that we re-register at. | |
Enumerations | |
enum | sip_outbound_registration_status { SIP_REGISTRATION_UNREGISTERED = 0 , SIP_REGISTRATION_REGISTERED , SIP_REGISTRATION_REJECTED_TEMPORARY , SIP_REGISTRATION_REJECTED_PERMANENT , SIP_REGISTRATION_STOPPING , SIP_REGISTRATION_STOPPED } |
Various states that an outbound registration may be in. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | add_configured_supported_headers (struct sip_outbound_registration_client_state *client_state, pjsip_tx_data *tdata) |
Helper function to add configured supported headers. | |
static void | add_security_headers (struct sip_outbound_registration_client_state *client_state, pjsip_tx_data *tdata) |
Adds security negotiation mechanisms of outbound registration client state as Security headers to tdata. | |
static int | add_to_supported_header (pjsip_tx_data *tdata, pj_str_t *name) |
Helper function to add string to Supported header. | |
static int | ami_outbound_registration_detail (void *obj, void *arg, int flags) |
static int | ami_outbound_registration_task (void *obj) |
static int | ami_register (struct mansession *s, const struct message *m) |
static int | ami_show_outbound_registrations (struct mansession *s, const struct message *m) |
static int | ami_unregister (struct mansession *s, const struct message *m) |
static | AO2_GLOBAL_OBJ_STATIC (current_states) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_THREADSTORAGE_CUSTOM_SCOPE (register_callback_invoked, NULL, ast_free_ptr, static) | |
Some thread local storage used to determine if the running thread invoked the callback. | |
static void | auth_observer (const char *type) |
static int | can_reuse_registration (struct sip_outbound_registration *existing, struct sip_outbound_registration *applied) |
static void | cancel_registration (struct sip_outbound_registration_client_state *client_state) |
Helper function which cancels the timer on a client. | |
static int | check_state (void *obj, void *arg, int flags) |
static char * | cli_complete_registration (const char *line, const char *word, int pos, int state) |
static struct ao2_container * | cli_get_container (const char *regex) |
static int | cli_iterator (void *container, ao2_callback_fn callback, void *args) |
static int | cli_print_body (void *obj, void *arg, int flags) |
static int | cli_print_header (void *obj, void *arg, int flags) |
static char * | cli_register (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void * | cli_retrieve_by_id (const char *id) |
static char * | cli_unregister (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | contact_add_security_headers_to_status (void *obj, void *arg, int flags) |
static int | contact_has_security_mechanisms (void *obj, void *arg, int flags) |
static const char * | fetch_google_access_token (const struct ast_sip_auth *auth) |
Get google oauth2 access token using refresh token. | |
static struct ao2_container * | get_registrations (void) |
static struct sip_outbound_registration_state * | get_state (const char *id) |
static struct pjsip_param * | get_uri_option_line (const void *uri) |
static int | handle_client_registration (void *data) |
Callback function for registering. | |
static int | handle_client_state_destruction (void *data) |
Callback function for unregistering (potentially) and destroying state. | |
static int | handle_registration_response (void *data) |
Callback function for handling a response to a registration attempt. | |
static struct ast_sip_endpoint * | line_identify (pjsip_rx_data *rdata) |
Endpoint identifier which uses the 'line' parameter to establish a relationship to an outgoing registration. | |
static int | line_identify_relationship (void *obj, void *arg, int flags) |
Callback function for matching an outbound registration based on line. | |
static int | load_module (void) |
static int | monitor_matcher (void *a, void *b) |
static char * | my_cli_traverse_objects (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void | network_change_stasis_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | outbound_auth_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | outbound_auths_to_str (const void *obj, const intptr_t *args, char **buf) |
static int | outbound_auths_to_var_list (const void *obj, struct ast_variable **fields) |
static int | queue_register (struct sip_outbound_registration_state *state) |
static int | queue_unregister (struct sip_outbound_registration_state *state) |
static pj_status_t | registration_client_send (struct sip_outbound_registration_client_state *client_state, pjsip_tx_data *tdata) |
Helper function which sends a message and cleans up, if needed, on failure. | |
static void | registration_deleted_observer (const void *obj) |
static void | registration_loaded_observer (const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded) |
static void | registration_response_destroy (void *obj) |
Registration response structure destructor. | |
static int | registration_state_cmp (void *obj, void *arg, int flags) |
comparator function for state objects | |
static int | registration_state_hash (const void *obj, const int flags) |
hashing function for state objects | |
static void | registration_transport_monitor_setup (const char *transport_key, const char *registration_name) |
static void | registration_transport_shutdown_cb (void *obj) |
static int | reload_module (void) |
static void | reregister_all (void) |
static int | reregister_immediately_cb (void *obj) |
static void | save_response_fields_to_transport (struct registration_response *response) |
static void | schedule_registration (struct sip_outbound_registration_client_state *client_state, unsigned int seconds) |
Helper function which sets up the timer to re-register in a specific amount of time. | |
static void | schedule_retry (struct registration_response *response, unsigned int interval, const char *server_uri, const char *client_uri) |
static int | security_mechanism_to_str (const void *obj, const intptr_t *args, char **buf) |
static int | security_mechanisms_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | security_negotiation_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | security_negotiation_to_str (const void *obj, const intptr_t *args, char **buf) |
static int | set_outbound_initial_authentication_credentials (pjsip_regc *regc, const struct ast_sip_auth_vector *auth_vector) |
static int | sip_dialog_create_contact (pj_pool_t *pool, pj_str_t *contact, const char *user, const pj_str_t *target, pjsip_tpselector *selector, const char *line, const char *header_params) |
Helper function which populates a pj_str_t with a contact header. | |
static void * | sip_outbound_registration_alloc (const char *name) |
Allocator function for registration information. | |
static int | sip_outbound_registration_apply (const struct ast_sorcery *sorcery, void *obj) |
Apply function which finds or allocates a state structure. | |
static void | sip_outbound_registration_client_state_destroy (void *obj) |
Destructor function for client registration state. | |
static void | sip_outbound_registration_destroy (void *obj) |
Destructor function for registration information. | |
static int | sip_outbound_registration_is_temporal (unsigned int code, struct sip_outbound_registration_client_state *client_state) |
Helper function which determines if a response code is temporal or not. | |
static int | sip_outbound_registration_perform (void *data) |
Helper function which performs a single registration. | |
static int | sip_outbound_registration_regc_alloc (void *data) |
Helper function that allocates a pjsip registration client and configures it. | |
static void | sip_outbound_registration_response_cb (struct pjsip_regc_cbparam *param) |
Callback function for outbound registration client. | |
static struct sip_outbound_registration_state * | sip_outbound_registration_state_alloc (struct sip_outbound_registration *registration) |
Allocator function for registration state. | |
static void | sip_outbound_registration_state_destroy (void *obj) |
Destructor function for registration state. | |
static const char * | sip_outbound_registration_status_str (enum sip_outbound_registration_status state) |
static void | sip_outbound_registration_timer_cb (pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry) |
Timer callback function, used just for registrations. | |
static int | unload_module (void) |
static void | unregister_all (void) |
static int | unregister_task (void *obj) |
static void | update_client_state_status (struct sip_outbound_registration_client_state *client_state, enum sip_outbound_registration_status status) |
#define DEFAULT_STATE_BUCKETS 53 |
Default number of state container buckets.
Definition at line 630 of file res_pjsip_outbound_registration.c.
#define LINE_PARAMETER_SIZE 8 |
Size of the buffer for creating a unique string for the line.
Definition at line 449 of file res_pjsip_outbound_registration.c.
#define MAX_UNLOAD_TIMEOUT_TIME 35 /* Seconds */ |
Time needs to be long enough for a transaction to timeout if nothing replies.
Definition at line 624 of file res_pjsip_outbound_registration.c.
#define REGISTRATION_URI_FIELD_LEN 53 |
#define REREGISTER_BUFFER_TIME 10 |
Amount of buffer time (in seconds) before expiration that we re-register at.
Definition at line 446 of file res_pjsip_outbound_registration.c.
Various states that an outbound registration may be in.
Definition at line 452 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 3069 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 3069 of file res_pjsip_outbound_registration.c.
|
static |
Helper function to add configured supported headers.
Definition at line 1000 of file res_pjsip_outbound_registration.c.
References add_to_supported_header(), OUTBOUND_NAME, PATH_NAME, sip_outbound_registration_client_state::support_outbound, and sip_outbound_registration_client_state::support_path.
Referenced by handle_client_registration(), handle_client_state_destruction(), and unregister_task().
|
static |
Adds security negotiation mechanisms of outbound registration client state as Security headers to tdata.
Definition at line 821 of file res_pjsip_outbound_registration.c.
References ao2_callback, ao2_cleanup, ao2_lock, ao2_unlock, ast_sip_endpoint::aors, ast_sip_add_security_headers(), ast_sip_get_sorcery(), ast_sip_location_retrieve_contacts_from_aor_list(), ast_sip_remove_headers_by_name_and_value(), AST_SIP_SECURITY_NEG_MEDIASEC, ast_sorcery_retrieve_by_id(), ast_strlen_zero(), AST_VECTOR_SIZE, sip_outbound_registration_client_state::auth_attempted, contact_has_security_mechanisms(), sip_outbound_registration::endpoint, sip_outbound_registration_client_state::last_status_code, NULL, OBJ_NODATA, sip_outbound_registration_client_state::registration_name, ast_sip_contact_status::security_mechanisms, sip_outbound_registration_client_state::security_mechanisms, sip_outbound_registration_client_state::security_negotiation, sip_outbound_registration_client_state::server_security_mechanisms, SIP_REGISTRATION_REJECTED_TEMPORARY, and sip_outbound_registration_client_state::status.
Referenced by registration_client_send().
|
static |
Helper function to add string to Supported header.
Definition at line 965 of file res_pjsip_outbound_registration.c.
Referenced by add_configured_supported_headers().
|
static |
Definition at line 2607 of file res_pjsip_outbound_registration.c.
References sip_ami_outbound::ami, ami_outbound_registration_task(), ast_sip_push_task_wait_servant(), and NULL.
Referenced by ami_show_outbound_registrations().
|
static |
Definition at line 2571 of file res_pjsip_outbound_registration.c.
References sip_ami_outbound::ami, ao2_ref, ast_free, ast_sip_create_ami_event(), ast_sip_format_auths_ami(), ast_sip_sorcery_object_to_ami(), ast_sorcery_object_get_id(), ast_str_append(), ast_str_buffer(), astman_append(), buf, get_state(), sip_ami_outbound::not_registered, sip_outbound_registration::outbound_auths, sip_ami_outbound::registered, sip_ami_outbound::registration, ast_sip_ami::s, sip_outbound_registration_status_str(), and SIP_REGISTRATION_REGISTERED.
Referenced by ami_outbound_registration_detail().
|
static |
Definition at line 2527 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_strlen_zero(), astman_get_header(), astman_send_ack(), astman_send_error(), get_state(), queue_register(), queue_unregister(), and reregister_all().
Referenced by load_module().
|
static |
Definition at line 2615 of file res_pjsip_outbound_registration.c.
References sip_ami_outbound::ami, ami_outbound_registration_detail(), ao2_callback, ao2_ref, astman_append(), astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), get_registrations(), ast_sip_ami::m, sip_ami_outbound::not_registered, OBJ_NODATA, sip_ami_outbound::registered, and ast_sip_ami::s.
Referenced by load_module().
|
static |
Definition at line 2495 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_strlen_zero(), astman_get_header(), astman_send_ack(), astman_send_error(), get_state(), queue_unregister(), and unregister_all().
Referenced by load_module().
|
static |
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 3069 of file res_pjsip_outbound_registration.c.
AST_THREADSTORAGE_CUSTOM_SCOPE | ( | register_callback_invoked | , |
NULL | , | ||
ast_free_ptr | , | ||
static | |||
) |
Some thread local storage used to determine if the running thread invoked the callback.
|
static |
Definition at line 2771 of file res_pjsip_outbound_registration.c.
References ao2_bump, ao2_cleanup, ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_debug, ast_log, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sip_push_task(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_fields(), get_state(), LOG_ERROR, NULL, sip_outbound_registration_perform(), and SIP_REGISTRATION_REJECTED_PERMANENT.
|
static |
Definition at line 1866 of file res_pjsip_outbound_registration.c.
References ast_debug, ast_sip_get_sorcery(), ast_sorcery_changeset_create(), ast_sorcery_object_get_id(), ast_sorcery_objectset_create, ast_variables_destroy(), NULL, and sorcery.
Referenced by sip_outbound_registration_apply().
|
static |
Helper function which cancels the timer on a client.
Definition at line 757 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_get_pjsip_endpoint(), and sip_outbound_registration_client_state::timer.
Referenced by handle_client_state_destruction(), reregister_immediately_cb(), schedule_registration(), and unregister_task().
|
static |
Definition at line 2811 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_id(), and CMP_MATCH.
Referenced by registration_loaded_observer().
|
static |
Definition at line 2360 of file res_pjsip_outbound_registration.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_fields(), ast_strdup, name, NULL, and result.
Referenced by cli_register(), and cli_unregister().
|
static |
Definition at line 2647 of file res_pjsip_outbound_registration.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_container_dup(), ao2_ref, ast_sip_get_sorcery(), ast_sorcery_object_id_compare(), ast_sorcery_object_id_sort(), ast_sorcery_retrieve_by_regex(), container, NULL, RAII_VAR, and regex().
Referenced by load_module().
|
static |
Definition at line 2671 of file res_pjsip_outbound_registration.c.
References ao2_callback, args, callback(), container, and OBJ_NODATA.
Referenced by load_module().
|
static |
Definition at line 2707 of file res_pjsip_outbound_registration.c.
References abs, ao2_cleanup, ast_assert, ast_sip_cli_print_sorcery_objectset(), ast_sorcery_object_get_id(), ast_str_append(), AST_VECTOR_GET, AST_VECTOR_SIZE, get_state(), NULL, sip_outbound_registration::outbound_auths, sip_outbound_registration_state::registration, REGISTRATION_URI_FIELD_LEN, sip_outbound_registration::server_uri, and sip_outbound_registration_status_str().
Referenced by load_module().
|
static |
Definition at line 2695 of file res_pjsip_outbound_registration.c.
References ast_assert, ast_str_append(), and NULL.
Referenced by load_module().
|
static |
Definition at line 2447 of file res_pjsip_outbound_registration.c.
References a, ao2_ref, ast_cli(), cli_complete_registration(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, get_state(), NULL, queue_register(), queue_unregister(), reregister_all(), and ast_cli_entry::usage.
|
static |
Definition at line 2678 of file res_pjsip_outbound_registration.c.
References ao2_find, ao2_global_obj_ref, ao2_ref, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), OBJ_NODATA, OBJ_SEARCH_KEY, and OBJ_UNLINK.
Referenced by load_module().
|
static |
Definition at line 2404 of file res_pjsip_outbound_registration.c.
References a, ao2_ref, ast_cli(), cli_complete_registration(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, get_state(), NULL, queue_unregister(), unregister_all(), and ast_cli_entry::usage.
|
static |
Definition at line 798 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_sip_get_contact_status(), ast_sip_header_to_security_mechanism(), AST_VECTOR_CALLBACK_VOID, AST_VECTOR_SIZE, out, and ast_sip_contact_status::security_mechanisms.
Referenced by handle_registration_response().
|
static |
Definition at line 781 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, ast_sip_get_contact_status(), AST_VECTOR_SIZE, CMP_MATCH, CMP_STOP, and ast_sip_contact_status::security_mechanisms.
Referenced by add_security_headers().
|
static |
Get google oauth2 access token using refresh token.
Definition at line 1890 of file res_pjsip_outbound_registration.c.
References ast_asprintf, ast_debug, ast_free, ast_func_read(), ast_func_write(), ast_json_load_string(), ast_json_object_get(), ast_json_string_get(), ast_json_unref(), ast_log, ast_strdup, buf, error(), LOG_ERROR, NULL, ast_sip_auth::oauth_clientid, ast_sip_auth::oauth_secret, ast_sip_auth::refresh_token, and url.
Referenced by set_outbound_initial_authentication_credentials().
|
static |
Definition at line 699 of file res_pjsip_outbound_registration.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), and NULL.
Referenced by ami_show_outbound_registrations(), and registration_loaded_observer().
|
static |
Definition at line 686 of file res_pjsip_outbound_registration.c.
References ao2_find, ao2_global_obj_ref, ao2_ref, NULL, and OBJ_SEARCH_KEY.
Referenced by ami_outbound_registration_task(), ami_register(), ami_unregister(), auth_observer(), cli_print_body(), cli_register(), cli_unregister(), and registration_transport_shutdown_cb().
|
static |
Definition at line 717 of file res_pjsip_outbound_registration.c.
References ast_sip_pjsip_uri_get_other_param().
Referenced by line_identify().
|
static |
Callback function for registering.
Definition at line 1018 of file res_pjsip_outbound_registration.c.
References add_configured_supported_headers(), ao2_cleanup, ast_log, DEBUG_ATLEAST, LOG_DEBUG, LOG_WARNING, RAII_VAR, registration_client_send(), set_outbound_initial_authentication_credentials(), and SIP_REGISTRATION_STOPPED.
Referenced by reregister_immediately_cb(), and sip_outbound_registration_timer_cb().
|
static |
Callback function for unregistering (potentially) and destroying state.
Definition at line 1123 of file res_pjsip_outbound_registration.c.
References add_configured_supported_headers(), ao2_ref, ast_debug, ast_sip_auth_vector_destroy(), ast_sip_security_mechanisms_vector_destroy(), cancel_registration(), sip_outbound_registration_client_state::client, sip_outbound_registration_client_state::destroy, NULL, sip_outbound_registration_client_state::outbound_auths, registration_client_send(), sip_outbound_registration_client_state::security_mechanisms, sip_outbound_registration_client_state::server_security_mechanisms, SIP_REGISTRATION_REGISTERED, SIP_REGISTRATION_REJECTED_PERMANENT, SIP_REGISTRATION_REJECTED_TEMPORARY, SIP_REGISTRATION_STOPPED, SIP_REGISTRATION_STOPPING, SIP_REGISTRATION_UNREGISTERED, sip_outbound_registration_client_state::status, and update_client_state_status().
Referenced by handle_registration_response(), and sip_outbound_registration_state_destroy().
|
static |
Callback function for handling a response to a registration attempt.
Definition at line 1409 of file res_pjsip_outbound_registration.c.
References ao2_callback, ao2_cleanup, ao2_ref, ast_sip_endpoint::aors, ast_copy_pj_str(), ast_debug, ast_log, ast_sip_create_request_with_auth(), ast_sip_failover_request(), ast_sip_get_sorcery(), ast_sip_header_to_security_mechanism(), ast_sip_location_retrieve_contacts_from_aor_list(), AST_SIP_SECURITY_NEG_MEDIASEC, ast_sip_transport_monitor_unregister_key(), ast_sorcery_retrieve_by_id(), ast_system_publish_registry(), AST_VECTOR_APPEND, AST_VECTOR_FREE, AST_VECTOR_INIT, sip_outbound_registration_client_state::auth_attempted, sip_outbound_registration_client_state::auth_cseq, sip_outbound_registration_client_state::client, registration_response::client_state, registration_response::code, contact_add_security_headers_to_status(), sip_outbound_registration_client_state::destroy, sip_outbound_registration::endpoint, registration_response::expiration, sip_outbound_registration_client_state::fatal_retry_interval, sip_outbound_registration_client_state::forbidden_retry_interval, handle_client_state_destruction(), sip_outbound_registration_client_state::last_status_code, LOG_WARNING, sip_outbound_registration_client_state::max_retries, monitor_matcher(), header::next, NULL, OBJ_NODATA, registration_response::old_request, sip_outbound_registration_client_state::outbound_auths, registration_response::rdata, registration_client_send(), sip_outbound_registration_client_state::registration_name, registration_transport_monitor_setup(), registration_transport_shutdown_cb(), REREGISTER_BUFFER_TIME, sip_outbound_registration_client_state::retries, registration_response::retry_after, sip_outbound_registration_client_state::retry_interval, save_response_fields_to_transport(), schedule_registration(), schedule_retry(), sip_outbound_registration_client_state::security_negotiation, sip_outbound_registration_client_state::server_security_mechanisms, server_uri, sip_outbound_registration_is_temporal(), sip_outbound_registration_status_str(), SIP_REGISTRATION_REGISTERED, SIP_REGISTRATION_REJECTED_PERMANENT, SIP_REGISTRATION_REJECTED_TEMPORARY, SIP_REGISTRATION_STOPPED, SIP_REGISTRATION_UNREGISTERED, sip_outbound_registration_client_state::status, registration_response::transport_key, and update_client_state_status().
Referenced by sip_outbound_registration_response_cb().
|
static |
Endpoint identifier which uses the 'line' parameter to establish a relationship to an outgoing registration.
Definition at line 725 of file res_pjsip_outbound_registration.c.
References ao2_callback, ao2_cleanup, ao2_global_obj_ref, ast_debug, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_id(), ast_strlen_zero(), get_uri_option_line(), line_identify_relationship(), NULL, and RAII_VAR.
|
static |
Callback function for matching an outbound registration based on line.
Definition at line 709 of file res_pjsip_outbound_registration.c.
References CMP_MATCH.
Referenced by line_identify().
|
static |
Definition at line 2945 of file res_pjsip_outbound_registration.c.
References ami_register(), ami_show_outbound_registrations(), ami_unregister(), ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_global_obj_replace_unref, ao2_ref, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_network_change_type(), ast_serializer_shutdown_group_alloc(), ast_sip_get_sorcery(), ast_sip_register_cli_formatter(), ast_sip_register_endpoint_identifier(), ast_sorcery_apply_config, ast_sorcery_apply_default, ast_sorcery_instance_observer_add(), ast_sorcery_load_object(), ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_get_id(), ast_sorcery_object_register, ast_sorcery_observer_add(), AST_STATSD_GAUGE, ast_statsd_log(), ast_system_topic(), cli_formatter, cli_get_container(), cli_iterator(), cli_outbound_registration, cli_print_body(), cli_print_header(), cli_retrieve_by_id(), DEFAULT_STATE_BUCKETS, EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, FLDSET, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, ast_sip_cli_formatter_entry::iterate, line_identifier, LOG_ERROR, max_retries, ast_sip_cli_formatter_entry::name, network_change_stasis_cb(), network_change_sub, new_states, NULL, observer_callbacks_auth, observer_callbacks_registrations, OPT_BOOL_T, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, OPT_YESNO_T, outbound_auth_handler(), outbound_auths_to_str(), outbound_auths_to_var_list(), ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, registration_observer, registration_state_cmp(), registration_state_hash(), ast_sip_cli_formatter_entry::retrieve_by_id, security_mechanism_to_str(), security_mechanisms_handler(), security_negotiation_handler(), security_negotiation_to_str(), server_uri, shutdown_group, sip_outbound_registration_alloc(), sip_outbound_registration_apply(), stasis_subscribe, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), STRFLDSET, and unload_module().
|
static |
Definition at line 1307 of file res_pjsip_outbound_registration.c.
Referenced by handle_registration_response(), and registration_transport_monitor_setup().
|
static |
Definition at line 2745 of file res_pjsip_outbound_registration.c.
References a, and ast_sip_cli_traverse_objects().
|
static |
Definition at line 2887 of file res_pjsip_outbound_registration.c.
References ast_debug, ast_network_change_type(), and reregister_all().
Referenced by load_module().
|
static |
Definition at line 2264 of file res_pjsip_outbound_registration.c.
References ast_sip_auth_vector_init(), sip_outbound_registration::outbound_auths, and var.
Referenced by load_module().
|
static |
Definition at line 2271 of file res_pjsip_outbound_registration.c.
References ast_sip_auths_to_str(), buf, and sip_outbound_registration::outbound_auths.
Referenced by load_module().
|
static |
Definition at line 2278 of file res_pjsip_outbound_registration.c.
References ast_variable_list_append, ast_variable_new, AST_VECTOR_GET, AST_VECTOR_SIZE, NULL, and sip_outbound_registration::outbound_auths.
Referenced by load_module().
|
static |
Definition at line 2329 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_push_task(), and sip_outbound_registration_perform().
Referenced by ami_register(), and cli_register().
|
static |
Definition at line 2318 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_push_task(), and unregister_task().
Referenced by ami_register(), ami_unregister(), cli_register(), and cli_unregister().
|
static |
Helper function which sends a message and cleans up, if needed, on failure.
Definition at line 883 of file res_pjsip_outbound_registration.c.
References add_security_headers(), ao2_ref, ast_log, ast_sip_set_tpselector_from_transport_name(), ast_sip_tpselector_unref(), ast_strlen_zero(), ast_threadstorage_get(), sip_outbound_registration_client_state::client, sip_outbound_registration_client_state::last_tdata, LOG_ERROR, NULL, sip_outbound_registration_client_state::registration_name, status, sip_outbound_registration_client_state::transport_name, and sip_outbound_registration_client_state::user_agent.
Referenced by handle_client_registration(), handle_client_state_destruction(), handle_registration_response(), and unregister_task().
|
static |
Definition at line 2867 of file res_pjsip_outbound_registration.c.
References ao2_find, ao2_global_obj_ref, ao2_ref, ast_sorcery_object_get_id(), OBJ_NODATA, OBJ_SEARCH_KEY, and OBJ_UNLINK.
|
static |
Definition at line 2836 of file res_pjsip_outbound_registration.c.
References ao2_callback, ao2_cleanup, ao2_global_obj_ref, ao2_ref, check_state(), get_registrations(), NULL, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
|
static |
Registration response structure destructor.
Definition at line 1203 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, registration_response::client_state, registration_response::old_request, and registration_response::rdata.
Referenced by sip_outbound_registration_response_cb().
|
static |
comparator function for state objects
Definition at line 658 of file res_pjsip_outbound_registration.c.
References ast_assert, ast_sorcery_object_get_id(), CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and sip_outbound_registration_state::registration.
Referenced by load_module().
|
static |
hashing function for state objects
Definition at line 637 of file res_pjsip_outbound_registration.c.
References ast_assert, ast_sorcery_object_get_id(), ast_str_hash(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and sip_outbound_registration_state::registration.
Referenced by load_module().
|
static |
Definition at line 1315 of file res_pjsip_outbound_registration.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_ref, ast_log, ast_sip_transport_monitor_register_replace_key(), LOG_NOTICE, monitor_matcher(), NULL, and registration_transport_shutdown_cb().
Referenced by handle_registration_response().
|
static |
Definition at line 1292 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_push_task(), get_state(), and reregister_immediately_cb().
Referenced by handle_registration_response(), registration_transport_monitor_setup(), and unload_module().
|
static |
Definition at line 3055 of file res_pjsip_outbound_registration.c.
References ast_sip_get_sorcery(), and ast_sorcery_reload_object().
|
static |
Definition at line 2354 of file res_pjsip_outbound_registration.c.
References ast_sip_get_sorcery(), ast_sorcery_load_object(), and unregister_all().
Referenced by ami_register(), cli_register(), and network_change_stasis_cb().
|
static |
Definition at line 1255 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_log, cancel_registration(), DEBUG_ATLEAST, handle_client_registration(), LOG_DEBUG, and SIP_REGISTRATION_REGISTERED.
Referenced by registration_transport_shutdown_cb().
|
static |
Definition at line 1339 of file res_pjsip_outbound_registration.c.
References ast_copy_pj_str(), ast_free, ast_malloc, ast_sip_service_route_vector_alloc(), ast_sip_service_route_vector_destroy(), ast_sip_transport_state_set_preferred_identity(), ast_sip_transport_state_set_service_routes(), ast_sip_transport_state_set_transport(), ast_strlen_zero(), AST_VECTOR_APPEND, registration_response::client_state, header::next, NULL, registration_response::rdata, sip_outbound_registration_client_state::transport_name, and value.
Referenced by handle_registration_response().
|
static |
Helper function which sets up the timer to re-register in a specific amount of time.
Definition at line 1071 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_debug, ast_log, ast_sip_get_pjsip_endpoint(), cancel_registration(), sip_outbound_registration_client_state::client, LOG_WARNING, NULL, sip_outbound_registration_client_state::registration_expires, and sip_outbound_registration_client_state::timer.
Referenced by handle_registration_response(), schedule_retry(), and sip_outbound_registration_perform().
|
static |
Definition at line 1238 of file res_pjsip_outbound_registration.c.
References ast_log, registration_response::client_state, registration_response::code, LOG_WARNING, registration_response::rdata, schedule_registration(), server_uri, SIP_REGISTRATION_REJECTED_TEMPORARY, and update_client_state_status().
Referenced by handle_registration_response().
|
static |
Definition at line 2229 of file res_pjsip_outbound_registration.c.
References ast_sip_security_mechanisms_to_str(), buf, and sip_outbound_registration::security_mechanisms.
Referenced by load_module().
|
static |
Definition at line 2250 of file res_pjsip_outbound_registration.c.
References ast_sip_security_mechanism_vector_init(), sip_outbound_registration::security_mechanisms, and var.
Referenced by load_module().
|
static |
Definition at line 2257 of file res_pjsip_outbound_registration.c.
References ast_sip_set_security_negotiation(), sip_outbound_registration::security_negotiation, and var.
Referenced by load_module().
|
static |
Definition at line 2241 of file res_pjsip_outbound_registration.c.
References ARRAY_IN_BOUNDS, ast_strdup, buf, sip_outbound_registration::security_negotiation, and security_negotiation_map.
Referenced by load_module().
|
static |
Definition at line 1950 of file res_pjsip_outbound_registration.c.
References ast_debug, ast_free, ast_log, AST_SIP_AUTH_TYPE_GOOGLE_OAUTH, ast_sip_cleanup_auths(), ast_sip_retrieve_auths(), AST_VECTOR_SIZE, ast_sip_auth::auth_pass, ast_sip_auth::auth_user, cleanup(), fetch_google_access_token(), LOG_WARNING, ast_sip_auth::realm, and type.
Referenced by handle_client_registration().
|
static |
Helper function which populates a pj_str_t with a contact header.
Definition at line 1793 of file res_pjsip_outbound_registration.c.
References ast_sip_get_pjsip_endpoint(), ast_strlen_zero(), sip_outbound_registration::line, S_OR, and type.
Referenced by sip_outbound_registration_regc_alloc().
|
static |
Allocator function for registration information.
Definition at line 1778 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, ast_sorcery_generic_alloc(), ast_string_field_init, NULL, and sip_outbound_registration_destroy().
Referenced by load_module().
|
static |
Apply function which finds or allocates a state structure.
Definition at line 2145 of file res_pjsip_outbound_registration.c.
References ao2_bump, ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_link, ao2_lock, ao2_ref, ao2_replace, ao2_unlink, ao2_unlock, ast_debug, ast_log, ast_sip_push_task(), ast_sip_push_task_wait_serializer(), ast_sip_validate_uri_length(), ast_sorcery_object_get_id(), ast_strlen_zero(), can_reuse_registration(), sip_outbound_registration::client_uri, sip_outbound_registration::endpoint, sip_outbound_registration::line, LOG_ERROR, NULL, OBJ_SEARCH_KEY, RAII_VAR, sip_outbound_registration::server_uri, sip_outbound_registration_perform(), sip_outbound_registration_regc_alloc(), and sip_outbound_registration_state_alloc().
Referenced by load_module().
|
static |
Destructor function for client registration state.
Definition at line 1699 of file res_pjsip_outbound_registration.c.
References ast_free, AST_STATSD_GAUGE, ast_statsd_log_string(), ast_statsd_log_string_va(), ast_taskprocessor_unreference(), sip_outbound_registration_client_state::last_tdata, sip_outbound_registration_client_state::registration_name, sip_outbound_registration_client_state::serializer, sip_outbound_registration_status_str(), sip_outbound_registration_client_state::status, sip_outbound_registration_client_state::transport_name, and sip_outbound_registration_client_state::user_agent.
Referenced by sip_outbound_registration_state_alloc().
|
static |
Destructor function for registration information.
Definition at line 1767 of file res_pjsip_outbound_registration.c.
References ast_sip_auth_vector_destroy(), ast_sip_security_mechanisms_vector_destroy(), ast_string_field_free_memory, sip_outbound_registration::outbound_auths, and sip_outbound_registration::security_mechanisms.
Referenced by sip_outbound_registration_alloc().
|
static |
Helper function which determines if a response code is temporal or not.
Definition at line 1219 of file res_pjsip_outbound_registration.c.
References sip_outbound_registration_client_state::auth_rejection_permanent, registration_response::client_state, and registration_response::code.
Referenced by handle_registration_response().
|
static |
Helper function which performs a single registration.
Definition at line 2101 of file res_pjsip_outbound_registration.c.
References ao2_bump, ao2_ref, ast_free, ast_random(), ast_sip_auth_vector_destroy(), ast_sip_security_mechanisms_vector_copy(), ast_sip_security_mechanisms_vector_destroy(), ast_strdup, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_INIT, AST_VECTOR_SIZE, sip_outbound_registration::auth_rejection_permanent, sip_outbound_registration::expiration, sip_outbound_registration::fatal_retry_interval, sip_outbound_registration::forbidden_retry_interval, sip_outbound_registration::max_random_initial_delay, sip_outbound_registration::max_retries, name, sip_outbound_registration::outbound_auths, sip_outbound_registration::retry_interval, schedule_registration(), sip_outbound_registration::security_mechanisms, sip_outbound_registration::security_negotiation, sip_outbound_registration::support_outbound, and sip_outbound_registration::support_path.
Referenced by auth_observer(), queue_register(), and sip_outbound_registration_apply().
|
static |
Helper function that allocates a pjsip registration client and configures it.
Definition at line 2008 of file res_pjsip_outbound_registration.c.
References ao2_bump, ao2_cleanup, ast_assert, ast_generate_random_string(), ast_log, ast_sip_get_pjsip_endpoint(), ast_sip_set_tpselector_from_transport_name(), ast_sip_tpselector_unref(), ast_sorcery_object_get_id(), ast_strlen_zero(), sip_outbound_registration::client_uri, sip_outbound_registration::contact_header_params, sip_outbound_registration::contact_user, sip_outbound_registration::expiration, LOG_ERROR, NULL, sip_outbound_registration::outbound_proxy, RAII_VAR, sip_outbound_registration_state::registration, S_OR, sip_outbound_registration::server_uri, server_uri, sip_dialog_create_contact(), sip_outbound_registration_response_cb(), and sip_outbound_registration::transport.
Referenced by sip_outbound_registration_apply().
|
static |
Callback function for outbound registration client.
Definition at line 1606 of file res_pjsip_outbound_registration.c.
References ao2_alloc, ao2_cleanup, ao2_ref, ast_assert, ast_debug, ast_log, AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR, ast_sip_push_task(), ast_threadstorage_get(), registration_response::client_state, registration_response::code, registration_response::expiration, handle_registration_response(), sip_outbound_registration_client_state::last_tdata, LOG_WARNING, NULL, registration_response::old_request, registration_response::rdata, registration_response_destroy(), registration_response::retry_after, sip_outbound_registration_client_state::serializer, and registration_response::transport_key.
Referenced by sip_outbound_registration_regc_alloc().
|
static |
Allocator function for registration state.
Definition at line 1717 of file res_pjsip_outbound_registration.c.
References ao2_alloc, ao2_bump, ao2_cleanup, ast_sip_create_serializer_group(), ast_sorcery_object_get_id(), AST_STATSD_GAUGE, ast_statsd_log_string(), ast_statsd_log_string_va(), ast_strdup, ast_taskprocessor_build_name(), AST_TASKPROCESSOR_MAX_NAME, NULL, sip_outbound_registration_state::registration, shutdown_group, sip_outbound_registration_client_state_destroy(), sip_outbound_registration_state_destroy(), sip_outbound_registration_status_str(), sip_outbound_registration_timer_cb(), SIP_REGISTRATION_UNREGISTERED, sip_outbound_registration::transport, and sip_outbound_registration::user_agent.
Referenced by sip_outbound_registration_apply().
|
static |
Destructor function for registration state.
Definition at line 1678 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, ao2_ref, ast_debug, ast_log, ast_sip_push_task(), handle_client_state_destruction(), and LOG_WARNING.
Referenced by sip_outbound_registration_state_alloc().
|
static |
Definition at line 476 of file res_pjsip_outbound_registration.c.
References SIP_REGISTRATION_REGISTERED, SIP_REGISTRATION_REJECTED_PERMANENT, SIP_REGISTRATION_REJECTED_TEMPORARY, SIP_REGISTRATION_STOPPED, SIP_REGISTRATION_STOPPING, SIP_REGISTRATION_UNREGISTERED, and str.
Referenced by ami_outbound_registration_task(), cli_print_body(), handle_registration_response(), sip_outbound_registration_client_state_destroy(), sip_outbound_registration_state_alloc(), and update_client_state_status().
|
static |
Timer callback function, used just for registrations.
Definition at line 1053 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_log, ast_sip_push_task(), handle_client_registration(), LOG_WARNING, and sip_outbound_registration_client_state::serializer.
Referenced by sip_outbound_registration_state_alloc().
|
static |
Definition at line 2898 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_debug, ast_log, ast_manager_unregister(), ast_serializer_shutdown_group_join(), ast_sip_get_sorcery(), ast_sip_transport_monitor_unregister_all(), ast_sip_unregister_cli_formatter(), ast_sip_unregister_endpoint_identifier(), ast_sorcery_instance_observer_remove(), ast_sorcery_object_unregister(), ast_sorcery_observer_remove(), cli_formatter, cli_outbound_registration, line_identifier, LOG_WARNING, MAX_UNLOAD_TIMEOUT_TIME, network_change_sub, NULL, observer_callbacks_auth, observer_callbacks_registrations, registration_transport_shutdown_cb(), shutdown_group, and stasis_unsubscribe_and_join().
Referenced by load_module().
|
static |
Definition at line 2340 of file res_pjsip_outbound_registration.c.
References ao2_callback, ao2_global_obj_ref, ao2_ref, NULL, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
Referenced by ami_unregister(), cli_unregister(), and reregister_all().
|
static |
Definition at line 2296 of file res_pjsip_outbound_registration.c.
References add_configured_supported_headers(), ao2_ref, ast_debug, cancel_registration(), and registration_client_send().
Referenced by queue_unregister().
|
static |
Definition at line 1094 of file res_pjsip_outbound_registration.c.
References AST_STATSD_GAUGE, ast_statsd_log_string_va(), sip_outbound_registration_status_str(), status, and sip_outbound_registration_client_state::status.
Referenced by handle_client_state_destruction(), handle_registration_response(), and schedule_retry().
|
static |
Definition at line 3069 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 3069 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2769 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 2750 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 752 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), and unload_module().
|
static |
subscription id for network change events
Definition at line 634 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 2807 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 2863 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), pjsip_outbound_registration_metrics_init(), pjsip_outbound_registration_metrics_unload_cb(), and unload_module().
|
static |
Definition at line 767 of file res_pjsip_outbound_registration.c.
Referenced by add_configured_supported_headers().
|
static |
Definition at line 766 of file res_pjsip_outbound_registration.c.
Referenced by add_configured_supported_headers().
|
static |
Definition at line 2883 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), pjsip_outbound_registration_metrics_init(), and pjsip_outbound_registration_metrics_unload_cb().
|
static |
Definition at line 2236 of file res_pjsip_outbound_registration.c.
Referenced by security_negotiation_to_str().
|
static |
Shutdown group to monitor sip_outbound_registration_client_state serializers.
Definition at line 627 of file res_pjsip_outbound_registration.c.
Referenced by load_module(), sip_outbound_registration_state_alloc(), and unload_module().