summaryrefslogtreecommitdiff
path: root/res/res_pjsip/location.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-06-22 15:25:23 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-06-22 15:29:50 -0400
commit6fa3ed067957e580e208ead7a62a095ac26f5fa9 (patch)
tree7d48f6d6631bcc8ca17f05f18fbd392da414b3f4 /res/res_pjsip/location.c
parentaec09d9c09f04c886b15c731faee9f8d4fb9833f (diff)
res_pjsip: improve realtime performance #2
The patch removes updating all Endpoints' status on startup. Instead, only non-qualified aors with static contact and non-qualified non-expired contacts are retrieved from the realtime to update the endpoint status to ONLINE. The endpoint name was added to the contact object to simply find the endpoint that created this contact. The status of endpoints with qualified aors will be updated by 'qualify' functions. ASTERISK-26061 #close Change-Id: Id324c1776fa55d3741e0c5457ecac0304cb1a0df
Diffstat (limited to 'res/res_pjsip/location.c')
-rw-r--r--res/res_pjsip/location.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 8f8c030c3..aad76a694 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -121,6 +121,7 @@ static void *contact_alloc(const char *name)
return NULL;
}
+ ast_string_field_init_extended(contact, endpoint_name);
ast_string_field_init_extended(contact, reg_server);
ast_string_field_init_extended(contact, via_addr);
ast_string_field_init_extended(contact, call_id);
@@ -352,6 +353,10 @@ int ast_sip_location_add_contact_nolock(struct ast_sip_aor *aor, const char *uri
contact->endpoint = ao2_bump(endpoint);
+ if (endpoint) {
+ ast_string_field_set(contact, endpoint_name, ast_sorcery_object_get_id(endpoint));
+ }
+
return ast_sorcery_create(ast_sip_get_sorcery(), contact);
}
@@ -1136,6 +1141,7 @@ int ast_sip_initialize_sorcery_location(void)
ast_sorcery_object_field_register(sorcery, "contact", "authenticate_qualify", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_contact, authenticate_qualify));
ast_sorcery_object_field_register(sorcery, "contact", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, outbound_proxy));
ast_sorcery_object_field_register(sorcery, "contact", "user_agent", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, user_agent));
+ ast_sorcery_object_field_register(sorcery, "contact", "endpoint", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, endpoint_name));
ast_sorcery_object_field_register(sorcery, "contact", "reg_server", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, reg_server));
ast_sorcery_object_field_register(sorcery, "contact", "via_addr", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, via_addr));
ast_sorcery_object_field_register(sorcery, "contact", "via_port", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_contact, via_port));