001: package test.tck.factory;
002:
003: import javax.sip.header.*;
004: import test.tck.*;
005:
006: public class FactoryTestHarness extends TestHarness {
007:
008: protected static String hosts[] = { "herbivore.ncsl.nist.gov",
009: "foo.bar.com", "129.6.55.181",
010: "herbivore.ncsl.nist.gov:5070", "big.com", "big.com",
011: "big.com", "gateway.com", "10.1.2.3", "example.com",
012: "alice", "registrar.com", "10.10.30.186:666",
013: "abc123.xyz-test." };
014:
015: static protected String urls[] = {
016: "sip:herbivore.ncsl.nist.gov:5070;maddr=129.6.55.251;lr",
017: "sip:1-301-975-3664@foo.bar.com;user=phone",
018: "sip:129.6.55.181",
019: "sip:herbivore.ncsl.nist.gov:5070;maddr=129.6.55.251?method=INVITE&contact=sip:foo.bar.com",
020: "sip:j.doe@big.com",
021: "sip:j.doe:secret@big.com;transport=tcp",
022: "sip:j.doe@big.com?subject=project",
023: "sip:+1-212-555-1212:1234@gateway.com;user=phone",
024: "sip:1212@gateway.com",
025: "sip:alice@10.1.2.3",
026: "sip:alice@example.com",
027: "sip:alice",
028: "sip:alice@registrar.com;method=REGISTER",
029: "sip:annc@10.10.30.186:6666;early=no;play=http://10.10.30.186:8080/examples/pin.vxml",
030: "http://10.10.30.186:8080/examples/pin.vxml",
031: "sip:&=+$,;?/%00-_.!~*'()@abc123.xyz-test.:12345;weird123[]/:&+$=weird123[]/:&+$?[]/?:+$=[]/?:+$",
032: "sip:[2001:db8::9:1];real=[2001:db8::9:255]\n",
033: "sip:user;par=u%40example.net@example.com\n" };
034:
035: protected static String telUrls[] = { "tel:+463-1701-4291",
036: "tel:46317014291;phone-context=+5", "tel:+1-212-555-1212" };
037:
038: protected static String phoneNumbers[] = { "+463-1701-4291",
039: "46317014291;phone-context=+5", "+1-212-555-1212" };
040:
041: protected static String addresses[] = { "herbivore.ncsl.nist.gov",
042: "1-301-975-3664@foo.bar.com", "129.6.55.181",
043: "herbivore.ncsl.nist.gov:5070", "j.doe@big.com",
044: "secret@big.com", "j.doe@big.com", "1212@gateway.com",
045: "alice@10.1.2.3", "alice@example.com", "alice",
046: "alice@registrar.com", "annc@10.10.30.186:666" // 666 is the sign of the beast. heh. heh.
047: };
048: protected static String msgString = "INVITE sip:littleguy@there.com:5060 SIP/2.0\r\n"
049: + "Via: SIP/2.0/UDP 65.243.118.100:5050\r\n"
050: + "From: Me <sip:M.Ranganathan@sipbakeoff.com>;tag=1234\r\n"
051: + "To: \"littleguy@there.com\" <sip:littleguy@there.com:5060> \r\n"
052: + "Call-ID: Q2AboBsaGn9!?x6@sipbakeoff.com \r\n"
053: + "CSeq: 1 INVITE \r\n"
054: // BUG submitted by Ben Evans (opencloud):
055: // was missing \r\n on Accept and Accept-Language headers
056: // (works OK in NIST-SIP but not valid SIP syntax)
057: + "Accept: application/sdp;level=1\r\n"
058: + "Accept-Language: da\r\n"
059: + "Authentication-Info: nextnonce=\"47364c23432d2e131a5fb210812c\"\r\n"
060: + "Accept-Encoding: identity; q=0.5\r\n"
061: + "Authorization: Digest username=\"UserB\", realm=\"MCI WorldCom SIP\","
062: + " nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\", opaque=\"\","
063: + " uri=\"sip:ss2.wcom.com\", "
064: + "response=\"dfe56131d1958046689cd83306477ecc\"\r\n"
065: + "Contact:<sip:utente@127.0.0.1:5000;transport=udp>;expires=3600\r\n"
066: + "Content-Type: text/html; charset=ISO-8859-4\r\n"
067: + "Date: Sun, 07 Jan 2001 19:05:06 GMT\r\n"
068: + "Organization: Boxes by Bob\r\n"
069: + "Content-Length: 0\r\n\r\n";
070:
071: protected static String multiHeaders[] = {
072: "Allow: INVITE , FooBar\r\n",
073: "Accept-Encoding: compress;q=0.5,gzip;q=1.0\r\n",
074: "Accept: application/sdp;level=1,application/x-private,text/html\r\n",
075: "Contact: Bo Bob Biggs "
076: // BUG submitted by Ben Evans (opencloud): SIP syntax does not
077: // permit space between < and URI
078: + "<sip:user@example.com?Route=%3Csip:sip.example.com%3E>,"
079: + "Joe Bob Briggs <sip:mranga@nist.gov>\r\n",
080: "Proxy-Require: foo, 1234 \r\n",
081: "Record-Route: <sip:bob@biloxi.com>,"
082: + "<sip:bob@biloxi.com;maddr=10.1.1.1>,"
083: + "<sip:+1-650-555-2222@iftgw.there.com;"
084: + "maddr=ss1.wcom.com>\r\n" };
085:
086: protected static String headers[] = {
087: "Accept: application/sdp;level=1\n",
088: "Accept: application/x-private\n",
089: "Accept: text/html\n",
090: "Accept: text/*\n",
091: "Accept: text/*strange_extension*\n",
092: "Accept: application/sdp;level=1;q=1.0\n",
093: "Accept-Encoding: compress\n",
094: "Accept-Encoding: gzip\n",
095: "Accept-Encoding:\n",
096: "Accept-Encoding: *\n",
097: "Accept-Encoding: *special*\n",
098: "Accept-Encoding: compress;q=0.5\n",
099: "Accept-Encoding: gzip;q=1.0\n",
100: "Accept-Encoding: identity; q=0.5\n",
101: "Accept-Language: da\n",
102: "Accept-Language:\n",
103: "Accept-Language: en-gb;q=0.8\n",
104: "Accept-Language: *\n",
105:
106: "Alert-Info: <http://www.example.com/sounds/moo.wav>;purpose=icon\n",
107: "Alert-Info: <http://www.example.com/alice/> ;purpose=info\n",
108: "Alert-Info: <http://wwww.example.com/alice/photo1.jpg>\n",
109: "Allow: INVITE \r\n",
110: "Allow: FooBars\r\n",
111: "Allow-Events: pack1.pack2\n",
112: "Allow-Events: pack1\n",
113:
114: // JvB: added
115: "u: pack1\n",
116: "U: pack1\n",
117:
118: "Authentication-Info: nextnonce=\"47364c23432d2e131a5fb210812c\"\n",
119: // Issue 4 posted by Larry B
120: "Authentication-Info: nextnonce=\"47364c23432d2e131a5fb210812c\",rspauth=\"hello\"\n",
121: "Authorization: Digest username=\"UserB\", realm=\"MCI WorldCom SIP\","
122: + " nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\", opaque=\"\","
123: + " uri=\"sip:ss2.wcom.com\","
124: + " response=\"dfe56131d1958046689cd83306477ecc\"\n",
125: "Authorization: Digest username=\"apro,kop\","
126: + "realm=\"Realm\","
127: + "nonce=\"MTA1MDMzMjE5ODUzMjUwM2QyMzBhOTJlMTkxYjIxYWY1NDlhYzk4YzNiMGYz\""
128: + ",uri=\"sip:nortelnetworks.com:5060\","
129: + "response=\"dbfba6c0e9664b45b7d224d2b52a1d01\","
130: + "algorithm=MD5,"
131: + "cnonce=\"VG05eWRHVnNJRTVsZEhkdmNtdHpNVEExTURNek16WTFOREUyTUE9PQ==\","
132: + "qop=auth-int,nc=00000001\n",
133: "Call-ID: f0b40bcc-3485-49e7-ad1a-f1dfad2e39c9@10.5.0.53\n",
134: "Call-ID: f81d4fae-7dec-11d0-a765-00a0c91e6bf6@foo.bar.com\n",
135: "i:f81d4fae-7dec-11d0-a765-00a0c91e6bf6@foo.bar.com\n",
136: "I:f81d4fae-7dec-11d0-a765-00a0c91e6bf6@foo.bar.com\n",
137: "Call-ID: 1@10.0.0.1\n",
138: "Call-ID: kl24ahsd546folnyt2vbak9sad98u23naodiunzds09a3bqw0sdfbsk34poouymnae0043nsed09mfkvc74bd0cuwnms05dknw87hjpobd76f\n",
139: "Call-Id: 281794\n",
140: "Call-Info: <http://wwww.example.com/alice/photo.jpg> ;purpose=icon\n",
141: "Call-Info: <http://www.example.com/alice/> ;purpose=info\n",
142: "Call-Info: <http://wwww.example.com/alice/photo1.jpg>\n",
143: "Contact:<sip:utente@127.0.0.1:5000;transport=udp>;expires=3600\n",
144: "Contact:BigGuy<sip:utente@127.0.0.1:5000>;expires=3600\n",
145: "Contact: sip:4855@166.35.224.216:5060\n",
146: "Contact: sip:user@host.company.com\n",
147: // BUG reported by Ben Evans (opencloud): SIP syntax
148: // does not permit space between < and URI
149: "Contact: Bo Bob Biggs"
150: + "<sip:user@example.com?Route=%3Csip:sip.example.com%3E>\n",
151: "Contact: Joe Bob Briggs <sip:mranga@nist.gov>\n",
152: "Contact: \"Mr. Watson\" <sip:watson@worcester.bell-telephone.com>"
153: + " ; q=0.7; expires=3600",
154: "Contact: \"Mr. Watson\" <mailto:watson@bell-telephone.com>;q=0.1\n",
155: "Contact: LittleGuy <sip:UserB@there.com;user=phone>\n",
156: "Contact: <sip:+1-972-555-2222@gw1.wcom.com;user=phone>\n",
157: "Contact: <tel:+1-972-555-2222>\n",
158: "Contact:*\n",
159: "Contact: *displayname* <sip:user@provider.com>\n",
160: "Contact:BigGuy<sip:utente@127.0.0.1;5000>;Expires=3600\n",
161:
162: // JvB: added
163: "m:BigGuy<sip:utente@127.0.0.1;5000>;Expires=3600\n",
164: "M:BigGuy<sip:utente@127.0.0.1;5000>;Expires=3600\n",
165:
166: "Content-Disposition: session\n",
167: "Content-Disposition: render;handling=hand;optional=opt \n",
168: "Content-Encoding: gzip \n",
169:
170: // JvB: added
171: "e: gzip \n",
172: "E: gzip \n",
173: "Content-Language: fr \n",
174: "l: 345\n",
175: "L: 345\n",
176: "Content-Length: 3495\n",
177: "Content-Length: 0 \n",
178: "c: text/html; charset=ISO-8859-4\n",
179: "Content-Type: text/html; charset=ISO-8859-4\n",
180: "Content-Type: application/sdp\n",
181: "Content-Type: application/sdp; o=we ;l=ek ; i=end \n",
182: "CSeq: 17 INVITE\n",
183: "CSeq: 17 ACK\n",
184: "CSeq : 18 BYE\n",
185: "CSeq:1 CANCEL\n",
186: "CSeq: 3 BYE\n",
187: "Date: Sun, 07 Jan 2001 19:05:06 GMT\n",
188:
189: // JvB: Date is officially 1 or 2 digits
190: "Date: Mon, 8 Jan 2001 19:05:06 GMT\n",
191: "Error-Info: <sip:not-in-service-recording@atlanta.com>\n",
192: "Error-Info: <sip:not-in-service-recording@atlanta.com>;param1=oli\n",
193:
194: // JvB: These ones were missing
195: "Expires: 3600\n",
196: "Event: register\n",
197: "o: presence\n",
198: "O: presence\n",
199:
200: // BUG from Ben Evans (opencloud): space before >
201: "From: foobar at com <sip:4855@166.34.120.100>;tag=1024181795\n",
202: "From: sip:user@company.com\n",
203: "From: sip:caller@university.edu\n",
204: "from: sip:localhost\n",
205: "from: * <sip:localhost>\n", // '*' is a token in from
206:
207: // JvB: test short form too
208: "f: sip:user@company.com\n",
209: "F: sip:user@company.com\n",
210:
211: "FROM: \"A. G. Bell\" <sip:agb@bell-telephone.com> ;tag=a48s\n",
212: "In-Reply-To: 70710@saturn.bell-tel.com\n",
213: "In-Reply-To: 70710 \n",
214: "Max-Forwards: 34\n",
215: "Max-Forwards: 10 \n",
216: "MIME-Version: 1.0 \n",
217: "Min-Expires: 60 \n",
218: "Organization: Boxes by Bob\n",
219: "Priority: emergency\n",
220: "Proxy-Authenticate: Digest realm=\"MCI WorldCom SIP\","
221: + "domain=\"sip:ss2.wcom.com\", "
222: + "nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\","
223: + "opaque=\"\", stale=FALSE, algorithm=MD5\n",
224: "Proxy-Authorization: Digest realm=\"MCI WorldCom SIP\","
225: + "domain=\"sip:ss2.wcom.com\", "
226: + "nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\","
227: + "opaque=\"\", stale=FALSE, algorithm=MD5\n",
228: "Proxy-Require: foo \n",
229: "Proxy-Require: 1234 \n",
230: "RAck: 776656 1 INVITE\n",
231: "Reason: SIP ;cause=200 ;text=\"Call completed elsewhere\"\n",
232: "Reason: Q.850 ;cause=16 ;text=\"Terminated\"\n",
233: "Reason: SIP ;cause=600 ;text=\"Busy Everywhere\"\n",
234: // API BUG: what should the default cause code be? - NIST uses -1 but this is not specified.
235: // TBD -- documentation fix in jain-sip 1.2 should specify the default cause to be -1
236: "Reason: SIP \n",
237: "Record-Route: <sip:bob@biloxi.com>",
238: "Record-Route: <sip:bob@biloxi.com;maddr=10.1.1.1>",
239: "Record-Route: <sip:+1-650-555-2222@iftgw.there.com;"
240: + "maddr=ss1.wcom.com>\n",
241: "Refer-To: <sip:+1-650-555-2222@ss1.wcom.com;user=phone>;tag=5617\n",
242: "Refer-To: T. A. Watson <sip:watson@bell-telephone.com>\n",
243: "Refer-To: LittleGuy <sip:UserB@there.com>\n",
244: "Refer-To: sip:mranga@120.6.55.9\n",
245: "Refer-To: sip:mranga@129.6.55.9 ; tag=696928473514.129.6.55.9\n",
246:
247: // JvB: added
248: "r: sip:mranga@120.6.55.9\n",
249: "R: sip:mranga@120.6.55.9\n",
250:
251: "Reply-To: Bob <sip:bob@biloxi.com>\n",
252: "Require: 100rel \n",
253: "Retry-After: 18000;duration=3600\n",
254: "Retry-After: 120;duration=3600;ra=oli\n",
255: // BUG reported by Ben Evans, opencloud:
256: // javadoc says default duration is 0 but RI returns -1,
257: // The RI was fixed to return 0
258: "Retry-After: 1230 (I'm in a meeting);fg=der;duration=23\n",
259: "Route: <sip:alice@atlanta.com>\n",
260: "Route: <sip:bob@biloxi.com>\n",
261: "RSeq: 988789 \n",
262: "Server: Softphone/Beta1.5 \n",
263: "Server: HomeServer v2\n",
264: "Server: Nist/Beta1 (beta version) \n",
265: "Server: Nist proxy (beta version)\n",
266: "Server: Nist1.0/Beta2 UbiServer/vers.1.0 (new stuff) (Cool) \n",
267:
268: // JvB: added for 1.2 to support RFC3903
269: "SIP-ETag: tag123\n",
270: "SIP-If-Match: tag123\n",
271:
272: "Subject: Where is the Moscone?\n",
273: "Subject: Need more boxes\n",
274:
275: // JvB: added
276: "s: Need more boxes\n",
277: "S: Need more boxes\n",
278:
279: // API BUG: default value of retry-after param not specified.
280: // TBD -- documentation bug in JAIN-SIP to be fixed in 1.2
281: "Subscription-State: active \n",
282: "Subscription-State: terminated;reason=rejected \n",
283: "Subscription-State: pending;reason=probation;expires=36\n",
284: "Subscription-State: pending;retry-after=10;expires=36\n",
285: "Subscription-State: pending;generic=void\n",
286: "Supported: 100rel \n",
287: "Supported: foo1\n",
288: "Supported:\n", // JvB: it may be empty! bug in parser
289:
290: // JvB: added
291: "k: foo1\n",
292: "K: foo1\n",
293:
294: "Timestamp: 54 \n",
295: "Timestamp: 52.34 34.5 \n",
296: "Timestamp: 52.34 .5 \n", // JvB: also valid syntax!
297:
298: "To: <sip:+1-650-555-2222@ss1.wcom.com;user=phone>;tag=5617\n",
299: "To: T. A. Watson <sip:watson@bell-telephone.com>\n",
300: "To: LittleGuy <sip:UserB@there.com>\n",
301: "To: sip:mranga@120.6.55.9\n",
302: "To: sip:mranga@129.6.55.9 ; tag=696928473514.129.6.55.9\n",
303:
304: // JvB: added
305: "t: sip:mranga@120.6.55.9\n",
306: "T: sip:mranga@120.6.55.9\n",
307:
308: "Unsupported: foo \n",
309: "User-Agent: Softphone/Beta1.5 \n",
310: "User-Agent: Nist/Beta1 (beta version) \n",
311: "User-Agent: Nist UA (beta version)\n",
312: "User-Agent: Nist1.0/Beta2 Ubi/vers.1.0 (very cool) \n",
313: "Via: SIP/2.0/UDP 135.180.130.133\n",
314: "Via: SIP/2.0/UDP 166.34.120.100;branch=0000045d-00000001\n",
315: "Via: SIP/2.0/UDP host.example.com;received=135.180.130.133\n",
316: "Via: SIP/2.0/UDP [2001:db8::9:1];received=[2001:db8::9:255];branch=z9hG4bKas3-111\n",
317:
318: // JvB: added
319: "v: SIP/2.0/UDP 135.180.130.133\n",
320: "V: SIP/2.0/UDP 135.180.130.133\n",
321:
322: "WWW-Authenticate: Digest realm=\"MCI WorldCom SIP\","
323: + "domain=\"sip:ss2.wcom.com\","
324: + "nonce=\"ea9c8e88df84f1cec4341ae6cbe5a359\","
325: + "opaque=\"\", stale=FALSE, algorithm=MD5\n",
326: "WWW-Authenticate: Digest realm=\"MCI WorldCom SIP\","
327: + "qop=\"auth\" , nonce-value=\"oli\"\n",
328: "Warning: 307 isi.edu \"Session parameter 'foo' not understood\"\n",
329: "Warning: 301 isi.edu \"Incompatible network address type 'E.164'\"\n",
330: "Route: \"displayname\\\\\"<sip:x@y.z>;x=\"\";y=\"\\\"\\\\\"\n" };
331:
332: protected Header createRiHeaderFromString(String hdr) {
333: try {
334: StringBuffer name = new StringBuffer();
335: StringBuffer body = new StringBuffer();
336: int n = 0;
337: for (n = 0; n < hdr.length(); n++) {
338: if (hdr.charAt(n) != ':') {
339: name.append(hdr.charAt(n));
340: } else
341: break;
342: }
343: n++;
344:
345: for (; n < hdr.length(); n++) {
346: body.append(hdr.charAt(n));
347: }
348: Header riHeader = riHeaderFactory.createHeader(name
349: .toString().trim(), body.toString().trim());
350: return riHeader;
351: } catch (java.text.ParseException ex) {
352: return null;
353: }
354: }
355:
356: public FactoryTestHarness(String name) {
357: super(name);
358: }
359:
360: }
|