--- channels/chan_sip.c.2011-02-02 2011-02-02 18:37:52.000000000 -0700 +++ channels/chan_sip.c 2011-02-02 19:43:13.000000000 -0700 @@ -7571,7 +7571,7 @@ int portnum = 0; enum sip_transport transport = SIP_TRANSPORT_UDP; char buf[256] = ""; - char *username = NULL, *hostname = NULL, *secret = NULL, *authuser = NULL, *porta = NULL, *mailbox = NULL; + char *username = NULL, *hostname = NULL, *secret = NULL, *authuser = NULL, *porta = NULL, *mailbox = NULL, *longhostname = NULL; if (!value) { return -1; @@ -7579,25 +7579,27 @@ ast_copy_string(buf, value, sizeof(buf)); - sip_parse_host(buf, lineno, &username, &portnum, &transport); - - if ((hostname = strrchr(username, '@'))) { - *hostname++ = '\0'; + if ((longhostname = strrchr(buf, '@'))) { + *longhostname++ = '\0'; } - + + if ((mailbox = strrchr(longhostname, '/'))) { + *mailbox++ = '\0'; + } + + sip_parse_host(longhostname, lineno, &hostname, &portnum, &transport); + + username = buf; + if ((secret = strchr(username, ':'))) { *secret++ = '\0'; if ((authuser = strchr(secret, ':'))) { *authuser++ = '\0'; } } - - if ((mailbox = strchr(hostname, '/'))) { - *mailbox++ = '\0'; - } if (ast_strlen_zero(username) || ast_strlen_zero(hostname) || ast_strlen_zero(mailbox)) { - ast_log(LOG_WARNING, "Format for MWI subscription is user[:secret[:authuser]]@host[:port][/mailbox] at line %d\n", lineno); + ast_log(LOG_WARNING, "Format for MWI subscription is user[:secret[:authuser]]@[tcp,udp://]host[:port]/mailbox at line %d\n", lineno); return -1; }