diff -NaurbB old/chan_sip.c new/chan_sip.c --- old/chan_sip.c 2009-01-21 17:00:22.000000000 +0000 +++ new/chan_sip.c 2009-01-26 10:48:54.000000000 +0000 @@ -6474,6 +6474,16 @@ ast_copy_string(buf, value, sizeof(buf)); + /* split [/contact][~expiry] */ + expire = strchr(buf, '~'); + if (expire) + *expire++ = '\0'; + callback = strchr(buf, '/'); + if (callback) + *callback++ = '\0'; + if (ast_strlen_zero(callback)) + callback = "s"; + sip_parse_host(buf, lineno, &username, &portnum, &transport); /* First split around the last '@' then parse the two components. */ @@ -6493,25 +6503,6 @@ *authuser++ = '\0'; } - /* split host[:port][/contact] */ - expire = strchr(hostname, '~'); - if (expire) - *expire++ = '\0'; - callback = strchr(hostname, '/'); - if (callback) - *callback++ = '\0'; - if (ast_strlen_zero(callback)) - callback = "s"; - /* Separate host from port when checking for reserved characters - */ - if ((port = strchr(hostname, ':'))) { - *port = '\0'; - } - /* And then re-merge the host and port so they are stored correctly - */ - if (port) { - *port = ':'; - } if (!(reg = ast_calloc(1, sizeof(*reg)))) { ast_log(LOG_ERROR, "Out of memory. Can't allocate SIP registry entry\n"); return -1;