diff options
author | Alexei Gradinari <alex2grad@gmail.com> | 2016-04-15 12:59:42 -0400 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-04-27 10:58:43 -0500 |
commit | 860b135c882892711c82672e641b446dd462b086 (patch) | |
tree | 9784e779de084390820af7db9d83d680fc0e6363 /res/res_pjsip_endpoint_identifier_anonymous.c | |
parent | c48015904514327d2e4f0fd74d3abdd8dc425f83 (diff) |
res_pjsip: disable multi domain to improve realtime performace
This patch added new global pjsip option 'disable_multi_domain'.
Disabling Multi Domain can improve Realtime performance by reducing
number of database requests.
ASTERISK-25930 #close
Change-Id: I2e7160f3aae68475d52742107949a799aa2c7dc7
Diffstat (limited to 'res/res_pjsip_endpoint_identifier_anonymous.c')
-rw-r--r-- | res/res_pjsip_endpoint_identifier_anonymous.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/res/res_pjsip_endpoint_identifier_anonymous.c b/res/res_pjsip_endpoint_identifier_anonymous.c index d9d7e03da..a52946632 100644 --- a/res/res_pjsip_endpoint_identifier_anonymous.c +++ b/res/res_pjsip_endpoint_identifier_anonymous.c @@ -69,28 +69,30 @@ static struct ast_sip_endpoint *anonymous_identify(pjsip_rx_data *rdata) return NULL; } - /* Attempt to find the endpoint given the name and domain provided */ - snprintf(id, sizeof(id), "anonymous@%s", domain_name); - if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) { - goto done; - } - - /* See if an alias exists for the domain provided */ - if ((alias = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "domain_alias", domain_name))) { - snprintf(id, sizeof(id), "anonymous@%s", alias->domain); + if (!ast_sip_get_disable_multi_domain()) { + /* Attempt to find the endpoint given the name and domain provided */ + snprintf(id, sizeof(id), "anonymous@%s", domain_name); if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) { goto done; } - } - /* See if the transport this came in on has a provided domain */ - if ((transport_states = ast_sip_get_transport_states()) - && (transport_state = ao2_callback(transport_states, 0, find_transport_state_in_use, rdata)) - && (transport = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport", transport_state->id)) - && !ast_strlen_zero(transport->domain)) { - snprintf(id, sizeof(id), "anonymous@%s", transport->domain); - if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) { - goto done; + /* See if an alias exists for the domain provided */ + if ((alias = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "domain_alias", domain_name))) { + snprintf(id, sizeof(id), "anonymous@%s", alias->domain); + if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) { + goto done; + } + } + + /* See if the transport this came in on has a provided domain */ + if ((transport_states = ast_sip_get_transport_states()) + && (transport_state = ao2_callback(transport_states, 0, find_transport_state_in_use, rdata)) + && (transport = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport", transport_state->id)) + && !ast_strlen_zero(transport->domain)) { + snprintf(id, sizeof(id), "anonymous@%s", transport->domain); + if ((endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id))) { + goto done; + } } } |