mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-27 14:41:58 +00:00
Merge "res_pjsip: Cache global config options." into 13
This commit is contained in:
6
CHANGES
6
CHANGES
@@ -43,6 +43,12 @@ res_pjsip
|
|||||||
when set will override the default user set on Contact headers in outgoing
|
when set will override the default user set on Contact headers in outgoing
|
||||||
requests.
|
requests.
|
||||||
|
|
||||||
|
* If you are using a sorcery realtime backend to store global res_pjsip
|
||||||
|
options (ps_globals table) then you now have to do a res_pjsip reload for
|
||||||
|
changes to these options to take effect. If you are using pjsip.conf to
|
||||||
|
configure these options then you already had to do a reload after making
|
||||||
|
changes.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
--- Functionality changes from Asterisk 13.10.0 to Asterisk 13.11.0 ----------
|
--- Functionality changes from Asterisk 13.10.0 to Asterisk 13.11.0 ----------
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -48,6 +48,15 @@
|
|||||||
#define DEFAULT_MWI_TPS_QUEUE_LOW -1
|
#define DEFAULT_MWI_TPS_QUEUE_LOW -1
|
||||||
#define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED 0
|
#define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED 0
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Cached global config object
|
||||||
|
*
|
||||||
|
* \details
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
static AO2_GLOBAL_OBJ_STATIC(global_cfg);
|
||||||
|
|
||||||
static char default_useragent[256];
|
static char default_useragent[256];
|
||||||
|
|
||||||
struct global_config {
|
struct global_config {
|
||||||
@@ -135,23 +144,14 @@ static int global_apply(const struct ast_sorcery *sorcery, void *obj)
|
|||||||
ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1);
|
ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1);
|
||||||
ast_sip_add_global_request_header("User-Agent", cfg->useragent, 1);
|
ast_sip_add_global_request_header("User-Agent", cfg->useragent, 1);
|
||||||
ast_sip_add_global_response_header("Server", cfg->useragent, 1);
|
ast_sip_add_global_response_header("Server", cfg->useragent, 1);
|
||||||
|
|
||||||
|
ao2_t_global_obj_replace_unref(global_cfg, cfg, "Applying global settings");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct global_config *get_global_cfg(void)
|
static struct global_config *get_global_cfg(void)
|
||||||
{
|
{
|
||||||
struct global_config *cfg;
|
return ao2_global_obj_ref(global_cfg);
|
||||||
struct ao2_container *globals;
|
|
||||||
|
|
||||||
globals = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "global",
|
|
||||||
AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
|
|
||||||
if (!globals) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg = ao2_find(globals, NULL, 0);
|
|
||||||
ao2_ref(globals, -1);
|
|
||||||
return cfg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ast_sip_global_default_outbound_endpoint(void)
|
char *ast_sip_global_default_outbound_endpoint(void)
|
||||||
@@ -462,6 +462,8 @@ int ast_sip_destroy_sorcery_global(void)
|
|||||||
|
|
||||||
ast_sorcery_instance_observer_remove(sorcery, &observer_callbacks_global);
|
ast_sorcery_instance_observer_remove(sorcery, &observer_callbacks_global);
|
||||||
|
|
||||||
|
ao2_t_global_obj_release(global_cfg, "Module is unloading");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user