diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-27 22:50:41 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-03-27 22:50:41 +0000 |
commit | 736cce740396bb7df4de4ed6fdb1ddd52d92b366 (patch) | |
tree | 4941697cb70926166b1a08024e2a41135a093ad9 /channels | |
parent | 6edc2501cfaa5da5c8dc830bf92e87cee8c60592 (diff) |
Issue #6409 - Use "s" extension when there's no username in the URI
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@15366 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 3bc66f8b7..2a62f6af2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -6519,6 +6519,7 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) char tmp[256] = "", *uri, *a; char tmpf[256], *from; struct sip_request *req; + char *colon; req = oreq; if (!req) @@ -6550,20 +6551,24 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) ast_uri_decode(from); } + /* Skip any options */ + if ((a = strchr(uri, ';'))) { + *a = '\0'; + } + /* Get the target domain */ if ((a = strchr(uri, '@'))) { - char *colon; *a = '\0'; a++; - colon = strchr(a, ':'); /* Remove :port */ - if (colon) - *colon = '\0'; - ast_copy_string(p->domain, a, sizeof(p->domain)); - } - /* Skip any options */ - if ((a = strchr(uri, ';'))) { - *a = '\0'; + } else { /* No username part */ + a = uri; + uri = "s"; /* Set extension to "s" */ } + colon = strchr(a, ':'); /* Remove :port */ + if (colon) + *colon = '\0'; + + ast_copy_string(p->domain, a, sizeof(p->domain)); if (!AST_LIST_EMPTY(&domain_list)) { char domain_context[AST_MAX_EXTENSION]; |