/** * Create a new Request Line from a String. * */ public SipRequestLine createRequestLine(String requestLine) throws ParseException { RequestLineParser requestLineParser = new RequestLineParser(requestLine); return (SipRequestLine) requestLineParser.parse(); }
public RequestLine parse() throws ParseException { if (debug) dbg_enter("parse"); try { RequestLine retval = new RequestLine(); String m = method(); lexer.SPorHT(); retval.setMethod(m); this.lexer.selectLexer("sip_urlLexer"); URLParser urlParser = new URLParser(this.getLexer()); GenericURI url = urlParser.uriReference(true); lexer.SPorHT(); retval.setUri(url); this.lexer.selectLexer("request_lineLexer"); String v = sipVersion(); retval.setSipVersion(v); lexer.SPorHT(); lexer.match('\n'); return retval; } finally { if (debug) dbg_leave("parse"); } }
/** * Parse the SIP Request Line * * @param requestLine * a String containing the request line to be parsed. * @return a RequestLine structure that has the parsed RequestLine * @exception ParseException * if there was an error parsing the requestLine. */ public RequestLine parseSIPRequestLine(String requestLine) throws ParseException { requestLine += "\n"; return new RequestLineParser(requestLine).parse(); }
public static void main(String args[]) throws ParseException { String requestLines[] = { "REGISTER sip:192.168.0.68 SIP/2.0\n", "REGISTER sip:company.com SIP/2.0\n", "INVITE sip:3660@166.35.231.140 SIP/2.0\n", "INVITE sip:user@company.com SIP/2.0\n", "REGISTER sip:[2001::1]:5060;transport=tcp SIP/2.0\n", // Added by Daniel J. Martinez Manzano <dani@dif.um.es> "REGISTER sip:[2002:800:700:600:30:4:6:1]:5060;transport=udp SIP/2.0\n", // Added by Daniel J. Martinez Manzano <dani@dif.um.es> "REGISTER sip:[3ffe:800:700::30:4:6:1]:5060;transport=tls SIP/2.0\n", // Added by Daniel J. Martinez Manzano <dani@dif.um.es> "REGISTER sip:[2001:720:1710:0:201:29ff:fe21:f403]:5060;transport=udp SIP/2.0\n", "OPTIONS sip:135.180.130.133 SIP/2.0\n" }; for (int i = 0; i < requestLines.length; i++ ) { RequestLineParser rlp = new RequestLineParser(requestLines[i]); RequestLine rl = rlp.parse(); System.out.println("encoded = " + rl.encode()); } }
message = new SIPRequest(); try { RequestLine requestLine = new RequestLineParser(firstLine + "\n") .parse(); ((SIPRequest) message).setRequestLine(requestLine); } catch (ParseException ex) {
RequestLine requestLine = new RequestLineParser(firstLine + "\n") .parse(); ((SIPRequest) message).setRequestLine(requestLine); } catch (ParseException ex) {