--- chan_sip.c.orig 2011-01-14 21:49:57.000000000 +0100 +++ chan_sip.c 2011-01-14 21:53:12.000000000 +0100 @@ -13774,12 +13774,19 @@ /*! \todo XXX here too we interpret a missing @domain as a name-only * URI, whereas the RFC says this is a domain-only uri. */ - if (!ast_strlen_zero(domain) && !AST_LIST_EMPTY(&domain_list)) { - if (!check_sip_domain(domain, NULL, 0)) { - transmit_response(p, "404 Not found (unknown domain)", &p->initreq); - return AUTH_UNKNOWN_DOMAIN; - } - } + /* Strip off the domain name */ + if ((c = strchr(name, '@'))) { + *c++ = '\0'; + domain = c; + if ((c = strchr(domain, ':'))) /* Remove :port */ + *c = '\0'; + if (!ast_strlen_zero(domain) && !AST_LIST_EMPTY(&domain_list)) { + if (!check_sip_domain(domain, NULL, 0)) { + transmit_response(p, "404 Not found (unknown domain)", &p->initreq); + return AUTH_UNKNOWN_DOMAIN; + } + } + } ast_string_field_set(p, exten, name); build_contact(p);