Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 11844) +++ channels/chan_sip.c (working copy) @@ -6506,6 +6506,7 @@ char tmp[256] = "", *uri, *a; char tmpf[256], *from; struct sip_request *req; + char *colon; req = oreq; if (!req) @@ -6537,21 +6538,25 @@ 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)); + } else { /* No username part */ + a = uri; + uri = "s"; /* Set extension to "s" */ } - /* Skip any options */ - if ((a = strchr(uri, ';'))) { - *a = '\0'; - } + 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];