Asterisk - The Open Source Telephony Project GIT-master-0644429
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjlib.h>
#include "asterisk/res_pjsip.h"
#include "include/res_pjsip_private.h"
#include "asterisk/pbx.h"
#include "asterisk/sorcery.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/ast_version.h"
#include "asterisk/res_pjsip_cli.h"
Go to the source code of this file.
Data Structures | |
struct | global_config |
Functions | |
static | AO2_GLOBAL_OBJ_STATIC (global_cfg) |
Cached global config object. More... | |
int | ast_sip_destroy_sorcery_global (void) |
unsigned int | ast_sip_get_all_codecs_on_empty_reinvite (void) |
Retrieve the system setting 'all_codecs_on_empty_reinvite'. More... | |
unsigned int | ast_sip_get_allow_sending_180_after_183 (void) |
Retrieve the global setting 'allow_sending_180_after_183'. More... | |
unsigned int | ast_sip_get_contact_expiration_check_interval (void) |
Retrieve the system contact expiration check interval setting. More... | |
char * | ast_sip_get_debug (void) |
Retrieve the system debug setting (yes|no|host). More... | |
void | ast_sip_get_default_from_user (char *from_user, size_t size) |
Retrieve the global default from user. More... | |
void | ast_sip_get_default_realm (char *realm, size_t size) |
Retrieve the global default realm. More... | |
char * | ast_sip_get_default_voicemail_extension (void) |
Retrieve the default voicemail extension. More... | |
unsigned int | ast_sip_get_disable_multi_domain (void) |
Retrieve the system setting 'disable multi domain'. More... | |
char * | ast_sip_get_endpoint_identifier_order (void) |
Retrieve the global endpoint_identifier_order setting. More... | |
unsigned int | ast_sip_get_ignore_uri_user_options (void) |
Retrieve the global setting 'ignore_uri_user_options'. More... | |
unsigned int | ast_sip_get_keep_alive_interval (void) |
Retrieve the system keep alive interval setting. More... | |
unsigned int | ast_sip_get_max_initial_qualify_time (void) |
Retrieve the system max initial qualify time. More... | |
unsigned int | ast_sip_get_mwi_disable_initial_unsolicited (void) |
Retrieve the global setting 'disable sending unsolicited mwi on startup'. More... | |
unsigned int | ast_sip_get_mwi_tps_queue_high (void) |
Retrieve the global MWI taskprocessor high water alert trigger level. More... | |
int | ast_sip_get_mwi_tps_queue_low (void) |
Retrieve the global MWI taskprocessor low water clear alert level. More... | |
unsigned int | ast_sip_get_norefersub (void) |
Retrieve the global setting 'norefersub'. More... | |
char * | ast_sip_get_regcontext (void) |
Retrieve the global regcontext setting. More... | |
unsigned int | ast_sip_get_send_contact_status_on_update_registration (void) |
Retrieve the global setting 'send_contact_status_on_update_registration'. More... | |
enum ast_sip_taskprocessor_overload_trigger | ast_sip_get_taskprocessor_overload_trigger (void) |
void | ast_sip_get_unidentified_request_thresholds (unsigned int *count, unsigned int *period, unsigned int *prune_interval) |
Retrieve the unidentified request security event thresholds. More... | |
unsigned int | ast_sip_get_use_callerid_contact (void) |
Retrieve the global setting 'use_callerid_contact'. More... | |
char * | ast_sip_global_default_outbound_endpoint (void) |
int | ast_sip_initialize_sorcery_global (void) |
const char * | ast_sip_overload_trigger_to_str (enum ast_sip_taskprocessor_overload_trigger trigger) |
static int | check_regcontext (const struct global_config *cfg) |
static struct global_config * | get_global_cfg (void) |
static void * | global_alloc (const char *name) |
static int | global_apply (const struct ast_sorcery *sorcery, void *obj) |
static void | global_destructor (void *obj) |
static void | global_loaded_observer (const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded) |
static int | overload_trigger_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | overload_trigger_to_str (const void *obj, const intptr_t *args, char **buf) |
int | sip_cli_print_global (struct ast_sip_cli_context *context) |
Variables | |
static char | default_useragent [256] |
static const struct ast_sorcery_instance_observer | observer_callbacks_global |
static const char * | overload_trigger_map [] |
static char * | previous_regcontext = NULL |
#define DEFAULT_ALL_CODECS_ON_EMPTY_REINVITE 0 |
Definition at line 57 of file config_global.c.
#define DEFAULT_ALLOW_SENDING_180_AFTER_183 0 |
Definition at line 51 of file config_global.c.
#define DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL 30 |
Definition at line 42 of file config_global.c.
#define DEFAULT_DEBUG "no" |
Definition at line 36 of file config_global.c.
#define DEFAULT_DISABLE_MULTI_DOMAIN 0 |
Definition at line 43 of file config_global.c.
#define DEFAULT_ENDPOINT_IDENTIFIER_ORDER "ip,username,anonymous" |
Definition at line 37 of file config_global.c.
#define DEFAULT_FROM_USER "asterisk" |
Definition at line 39 of file config_global.c.
#define DEFAULT_IGNORE_URI_USER_OPTIONS 0 |
Definition at line 52 of file config_global.c.
#define DEFAULT_KEEPALIVE_INTERVAL 90 |
Definition at line 33 of file config_global.c.
#define DEFAULT_MAX_FORWARDS 70 |
Definition at line 32 of file config_global.c.
#define DEFAULT_MAX_INITIAL_QUALIFY_TIME 0 |
Definition at line 38 of file config_global.c.
#define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED 0 |
Definition at line 50 of file config_global.c.
#define DEFAULT_MWI_TPS_QUEUE_HIGH AST_TASKPROCESSOR_HIGH_WATER_LEVEL |
Definition at line 48 of file config_global.c.
#define DEFAULT_MWI_TPS_QUEUE_LOW -1 |
Definition at line 49 of file config_global.c.
#define DEFAULT_NOREFERSUB 1 |
Definition at line 56 of file config_global.c.
#define DEFAULT_OUTBOUND_ENDPOINT "default_outbound_endpoint" |
Definition at line 35 of file config_global.c.
#define DEFAULT_REALM "asterisk" |
Definition at line 40 of file config_global.c.
#define DEFAULT_REGCONTEXT "" |
Definition at line 41 of file config_global.c.
#define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION 0 |
Definition at line 54 of file config_global.c.
#define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL |
Definition at line 55 of file config_global.c.
#define DEFAULT_UNIDENTIFIED_REQUEST_COUNT 5 |
Definition at line 45 of file config_global.c.
#define DEFAULT_UNIDENTIFIED_REQUEST_PERIOD 5 |
Definition at line 46 of file config_global.c.
#define DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL 30 |
Definition at line 47 of file config_global.c.
#define DEFAULT_USE_CALLERID_CONTACT 0 |
Definition at line 53 of file config_global.c.
#define DEFAULT_USERAGENT_PREFIX "Asterisk PBX" |
Definition at line 34 of file config_global.c.
#define DEFAULT_VOICEMAIL_EXTENSION "" |
Definition at line 44 of file config_global.c.
|
static |
Cached global config object.
Cached so we don't have to keep asking sorcery for the config. We could ask for it hundreds of times a second if not more.
int ast_sip_destroy_sorcery_global | ( | void | ) |
Definition at line 664 of file config_global.c.
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().
unsigned int ast_sip_get_all_codecs_on_empty_reinvite | ( | void | ) |
Retrieve the system setting 'all_codecs_on_empty_reinvite'.
non | zero if we should return all codecs on empty re-INVITE |
Definition at line 543 of file config_global.c.
References global_config::all_codecs_on_empty_reinvite, ao2_ref, DEFAULT_ALL_CODECS_ON_EMPTY_REINVITE, and get_global_cfg().
Referenced by session_inv_on_create_offer().
unsigned int ast_sip_get_allow_sending_180_after_183 | ( | void | ) |
Retrieve the global setting 'allow_sending_180_after_183'.
non | zero if disable. |
Definition at line 453 of file config_global.c.
References global_config::allow_sending_180_after_183, ao2_ref, DEFAULT_ALLOW_SENDING_180_AFTER_183, and get_global_cfg().
Referenced by chan_pjsip_indicate().
unsigned int ast_sip_get_contact_expiration_check_interval | ( | void | ) |
Retrieve the system contact expiration check interval setting.
the | contact expiration check interval. |
Definition at line 315 of file config_global.c.
References ao2_ref, global_config::contact_expiration_check_interval, DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL, and get_global_cfg().
Referenced by expiration_global_loaded().
char * ast_sip_get_debug | ( | void | ) |
Retrieve the system debug setting (yes|no|host).
the | system debug setting. |
Definition at line 238 of file config_global.c.
References ao2_ref, ast_strdup, global_config::debug, DEFAULT_DEBUG, and get_global_cfg().
Referenced by check_debug().
void ast_sip_get_default_from_user | ( | char * | from_user, |
size_t | size | ||
) |
Retrieve the global default from user.
This is the value placed in outbound requests' From header if there is no better option (such as an endpoint-configured from_user or caller ID number).
[out] | from_user | The default from user |
size | The buffer size of from_user |
Definition at line 394 of file config_global.c.
References ao2_ref, ast_copy_string(), DEFAULT_FROM_USER, global_config::default_from_user, and get_global_cfg().
Referenced by sip_dialog_create_from().
void ast_sip_get_default_realm | ( | char * | realm, |
size_t | size | ||
) |
Retrieve the global default realm.
This is the value placed in outbound challenges' realm if there is no better option (such as an auth-configured realm).
[out] | realm | The default realm |
size | The buffer size of realm |
Definition at line 381 of file config_global.c.
References ao2_ref, ast_copy_string(), DEFAULT_REALM, global_config::default_realm, and get_global_cfg().
Referenced by create_artificial_auth(), and global_loaded().
char * ast_sip_get_default_voicemail_extension | ( | void | ) |
Retrieve the default voicemail extension.
the | default voicemail extension |
Definition at line 269 of file config_global.c.
References ao2_ref, ast_strdup, DEFAULT_VOICEMAIL_EXTENSION, global_config::default_voicemail_extension, and get_global_cfg().
Referenced by global_loaded().
unsigned int ast_sip_get_disable_multi_domain | ( | void | ) |
Retrieve the system setting 'disable multi domain'.
non | zero if disable multi domain. |
Definition at line 330 of file config_global.c.
References ao2_ref, DEFAULT_DISABLE_MULTI_DOMAIN, global_config::disable_multi_domain, and get_global_cfg().
Referenced by anonymous_identify(), find_endpoint(), request(), and sip_dialog_create_from().
char * ast_sip_get_endpoint_identifier_order | ( | void | ) |
Retrieve the global endpoint_identifier_order setting.
Specifies the order by which endpoint identifiers should be regarded.
the | global endpoint_identifier_order value |
Definition at line 285 of file config_global.c.
References ao2_ref, ast_strdup, DEFAULT_ENDPOINT_IDENTIFIER_ORDER, global_config::endpoint_identifier_order, and get_global_cfg().
Referenced by ast_sip_register_endpoint_identifier_with_name(), and global_loaded().
unsigned int ast_sip_get_ignore_uri_user_options | ( | void | ) |
Retrieve the global setting 'ignore_uri_user_options'.
non | zero if ignore the user field options. |
Definition at line 468 of file config_global.c.
References ao2_ref, DEFAULT_IGNORE_URI_USER_OPTIONS, get_global_cfg(), and global_config::ignore_uri_user_options.
Referenced by find_registrar_aor().
unsigned int ast_sip_get_keep_alive_interval | ( | void | ) |
Retrieve the system keep alive interval setting.
the | keep alive interval. |
Definition at line 300 of file config_global.c.
References ao2_ref, DEFAULT_KEEPALIVE_INTERVAL, get_global_cfg(), and global_config::keep_alive_interval.
Referenced by keepalive_global_loaded().
unsigned int ast_sip_get_max_initial_qualify_time | ( | void | ) |
Retrieve the system max initial qualify time.
the | maximum initial qualify time. |
Definition at line 345 of file config_global.c.
References ao2_ref, DEFAULT_MAX_INITIAL_QUALIFY_TIME, get_global_cfg(), and global_config::max_initial_qualify_time.
Referenced by sip_options_determine_initial_qualify_time().
unsigned int ast_sip_get_mwi_disable_initial_unsolicited | ( | void | ) |
Retrieve the global setting 'disable sending unsolicited mwi on startup'.
non | zero if disable. |
Definition at line 438 of file config_global.c.
References ao2_ref, DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED, global_config::disable_initial_unsolicited, get_global_cfg(), and global_config::mwi.
Referenced by load_module(), and reload().
unsigned int ast_sip_get_mwi_tps_queue_high | ( | void | ) |
Retrieve the global MWI taskprocessor high water alert trigger level.
the | system MWI taskprocessor high water alert trigger level |
Definition at line 408 of file config_global.c.
References ao2_ref, DEFAULT_MWI_TPS_QUEUE_HIGH, get_global_cfg(), global_config::mwi, and global_config::tps_queue_high.
Referenced by global_loaded().
int ast_sip_get_mwi_tps_queue_low | ( | void | ) |
Retrieve the global MWI taskprocessor low water clear alert level.
the | system MWI taskprocessor low water clear alert level |
Definition at line 423 of file config_global.c.
References ao2_ref, DEFAULT_MWI_TPS_QUEUE_LOW, get_global_cfg(), global_config::mwi, and global_config::tps_queue_low.
Referenced by global_loaded().
unsigned int ast_sip_get_norefersub | ( | void | ) |
Retrieve the global setting 'norefersub'.
non | zero if norefersub is to be sent in "Supported" Headers |
Definition at line 528 of file config_global.c.
References ao2_ref, DEFAULT_NOREFERSUB, get_global_cfg(), and global_config::norefersub.
Referenced by load_module().
char * ast_sip_get_regcontext | ( | void | ) |
Retrieve the global regcontext setting.
the | global regcontext setting |
Definition at line 253 of file config_global.c.
References ao2_ref, ast_strdup, DEFAULT_REGCONTEXT, get_global_cfg(), and global_config::regcontext.
Referenced by ast_sip_persistent_endpoint_update_state().
unsigned int ast_sip_get_send_contact_status_on_update_registration | ( | void | ) |
Retrieve the global setting 'send_contact_status_on_update_registration'.
non | zero if need to send AMI ContactStatus event when a contact is updated. |
Definition at line 498 of file config_global.c.
References ao2_ref, DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION, get_global_cfg(), and global_config::send_contact_status_on_update_registration.
Referenced by contact_observer_updated().
enum ast_sip_taskprocessor_overload_trigger ast_sip_get_taskprocessor_overload_trigger | ( | void | ) |
Definition at line 513 of file config_global.c.
References ao2_ref, DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER, get_global_cfg(), and global_config::overload_trigger.
Referenced by global_loaded().
void ast_sip_get_unidentified_request_thresholds | ( | unsigned int * | count, |
unsigned int * | period, | ||
unsigned int * | prune_interval | ||
) |
Retrieve the unidentified request security event thresholds.
count | The maximum number of unidentified requests per source ip to accumulate before emitting a security event |
period | The period in seconds over which to accumulate unidentified requests |
prune_interval | The interval in seconds at which expired entries will be pruned |
Definition at line 360 of file config_global.c.
References ao2_ref, DEFAULT_UNIDENTIFIED_REQUEST_COUNT, DEFAULT_UNIDENTIFIED_REQUEST_PERIOD, DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL, get_global_cfg(), global_config::unidentified_request_count, global_config::unidentified_request_period, and global_config::unidentified_request_prune_interval.
Referenced by global_loaded(), and prune_task().
unsigned int ast_sip_get_use_callerid_contact | ( | void | ) |
Retrieve the global setting 'use_callerid_contact'.
non | zero if CALLERID(num) is to be used as the default username in the contact |
Definition at line 483 of file config_global.c.
References ao2_ref, DEFAULT_USE_CALLERID_CONTACT, get_global_cfg(), and global_config::use_callerid_contact.
Referenced by set_from_header().
char * ast_sip_global_default_outbound_endpoint | ( | void | ) |
Definition at line 223 of file config_global.c.
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().
int ast_sip_initialize_sorcery_global | ( | void | ) |
Definition at line 681 of file config_global.c.
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().
const char * ast_sip_overload_trigger_to_str | ( | enum ast_sip_taskprocessor_overload_trigger | trigger | ) |
Definition at line 582 of file config_global.c.
References ARRAY_IN_BOUNDS, and overload_trigger_map.
Referenced by overload_trigger_to_str().
|
static |
Definition at line 153 of file config_global.c.
References ast_context_destroy_by_name(), ast_free, ast_sip_persistent_endpoint_add_to_regcontext(), ast_strdup, ast_strlen_zero(), current, NULL, previous_regcontext, and global_config::regcontext.
Referenced by global_apply().
|
static |
Definition at line 218 of file config_global.c.
References ao2_global_obj_ref.
Referenced by ast_sip_get_all_codecs_on_empty_reinvite(), ast_sip_get_allow_sending_180_after_183(), ast_sip_get_contact_expiration_check_interval(), ast_sip_get_debug(), ast_sip_get_default_from_user(), ast_sip_get_default_realm(), ast_sip_get_default_voicemail_extension(), ast_sip_get_disable_multi_domain(), ast_sip_get_endpoint_identifier_order(), ast_sip_get_ignore_uri_user_options(), ast_sip_get_keep_alive_interval(), ast_sip_get_max_initial_qualify_time(), ast_sip_get_mwi_disable_initial_unsolicited(), ast_sip_get_mwi_tps_queue_high(), ast_sip_get_mwi_tps_queue_low(), ast_sip_get_norefersub(), ast_sip_get_regcontext(), ast_sip_get_send_contact_status_on_update_registration(), ast_sip_get_taskprocessor_overload_trigger(), ast_sip_get_unidentified_request_thresholds(), ast_sip_get_use_callerid_contact(), ast_sip_global_default_outbound_endpoint(), and sip_cli_print_global().
|
static |
Definition at line 134 of file config_global.c.
References ao2_cleanup, ast_sorcery_generic_alloc(), ast_string_field_init, global_destructor(), and NULL.
Referenced by ast_sip_initialize_sorcery_global().
|
static |
Definition at line 187 of file config_global.c.
References ao2_t_global_obj_replace_unref, ast_log, ast_sip_add_global_request_header(), ast_sip_add_global_response_header(), ast_strlen_zero(), check_regcontext(), global_config::debug, global_config::default_from_user, LOG_ERROR, global_config::max_forwards, and global_config::useragent.
Referenced by ast_sip_initialize_sorcery_global(), and global_loaded_observer().
|
static |
Definition at line 127 of file config_global.c.
References ast_string_field_free_memory.
Referenced by global_alloc().
|
static |
Definition at line 604 of file config_global.c.
References ao2_container_count(), ao2_ref, ast_debug, ast_log, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_alloc(), ast_sorcery_retrieve_by_fields(), global_apply(), globals, LOG_ERROR, NULL, and sorcery.
|
static |
Definition at line 558 of file config_global.c.
References ast_log, LOG_WARNING, global_config::overload_trigger, TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL, TASKPROCESSOR_OVERLOAD_TRIGGER_NONE, TASKPROCESSOR_OVERLOAD_TRIGGER_PJSIP_ONLY, and var.
Referenced by ast_sip_initialize_sorcery_global().
|
static |
Definition at line 588 of file config_global.c.
References ast_sip_overload_trigger_to_str(), ast_strdup, buf, and global_config::overload_trigger.
Referenced by ast_sip_initialize_sorcery_global().
int sip_cli_print_global | ( | struct ast_sip_cli_context * | context | ) |
Definition at line 646 of file config_global.c.
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().
|
static |
Definition at line 68 of file config_global.c.
Referenced by ast_sip_initialize_sorcery_global().
|
static |
Definition at line 642 of file config_global.c.
Referenced by ast_sip_destroy_sorcery_global(), and ast_sip_initialize_sorcery_global().
|
static |
Definition at line 576 of file config_global.c.
Referenced by ast_sip_initialize_sorcery_global(), and ast_sip_overload_trigger_to_str().
|
static |
Definition at line 151 of file config_global.c.
Referenced by ast_sip_destroy_sorcery_global(), and check_regcontext().