001: /**
002: * $RCSfile$
003: * $Revision: $
004: * $Date: $
005: *
006: * Copyright (C) 2007 Jive Software. All rights reserved.
007: *
008: * This software is published under the terms of the GNU Public License (GPL),
009: * a copy of which is included in this distribution.
010: */package org.jivesoftware.openfire.sip.tester.stack;
011:
012: /**
013: * Title: SIPark
014: *
015: * @author Thiago Rocha Camargo (thiago@jivesoftware.com)
016: */
017:
018: public class SIPConfig {
019:
020: private static boolean askPassword = true;
021:
022: private static String audioPort = "20002";
023:
024: private static String authenticationRealm = "";
025:
026: private static String authUserName = "";
027:
028: private static int bindRetries = 3;
029:
030: private static int defaultBufferLength = 200;
031:
032: private static String defaultDomain = "";
033:
034: private static String displayName = "";
035:
036: private static String excessiveURIChar = "( )-";
037:
038: private static boolean failCallInUserMismatch = false;
039:
040: private static boolean firstLaunch = false;
041:
042: private static String httpProxy = "";
043:
044: private static String IPAddress = "";
045:
046: private static String javaHome = "";
047:
048: private static int keepAliveDelay = 30;
049:
050: private static int localPort = 5060;
051:
052: private static boolean loopAlerts = true;
053:
054: private static String mediaSource = null;
055:
056: private static String os = "windows";
057:
058: private static String outboundProxy = "";
059:
060: private static boolean preferIPv4Stack = true;
061:
062: private static String preferredAudioCodec = "3";
063:
064: private static String preferredNetworkAddress = "";
065:
066: private static String preferredNetworkInterface = "";
067:
068: private static String preferredVideoCodec = "29";
069:
070: private static String publicAddress = "";
071:
072: private static String registrarAddress = "";
073:
074: private static int registrarPort = 5060;
075:
076: private static String registrarTransport = "UDP";
077:
078: private static int registrationExpiration = 2000;
079:
080: private static String retransmissionFilter = "";
081:
082: private static String routerPath = "org.jivesoftware.openfire.sip.tester.stack.SipCommRouter";
083:
084: private static String stackName = "SIPark";
085:
086: private static String stackPath = "gov.nist";
087:
088: private static String transport = "";
089:
090: private static String userName = "";
091:
092: private static String videoPort = "20006";
093:
094: private static int waitUnregistration = 1000;
095:
096: private static String stunServer = "";
097:
098: private static String stunPort = "";
099:
100: private static boolean useStun = false;
101:
102: public static String getAudioPort() {
103: return SIPConfig.audioPort;
104: }
105:
106: public static String getAuthenticationRealm() {
107: return SIPConfig.authenticationRealm;
108: }
109:
110: public static String getAuthUserName() {
111: return SIPConfig.authUserName;
112: }
113:
114: public static int getBindRetries() {
115: return SIPConfig.bindRetries;
116: }
117:
118: public static int getDefaultBufferLength() {
119: return SIPConfig.defaultBufferLength;
120: }
121:
122: public static String getDefaultDomain() {
123: return SIPConfig.defaultDomain;
124: }
125:
126: public static String getDisplayName() {
127: return SIPConfig.displayName;
128: }
129:
130: public static String getExcessiveURIChar() {
131: return SIPConfig.excessiveURIChar;
132: }
133:
134: public static String getHttpProxy() {
135: return SIPConfig.httpProxy;
136: }
137:
138: public static String getIPAddress() {
139: return SIPConfig.IPAddress;
140: }
141:
142: public static String getJavaHome() {
143: return SIPConfig.javaHome;
144: }
145:
146: public static int getKeepAliveDelay() {
147: return SIPConfig.keepAliveDelay;
148: }
149:
150: public static int getLocalPort() {
151: return SIPConfig.localPort;
152: }
153:
154: public static String getMediaSource() {
155: return SIPConfig.mediaSource;
156: }
157:
158: public static String getOs() {
159: return SIPConfig.os;
160: }
161:
162: public static String getOutboundProxy() {
163: return SIPConfig.outboundProxy;
164: }
165:
166: public static String getPreferredAudioCodec() {
167: return SIPConfig.preferredAudioCodec;
168: }
169:
170: public static String getPreferredNetworkAddress() {
171: return SIPConfig.preferredNetworkAddress;
172: }
173:
174: public static String getPreferredNetworkInterface() {
175: return SIPConfig.preferredNetworkInterface;
176: }
177:
178: public static String getPreferredVideoCodec() {
179: return SIPConfig.preferredVideoCodec;
180: }
181:
182: public static String getPublicAddress() {
183: return SIPConfig.publicAddress;
184: }
185:
186: public static String getRegistrarAddress() {
187: return SIPConfig.registrarAddress;
188: }
189:
190: public static int getRegistrarPort() {
191: return SIPConfig.registrarPort;
192: }
193:
194: public static String getRegistrarTransport() {
195: return SIPConfig.registrarTransport;
196: }
197:
198: public static int getRegistrationExpiration() {
199: return SIPConfig.registrationExpiration;
200: }
201:
202: public static String getRetransmissionFilter() {
203: return SIPConfig.retransmissionFilter;
204: }
205:
206: public static String getRouterPath() {
207: return SIPConfig.routerPath;
208: }
209:
210: public static String getStackName() {
211: return SIPConfig.stackName;
212: }
213:
214: public static String getStackPath() {
215: return SIPConfig.stackPath;
216: }
217:
218: public static String getTransport() {
219: return SIPConfig.transport;
220: }
221:
222: public static String getUserName() {
223: return SIPConfig.userName;
224: }
225:
226: public static String getVideoPort() {
227: return SIPConfig.videoPort;
228: }
229:
230: public static int getWaitUnregistration() {
231: return SIPConfig.waitUnregistration;
232: }
233:
234: public static boolean isAskPassword() {
235: return SIPConfig.askPassword;
236: }
237:
238: public static boolean isFailCallInUserMismatch() {
239: return SIPConfig.failCallInUserMismatch;
240: }
241:
242: public static boolean isFirstLaunch() {
243: return SIPConfig.firstLaunch;
244: }
245:
246: public static boolean isLoopAlerts() {
247: return SIPConfig.loopAlerts;
248: }
249:
250: public static boolean isPreferIPv4Stack() {
251: return SIPConfig.preferIPv4Stack;
252: }
253:
254: protected static void setAskPassword(boolean askPassword) {
255: SIPConfig.askPassword = askPassword;
256: }
257:
258: protected static void setAudioPort(String audioPort) {
259: SIPConfig.audioPort = audioPort;
260: }
261:
262: protected static void setAuthenticationRealm(
263: String authenticationRealm) {
264: SIPConfig.authenticationRealm = authenticationRealm;
265: }
266:
267: protected static void setAuthUserName(String authUserName) {
268: SIPConfig.authUserName = authUserName;
269: }
270:
271: protected static void setBindRetries(int bindRetries) {
272: SIPConfig.bindRetries = bindRetries;
273: }
274:
275: protected static void setDefaultBufferLength(int defaultBufferLength) {
276: SIPConfig.defaultBufferLength = defaultBufferLength;
277: }
278:
279: protected static void setDefaultDomain(String defaultDomain) {
280: SIPConfig.defaultDomain = defaultDomain;
281: }
282:
283: protected static void setDisplayName(String displayName) {
284: SIPConfig.displayName = displayName;
285: }
286:
287: protected static void setExcessiveURIChar(String excessiveURIChar) {
288: SIPConfig.excessiveURIChar = excessiveURIChar;
289: }
290:
291: protected static void setFailCallInUserMismatch(
292: boolean failCallInUserMismatch) {
293: SIPConfig.failCallInUserMismatch = failCallInUserMismatch;
294: }
295:
296: protected static void setFirstLaunch(boolean firstLaunch) {
297: SIPConfig.firstLaunch = firstLaunch;
298: }
299:
300: protected static void setHttpProxy(String httpProxy) {
301: SIPConfig.httpProxy = httpProxy;
302: }
303:
304: protected static void setIPAddress(String address) {
305: SIPConfig.IPAddress = address;
306: }
307:
308: protected static void setJavaHome(String javaHome) {
309: SIPConfig.javaHome = javaHome;
310: }
311:
312: protected static void setKeepAliveDelay(int keepAliveDelay) {
313: SIPConfig.keepAliveDelay = keepAliveDelay;
314: }
315:
316: protected static void setLocalPort(int localPort) {
317: SIPConfig.localPort = localPort;
318: }
319:
320: protected static void setLoopAlerts(boolean loopAlerts) {
321: SIPConfig.loopAlerts = loopAlerts;
322: }
323:
324: protected static void setMediaSource(String mediaSource) {
325: SIPConfig.mediaSource = mediaSource;
326: }
327:
328: protected static void setOs(String os) {
329: SIPConfig.os = os;
330: }
331:
332: protected static void setOutboundProxy(String outboundProxy) {
333: SIPConfig.outboundProxy = outboundProxy;
334: }
335:
336: protected static void setPreferIPv4Stack(boolean preferIPv4Stack) {
337: SIPConfig.preferIPv4Stack = preferIPv4Stack;
338: }
339:
340: protected static void setPreferredAudioCodec(
341: String preferredAudioCodec) {
342: SIPConfig.preferredAudioCodec = preferredAudioCodec;
343: }
344:
345: public static void setPreferredNetworkAddress(
346: String preferredNetworkAddress) {
347: SIPConfig.preferredNetworkAddress = preferredNetworkAddress;
348: }
349:
350: protected static void setPreferredNetworkInterface(
351: String preferredNetworkInterface) {
352: SIPConfig.preferredNetworkInterface = preferredNetworkInterface;
353: }
354:
355: protected static void setPreferredVideoCodec(
356: String preferredVideoCodec) {
357: SIPConfig.preferredVideoCodec = preferredVideoCodec;
358: }
359:
360: protected static void setPublicAddress(String publicAddress) {
361: SIPConfig.publicAddress = publicAddress;
362: }
363:
364: protected static void setRegistrarAddress(String registrarAddress) {
365: SIPConfig.registrarAddress = registrarAddress;
366: }
367:
368: protected static void setRegistrarPort(int registrarPort) {
369: SIPConfig.registrarPort = registrarPort;
370: }
371:
372: protected static void setRegistrarTransport(
373: String registrarTransport) {
374: SIPConfig.registrarTransport = registrarTransport;
375: }
376:
377: protected static void setRegistrationExpiration(
378: int registrationExpiration) {
379: SIPConfig.registrationExpiration = registrationExpiration;
380: }
381:
382: protected static void setRetransmissionFilter(
383: String retransmissionFilter) {
384: SIPConfig.retransmissionFilter = retransmissionFilter;
385: }
386:
387: protected static void setRouterPath(String routerPath) {
388: SIPConfig.routerPath = routerPath;
389: }
390:
391: public static void setServer(String server) {
392: SIPConfig.defaultDomain = server;
393: SIPConfig.authenticationRealm = server;
394: SIPConfig.registrarAddress = server;
395: SIPConfig.outboundProxy = server + ":"
396: + SIPConfig.registrarPort + "/"
397: + SIPConfig.registrarTransport;
398: SIPConfig.setSystemProperties();
399: }
400:
401: protected static void setStackName(String stackName) {
402: SIPConfig.stackName = stackName;
403: }
404:
405: protected static void setStackPath(String stackPath) {
406: SIPConfig.stackPath = stackPath;
407: }
408:
409: public static void setSystemProperties() {
410:
411: // javax.sip System Properties
412: System.setProperty("javax.sip.IP_ADDRESS", SIPConfig.IPAddress);
413: System.setProperty("javax.sip.STACK_NAME", SIPConfig.stackName);
414: System.setProperty("javax.sip.ROUTER_PATH",
415: SIPConfig.routerPath);
416: System.setProperty("javax.sip.OUTBOUND_PROXY",
417: SIPConfig.outboundProxy);
418: System.setProperty("javax.sip.RETRANSMISSON_FILTER", "");
419: System.setProperty("javax.sip.EXTENSION_METHODS", "");
420: System.setProperty("javax.sip.RETRANSMISSION_FILTER", "true");
421: System.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "0");
422:
423: }
424:
425: protected static void setTransport(String transport) {
426: SIPConfig.transport = transport;
427: }
428:
429: public static void setUserName(String userName) {
430: SIPConfig.userName = userName;
431: }
432:
433: protected static void setVideoPort(String videoPort) {
434: SIPConfig.videoPort = videoPort;
435: }
436:
437: protected static void setWaitUnregistration(int waitUnregistration) {
438: SIPConfig.waitUnregistration = waitUnregistration;
439: }
440:
441: public static String getStunPort() {
442: return SIPConfig.stunPort;
443: }
444:
445: public static void setStunPort(String stunPort) {
446: SIPConfig.stunPort = stunPort;
447: }
448:
449: public static String getStunServer() {
450: return SIPConfig.stunServer;
451: }
452:
453: public static void setStunServer(String stunServer) {
454: SIPConfig.stunServer = stunServer;
455: }
456:
457: public static boolean isUseStun() {
458: return SIPConfig.useStun;
459: }
460:
461: public static void setUseStun(boolean useStun) {
462: SIPConfig.useStun = useStun;
463: }
464:
465: }
|