Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
Enumerations | Functions
res_pjsip_private.h File Reference
#include "asterisk/module.h"
#include "asterisk/compat.h"
Include dependency graph for res_pjsip_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  ast_sip_taskprocessor_overload_trigger { TASKPROCESSOR_OVERLOAD_TRIGGER_NONE = 0 , TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL , TASKPROCESSOR_OVERLOAD_TRIGGER_PJSIP_ONLY }
 

Functions

void ast_res_pjsip_cleanup_message_filter (void)
 
void ast_res_pjsip_cleanup_options_handling (void)
 
void ast_res_pjsip_destroy_configuration (void)
 
struct ast_sip_contact_statusast_res_pjsip_find_or_create_contact_status (const struct ast_sip_contact *contact)
 
int ast_res_pjsip_init_contact_transports (void)
 
int ast_res_pjsip_init_message_filter (void)
 
int ast_res_pjsip_init_options_handling (int reload)
 
int ast_res_pjsip_initialize_configuration (void)
 
int ast_res_pjsip_preinit_options_handling (void)
 
int ast_res_pjsip_reload_configuration (void)
 
void ast_sip_destroy_cli (void)
 
void ast_sip_destroy_distributor (void)
 
void ast_sip_destroy_global_headers (void)
 
int ast_sip_destroy_scheduler (void)
 
int ast_sip_destroy_sorcery_auth (void)
 
int ast_sip_destroy_sorcery_global (void)
 
int ast_sip_destroy_sorcery_location (void)
 
int ast_sip_destroy_sorcery_transport (void)
 
void ast_sip_destroy_system (void)
 
void ast_sip_destroy_transport_events (void)
 
void ast_sip_destroy_transport_management (void)
 
enum ast_sip_taskprocessor_overload_trigger ast_sip_get_taskprocessor_overload_trigger (void)
 
char * ast_sip_global_default_outbound_endpoint (void)
 
int ast_sip_initialize_cli (void)
 
int ast_sip_initialize_distributor (void)
 
void ast_sip_initialize_dns (void)
 
int ast_sip_initialize_global (void)
 
void ast_sip_initialize_global_headers (void)
 
void ast_sip_initialize_resolver (void)
 
int ast_sip_initialize_scheduler (void)
 Initialize scheduler. More...
 
int ast_sip_initialize_sorcery_auth (void)
 Initialize sorcery with auth support. More...
 
int ast_sip_initialize_sorcery_domain_alias (void)
 Initialize sorcery with domain alias support. More...
 
int ast_sip_initialize_sorcery_global (void)
 
int ast_sip_initialize_sorcery_location (void)
 Initialize sorcery with location support. More...
 
int ast_sip_initialize_sorcery_qualify (void)
 
int ast_sip_initialize_sorcery_transport (void)
 Initialize sorcery with transport support. More...
 
int ast_sip_initialize_system (void)
 
int ast_sip_initialize_transport_events (void)
 
int ast_sip_initialize_transport_management (void)
 
const char * ast_sip_overload_trigger_to_str (enum ast_sip_taskprocessor_overload_trigger trigger)
 
int ast_sip_persistent_endpoint_add_to_regcontext (const char *regcontext)
 
int ast_sip_validate_uri_length (const char *uri)
 
int ast_sip_will_uri_survive_restart (pjsip_sip_uri *uri, struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)
 
int sip_cli_print_global (struct ast_sip_cli_context *context)
 
int sip_cli_print_system (struct ast_sip_cli_context *context)
 
void sip_get_threadpool_options (struct ast_threadpool_options *threadpool_options)
 

Enumeration Type Documentation

◆ ast_sip_taskprocessor_overload_trigger

Enumerator
TASKPROCESSOR_OVERLOAD_TRIGGER_NONE 
TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL 
TASKPROCESSOR_OVERLOAD_TRIGGER_PJSIP_ONLY 

Definition at line 407 of file res_pjsip_private.h.

Function Documentation

◆ ast_res_pjsip_cleanup_message_filter()

void ast_res_pjsip_cleanup_message_filter ( void  )

Definition at line 604 of file pjsip_message_filter.c.

605{
610}
static pjsip_module filter_module_tsx
static pjsip_module filter_module_transport
static struct ast_sip_session_supplement filter_session_supplement
PJSIP Session Supplement for tagging messages with restrictions.
static struct ast_sip_supplement filter_supplement
PJSIP Supplement for tagging messages with restrictions.
void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement)
Unregister a an supplement to SIP out of dialog processing.
Definition: res_pjsip.c:1476
void ast_sip_unregister_service(pjsip_module *module)
Definition: res_pjsip.c:133
void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
Unregister a an supplement to SIP session processing.
Definition: pjsip_session.c:63

References ast_sip_session_unregister_supplement(), ast_sip_unregister_service(), ast_sip_unregister_supplement(), filter_module_transport, filter_module_tsx, filter_session_supplement, and filter_supplement.

Referenced by ast_res_pjsip_init_message_filter(), and unload_pjsip().

◆ ast_res_pjsip_cleanup_options_handling()

void ast_res_pjsip_cleanup_options_handling ( void  )

Definition at line 2839 of file pjsip_options.c.

2840{
2841 int remaining;
2842 struct ast_taskprocessor *mgmt_serializer;
2843
2845 ast_manager_unregister("PJSIPQualify");
2846 ast_manager_unregister("PJSIPShowContacts");
2848
2855
2856 mgmt_serializer = management_serializer;
2858 if (mgmt_serializer) {
2860 }
2861
2864 if (remaining) {
2865 ast_log(LOG_WARNING, "Cleanup incomplete. Could not stop %d AORs.\n",
2866 remaining);
2867 }
2870
2871 if (mgmt_serializer) {
2872 ast_taskprocessor_unreference(mgmt_serializer);
2873 }
2874
2881
2882 pjsip_endpt_unregister_module(ast_sip_get_pjsip_endpoint(), &options_module);
2883}
#define ast_log
Definition: astobj2.c:42
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
Definition: manager.c:7606
int ast_sip_push_task_wait_serializer(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Push a task to the serializer and wait for it to complete.
Definition: res_pjsip.c:2179
#define LOG_WARNING
static pjsip_module options_module
static struct ao2_container * sip_options_aors
static struct ast_taskprocessor * management_serializer
static struct ast_serializer_shutdown_group * shutdown_group
Shutdown group for options serializers.
#define MAX_UNLOAD_TIMEOUT_TIME
Maximum wait time to join the below shutdown group.
static const struct ast_sorcery_observer endpoint_observer_callbacks
Observer callbacks for endpoints.
static struct ao2_container * sip_options_contact_statuses
static struct ao2_container * sip_options_endpoint_state_compositors
static struct ast_cli_entry cli_options[]
static int sip_options_cleanup_task(void *obj)
Management task to clean up the environment.
static const struct ast_sorcery_observer aor_observer_callbacks
Observer callbacks for AORs.
static const struct ast_sorcery_observer contact_observer_callbacks
Observer callbacks for contacts.
static struct ast_sip_endpoint_formatter contact_status_formatter
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
Definition: res_pjsip.c:520
void ast_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
Unregister an endpoint formatter.
Definition: res_pjsip.c:487
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
#define NULL
Definition: resample.c:96
void ast_sorcery_observer_remove(const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks)
Remove an observer from a specific object type.
Definition: sorcery.c:2423
A ast_taskprocessor structure is a singleton by name.
Definition: taskprocessor.c:69
void * ast_taskprocessor_unreference(struct ast_taskprocessor *tps)
Unreference the specified taskprocessor and its reference count will decrement.
int ast_serializer_shutdown_group_join(struct ast_serializer_shutdown_group *shutdown_group, int timeout)
Wait for the serializers in the group to shutdown with timeout.
Definition: threadpool.c:1241
#define ARRAY_LEN(a)
Definition: utils.h:666

References ao2_cleanup, aor_observer_callbacks, ARRAY_LEN, ast_cli_unregister_multiple(), ast_log, ast_manager_unregister(), ast_serializer_shutdown_group_join(), ast_sip_get_pjsip_endpoint(), ast_sip_get_sorcery(), ast_sip_push_task_wait_serializer(), ast_sip_unregister_endpoint_formatter(), ast_sorcery_observer_remove(), ast_taskprocessor_unreference(), cli_options, contact_observer_callbacks, contact_status_formatter, endpoint_observer_callbacks, LOG_WARNING, management_serializer, MAX_UNLOAD_TIMEOUT_TIME, NULL, options_module, shutdown_group, sip_options_aors, sip_options_cleanup_task(), sip_options_contact_statuses, and sip_options_endpoint_state_compositors.

Referenced by ast_res_pjsip_init_options_handling(), and unload_pjsip().

◆ ast_res_pjsip_destroy_configuration()

void ast_res_pjsip_destroy_configuration ( void  )

Definition at line 2369 of file pjsip_configuration.c.

2370{
2371 if (!sip_sorcery) {
2372 return;
2373 }
2374
2381 sip_sorcery = NULL;
2389}
int ast_sip_destroy_sorcery_auth(void)
Definition: config_auth.c:426
int ast_sip_destroy_sorcery_global(void)
int ast_sip_destroy_sorcery_transport(void)
static struct ast_cli_entry cli_commands[]
struct ast_sip_cli_formatter_entry * endpoint_formatter
static struct stasis_subscription * acl_change_sub
#define AMI_SHOW_ENDPOINT
static struct ast_sorcery * sip_sorcery
#define AMI_SHOW_ENDPOINTS
static struct ao2_container * persistent_endpoints
Container for persistent endpoint information.
int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Unregisters a CLI formatter.
Definition: pjsip_cli.c:326
void ast_sip_destroy_cli(void)
Definition: pjsip_cli.c:375
int ast_sip_destroy_sorcery_location(void)
Definition: location.c:1471
#define ast_sorcery_unref(sorcery)
Decrease the reference count of a sorcery structure.
Definition: sorcery.h:1500
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
Definition: stasis.c:1135

References acl_change_sub, AMI_SHOW_ENDPOINT, AMI_SHOW_ENDPOINTS, ao2_cleanup, ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), ast_sip_destroy_cli(), ast_sip_destroy_sorcery_auth(), ast_sip_destroy_sorcery_global(), ast_sip_destroy_sorcery_location(), ast_sip_destroy_sorcery_transport(), ast_sip_unregister_cli_formatter(), ast_sorcery_unref, cli_commands, endpoint_formatter, NULL, persistent_endpoints, sip_sorcery, and stasis_unsubscribe_and_join().

Referenced by unload_pjsip().

◆ ast_res_pjsip_find_or_create_contact_status()

struct ast_sip_contact_status * ast_res_pjsip_find_or_create_contact_status ( const struct ast_sip_contact contact)

Definition at line 464 of file pjsip_options.c.

465{
466 struct ast_sip_contact_status *contact_status;
467 int res;
468
469 /*
470 * At startup a contact status can be retrieved when static contacts
471 * are themselves being setup. This happens before we are fully setup.
472 * Since we don't actually trigger qualify or anything as a result it
473 * is safe to do so. They'll just get back a contact status that will
474 * be updated later. At this time they only care that the contact
475 * status gets created for the static contact anyway.
476 */
478 /*
479 * We haven't been pre-initialized or we are shutting down.
480 * Neither situation should happen.
481 */
482 ast_assert(0);
483 return NULL;
484 }
485
487
488 /* If contact status for this contact already exists just return it */
489 contact_status = ao2_find(sip_options_contact_statuses,
491 if (contact_status) {
493 return contact_status;
494 }
495
496 /* Otherwise we have to create and store a new contact status */
497 contact_status = sip_contact_status_alloc(ast_sorcery_object_get_id(contact));
498 if (!contact_status) {
500 return NULL;
501 }
502
503 contact_status->rtt = 0;
504 contact_status->status = CREATED;
505 contact_status->last_status = CREATED;
506 res = ast_string_field_set(contact_status, uri, contact->uri);
507 res |= ast_string_field_set(contact_status, aor, contact->aor);
508 if (res) {
510 ao2_ref(contact_status, -1);
511 return NULL;
512 }
513
516
517 ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE,
518 "+1", 1.0, ast_sip_get_contact_status_label(contact_status->status));
519
520 sip_options_contact_status_update(contact_status);
521
522 return contact_status;
523}
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
Definition: astobj2.h:1554
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1736
#define ao2_unlock(a)
Definition: astobj2.h:729
#define ao2_lock(a)
Definition: astobj2.h:717
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
Definition: astobj2.h:1063
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
Definition: astobj2.h:1101
static void sip_options_contact_status_update(struct ast_sip_contact_status *contact_status)
const char * ast_sip_get_contact_status_label(const enum ast_sip_contact_status_type status)
translate ast_sip_contact_status_type to character string.
static struct ast_sip_contact_status * sip_contact_status_alloc(const char *name)
@ CREATED
Definition: res_pjsip.h:439
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
Definition: sorcery.c:2317
void ast_statsd_log_string_va(const char *metric_name, const char *metric_type, const char *value, double sample_rate,...)
Send a stat to the configured statsd server.
Definition: res_statsd.c:186
#define AST_STATSD_GAUGE
Support for publishing to a statsd server.
Definition: statsd.h:32
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
A contact's status.
Definition: res_pjsip.h:448
const ast_string_field uri
Definition: res_pjsip.h:454
enum ast_sip_contact_status_type status
Definition: res_pjsip.h:465
enum ast_sip_contact_status_type last_status
Definition: res_pjsip.h:467
const ast_string_field aor
Definition: res_pjsip.h:454
const ast_string_field uri
Definition: res_pjsip.h:411
const ast_string_field aor
Definition: res_pjsip.h:411
#define ast_assert(a)
Definition: utils.h:739

References ao2_find, ao2_link_flags, ao2_lock, ao2_ref, ao2_unlock, ast_sip_contact::aor, ast_sip_contact_status::aor, ast_assert, ast_sip_get_contact_status_label(), ast_sorcery_object_get_id(), AST_STATSD_GAUGE, ast_statsd_log_string_va(), ast_string_field_set, CREATED, ast_sip_contact_status::last_status, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, ast_sip_contact_status::rtt, sip_contact_status_alloc(), sip_options_contact_status_update(), sip_options_contact_statuses, ast_sip_contact_status::status, ast_sip_contact::uri, and ast_sip_contact_status::uri.

Referenced by contact_apply_handler(), permanent_uri_handler(), sip_options_contact_add_task(), sip_options_contact_status_available_count(), sip_options_qualify_contact(), sip_options_set_contact_status_qualified(), and sip_options_set_contact_status_unqualified().

◆ ast_res_pjsip_init_contact_transports()

int ast_res_pjsip_init_contact_transports ( void  )

◆ ast_res_pjsip_init_message_filter()

int ast_res_pjsip_init_message_filter ( void  )

Definition at line 612 of file pjsip_message_filter.c.

613{
616
618 ast_log(LOG_ERROR, "Could not register message filter module for incoming and outgoing requests\n");
620 return -1;
621 }
622
624 ast_log(LOG_ERROR, "Could not register message filter module for incoming and outgoing requests\n");
626 return -1;
627 }
628
629 return 0;
630}
#define LOG_ERROR
void ast_res_pjsip_cleanup_message_filter(void)
int ast_sip_register_service(pjsip_module *module)
Register a SIP service in Asterisk.
Definition: res_pjsip.c:117
void ast_sip_register_supplement(struct ast_sip_supplement *supplement)
Register a supplement to SIP out of dialog processing.
Definition: res_pjsip.c:1456
#define ast_sip_session_register_supplement(supplement)

References ast_log, ast_res_pjsip_cleanup_message_filter(), ast_sip_register_service(), ast_sip_register_supplement(), ast_sip_session_register_supplement, filter_module_transport, filter_module_tsx, filter_session_supplement, filter_supplement, and LOG_ERROR.

Referenced by load_module().

◆ ast_res_pjsip_init_options_handling()

int ast_res_pjsip_init_options_handling ( int  reload)

Definition at line 2922 of file pjsip_options.c.

2923{
2924 struct ast_taskprocessor *mgmt_serializer;
2925
2926 static const pj_str_t STR_OPTIONS = { "OPTIONS", 7 };
2927
2928 if (reload) {
2930 return 0;
2931 }
2932
2933 if (pjsip_endpt_register_module(ast_sip_get_pjsip_endpoint(), &options_module)
2934 != PJ_SUCCESS) {
2935 return -1;
2936 }
2937
2938 if (pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_ALLOW,
2939 NULL, 1, &STR_OPTIONS) != PJ_SUCCESS) {
2941 return -1;
2942 }
2943
2945 sip_options_aor_hash_fn, NULL, sip_options_aor_cmp_fn);
2946 if (!sip_options_aors) {
2948 return -1;
2949 }
2953 sip_options_endpoint_state_compositor_hash_fn, NULL,
2954 sip_options_endpoint_state_compositor_cmp_fn);
2957 return -1;
2958 }
2959
2960 mgmt_serializer = ast_sip_create_serializer("pjsip/options/manage");
2961 if (!mgmt_serializer) {
2963 return -1;
2964 }
2965
2966 /*
2967 * Set the water mark levels high because we can get a flood of
2968 * contact status updates from sip_options_synchronize() that
2969 * quickly clears on initial load or reload.
2970 */
2971 ast_taskprocessor_alert_set_levels(mgmt_serializer, -1,
2973
2974 /*
2975 * We make sure that the environment is completely setup before we allow
2976 * any other threads to post contact_status updates to the
2977 * management_serializer.
2978 */
2980 mgmt_serializer)) {
2981 /* Set management_serializer in case pushing the task actually failed. */
2982 management_serializer = mgmt_serializer;
2984 return -1;
2985 }
2986
2992
2993 return 0;
2994}
@ AO2_ALLOC_OPT_LOCK_RWLOCK
Definition: astobj2.h:365
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
Definition: astobj2.h:1303
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
struct ast_taskprocessor * ast_sip_create_serializer(const char *name)
Create a new serializer for SIP tasks.
Definition: res_pjsip.c:2094
#define EVENT_FLAG_REPORTING
Definition: manager.h:84
#define EVENT_FLAG_SYSTEM
Definition: manager.h:75
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Definition: manager.h:191
static void sip_options_synchronize(int reload)
Synchronize our local container of AORs and endpoint state compositors with the current configuration...
static int ami_sip_qualify(struct mansession *s, const struct message *m)
void ast_res_pjsip_cleanup_options_handling(void)
#define ENDPOINT_STATE_COMPOSITOR_BUCKETS
These are the number of buckets to store endpoint state compositors.
#define AOR_BUCKETS
These are the number of buckets to store AORs in.
static int ami_show_contacts(struct mansession *s, const struct message *m)
static int sip_options_init_task(void *mgmt_serializer)
Management task to finish setting up the environment.
static int reload(void)
void ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
Register an endpoint formatter.
Definition: res_pjsip.c:481
#define AST_TASKPROCESSOR_HIGH_WATER_LEVEL
Definition: taskprocessor.h:64
int ast_taskprocessor_alert_set_levels(struct ast_taskprocessor *tps, long low_water, long high_water)
Set the high and low alert water marks of the given taskprocessor queue.

References ami_show_contacts(), ami_sip_qualify(), AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, AOR_BUCKETS, ARRAY_LEN, ast_cli_register_multiple, ast_manager_register_xml, ast_res_pjsip_cleanup_options_handling(), ast_sip_create_serializer(), ast_sip_get_pjsip_endpoint(), ast_sip_push_task_wait_serializer(), ast_sip_register_endpoint_formatter(), ast_taskprocessor_alert_set_levels(), AST_TASKPROCESSOR_HIGH_WATER_LEVEL, cli_options, contact_status_formatter, ENDPOINT_STATE_COMPOSITOR_BUCKETS, EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, management_serializer, NULL, options_module, reload(), sip_options_aors, sip_options_endpoint_state_compositors, sip_options_init_task(), and sip_options_synchronize().

Referenced by load_module(), and reload_configuration_task().

◆ ast_res_pjsip_initialize_configuration()

int ast_res_pjsip_initialize_configuration ( void  )

Definition at line 2113 of file pjsip_configuration.c.

2114{
2117 return -1;
2118 }
2119
2122 if (!persistent_endpoints) {
2123 return -1;
2124 }
2125
2126 if (!(sip_sorcery = ast_sorcery_open())) {
2127 ast_log(LOG_ERROR, "Failed to open SIP sorcery failed to open\n");
2128 return -1;
2129 }
2130
2132
2134 ast_log(LOG_ERROR, "Failed to register SIP authentication support\n");
2136 sip_sorcery = NULL;
2137 return -1;
2138 }
2139
2140 ast_sorcery_apply_default(sip_sorcery, "endpoint", "config", "pjsip.conf,criteria=type=endpoint");
2141 ast_sorcery_apply_default(sip_sorcery, "nat_hook", "memory", NULL);
2142
2144 ast_log(LOG_ERROR, "Failed to register SIP endpoint object with sorcery\n");
2146 sip_sorcery = NULL;
2147 return -1;
2148 }
2149
2151 ast_log(LOG_ERROR, "Failed to register nat_hook\n");
2152 }
2153
2154 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "type", "", OPT_NOOP_T, 0, 0);
2156 ast_sorcery_object_field_register_alias(sip_sorcery, "endpoint", "disallow", "", OPT_CODEC_T, 0, FLDSET(struct ast_sip_endpoint, media.codecs));
2157 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow", "", OPT_CODEC_T, 1, FLDSET(struct ast_sip_endpoint, media.codecs));
2158 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtmf_mode", "rfc4733", dtmf_handler, dtmf_to_str, NULL, 0, 0);
2159 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.ipv6));
2160 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_symmetric", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.symmetric));
2161 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "ice_support", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.ice_support));
2162 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_ptime", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_ptime));
2163 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "force_rport", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, nat.force_rport));
2164 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rewrite_contact", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, nat.rewrite_contact));
2165 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "transport", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, transport));
2166 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, outbound_proxy));
2167 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "moh_suggest", "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, mohsuggest));
2170 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "timers_min_se", "90", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, extensions.timer.min_se));
2171 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "timers_sess_expires", "1800", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, extensions.timer.sess_expires));
2176 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "bind_rtp_to_media_address", "no", OPT_BOOL_T, 1, STRFLDSET(struct ast_sip_endpoint, media.bind_rtp_to_media_address));
2177 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "identify_by", "username,ip", ident_handler, ident_to_str, NULL, 0, 0);
2178 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.enabled));
2180 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_connected_line", "yes", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_connected_line));
2181 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_connected_line", "yes", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, id.send_connected_line));
2184 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.disable_on_nat));
2186 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_privacy", "allowed_not_screened", caller_id_privacy_handler, caller_id_privacy_to_str, NULL, 0, 0);
2188 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_inbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_inbound));
2189 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_outbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_outbound));
2190 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_pai));
2191 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_rpid));
2192 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rpid_immediate", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.rpid_immediate));
2193 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_diversion", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_diversion));
2194 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_history_info", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_history_info));
2195 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mailboxes", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, subscription.mwi.mailboxes));
2197 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aggregate_mwi", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.mwi.aggregate));
2198 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mwi_subscribe_replaces_unsolicited", "no", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, subscription.mwi.subscribe_replaces_unsolicited));
2200 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_avpf", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_avpf));
2201 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "force_avp", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.force_avp));
2202 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "media_use_received_transport", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_received_transport));
2203 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_keepalive", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.rtp.keepalive));
2204 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_timeout", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.rtp.timeout));
2205 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_timeout_hold", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.rtp.timeout_hold));
2206 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "one_touch_recording", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, info.recording.enabled));
2207 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "inband_progress", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, inband_progress));
2212 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "device_state_busy_at", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, devicestate_busy_at));
2213 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.enabled));
2215 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl_maxdatagram", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.t38.maxdatagram));
2216 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fax_detect", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, faxdetect));
2217 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fax_detect_timeout", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, faxdetect_timeout));
2218 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.nat));
2219 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.ipv6));
2220 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_bind_udptl_to_media_address", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.bind_udptl_to_media_address));
2221 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tone_zone", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, zone));
2223 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "record_on_feature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, info.recording.onfeature));
2224 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "record_off_feature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, info.recording.offfeature));
2225 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_transfer", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allowtransfer));
2226 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "user_eq_phone", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, usereqphone));
2227 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "moh_passthrough", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, moh_passthrough));
2228 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdp_owner", "-", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.sdpowner));
2229 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdp_session", "Asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.sdpsession));
2232 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_audio));
2233 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_video));
2234 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_subscribe", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.allow));
2235 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sub_min_expiry", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subscription.minexpiry));
2237 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "from_domain", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, fromdomain));
2238 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mwi_from_user", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, subscription.mwi.fromuser));
2239 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_engine", "asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.rtp.engine));
2242 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtls_auto_generate_cert", "no", dtls_handler, dtlsautogeneratecert_to_str, NULL, 0, 0);
2250 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "srtp_tag_32", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.srtp_tag_32));
2251 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "media_encryption_optimistic", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.encryption_optimistic));
2252 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "g726_non_standard", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.g726_non_standard));
2253 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "redirect_method", "user", redirect_handler, NULL, NULL, 0, 0);
2255 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "message_context", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, message_context));
2260 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "contact_deny", "", endpoint_acl_handler, NULL, NULL, 0, 0);
2261 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "contact_permit", "", endpoint_acl_handler, NULL, NULL, 0, 0);
2263 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subscribe_context", "", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct ast_sip_endpoint, subscription.context));
2265 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "preferred_codec_only", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, preferred_codec_only));
2266 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "asymmetric_rtp_codec", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, asymmetric_rtp_codec));
2267 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtcp_mux", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtcp_mux));
2268 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_overlap", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allow_overlap));
2269 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "overlap_context", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, overlap_context));
2270 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "refer_blind_progress", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, refer_blind_progress));
2271 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "notify_early_inuse_ringing", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, notify_early_inuse_ringing));
2272 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "max_audio_streams", "1", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.max_audio_streams));
2273 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "max_video_streams", "1", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.max_video_streams));
2274 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "bundle", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.bundle));
2275 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "webrtc", "no", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, media.webrtc));
2276 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "incoming_mwi_mailbox", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, incoming_mwi_mailbox));
2277 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "follow_early_media_fork", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.follow_early_media_fork));
2278 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "accept_multiple_sdp_answers", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.accept_multiple_sdp_answers));
2279 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "suppress_q850_reason_headers", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, suppress_q850_reason_headers));
2280 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "ignore_183_without_sdp", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, ignore_183_without_sdp));
2281 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "incoming_call_offer_pref", "local",
2283 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "outgoing_call_offer_pref", "remote_merge",
2285 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_incoming_offer",
2286 "prefer: pending, operation: intersect, keep: all, transcode: allow",
2288 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_outgoing_offer",
2289 "prefer: pending, operation: union, keep: all, transcode: allow",
2291 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_incoming_answer",
2292 "prefer: pending, operation: intersect, keep: all",
2294 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_outgoing_answer",
2295 "prefer: pending, operation: intersect, keep: all",
2298 "stir_shaken", 0, stir_shaken_handler, stir_shaken_to_str, NULL, 0, 0);
2299 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "stir_shaken_profile", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, stir_shaken_profile));
2300 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_unauthenticated_options", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allow_unauthenticated_options));
2301 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "geoloc_incoming_call_profile", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, geoloc_incoming_call_profile));
2302 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "geoloc_outgoing_call_profile", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, geoloc_outgoing_call_profile));
2305 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_aoc", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_aoc));
2306 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tenantid", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, tenantid));
2307 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "suppress_moh_on_sendonly",
2308 "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, suppress_moh_on_sendonly));
2309
2311 ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
2313 sip_sorcery = NULL;
2314 return -1;
2315 }
2316
2318 ast_log(LOG_ERROR, "Failed to register SIP location support with sorcery\n");
2320 sip_sorcery = NULL;
2321 return -1;
2322 }
2323
2325
2327 ast_log(LOG_ERROR, "Failed to register SIP domain aliases support with sorcery\n");
2329 sip_sorcery = NULL;
2330 return -1;
2331 }
2332
2334 ast_log(LOG_ERROR, "Failed to register SIP Global support\n");
2336 sip_sorcery = NULL;
2337 return -1;
2338 }
2339
2341 if (!endpoint_formatter) {
2342 ast_log(LOG_ERROR, "Unable to allocate memory for endpoint_formatter\n");
2344 sip_sorcery = NULL;
2345 return -1;
2346 }
2347 endpoint_formatter->name = "endpoint";
2354
2357
2359
2361
2365
2366 return 0;
2367}
struct stasis_message_type * ast_named_acl_change_type(void)
a stasis_message_type for changes against a named ACL or the set of all named ACLs
@ AO2_ALLOC_OPT_LOCK_MUTEX
Definition: astobj2.h:363
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:409
static char language[MAX_LANGUAGE]
Definition: chan_iax2.c:324
static char accountcode[AST_MAX_ACCOUNT_CODE]
Definition: chan_iax2.c:473
static char mohsuggest[MAX_MUSICCLASS]
Definition: chan_iax2.c:475
int ast_sip_initialize_sorcery_auth(void)
Initialize sorcery with auth support.
Definition: config_auth.c:370
int ast_sip_initialize_sorcery_domain_alias(void)
Initialize sorcery with domain alias support.
int ast_sip_initialize_sorcery_global(void)
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_CODEC_T
Type for default option handler for format capabilities.
@ OPT_BOOL_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_CHAR_ARRAY_T
Type for default option handler for character array strings.
@ OPT_YESNO_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_STRINGFIELD_T
Type for default option handler for stringfields.
int ast_sip_initialize_sorcery_transport(void)
Initialize sorcery with transport support.
def info(msg)
static int tos_video_to_str(const void *obj, const intptr_t *args, char **buf)
static int t38udptl_ec_to_str(const void *obj, const intptr_t *args, char **buf)
static int connected_line_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int outgoing_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static int codec_prefs_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static void load_all_endpoints(void)
static int from_user_to_str(const void *obj, const intptr_t *args, char **buf)
static void * sip_nat_hook_alloc(const char *name)
static int prack_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int set_var_to_vl(const void *obj, struct ast_variable **fields)
static int redirect_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int media_address_to_str(const void *obj, const intptr_t *args, char **buf)
static int stir_shaken_to_str(const void *obj, const intptr_t *args, char **buf)
#define PERSISTENT_BUCKETS
Number of buckets for persistent endpoint information.
static int stir_shaken_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int incoming_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static int caller_id_privacy_to_str(const void *obj, const intptr_t *args, char **buf)
static int pickupgroup_to_str(const void *obj, const intptr_t *args, char **buf)
static int cli_endpoint_print_body(void *obj, void *arg, int flags)
void * ast_sip_endpoint_alloc(const char *name)
Allocate a new SIP endpoint.
static int contact_user_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int ident_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int tos_audio_to_str(const void *obj, const intptr_t *args, char **buf)
static int direct_media_method_to_str(const void *obj, const intptr_t *args, char **buf)
static int call_offer_pref_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int dtlsverify_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtls_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int media_encryption_to_str(const void *obj, const intptr_t *args, char **buf)
static int ami_show_endpoints(struct mansession *s, const struct message *m)
static int dtmf_to_str(const void *obj, const intptr_t *args, char **buf)
static int outbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static const struct ast_sorcery_observer endpoint_observers
static int group_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int ami_show_endpoint(struct mansession *s, const struct message *m)
static int outgoing_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static int contact_user_to_str(const void *obj, const intptr_t *args, char **buf)
static int voicemail_extension_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlscapath_to_str(const void *obj, const intptr_t *args, char **buf)
static int contact_acl_to_str(const void *obj, const intptr_t *args, char **buf)
static int set_var_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int named_callgroups_to_str(const void *obj, const intptr_t *args, char **buf)
static int security_negotiation_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int dtlscipher_to_str(const void *obj, const intptr_t *args, char **buf)
static int t38udptl_ec_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int named_pickupgroups_to_str(const void *obj, const intptr_t *args, char **buf)
static int caller_id_tag_to_str(const void *obj, const intptr_t *args, char **buf)
static int caller_id_to_str(const void *obj, const intptr_t *args, char **buf)
static int incoming_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static int cli_endpoint_iterate(void *obj, ao2_callback_fn callback, void *args)
static int security_mechanism_to_str(const void *obj, const intptr_t *args, char **buf)
static int prack_to_str(const void *obj, const intptr_t *args, char **buf)
static int caller_id_tag_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int cli_endpoint_print_header(void *obj, void *arg, int flags)
static int dtlsfingerprint_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlsautogeneratecert_to_str(const void *obj, const intptr_t *args, char **buf)
static int voicemail_extension_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int callgroup_to_str(const void *obj, const intptr_t *args, char **buf)
static int outbound_auths_to_str(const void *obj, const intptr_t *args, char **buf)
static int sip_endpoint_apply_handler(const struct ast_sorcery *sorcery, void *obj)
Callback function for when an object is finalized.
static int connected_line_method_to_str(const void *obj, const intptr_t *args, char **buf)
static int media_encryption_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int persistent_endpoint_cmp(void *obj, void *arg, int flags)
Comparison function for persistent endpoint information.
static void * cli_endpoint_retrieve_by_id(const char *id)
static int inbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int incoming_call_offer_pref_to_str(const void *obj, const intptr_t *args, char **buf)
static int inbound_auths_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlsrekey_to_str(const void *obj, const intptr_t *args, char **buf)
static int outgoing_call_offer_pref_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtmf_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int endpoint_acl_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int from_user_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int set_var_to_str(const void *obj, const intptr_t *args, char **buf)
static int security_negotiation_to_str(const void *obj, const intptr_t *args, char **buf)
static int direct_media_glare_mitigation_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlssetup_to_str(const void *obj, const intptr_t *args, char **buf)
static int tos_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int caller_id_privacy_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int acl_to_str(const void *obj, const intptr_t *args, char **buf)
static int security_mechanism_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int media_address_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int direct_media_glare_mitigation_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int ident_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlscafile_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlscertfile_to_str(const void *obj, const intptr_t *args, char **buf)
static int timers_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int direct_media_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct ao2_container * cli_endpoint_get_container(const char *regex)
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static int dtlsprivatekey_to_str(const void *obj, const intptr_t *args, char **buf)
static int persistent_endpoint_hash(const void *obj, const int flags)
Hashing function for persistent endpoint information.
static int named_groups_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int caller_id_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int timers_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Registers a CLI formatter.
Definition: pjsip_cli.c:310
int ast_sip_initialize_sorcery_location(void)
Initialize sorcery with location support.
Definition: location.c:1369
int ast_sip_initialize_cli(void)
Definition: pjsip_cli.c:360
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
void ast_sorcery_load(const struct ast_sorcery *sorcery)
Inform any wizards to load persistent objects.
Definition: sorcery.c:1377
#define ast_sorcery_object_field_register_alias(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object as an alias.
Definition: sorcery.h:971
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
Definition: sorcery.h:837
int ast_sorcery_observer_add(const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks)
Add an observer to a specific object type.
Definition: sorcery.c:2391
#define ast_sorcery_internal_object_register(sorcery, type, alloc, transform, apply)
Register an internal, hidden object type.
Definition: sorcery.h:867
#define ast_sorcery_object_field_register_custom(sorcery, type, name, default_val, config_handler, sorcery_handler, multiple_handler, flags,...)
Register a field within an object with custom handlers.
Definition: sorcery.h:1005
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
Definition: sorcery.h:955
#define ast_sorcery_apply_default(sorcery, type, name, data)
Definition: sorcery.h:476
#define ast_sorcery_open()
Open a new sorcery structure.
Definition: sorcery.h:406
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
Definition: stasis.h:297
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
Definition: stasis.c:1024
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
Definition: stasis.c:1078
#define stasis_subscribe(topic, callback, data)
Definition: stasis.h:649
CLI Formatter Registry Entry.
Definition: res_pjsip_cli.h:52
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
Definition: res_pjsip_cli.h:66
ao2_callback_fn * print_header
Definition: res_pjsip_cli.h:60
void *(* retrieve_by_id)(const char *id)
Definition: res_pjsip_cli.h:68
const char *(* get_id)(const void *obj)
Definition: res_pjsip_cli.h:70
const char * name
Definition: res_pjsip_cli.h:58
ao2_callback_fn * print_body
Definition: res_pjsip_cli.h:62
struct ao2_container *(* get_container)(const char *regex)
Definition: res_pjsip_cli.h:64
An entity with which Asterisk communicates.
Definition: res_pjsip.h:958
const ast_string_field context
Definition: res_pjsip.h:987
const ast_string_field fromuser
Definition: res_pjsip.h:987
struct ast_sip_endpoint_nat_configuration nat
Definition: res_pjsip.h:995

References accountcode, acl_change_stasis_cb(), acl_change_sub, acl_to_str(), AMI_SHOW_ENDPOINT, ami_show_endpoint(), AMI_SHOW_ENDPOINTS, ami_show_endpoints(), ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, ast_named_acl_change_type(), ast_security_topic(), ast_sip_endpoint_alloc(), ast_sip_initialize_cli(), ast_sip_initialize_sorcery_auth(), ast_sip_initialize_sorcery_domain_alias(), ast_sip_initialize_sorcery_global(), ast_sip_initialize_sorcery_location(), ast_sip_initialize_sorcery_transport(), ast_sip_register_cli_formatter(), ast_sorcery_apply_default, ast_sorcery_internal_object_register, ast_sorcery_load(), ast_sorcery_object_field_register, ast_sorcery_object_field_register_alias, ast_sorcery_object_field_register_custom, ast_sorcery_object_get_id(), ast_sorcery_object_register, ast_sorcery_observer_add(), ast_sorcery_open, ast_sorcery_unref, call_offer_pref_handler(), caller_id_handler(), caller_id_privacy_handler(), caller_id_privacy_to_str(), caller_id_tag_handler(), caller_id_tag_to_str(), caller_id_to_str(), callgroup_to_str(), CHARFLDSET, cli_commands, cli_endpoint_get_container(), cli_endpoint_iterate(), cli_endpoint_print_body(), cli_endpoint_print_header(), cli_endpoint_retrieve_by_id(), codec_prefs_handler(), connected_line_method_handler(), connected_line_method_to_str(), contact_acl_to_str(), contact_user_handler(), contact_user_to_str(), voicemailpwcheck::context, ast_sip_endpoint::context, direct_media_glare_mitigation_handler(), direct_media_glare_mitigation_to_str(), direct_media_method_handler(), direct_media_method_to_str(), dtls_handler(), dtlsautogeneratecert_to_str(), dtlscafile_to_str(), dtlscapath_to_str(), dtlscertfile_to_str(), dtlscipher_to_str(), dtlsfingerprint_to_str(), dtlsprivatekey_to_str(), dtlsrekey_to_str(), dtlssetup_to_str(), dtlsverify_to_str(), dtmf_handler(), dtmf_to_str(), endpoint_acl_handler(), endpoint_formatter, endpoint_observers, EVENT_FLAG_SYSTEM, FLDSET, from_user_handler(), from_user_to_str(), ast_sip_endpoint::fromuser, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, group_handler(), ident_handler(), ident_to_str(), inbound_auth_handler(), inbound_auths_to_str(), incoming_answer_codec_prefs_to_str(), incoming_call_offer_pref_to_str(), incoming_offer_codec_prefs_to_str(), sip_to_pjsip::info(), ast_sip_cli_formatter_entry::iterate, language, load_all_endpoints(), LOG_ERROR, media_address_handler(), media_address_to_str(), media_encryption_handler(), media_encryption_to_str(), mohsuggest, ast_sip_cli_formatter_entry::name, named_callgroups_to_str(), named_groups_handler(), named_pickupgroups_to_str(), ast_sip_endpoint::nat, NULL, OPT_BOOL_T, OPT_CHAR_ARRAY_T, OPT_CODEC_T, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, OPT_YESNO_T, outbound_auth_handler(), outbound_auths_to_str(), outgoing_answer_codec_prefs_to_str(), outgoing_call_offer_pref_to_str(), outgoing_offer_codec_prefs_to_str(), PERSISTENT_BUCKETS, persistent_endpoint_cmp(), persistent_endpoint_hash(), persistent_endpoints, pickupgroup_to_str(), prack_handler(), prack_to_str(), ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, redirect_handler(), ast_sip_cli_formatter_entry::retrieve_by_id, security_mechanism_handler(), security_mechanism_to_str(), security_negotiation_handler(), security_negotiation_to_str(), set_var_handler(), set_var_to_str(), set_var_to_vl(), sip_endpoint_apply_handler(), sip_nat_hook_alloc(), sip_sorcery, stasis_subscribe, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), stir_shaken_handler(), stir_shaken_to_str(), STRFLDSET, t38udptl_ec_handler(), t38udptl_ec_to_str(), timers_handler(), timers_to_str(), tos_audio_to_str(), tos_handler(), tos_video_to_str(), voicemail_extension_handler(), and voicemail_extension_to_str().

Referenced by load_module().

◆ ast_res_pjsip_preinit_options_handling()

int ast_res_pjsip_preinit_options_handling ( void  )

Definition at line 2916 of file pjsip_options.c.

2917{
2919 return sip_options_contact_statuses ? 0 : -1;
2920}
static struct ao2_container * sip_options_contact_statuses_alloc(void)
Helper function to allocate a contact statuses container.

References sip_options_contact_statuses, and sip_options_contact_statuses_alloc().

Referenced by load_module().

◆ ast_res_pjsip_reload_configuration()

int ast_res_pjsip_reload_configuration ( void  )

Definition at line 2391 of file pjsip_configuration.c.

2392{
2393 if (sip_sorcery) {
2395 }
2396 return 0;
2397}
void ast_sorcery_reload(const struct ast_sorcery *sorcery)
Inform any wizards to reload persistent objects.
Definition: sorcery.c:1408

References ast_sorcery_reload(), and sip_sorcery.

Referenced by reload_configuration_task().

◆ ast_sip_destroy_cli()

void ast_sip_destroy_cli ( void  )

Definition at line 375 of file pjsip_cli.c.

376{
379}
static struct ast_cli_entry pjsip_cli[]
Definition: pjsip_cli.c:356
static struct ao2_container * formatter_registry
Definition: pjsip_cli.c:34

References ao2_ref, ARRAY_LEN, ast_cli_unregister_multiple(), formatter_registry, and pjsip_cli.

Referenced by ast_res_pjsip_destroy_configuration().

◆ ast_sip_destroy_distributor()

void ast_sip_destroy_distributor ( void  )

Definition at line 1329 of file pjsip_distributor.c.

1330{
1333
1337
1338 ao2_global_obj_release(artificial_auth);
1340
1342
1343 if (prune_context) {
1345 }
1346
1348
1351}
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
Definition: astobj2.h:859
static struct ast_sorcery_observer global_observer
Observer which is used to update our interval and default_realm when the global setting changes.
static pjsip_module distributor_mod
static void distributor_pool_shutdown(void)
static struct ao2_container * unidentified_requests
static struct ast_cli_entry cli_commands[]
static pjsip_module auth_mod
static pjsip_module endpoint_mod
struct ast_sched_context * prune_context
static struct ast_sip_endpoint * artificial_endpoint
struct ast_sip_cli_formatter_entry * unid_formatter
static struct ao2_container * dialog_associations
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
Definition: sched.c:271

References ao2_cleanup, ao2_global_obj_release, ARRAY_LEN, artificial_endpoint, ast_cli_unregister_multiple(), ast_sched_context_destroy(), ast_sip_get_sorcery(), ast_sip_unregister_cli_formatter(), ast_sip_unregister_service(), ast_sorcery_observer_remove(), auth_mod, cli_commands, dialog_associations, distributor_mod, distributor_pool_shutdown(), endpoint_mod, global_observer, prune_context, unid_formatter, and unidentified_requests.

Referenced by ast_sip_initialize_distributor(), and unload_pjsip().

◆ ast_sip_destroy_global_headers()

void ast_sip_destroy_global_headers ( void  )

Definition at line 181 of file pjsip_global_headers.c.

182{
185
187}
static void destroy_headers(struct header_list *headers)
static pjsip_module global_header_mod
static struct header_list request_headers
static struct header_list response_headers

References ast_sip_unregister_service(), destroy_headers(), global_header_mod, request_headers, and response_headers.

Referenced by unload_pjsip().

◆ ast_sip_destroy_scheduler()

int ast_sip_destroy_scheduler ( void  )

Definition at line 642 of file pjsip_scheduler.c.

643{
645
646 if (scheduler_context) {
647 if (tasks) {
648 struct ao2_iterator iter;
649 struct ast_sip_sched_task *schtd;
650
651 /* Cancel all scheduled tasks */
652 iter = ao2_iterator_init(tasks, 0);
653 while ((schtd = ao2_iterator_next(&iter))) {
655 ao2_ref(schtd, -1);
656 }
658 }
659
662 }
663
665 tasks = NULL;
666
667 return 0;
668}
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
int ast_sip_sched_task_cancel(struct ast_sip_sched_task *schtd)
Cancels the next invocation of a task.
static struct ast_cli_entry cli_commands[]
static struct ast_sched_context * scheduler_context
static struct ao2_container * tasks
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821

References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ARRAY_LEN, ast_cli_unregister_multiple(), ast_sched_context_destroy(), ast_sip_sched_task_cancel(), cli_commands, NULL, scheduler_context, and tasks.

Referenced by load_module(), and unload_module().

◆ ast_sip_destroy_sorcery_auth()

int ast_sip_destroy_sorcery_auth ( void  )

Definition at line 426 of file config_auth.c.

427{
431
432 ast_manager_unregister("PJSIPShowAuths");
433
434 return 0;
435}
static struct ast_cli_entry cli_commands[]
Definition: config_auth.c:350
static struct ast_sip_endpoint_formatter endpoint_auth_formatter
Definition: config_auth.c:212
static struct ast_sip_cli_formatter_entry * cli_formatter
Definition: config_auth.c:367

References ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), ast_sip_unregister_cli_formatter(), ast_sip_unregister_endpoint_formatter(), cli_commands, cli_formatter, and endpoint_auth_formatter.

Referenced by ast_res_pjsip_destroy_configuration().

◆ ast_sip_destroy_sorcery_global()

int ast_sip_destroy_sorcery_global ( void  )

Definition at line 664 of file config_global.c.

665{
667
669
673 }
674
675 ao2_t_global_obj_release(global_cfg, "Module is unloading");
676
677 return 0;
678}
#define ast_free(a)
Definition: astmm.h:180
#define ao2_t_global_obj_release(holder, tag)
Definition: astobj2.h:861
static const struct ast_sorcery_instance_observer observer_callbacks_global
static char * previous_regcontext
int ast_context_destroy_by_name(const char *context, const char *registrar)
Destroy a context by name.
Definition: pbx.c:8205
static struct ast_sorcery * sorcery
void ast_sorcery_instance_observer_remove(struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks)
Remove an observer from a sorcery instance.
Definition: sorcery.c:537
Full structure for sorcery.
Definition: sorcery.c:230

References ao2_t_global_obj_release, ast_context_destroy_by_name(), ast_free, ast_sip_get_sorcery(), ast_sorcery_instance_observer_remove(), observer_callbacks_global, previous_regcontext, and sorcery.

Referenced by ast_res_pjsip_destroy_configuration().

◆ ast_sip_destroy_sorcery_location()

int ast_sip_destroy_sorcery_location ( void  )

Definition at line 1471 of file location.c.

1472{
1477 ast_manager_unregister("PJSIPShowAors");
1478
1480
1481 return 0;
1482}
static struct ast_cli_entry cli_commands[]
Definition: location.c:1293
static const struct ast_sorcery_observer aor_observer
Observer for contacts so state can be updated on respective endpoints.
Definition: location.c:105
struct ast_sip_cli_formatter_entry * contact_formatter
Definition: location.c:1325
struct ast_sip_cli_formatter_entry * aor_formatter
Definition: location.c:1326
struct ast_sip_endpoint_formatter endpoint_aor_formatter
Definition: location.c:878

References aor_formatter, aor_observer, ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), ast_sip_get_sorcery(), ast_sip_unregister_cli_formatter(), ast_sip_unregister_endpoint_formatter(), ast_sorcery_observer_remove(), cli_commands, contact_formatter, and endpoint_aor_formatter.

Referenced by ast_res_pjsip_destroy_configuration().

◆ ast_sip_destroy_sorcery_transport()

int ast_sip_destroy_sorcery_transport ( void  )

Definition at line 1877 of file config_transport.c.

1878{
1881
1883
1886
1887 return 0;
1888}
static struct ast_cli_entry cli_commands[]
struct ast_sip_endpoint_formatter endpoint_transport_formatter
static struct ast_sip_cli_formatter_entry * cli_formatter
static struct ao2_container * transport_states

References ao2_ref, ARRAY_LEN, ast_cli_unregister_multiple(), ast_sip_unregister_cli_formatter(), ast_sip_unregister_endpoint_formatter(), cli_commands, cli_formatter, endpoint_transport_formatter, NULL, and transport_states.

Referenced by ast_res_pjsip_destroy_configuration().

◆ ast_sip_destroy_system()

void ast_sip_destroy_system ( void  )

Definition at line 245 of file config_system.c.

246{
248}
static struct ast_sorcery * system_sorcery
Definition: config_system.c:75

References ast_sorcery_unref, and system_sorcery.

Referenced by unload_pjsip().

◆ ast_sip_destroy_transport_events()

void ast_sip_destroy_transport_events ( void  )

Definition at line 683 of file pjsip_transport_events.c.

684{
685 pjsip_tpmgr *tpmgr;
686
688
689 tpmgr = pjsip_endpt_get_tpmgr(ast_sip_get_pjsip_endpoint());
690 if (tpmgr) {
691 pjsip_tpmgr_set_state_cb(tpmgr, tpmgr_state_callback);
692 }
693
694 ao2_global_obj_release(active_transports);
695}
static struct ast_cli_entry cli_commands[]
static pjsip_tp_state_callback tpmgr_state_callback
Existing transport events callback that we need to invoke.

References ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_sip_get_pjsip_endpoint(), cli_commands, and tpmgr_state_callback.

Referenced by unload_pjsip().

◆ ast_sip_destroy_transport_management()

void ast_sip_destroy_transport_management ( void  )

Definition at line 410 of file pjsip_transport_management.c.

411{
412 if (keepalive_interval) {
415 pthread_kill(keepalive_thread, SIGURG);
416 pthread_join(keepalive_thread, NULL);
418 }
419 }
420
422
424
426
429 sched = NULL;
430
431 ao2_global_obj_release(monitored_transports);
432}
#define AST_PTHREADT_NULL
Definition: lock.h:66
static pjsip_module idle_monitor_module
static int idle_sched_cb(const void *data)
static unsigned int keepalive_interval
The global interval at which to send keepalives.
static int idle_sched_cleanup(const void *data)
static pthread_t keepalive_thread
Thread keeping things alive.
struct ast_sip_tpmgr_state_callback monitored_transport_reg
static struct ast_sorcery_observer keepalive_global_observer
Observer which is used to update our interval when the global setting changes.
void ast_sip_transport_state_unregister(struct ast_sip_tpmgr_state_callback *element)
Unregister a transport state notification callback element.
void ast_sched_clean_by_callback(struct ast_sched_context *con, ast_sched_cb match, ast_sched_cb cleanup_cb)
Clean all scheduled events with matching callback.
Definition: sched.c:409
Definition: sched.c:76

References ao2_global_obj_release, AST_PTHREADT_NULL, ast_sched_clean_by_callback(), ast_sched_context_destroy(), ast_sip_get_sorcery(), ast_sip_transport_state_unregister(), ast_sip_unregister_service(), ast_sorcery_observer_remove(), idle_monitor_module, idle_sched_cb(), idle_sched_cleanup(), keepalive_global_observer, keepalive_interval, keepalive_thread, monitored_transport_reg, and NULL.

Referenced by unload_pjsip().

◆ ast_sip_get_taskprocessor_overload_trigger()

enum ast_sip_taskprocessor_overload_trigger ast_sip_get_taskprocessor_overload_trigger ( void  )

Definition at line 513 of file config_global.c.

514{
516 struct global_config *cfg;
517
518 cfg = get_global_cfg();
519 if (!cfg) {
521 }
522
523 trigger = cfg->overload_trigger;
524 ao2_ref(cfg, -1);
525 return trigger;
526}
static struct global_config * get_global_cfg(void)
#define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER
Definition: config_global.c:55
ast_sip_taskprocessor_overload_trigger
enum ast_sip_taskprocessor_overload_trigger overload_trigger

References ao2_ref, DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER, get_global_cfg(), and global_config::overload_trigger.

Referenced by global_loaded().

◆ ast_sip_global_default_outbound_endpoint()

char * ast_sip_global_default_outbound_endpoint ( void  )

Definition at line 223 of file config_global.c.

224{
225 char *str;
226 struct global_config *cfg;
227
228 cfg = get_global_cfg();
229 if (!cfg) {
231 }
232
234 ao2_ref(cfg, -1);
235 return str;
236}
const char * str
Definition: app_jack.c:147
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define DEFAULT_OUTBOUND_ENDPOINT
Definition: config_global.c:35
const ast_string_field default_outbound_endpoint
Definition: config_global.c:86

References ao2_ref, ast_strdup, DEFAULT_OUTBOUND_ENDPOINT, global_config::default_outbound_endpoint, get_global_cfg(), and str.

Referenced by ast_sip_default_outbound_endpoint().

◆ ast_sip_initialize_cli()

int ast_sip_initialize_cli ( void  )

Definition at line 360 of file pjsip_cli.c.

361{
364
365 if (!formatter_registry) {
366 ast_log(LOG_ERROR, "Unable to create formatter_registry.\n");
367 return -1;
368 }
369
371
372 return 0;
373}
@ AO2_ALLOC_OPT_LOCK_NOLOCK
Definition: astobj2.h:367
static int formatter_sort(const void *obj, const void *arg, int flags)
Definition: pjsip_cli.c:239
static int formatter_hash(const void *obj, int flags)
Definition: pjsip_cli.c:293
static int formatter_compare(void *obj, void *arg, int flags)
Definition: pjsip_cli.c:264

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, ast_log, formatter_compare(), formatter_hash(), formatter_registry, formatter_sort(), LOG_ERROR, and pjsip_cli.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_sip_initialize_distributor()

int ast_sip_initialize_distributor ( void  )

Definition at line 1255 of file pjsip_distributor.c.

1256{
1259 if (!unidentified_requests) {
1260 return -1;
1261 }
1262
1266 if (!dialog_associations) {
1268 return -1;
1269 }
1270
1271 if (distributor_pool_setup()) {
1273 return -1;
1274 }
1275
1277 if (!prune_context) {
1279 return -1;
1280 }
1281
1284 return -1;
1285 }
1286
1289
1292 return -1;
1293 }
1294
1297 return -1;
1298 }
1301 return -1;
1302 }
1305 return -1;
1306 }
1307
1310 if (!unid_formatter) {
1312 ast_log(LOG_ERROR, "Unable to allocate memory for unid_formatter\n");
1313 return -1;
1314 }
1315 unid_formatter->name = "unidentified_request";
1323
1325
1326 return 0;
1327}
#define ao2_alloc_options(data_size, destructor_fn, options)
Definition: astobj2.h:404
static int dialog_associations_hash(const void *obj, int flags)
static int cli_unid_iterate(void *container, ao2_callback_fn callback, void *args)
static int cli_unid_print_header(void *obj, void *arg, int flags)
#define DIALOG_ASSOCIATIONS_BUCKETS
static struct ao2_container * cli_unid_get_container(const char *regex)
static int cli_unid_print_body(void *obj, void *arg, int flags)
static int suspects_hash(const void *obj, int flags)
static void * cli_unid_retrieve_by_id(const char *id)
static int suspects_compare(void *obj, void *arg, int flags)
static int create_artificial_endpoint(void)
static int dialog_associations_cmp(void *obj, void *arg, int flags)
void ast_sip_destroy_distributor(void)
static int create_artificial_auth(void)
static const char * cli_unid_get_id(const void *obj)
static int distributor_pool_setup(void)
#define DEFAULT_SUSPECTS_BUCKETS
int ast_sched_start_thread(struct ast_sched_context *con)
Start a thread for processing scheduler entries.
Definition: sched.c:197
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
Definition: sched.c:238
void ast_sorcery_reload_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to reload persistent objects.
Definition: sorcery.c:1442

References AO2_ALLOC_OPT_LOCK_NOLOCK, AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_alloc_options, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_sched_context_create(), ast_sched_start_thread(), ast_sip_destroy_distributor(), ast_sip_get_sorcery(), ast_sip_register_cli_formatter(), ast_sip_register_service(), ast_sorcery_observer_add(), ast_sorcery_reload_object(), auth_mod, cli_commands, cli_unid_get_container(), cli_unid_get_id(), cli_unid_iterate(), cli_unid_print_body(), cli_unid_print_header(), cli_unid_retrieve_by_id(), create_artificial_auth(), create_artificial_endpoint(), DEFAULT_SUSPECTS_BUCKETS, dialog_associations, DIALOG_ASSOCIATIONS_BUCKETS, dialog_associations_cmp(), dialog_associations_hash(), distributor_mod, distributor_pool_setup(), endpoint_mod, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, global_observer, ast_sip_cli_formatter_entry::iterate, LOG_ERROR, ast_sip_cli_formatter_entry::name, NULL, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, prune_context, ast_sip_cli_formatter_entry::retrieve_by_id, suspects_compare(), suspects_hash(), unid_formatter, and unidentified_requests.

Referenced by load_module().

◆ ast_sip_initialize_dns()

void ast_sip_initialize_dns ( void  )

Definition at line 314 of file config_system.c.

315{
317}
static int system_create_resolver_and_set_nameservers(void *data)
int ast_sip_push_task_wait_servant(struct ast_taskprocessor *serializer, int(*sip_task)(void *), void *task_data)
Push a task to SIP servants and wait for it to complete.
Definition: res_pjsip.c:2165

References ast_sip_push_task_wait_servant(), NULL, and system_create_resolver_and_set_nameservers().

Referenced by load_module(), and reload_configuration_task().

◆ ast_sip_initialize_global()

int ast_sip_initialize_global ( void  )

◆ ast_sip_initialize_global_headers()

void ast_sip_initialize_global_headers ( void  )

Definition at line 163 of file pjsip_global_headers.c.

164{
167
169}
#define AST_RWLIST_HEAD_INIT(head)
Initializes an rwlist head structure.
Definition: linkedlists.h:639

References AST_RWLIST_HEAD_INIT, ast_sip_register_service(), global_header_mod, request_headers, and response_headers.

Referenced by load_module().

◆ ast_sip_initialize_resolver()

void ast_sip_initialize_resolver ( void  )

Definition at line 710 of file pjsip_resolver.c.

711{
712 /* External resolver support does not exist in the version of PJSIP in use */
713 ast_log(LOG_NOTICE, "The version of PJSIP in use does not support external resolvers, using PJSIP provided resolver\n");
714}
#define LOG_NOTICE

References ast_log, and LOG_NOTICE.

Referenced by load_module().

◆ ast_sip_initialize_scheduler()

int ast_sip_initialize_scheduler ( void  )

Initialize scheduler.

Since
13.9.0
Return values
-1failure
0success

Definition at line 614 of file pjsip_scheduler.c.

615{
617 if (!scheduler_context) {
618 ast_log(LOG_ERROR, "Failed to create scheduler. Aborting load\n");
619 return -1;
620 }
621
623 ast_log(LOG_ERROR, "Failed to start scheduler. Aborting load\n");
625 return -1;
626 }
627
629 AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, TASK_BUCKETS, ast_sip_sched_task_hash_fn,
630 ast_sip_sched_task_sort_fn, ast_sip_sched_task_cmp_fn);
631 if (!tasks) {
632 ast_log(LOG_ERROR, "Failed to allocate task container. Aborting load\n");
634 return -1;
635 }
636
638
639 return 0;
640}
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT
Reject objects with duplicate keys in container.
Definition: astobj2.h:1188
#define TASK_BUCKETS

References AO2_ALLOC_OPT_LOCK_RWLOCK, ao2_container_alloc_hash, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_sched_context_create(), ast_sched_context_destroy(), ast_sched_start_thread(), cli_commands, LOG_ERROR, scheduler_context, TASK_BUCKETS, and tasks.

Referenced by load_module().

◆ ast_sip_initialize_sorcery_auth()

int ast_sip_initialize_sorcery_auth ( void  )

Initialize sorcery with auth support.

Definition at line 370 of file config_auth.c.

371{
373
374 ast_sorcery_apply_default(sorcery, SIP_SORCERY_AUTH_TYPE, "config", "pjsip.conf,criteria=type=auth");
375
377 return -1;
378 }
379
381 OPT_NOOP_T, 0, 0);
383 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, auth_user));
385 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, auth_pass));
387 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, refresh_token));
389 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, oauth_clientid));
391 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, oauth_secret));
393 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, md5_creds));
395 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_auth, realm));
397 "32", OPT_UINT_T, 0, FLDSET(struct ast_sip_auth, nonce_lifetime));
399 "userpass", auth_type_handler, auth_type_to_str, NULL, 0, 0);
400
402
404 if (!cli_formatter) {
405 ast_log(LOG_ERROR, "Unable to allocate memory for cli formatter\n");
406 return -1;
407 }
415
418
420 return -1;
421 }
422
423 return 0;
424}
static int cli_print_header(void *obj, void *arg, int flags)
Definition: config_auth.c:311
static int cli_iterator(void *container, ao2_callback_fn callback, void *args)
Definition: config_auth.c:301
static void * auth_alloc(const char *name)
Definition: config_auth.c:36
static void * cli_retrieve_by_id(const char *id)
Definition: config_auth.c:306
static int auth_type_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Definition: config_auth.c:52
static int auth_apply(const struct ast_sorcery *sorcery, void *obj)
Definition: config_auth.c:93
static struct ao2_container * cli_get_container(const char *regex)
Definition: config_auth.c:277
static int cli_print_body(void *obj, void *arg, int flags)
Definition: config_auth.c:326
static int ami_show_auths(struct mansession *s, const struct message *m)
Definition: config_auth.c:247
static int auth_type_to_str(const void *obj, const intptr_t *args, char **buf)
Definition: config_auth.c:86
#define SIP_SORCERY_AUTH_TYPE
Definition: res_pjsip.h:574

References ami_show_auths(), ao2_alloc, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, ast_sip_get_sorcery(), ast_sip_register_cli_formatter(), ast_sip_register_endpoint_formatter(), ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_get_id(), ast_sorcery_object_register, auth_alloc(), auth_apply(), auth_type_handler(), auth_type_to_str(), cli_commands, cli_formatter, cli_get_container(), cli_iterator(), cli_print_body(), cli_print_header(), cli_retrieve_by_id(), endpoint_auth_formatter, EVENT_FLAG_SYSTEM, FLDSET, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, ast_sip_cli_formatter_entry::iterate, LOG_ERROR, ast_sip_cli_formatter_entry::name, NULL, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, ast_sip_cli_formatter_entry::retrieve_by_id, SIP_SORCERY_AUTH_TYPE, sorcery, and STRFLDSET.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_sip_initialize_sorcery_domain_alias()

int ast_sip_initialize_sorcery_domain_alias ( void  )

Initialize sorcery with domain alias support.

Definition at line 71 of file config_domain_aliases.c.

72{
74
75 ast_sorcery_apply_default(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE, "config", "pjsip.conf,criteria=type=domain_alias");
76
79 return -1;
80 }
81
83 OPT_NOOP_T, 0, 0);
85 "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_domain_alias, domain));
86
87 return 0;
88}
static void * domain_alias_alloc(const char *name)
static int domain_alias_apply(const struct ast_sorcery *sorcery, void *obj)
Apply handler for domain_alias type.
#define SIP_SORCERY_DOMAIN_ALIAS_TYPE
Definition: res_pjsip.h:309

References ast_sip_get_sorcery(), ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_register, domain_alias_alloc(), domain_alias_apply(), NULL, OPT_NOOP_T, OPT_STRINGFIELD_T, SIP_SORCERY_DOMAIN_ALIAS_TYPE, sorcery, and STRFLDSET.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_sip_initialize_sorcery_global()

int ast_sip_initialize_sorcery_global ( void  )

Definition at line 681 of file config_global.c.

682{
684
685 snprintf(default_useragent, sizeof(default_useragent), "%s %s",
687
688 ast_sorcery_apply_default(sorcery, "global", "config", "pjsip.conf,criteria=type=global,single_object=yes,explicit_name=global");
689
691 return -1;
692 }
693
694 ast_sorcery_object_field_register(sorcery, "global", "type", "", OPT_NOOP_T, 0, 0);
695 ast_sorcery_object_field_register(sorcery, "global", "max_forwards",
699 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, useragent));
700 ast_sorcery_object_field_register(sorcery, "global", "default_outbound_endpoint",
702 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_outbound_endpoint));
705 ast_sorcery_object_field_register(sorcery, "global", "endpoint_identifier_order",
707 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, endpoint_identifier_order));
708 ast_sorcery_object_field_register(sorcery, "global", "keep_alive_interval",
710 OPT_UINT_T, 0, FLDSET(struct global_config, keep_alive_interval));
711 ast_sorcery_object_field_register(sorcery, "global", "max_initial_qualify_time",
713 OPT_UINT_T, 0, FLDSET(struct global_config, max_initial_qualify_time));
714 ast_sorcery_object_field_register(sorcery, "global", "default_from_user", DEFAULT_FROM_USER,
715 OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_from_user));
716 ast_sorcery_object_field_register(sorcery, "global", "default_voicemail_extension",
721 ast_sorcery_object_field_register(sorcery, "global", "contact_expiration_check_interval",
723 OPT_UINT_T, 0, FLDSET(struct global_config, contact_expiration_check_interval));
724 ast_sorcery_object_field_register(sorcery, "global", "disable_multi_domain",
725 DEFAULT_DISABLE_MULTI_DOMAIN ? "yes" : "no",
726 OPT_BOOL_T, 1, FLDSET(struct global_config, disable_multi_domain));
727 ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_count",
729 OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_count));
730 ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_period",
732 OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_period));
733 ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_prune_interval",
735 OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_prune_interval));
736 ast_sorcery_object_field_register(sorcery, "global", "default_realm", DEFAULT_REALM,
738 ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_high",
741 ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_low",
744 ast_sorcery_object_field_register(sorcery, "global", "mwi_disable_initial_unsolicited",
747 ast_sorcery_object_field_register(sorcery, "global", "allow_sending_180_after_183",
749 OPT_BOOL_T, 1, FLDSET(struct global_config, allow_sending_180_after_183));
750 ast_sorcery_object_field_register(sorcery, "global", "ignore_uri_user_options",
751 DEFAULT_IGNORE_URI_USER_OPTIONS ? "yes" : "no",
752 OPT_BOOL_T, 1, FLDSET(struct global_config, ignore_uri_user_options));
753 ast_sorcery_object_field_register(sorcery, "global", "use_callerid_contact",
754 DEFAULT_USE_CALLERID_CONTACT ? "yes" : "no",
755 OPT_YESNO_T, 1, FLDSET(struct global_config, use_callerid_contact));
756 ast_sorcery_object_field_register(sorcery, "global", "send_contact_status_on_update_registration",
758 OPT_YESNO_T, 1, FLDSET(struct global_config, send_contact_status_on_update_registration));
759 ast_sorcery_object_field_register_custom(sorcery, "global", "taskprocessor_overload_trigger",
762 ast_sorcery_object_field_register(sorcery, "global", "norefersub",
763 DEFAULT_NOREFERSUB ? "yes" : "no",
764 OPT_YESNO_T, 1, FLDSET(struct global_config, norefersub));
765 ast_sorcery_object_field_register(sorcery, "global", "all_codecs_on_empty_reinvite",
767 OPT_BOOL_T, 1, FLDSET(struct global_config, all_codecs_on_empty_reinvite));
768
770 return -1;
771 }
772
773 return 0;
774}
const char * ast_get_version(void)
Retrieve the Asterisk version string.
#define __stringify(x)
Definition: asterisk.h:216
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:325
#define DEFAULT_FROM_USER
Definition: config_global.c:39
static int overload_trigger_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_NOREFERSUB
Definition: config_global.c:56
static void * global_alloc(const char *name)
static char default_useragent[256]
Definition: config_global.c:68
#define DEFAULT_UNIDENTIFIED_REQUEST_COUNT
Definition: config_global.c:45
#define DEFAULT_USERAGENT_PREFIX
Definition: config_global.c:34
#define DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL
Definition: config_global.c:42
static const char * overload_trigger_map[]
#define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION
Definition: config_global.c:54
#define DEFAULT_MAX_FORWARDS
Definition: config_global.c:32
#define DEFAULT_MAX_INITIAL_QUALIFY_TIME
Definition: config_global.c:38
#define DEFAULT_VOICEMAIL_EXTENSION
Definition: config_global.c:44
#define DEFAULT_DEBUG
Definition: config_global.c:36
#define DEFAULT_DISABLE_MULTI_DOMAIN
Definition: config_global.c:43
#define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED
Definition: config_global.c:50
#define DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL
Definition: config_global.c:47
#define DEFAULT_REALM
Definition: config_global.c:40
static int overload_trigger_to_str(const void *obj, const intptr_t *args, char **buf)
#define DEFAULT_ALL_CODECS_ON_EMPTY_REINVITE
Definition: config_global.c:57
#define DEFAULT_ALLOW_SENDING_180_AFTER_183
Definition: config_global.c:51
#define DEFAULT_ENDPOINT_IDENTIFIER_ORDER
Definition: config_global.c:37
#define DEFAULT_REGCONTEXT
Definition: config_global.c:41
#define DEFAULT_USE_CALLERID_CONTACT
Definition: config_global.c:53
#define DEFAULT_IGNORE_URI_USER_OPTIONS
Definition: config_global.c:52
#define DEFAULT_MWI_TPS_QUEUE_HIGH
Definition: config_global.c:48
#define DEFAULT_UNIDENTIFIED_REQUEST_PERIOD
Definition: config_global.c:46
#define DEFAULT_KEEPALIVE_INTERVAL
Definition: config_global.c:33
static int global_apply(const struct ast_sorcery *sorcery, void *obj)
#define DEFAULT_MWI_TPS_QUEUE_LOW
Definition: config_global.c:49
@ OPT_INT_T
Type for default option handler for signed integers.
static char default_realm[AST_SIP_AUTH_MAX_REALM_LENGTH+1]
static char * default_voicemail_extension
Definition: res_pjsip_mwi.c:49
static int debug
Global debug status.
Definition: res_xmpp.c:441
int ast_sorcery_instance_observer_add(struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks)
Add an observer to a sorcery instance.
Definition: sorcery.c:520
unsigned int tps_queue_high
unsigned int disable_initial_unsolicited
Channel datastore data for max forwards.
Definition: max_forwards.c:29

References __stringify, ast_get_version(), ast_sip_get_sorcery(), ast_sorcery_apply_default, ast_sorcery_instance_observer_add(), ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_register, debug, DEFAULT_ALL_CODECS_ON_EMPTY_REINVITE, DEFAULT_ALLOW_SENDING_180_AFTER_183, DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL, DEFAULT_DEBUG, DEFAULT_DISABLE_MULTI_DOMAIN, DEFAULT_ENDPOINT_IDENTIFIER_ORDER, DEFAULT_FROM_USER, DEFAULT_IGNORE_URI_USER_OPTIONS, DEFAULT_KEEPALIVE_INTERVAL, DEFAULT_MAX_FORWARDS, DEFAULT_MAX_INITIAL_QUALIFY_TIME, DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED, DEFAULT_MWI_TPS_QUEUE_HIGH, DEFAULT_MWI_TPS_QUEUE_LOW, DEFAULT_NOREFERSUB, DEFAULT_OUTBOUND_ENDPOINT, DEFAULT_REALM, default_realm, DEFAULT_REGCONTEXT, DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION, DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER, DEFAULT_UNIDENTIFIED_REQUEST_COUNT, DEFAULT_UNIDENTIFIED_REQUEST_PERIOD, DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL, DEFAULT_USE_CALLERID_CONTACT, default_useragent, DEFAULT_USERAGENT_PREFIX, DEFAULT_VOICEMAIL_EXTENSION, default_voicemail_extension, global_config::disable_initial_unsolicited, FLDSET, global_alloc(), global_apply(), NULL, observer_callbacks_global, OPT_BOOL_T, OPT_INT_T, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, OPT_YESNO_T, overload_trigger_handler(), overload_trigger_map, overload_trigger_to_str(), regcontext, sorcery, STRFLDSET, global_config::tps_queue_high, and global_config::tps_queue_low.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_sip_initialize_sorcery_location()

int ast_sip_initialize_sorcery_location ( void  )

Initialize sorcery with location support.

Definition at line 1369 of file location.c.

1370{
1372 int i;
1373
1374 ast_pjproject_get_buildopt("PJ_MAX_HOSTNAME", "%d", &pj_max_hostname);
1375 /* As of pjproject 2.4.5, PJSIP_MAX_URL_SIZE isn't exposed yet but we try anyway. */
1376 ast_pjproject_get_buildopt("PJSIP_MAX_URL_SIZE", "%d", &pjsip_max_url_size);
1377
1378 ast_sorcery_apply_default(sorcery, "contact", "astdb", "registrar");
1381 ast_sorcery_apply_default(sorcery, "aor", "config", "pjsip.conf,criteria=type=aor");
1382
1385 return -1;
1386 }
1387
1389
1390 ast_sorcery_object_field_register(sorcery, "contact", "type", "", OPT_NOOP_T, 0, 0);
1392 ast_sorcery_object_field_register(sorcery, "contact", "path", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, path));
1394 ast_sorcery_object_field_register(sorcery, "contact", "qualify_frequency", 0, OPT_UINT_T,
1395 PARSE_IN_RANGE, FLDSET(struct ast_sip_contact, qualify_frequency), 0, 86400);
1396 ast_sorcery_object_field_register(sorcery, "contact", "qualify_timeout", "3.0", OPT_DOUBLE_T, 0, FLDSET(struct ast_sip_contact, qualify_timeout));
1397 ast_sorcery_object_field_register(sorcery, "contact", "authenticate_qualify", "no", OPT_YESNO_T, 1, FLDSET(struct ast_sip_contact, authenticate_qualify));
1398 ast_sorcery_object_field_register(sorcery, "contact", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, outbound_proxy));
1399 ast_sorcery_object_field_register(sorcery, "contact", "user_agent", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, user_agent));
1400 ast_sorcery_object_field_register(sorcery, "contact", "endpoint", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, endpoint_name));
1401 ast_sorcery_object_field_register(sorcery, "contact", "reg_server", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, reg_server));
1402 ast_sorcery_object_field_register(sorcery, "contact", "via_addr", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, via_addr));
1403 ast_sorcery_object_field_register(sorcery, "contact", "via_port", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_contact, via_port));
1404 ast_sorcery_object_field_register(sorcery, "contact", "call_id", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, call_id));
1405 ast_sorcery_object_field_register(sorcery, "contact", "prune_on_boot", "no", OPT_YESNO_T, 1, FLDSET(struct ast_sip_contact, prune_on_boot));
1406
1407 ast_sorcery_object_field_register(sorcery, "aor", "type", "", OPT_NOOP_T, 0, 0);
1408 ast_sorcery_object_field_register(sorcery, "aor", "minimum_expiration", "60", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, minimum_expiration));
1409 ast_sorcery_object_field_register(sorcery, "aor", "maximum_expiration", "7200", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, maximum_expiration));
1410 ast_sorcery_object_field_register(sorcery, "aor", "default_expiration", "3600", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, default_expiration));
1411 ast_sorcery_object_field_register(sorcery, "aor", "qualify_frequency", 0, OPT_UINT_T, PARSE_IN_RANGE, FLDSET(struct ast_sip_aor, qualify_frequency), 0, 86400);
1412 ast_sorcery_object_field_register(sorcery, "aor", "qualify_timeout", "3.0", OPT_DOUBLE_T, 0, FLDSET(struct ast_sip_aor, qualify_timeout));
1413 ast_sorcery_object_field_register(sorcery, "aor", "authenticate_qualify", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, authenticate_qualify));
1414 ast_sorcery_object_field_register(sorcery, "aor", "max_contacts", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, max_contacts));
1415 ast_sorcery_object_field_register(sorcery, "aor", "remove_existing", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, remove_existing));
1416 ast_sorcery_object_field_register(sorcery, "aor", "remove_unavailable", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, remove_unavailable));
1420 ast_sorcery_object_field_register(sorcery, "aor", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_aor, outbound_proxy));
1421 ast_sorcery_object_field_register(sorcery, "aor", "support_path", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, support_path));
1422
1424
1426 if (!contact_formatter) {
1427 ast_log(LOG_ERROR, "Unable to allocate memory for contact_formatter\n");
1428 return -1;
1429 }
1430 contact_formatter->name = "contact";
1437
1439 if (!aor_formatter) {
1440 ast_log(LOG_ERROR, "Unable to allocate memory for aor_formatter\n");
1441 return -1;
1442 }
1443 aor_formatter->name = "aor";
1450
1454
1456 return -1;
1457 }
1458
1459 /*
1460 * Reset StatsD gauges in case we didn't shut down cleanly.
1461 * Note that this must done here, as contacts will create the contact_status
1462 * object before PJSIP options handling is initialized.
1463 */
1464 for (i = 0; i <= REMOVED; i++) {
1465 ast_statsd_log_full_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE, 0, 1.0, ast_sip_get_contact_status_label(i));
1466 }
1467
1468 return 0;
1469}
@ OPT_DOUBLE_T
Type for default option handler for doubles.
static int contact_apply_handler(const struct ast_sorcery *sorcery, void *object)
Always create a contact_status for each contact.
Definition: location.c:1329
static int expiration_str2struct(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for translating from a string timeval to actual structure.
Definition: location.c:482
static void * contact_alloc(const char *name)
Allocator for contact.
Definition: location.c:120
static int cli_aor_print_body(void *obj, void *arg, int flags)
Definition: location.c:1186
static int contacts_to_var_list(const void *obj, struct ast_variable **fields)
Definition: location.c:660
static int pjsip_max_url_size
Definition: location.c:37
static int cli_contact_iterate(void *container, ao2_callback_fn callback, void *args)
Definition: location.c:979
static int voicemail_extension_to_str(const void *obj, const intptr_t *args, char **buf)
Definition: location.c:678
static int expiration_struct2str(const void *obj, const intptr_t *args, char **buf)
Custom handler for translating from an actual structure timeval to string.
Definition: location.c:489
static const char * cli_contact_get_id(const void *obj)
Definition: location.c:919
static void * aor_alloc(const char *name)
Allocator for AOR.
Definition: location.c:50
static int permanent_uri_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for permanent URIs.
Definition: location.c:592
static int voicemail_extension_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Definition: location.c:669
static void * cli_contact_retrieve_by_id(const char *id)
Definition: location.c:1079
static int contacts_to_str(const void *obj, const intptr_t *args, char **buf)
Definition: location.c:811
static int pj_max_hostname
Definition: location.c:36
static int cli_aor_print_header(void *obj, void *arg, int flags)
Definition: location.c:1159
static struct ao2_container * cli_contact_get_container(const char *regex)
Definition: location.c:1029
static const char * cli_aor_get_id(const void *obj)
Definition: location.c:1154
static struct ao2_container * cli_aor_get_container(const char *regex)
Definition: location.c:882
static void * cli_aor_retrieve_by_id(const char *id)
Definition: location.c:1149
static int cli_contact_print_header(void *obj, void *arg, int flags)
Definition: location.c:1094
static int aor_apply_handler(const struct ast_sorcery *sorcery, void *object)
Definition: location.c:1355
static int cli_contact_print_body(void *obj, void *arg, int flags)
Definition: location.c:1109
static int cli_aor_iterate(void *container, ao2_callback_fn callback, void *args)
Definition: location.c:1142
static int ami_show_aors(struct mansession *s, const struct message *m)
Definition: location.c:1263
static int default_expiration
Definition: pbx_dundi.c:199
static struct stasis_rest_handlers mailboxes
REST handler for /api-docs/mailboxes.json.
int ast_pjproject_get_buildopt(char *option, char *format_string,...)
Retrieve a pjproject build option.
const char * ast_sip_get_contact_status_label(const enum ast_sip_contact_status_type status)
translate ast_sip_contact_status_type to character string.
@ REMOVED
Definition: res_pjsip.h:440
int ast_sorcery_object_set_congestion_levels(struct ast_sorcery *sorcery, const char *type, long low_water, long high_water)
Set the high and low alert water marks of the sorcery object type.
Definition: sorcery.c:1114
void ast_statsd_log_full_va(const char *metric_name, const char *metric_type, intmax_t value, double sample_rate,...)
Send a stat to the configured statsd server.
Definition: res_statsd.c:209
A SIP address of record.
Definition: res_pjsip.h:475
Contact associated with an address of record.
Definition: res_pjsip.h:389

References ami_show_aors(), ao2_alloc, aor_alloc(), aor_apply_handler(), aor_formatter, aor_observer, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, ast_pjproject_get_buildopt(), ast_sip_get_contact_status_label(), ast_sip_get_sorcery(), ast_sip_register_cli_formatter(), ast_sip_register_endpoint_formatter(), ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_register, ast_sorcery_object_set_congestion_levels(), ast_sorcery_observer_add(), AST_STATSD_GAUGE, ast_statsd_log_full_va(), AST_TASKPROCESSOR_HIGH_WATER_LEVEL, cli_aor_get_container(), cli_aor_get_id(), cli_aor_iterate(), cli_aor_print_body(), cli_aor_print_header(), cli_aor_retrieve_by_id(), cli_commands, cli_contact_get_container(), cli_contact_get_id(), cli_contact_iterate(), cli_contact_print_body(), cli_contact_print_header(), cli_contact_retrieve_by_id(), contact_alloc(), contact_apply_handler(), contact_formatter, contacts_to_str(), contacts_to_var_list(), default_expiration, endpoint_aor_formatter, EVENT_FLAG_SYSTEM, expiration_str2struct(), expiration_struct2str(), FLDSET, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, ast_sip_cli_formatter_entry::iterate, LOG_ERROR, mailboxes, ast_sip_cli_formatter_entry::name, NULL, OPT_BOOL_T, OPT_DOUBLE_T, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, OPT_YESNO_T, PARSE_IN_RANGE, permanent_uri_handler(), pj_max_hostname, pjsip_max_url_size, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, REMOVED, ast_sip_cli_formatter_entry::retrieve_by_id, sorcery, STRFLDSET, voicemail_extension_handler(), and voicemail_extension_to_str().

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_sip_initialize_sorcery_qualify()

int ast_sip_initialize_sorcery_qualify ( void  )

◆ ast_sip_initialize_sorcery_transport()

int ast_sip_initialize_sorcery_transport ( void  )

Initialize sorcery with transport support.

Definition at line 1798 of file config_transport.c.

1799{
1801 struct ao2_container *transports = NULL;
1802
1803 /* Create outbound registration states container. */
1806 if (!transport_states) {
1807 ast_log(LOG_ERROR, "Unable to allocate transport states container\n");
1808 return -1;
1809 }
1810
1811 ast_sorcery_apply_default(sorcery, "transport", "config", "pjsip.conf,criteria=type=transport");
1812
1814 return -1;
1815 }
1816
1817 /* Normally type is a OPT_NOOP_T but we're using it to make sure that state is created */
1821 ast_sorcery_object_field_register(sorcery, "transport", "async_operations", "1", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, async_operations));
1822
1827
1828 ast_sorcery_object_field_register(sorcery, "transport", "password", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, password));
1829 ast_sorcery_object_field_register(sorcery, "transport", "external_signaling_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, external_signaling_address));
1830 ast_sorcery_object_field_register(sorcery, "transport", "external_signaling_port", "0", OPT_UINT_T, PARSE_IN_RANGE, FLDSET(struct ast_sip_transport, external_signaling_port), 0, 65535);
1831 ast_sorcery_object_field_register(sorcery, "transport", "external_media_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, external_media_address));
1832 ast_sorcery_object_field_register(sorcery, "transport", "domain", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_transport, domain));
1838 ast_sorcery_object_field_register(sorcery, "transport", "tcp_keepalive_enable", "no", OPT_BOOL_T, 0, FLDSET(struct ast_sip_transport, tcp_keepalive_enable));
1839 ast_sorcery_object_field_register(sorcery, "transport", "tcp_keepalive_idle_time", "30", OPT_INT_T, 0, FLDSET(struct ast_sip_transport, tcp_keepalive_idle_time));
1840 ast_sorcery_object_field_register(sorcery, "transport", "tcp_keepalive_interval_time", "1", OPT_INT_T, 0, FLDSET(struct ast_sip_transport, tcp_keepalive_interval_time));
1841 ast_sorcery_object_field_register(sorcery, "transport", "tcp_keepalive_probe_count", "5", OPT_INT_T, 0, FLDSET(struct ast_sip_transport, tcp_keepalive_probe_count));
1842#if defined(PJ_HAS_SSL_SOCK) && PJ_HAS_SSL_SOCK != 0
1843 ast_sorcery_object_field_register_custom(sorcery, "transport", "cipher", "", transport_tls_cipher_handler, transport_tls_cipher_to_str, NULL, 0, 0);
1844#endif
1847 ast_sorcery_object_field_register(sorcery, "transport", "cos", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_transport, cos));
1848 ast_sorcery_object_field_register(sorcery, "transport", "websocket_write_timeout", AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT_STR, OPT_INT_T, PARSE_IN_RANGE, FLDSET(struct ast_sip_transport, write_timeout), 1, INT_MAX);
1849 ast_sorcery_object_field_register(sorcery, "transport", "allow_reload", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_transport, allow_reload));
1850 ast_sorcery_object_field_register(sorcery, "transport", "symmetric_transport", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_transport, symmetric_transport));
1851
1853
1855 if (!cli_formatter) {
1856 ast_log(LOG_ERROR, "Unable to allocate memory for cli formatter\n");
1857 return -1;
1858 }
1859 cli_formatter->name = "transport";
1866
1869
1870 /* trigger load of transports from realtime by trying to revrieve them all */
1872 ao2_cleanup(transports);
1873
1874 return 0;
1875}
unsigned int cos
Definition: chan_iax2.c:356
static int require_client_cert_to_str(const void *obj, const intptr_t *args, char **buf)
static int transport_state_init(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for type just makes sure the state is created.
static int verify_server_to_str(const void *obj, const intptr_t *args, char **buf)
static int transport_tls_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for TLS method setting.
static int cli_print_header(void *obj, void *arg, int flags)
static int transport_bind_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for turning a string bind into a pj_sockaddr.
static int tls_method_to_str(const void *obj, const intptr_t *args, char **buf)
static int transport_protocol_to_str(const void *obj, const intptr_t *args, char **buf)
#define DEFAULT_STATE_BUCKETS
Default number of state container buckets.
static int internal_state_hash(const void *obj, const int flags)
hashing function for state objects
static int verify_client_to_str(const void *obj, const intptr_t *args, char **buf)
static int allow_wildcard_certs_to_str(const void *obj, const intptr_t *args, char **buf)
static int cert_file_to_str(const void *obj, const intptr_t *args, char **buf)
static int transport_tls_bool_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for TLS boolean settings.
static int transport_bind_to_str(const void *obj, const intptr_t *args, char **buf)
static int internal_state_cmp(void *obj, void *arg, int flags)
comparator function for state objects
static int localnet_to_str(const void *obj, const intptr_t *args, char **buf)
static int privkey_file_to_str(const void *obj, const intptr_t *args, char **buf)
static int cli_iterate(void *container, ao2_callback_fn callback, void *args)
static int transport_localnet_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for localnet setting.
static void * cli_retrieve_by_id(const char *id)
static int tos_to_str(const void *obj, const intptr_t *args, char **buf)
static struct ao2_container * cli_get_container(const char *regex)
static int transport_apply(const struct ast_sorcery *sorcery, void *obj)
Apply handler for transports.
static int cli_print_body(void *obj, void *arg, int flags)
static int localnet_to_vl(const void *obj, struct ast_variable **fields)
static int transport_tls_file_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for TLS method setting.
static int transport_tos_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for TOS setting.
static int ca_list_file_to_str(const void *obj, const intptr_t *args, char **buf)
static void * sip_transport_alloc(const char *name)
Allocator for transport.
static int ca_list_path_to_str(const void *obj, const intptr_t *args, char **buf)
static int transport_protocol_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Custom handler for turning a string protocol into an enum.
#define AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT_STR
Default websocket write timeout, in ms (as a string)
@ AST_RETRIEVE_FLAG_MULTIPLE
Return all matching objects.
Definition: sorcery.h:120
@ AST_RETRIEVE_FLAG_ALL
Perform no matching, return all objects.
Definition: sorcery.h:123
void * ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields)
Retrieve an object or multiple objects using specific fields.
Definition: sorcery.c:1897
Generic container type.
Transport to bind to.
Definition: res_pjsip.h:218

References allow_wildcard_certs_to_str(), ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_cleanup, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT_STR, ast_log, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sip_register_cli_formatter(), ast_sip_register_endpoint_formatter(), ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_get_id(), ast_sorcery_object_register, ast_sorcery_retrieve_by_fields(), ca_list_file_to_str(), ca_list_path_to_str(), cert_file_to_str(), cli_commands, cli_formatter, cli_get_container(), cli_iterate(), cli_print_body(), cli_print_header(), cli_retrieve_by_id(), cos, DEFAULT_STATE_BUCKETS, endpoint_transport_formatter, FLDSET, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, internal_state_cmp(), internal_state_hash(), ast_sip_cli_formatter_entry::iterate, localnet_to_str(), localnet_to_vl(), LOG_ERROR, ast_sip_cli_formatter_entry::name, NULL, OPT_BOOL_T, OPT_INT_T, OPT_STRINGFIELD_T, OPT_UINT_T, PARSE_IN_RANGE, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, privkey_file_to_str(), require_client_cert_to_str(), ast_sip_cli_formatter_entry::retrieve_by_id, sip_transport_alloc(), sorcery, STRFLDSET, tls_method_to_str(), tos_to_str(), transport_apply(), transport_bind_handler(), transport_bind_to_str(), transport_localnet_handler(), transport_protocol_handler(), transport_protocol_to_str(), transport_state_init(), transport_states, transport_tls_bool_handler(), transport_tls_file_handler(), transport_tls_method_handler(), transport_tos_handler(), verify_client_to_str(), and verify_server_to_str().

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_sip_initialize_system()

int ast_sip_initialize_system ( void  )

Definition at line 175 of file config_system.c.

176{
177 RAII_VAR(struct ao2_container *, system_configs, NULL, ao2_cleanup);
178 RAII_VAR(struct system_config *, system, NULL, ao2_cleanup);
179
181 if (!system_sorcery) {
182 ast_log(LOG_ERROR, "Failed to open SIP system sorcery\n");
183 return -1;
184 }
185
186 ast_sorcery_apply_default(system_sorcery, "system", "config", "pjsip.conf,criteria=type=system,single_object=yes,explicit_name=system");
187
189 ast_log(LOG_ERROR, "Failed to register with sorcery (is res_sorcery_config loaded?)\n");
192 return -1;
193 }
194
195 ast_sorcery_object_field_register(system_sorcery, "system", "type", "", OPT_NOOP_T, 0, 0);
197 OPT_UINT_T, 0, FLDSET(struct system_config, timert1));
199 OPT_UINT_T, 0, FLDSET(struct system_config, timerb));
200 ast_sorcery_object_field_register(system_sorcery, "system", "compact_headers", "no",
201 OPT_BOOL_T, 1, FLDSET(struct system_config, compactheaders));
202 ast_sorcery_object_field_register(system_sorcery, "system", "threadpool_initial_size", "0",
203 OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.initial_size));
204 ast_sorcery_object_field_register(system_sorcery, "system", "threadpool_auto_increment", "5",
205 OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.auto_increment));
206 ast_sorcery_object_field_register(system_sorcery, "system", "threadpool_idle_timeout", "60",
207 OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.idle_timeout));
208 ast_sorcery_object_field_register(system_sorcery, "system", "threadpool_max_size", "50",
209 OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.max_size));
210 ast_sorcery_object_field_register(system_sorcery, "system", "disable_tcp_switch", "yes",
211 OPT_BOOL_T, 1, FLDSET(struct system_config, disable_tcp_switch));
212 ast_sorcery_object_field_register(system_sorcery, "system", "follow_early_media_fork", "yes",
213 OPT_BOOL_T, 1, FLDSET(struct system_config, follow_early_media_fork));
214 ast_sorcery_object_field_register(system_sorcery, "system", "accept_multiple_sdp_answers", "no",
215 OPT_BOOL_T, 1, FLDSET(struct system_config, accept_multiple_sdp_answers));
216 ast_sorcery_object_field_register(system_sorcery, "system", "disable_rport", "no",
217 OPT_BOOL_T, 1, FLDSET(struct system_config, disable_rport));
218
220
221 system_configs = ast_sorcery_retrieve_by_fields(system_sorcery, "system",
223
224 if (ao2_container_count(system_configs)) {
225 return 0;
226 }
227
228 /* No config present, allocate one and apply defaults */
229 system = ast_sorcery_alloc(system_sorcery, "system", NULL);
230 if (!system) {
231 ast_log(LOG_ERROR, "Unable to allocate default system config.\n");
233 return -1;
234 }
235
236 if (system_apply(system_sorcery, system)) {
237 ast_log(LOG_ERROR, "Failed to apply default system config.\n");
239 return -1;
240 }
241
242 return 0;
243}
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
static int system_apply(const struct ast_sorcery *sorcery, void *obj)
Definition: config_system.c:88
#define DEFAULT_TIMER_B
Definition: config_system.c:33
#define DEFAULT_TIMER_T1
Definition: config_system.c:32
static void * system_alloc(const char *name)
Definition: config_system.c:77
static struct ast_threadpool * threadpool
Thread pool for observers.
Definition: sorcery.c:86
#define ast_sorcery_object_register_no_reload(sorcery, type, alloc, transform, apply)
Register an object type that is not reloadable.
Definition: sorcery.h:852
void * ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, const char *id)
Allocate an object.
Definition: sorcery.c:1744
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References __stringify, system_config::accept_multiple_sdp_answers, ao2_cleanup, ao2_container_count(), ast_log, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_alloc(), ast_sorcery_apply_default, ast_sorcery_load(), ast_sorcery_object_field_register, ast_sorcery_object_register_no_reload, ast_sorcery_open, ast_sorcery_retrieve_by_fields(), ast_sorcery_unref, system_config::compactheaders, DEFAULT_TIMER_B, DEFAULT_TIMER_T1, system_config::disable_rport, system_config::disable_tcp_switch, FLDSET, system_config::follow_early_media_fork, LOG_ERROR, NULL, OPT_BOOL_T, OPT_NOOP_T, OPT_UINT_T, RAII_VAR, system_alloc(), system_apply(), system_sorcery, threadpool, system_config::timerb, and system_config::timert1.

Referenced by load_module().

◆ ast_sip_initialize_transport_events()

int ast_sip_initialize_transport_events ( void  )

Definition at line 697 of file pjsip_transport_events.c.

698{
699 pjsip_tpmgr *tpmgr;
700 struct ao2_container *transports;
701
702 tpmgr = pjsip_endpt_get_tpmgr(ast_sip_get_pjsip_endpoint());
703 if (!tpmgr) {
704 return -1;
705 }
706
708 ACTIVE_TRANSPORTS_BUCKETS, transport_monitor_hash_fn, transport_monitor_sort_fn,
709 transport_monitor_cmp_fn);
710 if (!transports) {
711 return -1;
712 }
713 ao2_global_obj_replace_unref(active_transports, transports);
714 ao2_ref(transports, -1);
715
716 tpmgr_state_callback = pjsip_tpmgr_get_state_cb(tpmgr);
717 pjsip_tpmgr_set_state_cb(tpmgr, &transport_state_callback);
718
720
721
722 return 0;
723}
#define ao2_global_obj_replace_unref(holder, obj)
Replace an ao2 object in the global holder, throwing away any old object.
Definition: astobj2.h:901
static void transport_state_callback(pjsip_transport *transport, pjsip_transport_state state, const pjsip_transport_state_info *info)
Callback invoked when transport state changes occur.
#define ACTIVE_TRANSPORTS_BUCKETS
Number of buckets for monitored active transports.

References ACTIVE_TRANSPORTS_BUCKETS, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_global_obj_replace_unref, ao2_ref, ARRAY_LEN, ast_cli_register_multiple, ast_sip_get_pjsip_endpoint(), cli_commands, tpmgr_state_callback, and transport_state_callback().

Referenced by load_module().

◆ ast_sip_initialize_transport_management()

int ast_sip_initialize_transport_management ( void  )

Definition at line 372 of file pjsip_transport_management.c.

373{
374 struct ao2_container *transports;
375
378 if (!transports) {
379 ast_log(LOG_ERROR, "Could not create container for transports to perform keepalive on.\n");
381 }
382 ao2_global_obj_replace_unref(monitored_transports, transports);
383 ao2_ref(transports, -1);
384
386 if (!sched) {
387 ast_log(LOG_ERROR, "Failed to create keepalive scheduler context.\n");
388 ao2_global_obj_release(monitored_transports);
390 }
391
393 ast_log(LOG_ERROR, "Failed to start keepalive scheduler thread\n");
395 sched = NULL;
396 ao2_global_obj_release(monitored_transports);
398 }
399
401
403
406
408}
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
#define TRANSPORTS_BUCKETS
Number of buckets for monitored transports.
static int monitored_transport_hash_fn(const void *obj, int flags)
Hashing function for monitored transport.
static int monitored_transport_cmp_fn(void *obj, void *arg, int flags)
Comparison function for monitored transport.
void ast_sip_transport_state_register(struct ast_sip_tpmgr_state_callback *element)
Register a transport state notification callback element.

References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_global_obj_release, ao2_global_obj_replace_unref, ao2_ref, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_sched_context_create(), ast_sched_context_destroy(), ast_sched_start_thread(), ast_sip_get_sorcery(), ast_sip_register_service(), ast_sip_transport_state_register(), ast_sorcery_observer_add(), ast_sorcery_reload_object(), idle_monitor_module, keepalive_global_observer, LOG_ERROR, monitored_transport_cmp_fn(), monitored_transport_hash_fn(), monitored_transport_reg, NULL, and TRANSPORTS_BUCKETS.

Referenced by load_module().

◆ ast_sip_overload_trigger_to_str()

const char * ast_sip_overload_trigger_to_str ( enum ast_sip_taskprocessor_overload_trigger  trigger)

Definition at line 582 of file config_global.c.

583{
584 return ARRAY_IN_BOUNDS(trigger, overload_trigger_map) ?
585 overload_trigger_map[trigger] : "";
586}
#define ARRAY_IN_BOUNDS(v, a)
Checks to see if value is within the bounds of the given array.
Definition: utils.h:687

References ARRAY_IN_BOUNDS, and overload_trigger_map.

Referenced by overload_trigger_to_str().

◆ ast_sip_persistent_endpoint_add_to_regcontext()

int ast_sip_persistent_endpoint_add_to_regcontext ( const char *  regcontext)

Definition at line 1415 of file pjsip_configuration.c.

1416{
1418 return 0;
1419 }
1420
1421 /* Make sure the regcontext exists */
1423 ast_log(LOG_ERROR, "Failed to create regcontext '%s'\n", regcontext);
1424 return -1;
1425 }
1426
1427 /* Add any online endpoints */
1429 return 0;
1430}
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
Definition: astobj2.h:1693
@ OBJ_NODATA
Definition: astobj2.h:1044
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
Definition: pbx.c:6149
static int add_to_regcontext(void *obj, void *arg, int flags)
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65

References add_to_regcontext(), ao2_callback, ast_context_find_or_create(), ast_log, ast_strlen_zero(), LOG_ERROR, NULL, OBJ_NODATA, persistent_endpoints, and regcontext.

Referenced by check_regcontext().

◆ ast_sip_validate_uri_length()

int ast_sip_validate_uri_length ( const char *  uri)

Definition at line 528 of file location.c.

529{
530 int max_length = pj_max_hostname - 1;
531 char *contact = ast_strdupa(contact_uri);
532 char *host;
533 char *at;
534 int theres_a_port = 0;
535
536 if (strlen(contact_uri) > pjsip_max_url_size - 1) {
537 return -1;
538 }
539
540 contact = ast_strip_quoted(contact, "<", ">");
541
542 if (!strncasecmp(contact, "sip:", 4)) {
543 host = contact + 4;
544 } else if (!strncasecmp(contact, "sips:", 5)) {
545 host = contact + 5;
546 } else {
547 /* Not a SIP URI */
548 return -1;
549 }
550
551 at = strchr(contact, '@');
552 if (at) {
553 /* sip[s]:user@host */
554 host = at + 1;
555 }
556
557 if (host[0] == '[') {
558 /* Host is an IPv6 address. Just get up to the matching bracket */
559 char *close_bracket;
560
561 close_bracket = strchr(host, ']');
562 if (!close_bracket) {
563 return -1;
564 }
565 close_bracket++;
566 if (*close_bracket == ':') {
567 theres_a_port = 1;
568 }
569 *close_bracket = '\0';
570 } else {
571 /* uri parameters could contain ';' so trim them off first */
572 host = strsep(&host, ";?");
573 /* Host is FQDN or IPv4 address. Need to find closing delimiter */
574 if (strchr(host, ':')) {
575 theres_a_port = 1;
576 host = strsep(&host, ":");
577 }
578 }
579
580 if (!theres_a_port) {
581 max_length -= strlen("_sips.tcp.");
582 }
583
584 if (strlen(host) > max_length) {
585 return -1;
586 }
587
588 return 0;
589}
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
char * strsep(char **str, const char *delims)
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
Definition: utils.c:1818

References ast_strdupa, ast_strip_quoted(), pj_max_hostname, pjsip_max_url_size, and strsep().

Referenced by permanent_uri_handler(), sip_outbound_registration_apply(), and validate_publish_config().

◆ ast_sip_will_uri_survive_restart()

int ast_sip_will_uri_survive_restart ( pjsip_sip_uri *  uri,
struct ast_sip_endpoint endpoint,
pjsip_rx_data *  rdata 
)

Definition at line 525 of file res_pjsip.c.

527{
528 pj_str_t host_name;
529 int result = 1;
530
531 /* Determine if the contact cannot survive a restart/boot. */
532 if (uri->port == rdata->pkt_info.src_port
533 && !pj_strcmp(&uri->host,
534 pj_cstr(&host_name, rdata->pkt_info.src_name))
535 /* We have already checked if the URI scheme is sip: or sips: */
536 && PJSIP_TRANSPORT_IS_RELIABLE(rdata->tp_info.transport)) {
537 pj_str_t type_name;
538
539 /* Determine the transport parameter value */
540 if (!strcasecmp("WSS", rdata->tp_info.transport->type_name)) {
541 /* WSS is special, as it needs to be ws. */
542 pj_cstr(&type_name, "ws");
543 } else {
544 pj_cstr(&type_name, rdata->tp_info.transport->type_name);
545 }
546
547 if (!pj_stricmp(&uri->transport_param, &type_name)
548 && (endpoint->nat.rewrite_contact
549 /* Websockets are always rewritten */
550 || !pj_stricmp(&uri->transport_param,
551 pj_cstr(&type_name, "ws")))) {
552 /*
553 * The contact was rewritten to the reliable transport's
554 * source address. Disconnecting the transport for any
555 * reason invalidates the contact.
556 */
557 result = 0;
558 }
559 }
560
561 return result;
562}
static PGresult * result
Definition: cel_pgsql.c:84

References ast_sip_endpoint::nat, result, and ast_sip_endpoint_nat_configuration::rewrite_contact.

Referenced by subscription_persistence_update().

◆ sip_cli_print_global()

int sip_cli_print_global ( struct ast_sip_cli_context context)

Definition at line 646 of file config_global.c.

647{
648 struct global_config *cfg = get_global_cfg();
649
650 if (!cfg) {
651 cfg = ast_sorcery_alloc(ast_sip_get_sorcery(), "global", NULL);
652 if (!cfg) {
653 return -1;
654 }
655 }
656
657 ast_str_append(&context->output_buffer, 0, "\nGlobal Settings:\n\n");
659
660 ao2_ref(cfg, -1);
661 return 0;
662}
int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
Prints a sorcery object's ast_variable list.
Definition: pjsip_cli.c:36
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1139

References ao2_ref, ast_sip_cli_print_sorcery_objectset(), ast_sip_get_sorcery(), ast_sorcery_alloc(), ast_str_append(), voicemailpwcheck::context, get_global_cfg(), and NULL.

Referenced by cli_show_settings().

◆ sip_cli_print_system()

int sip_cli_print_system ( struct ast_sip_cli_context context)

Definition at line 157 of file config_system.c.

158{
159 struct system_config *cfg = get_system_cfg();
160
161 if (!cfg) {
162 cfg = ast_sorcery_alloc(system_sorcery, "system", NULL);
163 if (!cfg) {
164 return -1;
165 }
166 }
167
168 ast_str_append(&context->output_buffer, 0, "\nSystem Settings:\n\n");
170
171 ao2_ref(cfg, -1);
172 return 0;
173}
static struct system_config * get_system_cfg(void)

References ao2_ref, ast_sip_cli_print_sorcery_objectset(), ast_sorcery_alloc(), ast_str_append(), voicemailpwcheck::context, get_system_cfg(), NULL, and system_sorcery.

Referenced by cli_show_settings().

◆ sip_get_threadpool_options()

void sip_get_threadpool_options ( struct ast_threadpool_options threadpool_options)

Definition at line 70 of file config_system.c.

71{
73}
static struct ast_threadpool_options sip_threadpool_options
Definition: config_system.c:66
static struct aco_type * threadpool_options[]
Definition: stasis.c:2211

References sip_threadpool_options, and threadpool_options.

Referenced by load_module().