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
This commit is contained in:
Alexei Gradinari
2016-06-02 18:26:09 -04:00
parent 49b1be8952
commit b3c787d1dd
6 changed files with 265 additions and 46 deletions

View File

@@ -256,6 +256,8 @@ struct ast_sip_contact {
int via_port;
/*! Content of the Call-ID header in REGISTER request */
AST_STRING_FIELD_EXTENDED(call_id);
/*! The name of the endpoint that added the contact */
AST_STRING_FIELD_EXTENDED(endpoint_name);
};
#define CONTACT_STATUS "contact_status"
@@ -985,6 +987,16 @@ void ast_sip_unregister_endpoint_identifier(struct ast_sip_endpoint_identifier *
*/
void *ast_sip_endpoint_alloc(const char *name);
/*!
* \brief Change state of a persistent endpoint.
*
* \param endpoint The SIP endpoint name to change state.
* \param state The new state
* \retval 0 Success
* \retval -1 Endpoint not found
*/
int ast_sip_persistent_endpoint_update_state(const char *endpoint_name, enum ast_endpoint_state state);
/*!
* \brief Get a pointer to the PJSIP endpoint.
*