[Asterisk-code-review] res pjsip: High startup time using local configuration files (asterisk[14])

Daniel Journo asteriskteam at digium.com
Sat Mar 11 17:56:31 CST 2017


Daniel Journo has uploaded a new change for review. ( https://gerrit.asterisk.org/5163 )

Change subject: res_pjsip: High startup time using local configuration files
......................................................................

res_pjsip: High startup time using local configuration files

* pjsip_options.c Removed update_all_unqualified_endpoints()
* pjsip_configuration.c Marked new unqualified endpoints as Online

ASTERISK-26599 #close

Change-Id: If42d3a10e68b1c13a099564fdb93600fb4f42c56
---
M res/res_pjsip/pjsip_configuration.c
M res/res_pjsip/pjsip_options.c
2 files changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/63/5163/1

diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 2793285..7b910a6 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1270,6 +1270,8 @@
 /*! \brief Internal function which finds (or creates) persistent endpoint information */
 static struct ast_endpoint *persistent_endpoint_find_or_create(const struct ast_sip_endpoint *endpoint)
 {
+	char *aor_name;
+	char *aors;
 	RAII_VAR(struct sip_persistent_endpoint *, persistent, NULL, ao2_cleanup);
 	SCOPED_AO2LOCK(lock, persistent_endpoints);
 
@@ -1293,8 +1295,27 @@
 			return NULL;
 		}
 
+		ast_log(LOG_VERBOSE, "Setting new endpoint '%s' to OFFLINE\n",
+			ast_sorcery_object_get_id(endpoint));
+
 		ast_endpoint_set_state(persistent->endpoint, AST_ENDPOINT_OFFLINE);
 
+		aors = ast_strdupa(persistent->aors);
+
+		while ((aor_name = ast_strip(strsep(&aors, ",")))) {
+			struct ast_sip_aor *aor;
+			aor = ast_sip_location_retrieve_aor(aor_name);
+			if (!aor) {
+				continue;
+			}
+			if (aor->qualify_frequency <= 0) {
+				ast_log(LOG_VERBOSE, "Setting unqualified endpoint '%s' to ONLINE\n",
+					ast_sorcery_object_get_id(endpoint));
+
+				ast_endpoint_set_state(persistent->endpoint, AST_ENDPOINT_ONLINE);
+			}
+		}
+
 		ao2_link_flags(persistent_endpoints, persistent, OBJ_NOLOCK);
 	}
 
diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index 662166c..e1aeae7 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -1490,7 +1490,6 @@
 	ast_manager_register_xml("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify);
 	ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options));
 
-	update_all_unqualified_endpoints();
 	qualify_and_schedule_all();
 
 	return 0;

-- 
To view, visit https://gerrit.asterisk.org/5163
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If42d3a10e68b1c13a099564fdb93600fb4f42c56
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Daniel Journo <dan at keshercommunications.com>



More information about the asterisk-code-review mailing list