Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_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 | 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. More... | |
#define | LINE_PARAMETER_SIZE 8 |
Size of the buffer for creating a unique string for the line. More... | |
#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. More... | |
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 | __init_register_callback_invoked (void) |
Some thread local storage used to determine if the running thread invoked the callback. More... | |
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. More... | |
static int | add_to_supported_header (pjsip_tx_data *tdata, pj_str_t *name) |
Helper function to add string to Supported header. More... | |
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) |
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. More... | |
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 const char * | fetch_google_access_token (const struct ast_sip_auth *auth) |
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. More... | |
static int | handle_client_state_destruction (void *data) |
Callback function for unregistering (potentially) and destroying state. More... | |
static int | handle_registration_response (void *data) |
Callback function for handling a response to a registration attempt. More... | |
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. More... | |
static int | line_identify_relationship (void *obj, void *arg, int flags) |
Callback function for matching an outbound registration based on line. More... | |
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. More... | |
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. More... | |
static int | registration_state_cmp (void *obj, void *arg, int flags) |
comparator function for state objects More... | |
static int | registration_state_hash (const void *obj, const int flags) |
hashing function for state objects More... | |
static void | registration_transport_monitor_setup (pjsip_transport *transport, 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. More... | |
static void | schedule_retry (struct registration_response *response, unsigned int interval, const char *server_uri, const char *client_uri) |
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. More... | |
static void * | sip_outbound_registration_alloc (const char *name) |
Allocator function for registration information. More... | |
static int | sip_outbound_registration_apply (const struct ast_sorcery *sorcery, void *obj) |
Apply function which finds or allocates a state structure. More... | |
static void | sip_outbound_registration_client_state_destroy (void *obj) |
Destructor function for client registration state. More... | |
static void | sip_outbound_registration_destroy (void *obj) |
Destructor function for registration information. More... | |
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. More... | |
static int | sip_outbound_registration_perform (void *data) |
Helper function which performs a single registration. More... | |
static int | sip_outbound_registration_regc_alloc (void *data) |
Helper function that allocates a pjsip registration client and configures it. More... | |
static void | sip_outbound_registration_response_cb (struct pjsip_regc_cbparam *param) |
Callback function for outbound registration client. More... | |
static struct sip_outbound_registration_state * | sip_outbound_registration_state_alloc (struct sip_outbound_registration *registration) |
Allocator function for registration state. More... | |
static void | sip_outbound_registration_state_destroy (void *obj) |
Destructor function for registration state. More... | |
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. More... | |
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) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Outbound Registration Support" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .reload = reload_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_pjsip", .optional_modules = "res_statsd", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_sip_cli_formatter_entry * | cli_formatter |
static struct ast_cli_entry | cli_outbound_registration [] |
static struct ast_sip_endpoint_identifier | line_identifier |
static struct stasis_subscription * | network_change_sub |
static const struct ast_sorcery_observer | observer_callbacks_auth |
static const struct ast_sorcery_instance_observer | observer_callbacks_registrations |
static pj_str_t | OUTBOUND_NAME = { "outbound", 8 } |
static pj_str_t | PATH_NAME = { "path", 4 } |
static struct ast_threadstorage | register_callback_invoked = { .once = PTHREAD_ONCE_INIT , .key_init = __init_register_callback_invoked , .custom_init = NULL , } |
static const struct ast_sorcery_observer | registration_observer |
static struct ast_serializer_shutdown_group * | shutdown_group |
#define DEFAULT_STATE_BUCKETS 53 |
Default number of state container buckets.
Definition at line 412 of file res_pjsip_outbound_registration.c.
Referenced by load_module().
#define LINE_PARAMETER_SIZE 8 |
Size of the buffer for creating a unique string for the line.
Definition at line 251 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 406 of file res_pjsip_outbound_registration.c.
Referenced by unload_module().
#define REGISTRATION_URI_FIELD_LEN 53 |
Referenced by cli_print_body().
#define REREGISTER_BUFFER_TIME 10 |
Amount of buffer time (in seconds) before expiration that we re-register at.
Definition at line 248 of file res_pjsip_outbound_registration.c.
Referenced by handle_registration_response().
Various states that an outbound registration may be in.
Definition at line 254 of file res_pjsip_outbound_registration.c.
|
static |
Some thread local storage used to determine if the running thread invoked the callback.
Definition at line 245 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2628 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2628 of file res_pjsip_outbound_registration.c.
|
static |
Helper function to add configured supported headers.
Definition at line 650 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 |
Helper function to add string to Supported header.
Definition at line 615 of file res_pjsip_outbound_registration.c.
References NULL.
Referenced by add_configured_supported_headers().
|
static |
Definition at line 2171 of file res_pjsip_outbound_registration.c.
References sip_ami_outbound::ami, ami_outbound_registration_task(), ast_sip_push_task_wait_servant(), NULL, and sip_ami_outbound::registration.
Referenced by ami_show_outbound_registrations().
|
static |
Definition at line 2135 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, sip_outbound_registration_client_state::client, sip_outbound_registration_state::client_state, get_state(), sip_to_pjsip::info(), 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(), SIP_REGISTRATION_REGISTERED, state, and sip_outbound_registration_client_state::status.
Referenced by ami_outbound_registration_detail().
|
static |
Definition at line 2091 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(), reregister_all(), and state.
Referenced by load_module().
|
static |
Definition at line 2179 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 2059 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(), state, and unregister_all().
Referenced by load_module().
|
static |
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 2628 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2332 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(), sip_outbound_registration_state::client_state, get_state(), LOG_ERROR, NULL, sip_outbound_registration_client_state::serializer, sip_outbound_registration_perform(), SIP_REGISTRATION_REJECTED_PERMANENT, state, and sip_outbound_registration_client_state::status.
|
static |
Definition at line 1461 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 544 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 2372 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_id(), CMP_MATCH, and sip_outbound_registration_state::registration.
Referenced by registration_loaded_observer().
|
static |
Definition at line 1924 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, registrations, and result.
Referenced by cli_register(), and cli_unregister().
|
static |
Definition at line 2211 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, and RAII_VAR.
Referenced by load_module().
|
static |
Definition at line 2235 of file res_pjsip_outbound_registration.c.
References ao2_callback, and OBJ_NODATA.
Referenced by load_module().
|
static |
Definition at line 2271 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, ast_assert, ast_sip_cli_print_sorcery_objectset(), ast_sorcery_object_get_id(), ast_str_append(), AST_VECTOR_GET, AST_VECTOR_SIZE, sip_outbound_registration_state::client_state, context, get_state(), ast_sip_cli_context::indent_level, NULL, sip_outbound_registration::outbound_auths, ast_sip_cli_context::output_buffer, REGISTRATION_URI_FIELD_LEN, sip_outbound_registration::server_uri, ast_sip_cli_context::show_details, ast_sip_cli_context::show_details_only_level_0, sip_outbound_registration_status_str(), and sip_outbound_registration_client_state::status.
Referenced by load_module().
|
static |
Definition at line 2259 of file res_pjsip_outbound_registration.c.
References ast_assert, ast_str_append(), context, NULL, and ast_sip_cli_context::output_buffer.
Referenced by load_module().
|
static |
Definition at line 2011 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), cli_complete_registration(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, get_state(), ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, queue_register(), queue_unregister(), reregister_all(), state, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 2242 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 1968 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), cli_complete_registration(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, get_state(), ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, queue_unregister(), state, unregister_all(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1485 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, ast_json_error::column, ast_json_error::line, LOG_ERROR, NULL, ast_sip_auth::oauth_clientid, ast_sip_auth::oauth_secret, ast_sip_auth::refresh_token, ast_json_error::text, and url.
Referenced by set_outbound_initial_authentication_credentials().
|
static |
Definition at line 481 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(), NULL, and registrations.
Referenced by ami_show_outbound_registrations(), and registration_loaded_observer().
|
static |
Definition at line 468 of file res_pjsip_outbound_registration.c.
References ao2_find, ao2_global_obj_ref, ao2_ref, NULL, OBJ_SEARCH_KEY, and state.
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 499 of file res_pjsip_outbound_registration.c.
References NULL.
Referenced by line_identify().
|
static |
Callback function for registering.
Definition at line 668 of file res_pjsip_outbound_registration.c.
References add_configured_supported_headers(), ao2_cleanup, ast_log, DEBUG_ATLEAST, sip_to_pjsip::info(), 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 772 of file res_pjsip_outbound_registration.c.
References add_configured_supported_headers(), ao2_ref, ast_debug, ast_sip_auth_vector_destroy(), cancel_registration(), sip_outbound_registration_client_state::client, sip_outbound_registration_client_state::destroy, sip_to_pjsip::info(), NULL, sip_outbound_registration_client_state::outbound_auths, registration_client_send(), 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 1056 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_copy_pj_str(), ast_debug, ast_log, ast_sip_create_request_with_auth(), ast_sip_failover_request(), ast_sip_transport_monitor_unregister(), ast_system_publish_registry(), sip_outbound_registration_client_state::auth_attempted, sip_outbound_registration_client_state::auth_cseq, sip_outbound_registration_client_state::client, registration_response::client_state, sip_outbound_registration::client_uri, registration_response::code, sip_outbound_registration_client_state::destroy, registration_response::expiration, sip_outbound_registration_client_state::fatal_retry_interval, sip_outbound_registration_client_state::forbidden_retry_interval, handle_client_state_destruction(), sip_to_pjsip::info(), LOG_WARNING, sip_outbound_registration_client_state::max_retries, monitor_matcher(), NULL, 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::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, 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 512 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(), sip_outbound_registration::line, line_identify_relationship(), NULL, and RAII_VAR.
|
static |
Callback function for matching an outbound registration based on line.
Definition at line 491 of file res_pjsip_outbound_registration.c.
References sip_outbound_registration_state::client_state, CMP_MATCH, sip_outbound_registration::line, and sip_outbound_registration_client_state::line.
Referenced by line_identify().
|
static |
Definition at line 2508 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(), sip_outbound_registration::auth_rejection_permanent, cli_get_container(), cli_iterator(), cli_print_body(), cli_print_header(), cli_retrieve_by_id(), sip_outbound_registration::client_uri, sip_outbound_registration::contact_header_params, sip_outbound_registration::contact_user, DEFAULT_STATE_BUCKETS, sip_outbound_registration::endpoint, EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, sip_outbound_registration::expiration, sip_outbound_registration::fatal_retry_interval, FLDSET, sip_outbound_registration::forbidden_retry_interval, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, ast_sip_cli_formatter_entry::iterate, sip_outbound_registration::line, LOG_ERROR, sip_outbound_registration::max_retries, ast_sip_cli_formatter_entry::name, network_change_stasis_cb(), new_states, NULL, 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(), sip_outbound_registration::outbound_proxy, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, registration_state_cmp(), registration_state_hash(), ast_sip_cli_formatter_entry::retrieve_by_id, sip_outbound_registration::retry_interval, sip_outbound_registration::server_uri, sip_outbound_registration_alloc(), sip_outbound_registration_apply(), stasis_subscribe, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), STRFLDSET, sip_outbound_registration::support_outbound, sip_outbound_registration::support_path, sip_outbound_registration::transport, and unload_module().
Referenced by reload_module().
|
static |
Definition at line 954 of file res_pjsip_outbound_registration.c.
Referenced by handle_registration_response().
|
static |
Definition at line 2306 of file res_pjsip_outbound_registration.c.
References ast_sip_cli_traverse_objects().
|
static |
Definition at line 2450 of file res_pjsip_outbound_registration.c.
References ast_debug, ast_network_change_type(), reregister_all(), and stasis_message_type().
Referenced by load_module().
|
static |
Definition at line 1828 of file res_pjsip_outbound_registration.c.
References ast_sip_auth_vector_init(), sip_outbound_registration::outbound_auths, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 1835 of file res_pjsip_outbound_registration.c.
References ast_sip_auths_to_str(), and sip_outbound_registration::outbound_auths.
Referenced by load_module().
|
static |
Definition at line 1842 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 1893 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_push_task(), sip_outbound_registration_state::client_state, sip_outbound_registration_client_state::serializer, and sip_outbound_registration_perform().
Referenced by ami_register(), and cli_register().
|
static |
Definition at line 1882 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_push_task(), sip_outbound_registration_state::client_state, sip_outbound_registration_client_state::serializer, 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 557 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_set_tpselector_from_transport_name(), ast_sip_tpselector_unref(), ast_threadstorage_get(), sip_outbound_registration_client_state::client, sip_outbound_registration_client_state::last_tdata, register_callback_invoked, status, and sip_outbound_registration_client_state::transport_name.
Referenced by handle_client_registration(), handle_client_state_destruction(), handle_registration_response(), and unregister_task().
|
static |
Definition at line 2430 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 2399 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 848 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 440 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 419 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 962 of file res_pjsip_outbound_registration.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_ref, ast_sip_transport_monitor_register(), monitor, NULL, and registration_transport_shutdown_cb().
Referenced by handle_registration_response().
|
static |
Definition at line 939 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_sip_push_task(), sip_outbound_registration_state::client_state, get_state(), reregister_immediately_cb(), sip_outbound_registration_client_state::serializer, and state.
Referenced by handle_registration_response(), registration_transport_monitor_setup(), and unload_module().
|
static |
Definition at line 2614 of file res_pjsip_outbound_registration.c.
References AST_MODFLAG_LOAD_ORDER, AST_MODPRI_APP_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ast_sip_get_sorcery(), ast_sorcery_reload_object(), ASTERISK_GPL_KEY, load_module(), reload(), and unload_module().
|
static |
Definition at line 1918 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 900 of file res_pjsip_outbound_registration.c.
References ao2_ref, ast_log, cancel_registration(), sip_outbound_registration_client_state::client, sip_outbound_registration_state::client_state, DEBUG_ATLEAST, handle_client_registration(), sip_to_pjsip::info(), LOG_DEBUG, SIP_REGISTRATION_REGISTERED, and sip_outbound_registration_client_state::status.
Referenced by registration_transport_shutdown_cb().
|
static |
Definition at line 986 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, 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 721 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, sip_to_pjsip::info(), LOG_WARNING, and sip_outbound_registration_client_state::timer.
Referenced by handle_registration_response(), schedule_retry(), and sip_outbound_registration_perform().
|
static |
Definition at line 883 of file res_pjsip_outbound_registration.c.
References ast_log, registration_response::client_state, registration_response::code, LOG_WARNING, registration_response::rdata, schedule_registration(), SIP_REGISTRATION_REJECTED_TEMPORARY, and update_client_state_status().
Referenced by handle_registration_response().
|
static |
Definition at line 1545 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 1388 of file res_pjsip_outbound_registration.c.
References ast_sip_get_pjsip_endpoint(), ast_strlen_zero, S_OR, tmp(), and type.
Referenced by sip_outbound_registration_regc_alloc().
|
static |
Allocator function for registration information.
Definition at line 1373 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 1744 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 1297 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, and sip_outbound_registration_client_state::transport_name.
Referenced by sip_outbound_registration_state_alloc().
|
static |
Destructor function for registration information.
Definition at line 1363 of file res_pjsip_outbound_registration.c.
References ast_sip_auth_vector_destroy(), ast_string_field_free_memory, and sip_outbound_registration::outbound_auths.
Referenced by sip_outbound_registration_alloc().
|
static |
Helper function which determines if a response code is temporal or not.
Definition at line 864 of file res_pjsip_outbound_registration.c.
References sip_outbound_registration_client_state::auth_rejection_permanent.
Referenced by handle_registration_response().
|
static |
Helper function which performs a single registration.
Definition at line 1708 of file res_pjsip_outbound_registration.c.
References ao2_bump, ao2_ref, ast_free, ast_random(), ast_sip_auth_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_client_state::auth_rejection_permanent, sip_outbound_registration_client_state::client, sip_outbound_registration_state::client_state, sip_outbound_registration::expiration, sip_outbound_registration::fatal_retry_interval, sip_outbound_registration_client_state::fatal_retry_interval, sip_outbound_registration::forbidden_retry_interval, sip_outbound_registration_client_state::forbidden_retry_interval, sip_outbound_registration::max_retries, sip_outbound_registration_client_state::max_retries, name, sip_outbound_registration::outbound_auths, sip_outbound_registration_client_state::outbound_auths, sip_outbound_registration_state::registration, sip_outbound_registration_client_state::retries, sip_outbound_registration::retry_interval, sip_outbound_registration_client_state::retry_interval, schedule_registration(), sip_outbound_registration::support_outbound, sip_outbound_registration_client_state::support_outbound, sip_outbound_registration::support_path, and sip_outbound_registration_client_state::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 1603 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_state::client, sip_outbound_registration_state::client_state, sip_outbound_registration::client_uri, sip_outbound_registration::contact_header_params, sip_outbound_registration::contact_user, sip_outbound_registration::expiration, sip_outbound_registration::line, sip_outbound_registration_client_state::line, LOG_ERROR, NULL, sip_outbound_registration::outbound_proxy, pool, RAII_VAR, sip_outbound_registration_state::registration, S_OR, sip_outbound_registration::server_uri, sip_dialog_create_contact(), sip_outbound_registration_response_cb(), tmp(), and sip_outbound_registration::transport.
Referenced by sip_outbound_registration_apply().
|
static |
Callback function for outbound registration client.
Definition at line 1207 of file res_pjsip_outbound_registration.c.
References ao2_alloc, ao2_cleanup, ao2_ref, ast_assert, ast_debug, ast_log, 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, register_callback_invoked, registration_response_destroy(), registration_response::retry_after, and sip_outbound_registration_client_state::serializer.
Referenced by sip_outbound_registration_regc_alloc().
|
static |
Allocator function for registration state.
Definition at line 1314 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, sip_outbound_registration_state::client_state, NULL, sip_outbound_registration_state::registration, sip_outbound_registration_client_state::registration_name, sip_outbound_registration_client_state::serializer, sip_outbound_registration_client_state_destroy(), sip_outbound_registration_state_destroy(), sip_outbound_registration_status_str(), sip_outbound_registration_timer_cb(), SIP_REGISTRATION_UNREGISTERED, state, sip_outbound_registration_client_state::status, sip_outbound_registration_client_state::timer, sip_outbound_registration::transport, and sip_outbound_registration_client_state::transport_name.
Referenced by sip_outbound_registration_apply().
|
static |
Destructor function for registration state.
Definition at line 1276 of file res_pjsip_outbound_registration.c.
References ao2_cleanup, ao2_ref, ast_debug, ast_log, ast_sip_push_task(), sip_outbound_registration_state::client_state, sip_outbound_registration::client_uri, handle_client_state_destruction(), LOG_WARNING, sip_outbound_registration_state::registration, sip_outbound_registration_client_state::serializer, and sip_outbound_registration::server_uri.
Referenced by sip_outbound_registration_state_alloc().
|
static |
Definition at line 278 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 703 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 2461 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(), LOG_WARNING, MAX_UNLOAD_TIMEOUT_TIME, NULL, registration_transport_shutdown_cb(), and stasis_unsubscribe_and_join().
Referenced by load_module(), and reload_module().
|
static |
Definition at line 1904 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 1860 of file res_pjsip_outbound_registration.c.
References add_configured_supported_headers(), ao2_ref, ast_debug, cancel_registration(), sip_outbound_registration_client_state::client, sip_outbound_registration_state::client_state, sip_outbound_registration::client_uri, sip_to_pjsip::info(), sip_outbound_registration_state::registration, registration_client_send(), and sip_outbound_registration::server_uri.
Referenced by queue_unregister().
|
static |
Definition at line 743 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 2628 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2628 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2330 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2311 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 539 of file res_pjsip_outbound_registration.c.
|
static |
subscription id for network change events
Definition at line 416 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2368 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 2426 of file res_pjsip_outbound_registration.c.
|
static |
Definition at line 554 of file res_pjsip_outbound_registration.c.
Referenced by add_configured_supported_headers().
|
static |
Definition at line 553 of file res_pjsip_outbound_registration.c.
Referenced by add_configured_supported_headers().
|
static |
Definition at line 245 of file res_pjsip_outbound_registration.c.
Referenced by registration_client_send(), and sip_outbound_registration_response_cb().
|
static |
Definition at line 2446 of file res_pjsip_outbound_registration.c.
|
static |
Shutdown group to monitor sip_outbound_registration_client_state serializers.
Definition at line 409 of file res_pjsip_outbound_registration.c.