mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
res_pjsip: Add ignore_uri_user_options option.
This implements the chan_sip legacy_useroption_parsing option but with a better name. * Made the caller-id number and redirecting number strings obtained from incoming SIP URI user fields always truncated at the first semicolon. People don't care about anything after the semicolon showing up on their displays even though the RFC allows the semicolon. ASTERISK-26316 #close Reported by: Kevin Harwell Change-Id: Ib42b0e940dd34d84c7b14bc2e90d1ba392624f62
This commit is contained in:
@@ -40,7 +40,8 @@ static struct ast_sip_aor *find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri
|
||||
char *configured_aors, *aor_name;
|
||||
pjsip_sip_uri *sip_uri;
|
||||
char *domain_name;
|
||||
RAII_VAR(struct ast_str *, id, NULL, ast_free);
|
||||
char *username;
|
||||
struct ast_str *id = NULL;
|
||||
|
||||
if (ast_strlen_zero(endpoint->aors)) {
|
||||
return NULL;
|
||||
@@ -49,6 +50,14 @@ static struct ast_sip_aor *find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri
|
||||
sip_uri = pjsip_uri_get_uri(uri);
|
||||
domain_name = ast_alloca(sip_uri->host.slen + 1);
|
||||
ast_copy_pj_str(domain_name, &sip_uri->host, sip_uri->host.slen + 1);
|
||||
username = ast_alloca(sip_uri->user.slen + 1);
|
||||
ast_copy_pj_str(username, &sip_uri->user, sip_uri->user.slen + 1);
|
||||
|
||||
/*
|
||||
* We may want to match without any user options getting
|
||||
* in the way.
|
||||
*/
|
||||
AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(username);
|
||||
|
||||
configured_aors = ast_strdupa(endpoint->aors);
|
||||
|
||||
@@ -60,15 +69,16 @@ static struct ast_sip_aor *find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pj_strcmp2(&sip_uri->user, aor_name)) {
|
||||
if (!strcmp(username, aor_name)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!id && !(id = ast_str_create(sip_uri->user.slen + sip_uri->host.slen + 2))) {
|
||||
return NULL;
|
||||
if (!id && !(id = ast_str_create(strlen(username) + sip_uri->host.slen + 2))) {
|
||||
aor_name = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
ast_str_set(&id, 0, "%.*s@", (int)sip_uri->user.slen, sip_uri->user.ptr);
|
||||
ast_str_set(&id, 0, "%s@", username);
|
||||
if ((alias = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "domain_alias", domain_name))) {
|
||||
ast_str_append(&id, 0, "%s", alias->domain);
|
||||
ao2_cleanup(alias);
|
||||
@@ -77,10 +87,10 @@ static struct ast_sip_aor *find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri
|
||||
}
|
||||
|
||||
if (!strcmp(aor_name, ast_str_buffer(id))) {
|
||||
ast_free(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ast_free(id);
|
||||
|
||||
if (ast_strlen_zero(aor_name)) {
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user