/** * 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); } }
/** * 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); } }