/**
  * Creates a TelURL based on given URI string. The scheme or '+' should not be included in the
  * phoneNumber string argument.
  *
  * @param uri - the new string value of the phoneNumber.
  * @throws URISyntaxException if the URI string is malformed.
  */
 public javax.sip.address.TelURL createTelURL(String uri) throws ParseException {
   if (uri == null) throw new NullPointerException("null url");
   String telUrl = "tel:" + uri;
   try {
     StringMsgParser smp = new StringMsgParser();
     TelURLImpl timp = (TelURLImpl) smp.parseUrl(telUrl);
     return (TelURL) timp;
   } catch (ParseException ex) {
     throw new ParseException(ex.getMessage(), 0);
   }
 }
 /**
  * create a sip uri.
  *
  * @param uri -- the uri to parse.
  */
 public javax.sip.address.SipURI createSipURI(String uri)
     //  throws java.net.URISyntaxException {
     throws ParseException {
   if (uri == null) throw new NullPointerException("null URI");
   try {
     StringMsgParser smp = new StringMsgParser();
     SipUri sipUri = smp.parseSIPUrl(uri);
     return (SipURI) sipUri;
   } catch (ParseException ex) {
     //  throw new java.net.URISyntaxException(uri, ex.getMessage());
     throw new ParseException(ex.getMessage(), 0);
   }
 }
  /**
   * Creates an Address with the new address string value. The address string is parsed in order to
   * create the new Address instance. Create with a String value of "*" creates a wildcard address.
   * The wildcard can be determined if <code>((SipURI)Address.getURI).getUser() == *;</code>.
   *
   * @param address - the new string value of the address.
   * @throws ParseException which signals that an error has been reached unexpectedly while parsing
   *     the address value.
   */
  public javax.sip.address.Address createAddress(String address) throws java.text.ParseException {
    if (address == null) throw new NullPointerException("null address");

    if (address.equals("*")) {
      AddressImpl addressImpl = new AddressImpl();
      addressImpl.setAddressType(AddressImpl.WILD_CARD);
      SipURI uri = new SipUri();
      uri.setUser("*");
      addressImpl.setURI(uri);
      return addressImpl;
    } else {
      StringMsgParser smp = new StringMsgParser();
      return smp.parseAddress(address);
    }
  }
  /**
   * Create a SipURI
   *
   * @param user -- the user
   * @param host -- the host.
   */
  public javax.sip.address.SipURI createSipURI(String user, String host) throws ParseException {
    if (host == null) throw new NullPointerException("null host");

    StringBuffer uriString = new StringBuffer("sip:");
    if (user != null) {
      uriString.append(user);
      uriString.append("@");
    }

    // if host is an IPv6 string we should enclose it in sq brackets
    if (host.indexOf(':') != host.lastIndexOf(':') && host.trim().charAt(0) != '[')
      host = '[' + host + ']';

    uriString.append(host);

    StringMsgParser smp = new StringMsgParser();
    try {

      SipUri sipUri = smp.parseSIPUrl(uriString.toString());
      return sipUri;
    } catch (ParseException ex) {
      throw new ParseException(ex.getMessage(), 0);
    }
  }