summaryrefslogtreecommitdiff
path: root/res/res_pjsip_mwi.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2017-06-12 10:57:24 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2017-06-13 09:34:24 -0500
commit42f738e0528252479496680925081a35b1172b7e (patch)
tree48fea6a16e520bbbeb143a56887f9c5bd7d5493d /res/res_pjsip_mwi.c
parentabe1dd303909416a1b57747bdb162b82fb08f72b (diff)
res_pjsip_mwi: don't create mwi subscriptions if initial unsolicited disabled
If sending unsolicited mwi to all endpoints on startup is disabled (mwi_disable_initial_unsolicited=yes) do not need to create subscriptions. If there are many (thousands) realtime endpoints configured with unsolicited mwi and Vociemail Storage configured as ODBC or IMAP there will be huge number of DB/IMAP requests on startup. ASTERISK-26230 #close Change-Id: I50ae909639e3ee298b931a54def4b2b9e0fb86c5
Diffstat (limited to 'res/res_pjsip_mwi.c')
-rw-r--r--res/res_pjsip_mwi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c
index e625df77a..3dfccef86 100644
--- a/res/res_pjsip_mwi.c
+++ b/res/res_pjsip_mwi.c
@@ -1278,7 +1278,9 @@ static struct ast_sorcery_observer global_observer = {
static int reload(void)
{
- create_mwi_subscriptions();
+ if (!ast_sip_get_mwi_disable_initial_unsolicited()) {
+ create_mwi_subscriptions();
+ }
return 0;
}
@@ -1301,13 +1303,13 @@ static int load_module(void)
ast_sip_unregister_subscription_handler(&mwi_handler);
return AST_MODULE_LOAD_DECLINE;
}
- create_mwi_subscriptions();
ast_sorcery_observer_add(ast_sip_get_sorcery(), "contact", &mwi_contact_observer);
ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &global_observer);
ast_sorcery_reload_object(ast_sip_get_sorcery(), "global");
if (!ast_sip_get_mwi_disable_initial_unsolicited()) {
+ create_mwi_subscriptions();
if (ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
ast_sip_push_task(NULL, send_initial_notify_all, NULL);
} else {