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

Daniel Journo asteriskteam at digium.com
Sat Mar 11 17:52:10 CST 2017


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

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, 22 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/62/5162/1

diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index bfaf750..61e5b95 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1273,6 +1273,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);
 
@@ -1295,9 +1297,28 @@
 		if (!persistent->aors) {
 			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 d4ea911..3c7f302 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -1500,7 +1500,7 @@
 	ast_manager_register2("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify, NULL, NULL, NULL);
 	ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options));
 
-	update_all_unqualified_endpoints();
+	//update_all_unqualified_endpoints();
 	qualify_and_schedule_all();
 
 	return 0;

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

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



More information about the asterisk-code-review mailing list