anchor.diff:      %% IPv6 host and no port
       io:format("test: parse_hostport/1 - 7~n"),
       {"[1:2:3:4:5:6:7:8]", none} = sipparse_util:parse_hostport("[1:2:3:4:5:6:7:8]"),
  +    %% IPv6 address not starting with digit
  +    io:format("test: parse_hostport/1 - 8~n"),
  +    {"[ab:CD:3::5:6:7:8]", none} = sipparse_util:parse_hostport("[ab:CD:3::5:6:7:8]"),
  +    %% IPv6 host and no port, no brackets
  +    io:format("test: parse_hostport/1 - 9~n"),
  +    {"[1:2:3:4:5:6:7:8]", none} = sipparse_util:parse_hostport("1:2:3:4:5:6:7:8"),
  +    %% IPv6 host and no port, no brackets
  +    io:format("test: parse_hostport/1 - 10~n"),
  +    {"[abcd:2:3:4:5:6:7:8]", none} = sipparse_util:parse_hostport("abcd:2:3:4:5:6:7:8"),
  +    %% IPv6 host and no port, no brackets
  +    io:format("test: parse_hostport/1 - 11~n"),
  +    {"[1:2::8]", none} = sipparse_util:parse_hostport("1:2::8"),
  +    %% IPv6 host and no port, no brackets
  +    io:format("test: parse_hostport/1 - 12~n"),
  +    {"[abcd:2::6:7:8]", none} = sipparse_util:parse_hostport("abcd:2::6:7:8"),
  +    %% IPv6 host and no port, no brackets
  +    io:format("test: parse_hostport/1 - 13~n"),
  +    {"[abcd:2::6:BCDE:8]", none} = sipparse_util:parse_hostport("abcd:2::6:BCDE:8"),
       %% test bad port value
  -    io:format("test: parse_hostport/1 - 8~n"),
  +    io:format("test: parse_hostport/1 - 14~n"),
       case catch sipparse_util:parse_hostport("1.1.1.1:1A1") of
   	{'EXIT', _} -> ok;
   	{error, _} -> ok;
  
positive.code:     end,
      %% throw if not ip6 ref
      is_IPv6reference(IPv6Ref),
      {"[" ++ IPv6Ref ++ "]", Port}.
  
  get_ipv6ref_and_port(IPv6Hostport) ->
      case catch sipparse_util:split_fields(IPv6Hostport, 93) of	%% 93 is $]
  
negative.code: 		true ->
  		    %% probably a ipv4 address
  		    case catch parse_ipv4hostport(HostPort) of
  			{ok, Host, Port} when is_list(Host), is_list(Port); Port == none ->
  			    {Host, Port};
  			_ ->
  			    %% was not IPv4 address, try to parse as IPv6 address without
  			    %% brackets, and then as hostname
  			    {ok, Host, Port} = parse_hostport_v6_or_hostname(HostPort),
  			    {Host, Port}
  		    end;
  		false ->
  		    %% must be a hostname, or an IPv6 address without brackets
  		    {ok, Host, Port} = parse_hostport_v6_or_hostname(HostPort),
  		    {Host, Port}
  	    end
      end.
  
  parse_hostport_v6_or_hostname(In) ->
      case catch parse_ipv6hostport(In) of
  	{ok, Host, Port} ->
  	    {ok, Host, Port};
  	_ ->
  	    parse_domain_hostport(In)
      end.
  
  parse_ipv6hostport([91 | IPv6Hostport]) ->	%% 91 is $[
      {IPv6Ref, Port} = get_ipv6ref_and_port(IPv6Hostport),
      case Port of
  	none -> ok;
  