--- chan_sip.c.orig 2012-02-10 07:53:35.130197382 -0500 +++ chan_sip.c 2012-02-10 08:03:40.069370157 -0500 @@ -14558,14 +14558,21 @@ static enum check_auth_result register_v * skipped if it was a domain-only URI (used as username). Here we treat * as and won't forget to test the * domain ACLs against host. */ - if (!AST_LIST_EMPTY(&domain_list)) { - if (!check_sip_domain(domain, NULL, 0)) { - if (sip_cfg.alwaysauthreject) { - transmit_fake_auth_response(p, SIP_REGISTER, &p->initreq, XMIT_UNRELIABLE); - } else { - transmit_response(p, "404 Not found (unknown domain)", &p->initreq); + /* Strip port off the domain name - ASTERISK-17250 */ + if (( c = strchr(name, '@'))) { + *c++ = '\0'; + domain = c; + if ((c = strchr(domain, ':'))) /* Remove :port */ + *c = '\0'; + if (!AST_LIST_EMPTY(&domain_list)) { + if (!check_sip_domain(domain, NULL, 0)) { + if (sip_cfg.alwaysauthreject) { + transmit_fake_auth_response(p, SIP_REGISTER, &p->initreq, XMIT_UNRELIABLE); + } else { + transmit_response(p, "404 Not found (unknown domain)", &p->initreq); + } + return AUTH_UNKNOWN_DOMAIN; } - return AUTH_UNKNOWN_DOMAIN; } }