You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openmeetings.apache.org by co...@google.com on 2013/02/14 17:38:44 UTC
[red5phone] r77 committed - Shutdown hook is added to correctly stop
red5sip; code clean-up;
Revision: 77
Author: solomax666@gmail.com
Date: Thu Feb 14 08:34:08 2013
Log: Shutdown hook is added to correctly stop red5sip; code clean-up;
http://code.google.com/p/red5phone/source/detail?r=77
Modified:
/branches/red5sip/.classpath
/branches/red5sip/log
/branches/red5sip/red5sip
/branches/red5sip/src/java/org/openmeetings/utils/IOUtils.java
/branches/red5sip/src/java/org/openmeetings/utils/PropertiesUtils.java
/branches/red5sip/src/java/org/red5/codecs/SIPCodecAttributes.java
/branches/red5sip/src/java/org/red5/codecs/SIPCodecUtils.java
/branches/red5sip/src/java/org/red5/codecs/SIPCodeciLBC.java
/branches/red5sip/src/java/org/red5/codecs/asao/Codec.java
/branches/red5sip/src/java/org/red5/codecs/g729/Util.java
/branches/red5sip/src/java/org/red5/sip/app/Application.java
/branches/red5sip/src/java/org/red5/sip/app/Main.java
/branches/red5sip/src/java/org/red5/sip/app/PlayNetStream.java
/branches/red5sip/src/java/org/red5/sip/app/RTMPControlClient.java
/branches/red5sip/src/java/org/red5/sip/app/RTMPRoomClient.java
/branches/red5sip/src/java/org/red5/sip/app/RTPStream.java
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamForMultiplex.java
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamMultiplexingSender.java
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamReceiver.java
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamSender.java
/branches/red5sip/src/java/org/red5/sip/app/SIPAudioLauncher.java
/branches/red5sip/src/java/org/red5/sip/app/SIPRegisterAgent.java
/branches/red5sip/src/java/org/red5/sip/app/SIPUserAgent.java
/branches/red5sip/src/java/org/red5/sip/app/SdpUtils.java
/branches/red5sip/src/java/org/zoolu/net/TcpConnection.java
/branches/red5sip/src/java/org/zoolu/net/TcpServer.java
/branches/red5sip/src/java/org/zoolu/net/TcpSocket.java
/branches/red5sip/src/java/org/zoolu/net/UdpSocket.java
/branches/red5sip/src/java/org/zoolu/sdp/AttributeField.java
/branches/red5sip/src/java/org/zoolu/sdp/MediaDescriptor.java
/branches/red5sip/src/java/org/zoolu/sdp/MediaField.java
/branches/red5sip/src/java/org/zoolu/sdp/SdpParser.java
/branches/red5sip/src/java/org/zoolu/sdp/SessionDescriptor.java
/branches/red5sip/src/java/org/zoolu/sdp/SessionNameField.java
/branches/red5sip/src/java/org/zoolu/sip/address/SipURL.java
/branches/red5sip/src/java/org/zoolu/sip/call/Call.java
/branches/red5sip/src/java/org/zoolu/sip/call/CallListener.java
/branches/red5sip/src/java/org/zoolu/sip/call/CallListenerAdapter.java
/branches/red5sip/src/java/org/zoolu/sip/call/ExtendedCall.java
/branches/red5sip/src/java/org/zoolu/sip/call/ExtendedCallListener.java
/branches/red5sip/src/java/org/zoolu/sip/call/SdpTools.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/Dialog.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/DialogInfo.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/ExtendedInviteDialog.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/InviteDialog.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/InviteDialogListener.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/NotifierDialog.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/NotifierDialogListener.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/SubscriberDialog.java
/branches/red5sip/src/java/org/zoolu/sip/dialog/SubscriberDialogListener.java
/branches/red5sip/src/java/org/zoolu/sip/header/AuthenticationHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/AuthenticationInfoHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/ContactHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/EndPointHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/EventHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/ExpiresHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/FromHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/ListHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/MultipleHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/NameAddressHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/ParametricHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/ReferToHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/ReferredByHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/RequestLine.java
/branches/red5sip/src/java/org/zoolu/sip/header/SipDateHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/SubjectHeader.java
/branches/red5sip/src/java/org/zoolu/sip/header/ToHeader.java
/branches/red5sip/src/java/org/zoolu/sip/message/BaseMessage.java
/branches/red5sip/src/java/org/zoolu/sip/message/BaseMessageFactory.java
/branches/red5sip/src/java/org/zoolu/sip/message/BaseMessageOtp.java
/branches/red5sip/src/java/org/zoolu/sip/message/Message.java
/branches/red5sip/src/java/org/zoolu/sip/message/MessageFactory.java
/branches/red5sip/src/java/org/zoolu/sip/provider/ConnectedTransport.java
/branches/red5sip/src/java/org/zoolu/sip/provider/DialogIdentifier.java
/branches/red5sip/src/java/org/zoolu/sip/provider/SipParser.java
/branches/red5sip/src/java/org/zoolu/sip/provider/SipPromisqueInterface.java
/branches/red5sip/src/java/org/zoolu/sip/provider/SipProvider.java
/branches/red5sip/src/java/org/zoolu/sip/provider/SipStack.java
/branches/red5sip/src/java/org/zoolu/sip/provider/SpcHashtable.java
/branches/red5sip/src/java/org/zoolu/sip/provider/TcpTransport.java
/branches/red5sip/src/java/org/zoolu/sip/provider/TransactionIdentifier.java
/branches/red5sip/src/java/org/zoolu/sip/provider/Transport.java
/branches/red5sip/src/java/org/zoolu/sip/provider/UdpTransport.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/AckTransactionClient.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/AckTransactionServer.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/AckTransactionServerListener.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/InviteTransactionClient.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/InviteTransactionServer.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/Transaction.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/TransactionClient.java
/branches/red5sip/src/java/org/zoolu/sip/transaction/TransactionServer.java
/branches/red5sip/src/java/org/zoolu/tools/Archive.java
/branches/red5sip/src/java/org/zoolu/tools/Configure.java
/branches/red5sip/src/java/org/zoolu/tools/DateFormat.java
/branches/red5sip/src/java/org/zoolu/tools/Log.java
/branches/red5sip/src/java/org/zoolu/tools/MD5OTP.java
/branches/red5sip/src/java/org/zoolu/tools/Mangle.java
/branches/red5sip/src/java/org/zoolu/tools/Parser.java
/branches/red5sip/src/java/org/zoolu/tools/RotatingLog.java
/branches/red5sip/src/java/org/zoolu/tools/Timer.java
=======================================
--- /branches/red5sip/.classpath Fri Feb 10 07:37:46 2012
+++ /branches/red5sip/.classpath Thu Feb 14 08:34:08 2013
@@ -5,7 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/MjSIP"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/red5"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/log"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/apache-commons" />
+ <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/apache-commons"/>
<classpathentry exported="true" kind="lib"
path="lib/commons-beanutils-1.8.2.jar">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
@@ -21,6 +21,7 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
+ <classpathentry kind="lib" path="lib/libresample4j-1.0.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/openmeetings"/>
<classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/springframwork"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/red5sip"/>
@@ -70,5 +71,5 @@
<classpathentry kind="lib" path="lib/slf4j-api-1.6.4.jar"/>
<classpathentry kind="lib" path="lib/ua.jar"/>
<classpathentry kind="lib" path="lib/xmlrpc-2.0.1.jar"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="out/eclipse"/>
</classpath>
=======================================
--- /branches/red5sip/red5sip Tue Feb 12 02:46:43 2013
+++ /branches/red5sip/red5sip Thu Feb 14 08:34:08 2013
@@ -27,29 +27,21 @@
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name java
rm -f $PIDFILE
}
-
-d_stop() {
- start-stop-daemon --stop --quiet --pidfile $PIDFILE --name java
- rm -f $PIDFILE
-}
case "$1" in
start)
echo -n "Starting $DESC: $NAME\n"
d_start
-# echo ".\n"
;;
stop)
echo -n "Stopping $DESC: $NAME\n"
d_stop
-# echo ".\n"
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME\n"
d_stop
sleep 1
d_start
-# echo ".\n"
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
=======================================
--- /branches/red5sip/src/java/org/openmeetings/utils/IOUtils.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/openmeetings/utils/IOUtils.java Thu Feb
14 08:34:08 2013
@@ -1,12 +1,12 @@
package org.openmeetings.utils;
-import org.apache.commons.io.FileUtils;
-import org.slf4j.Logger;
-
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+
/**
* IO related utility classes
*/
=======================================
--- /branches/red5sip/src/java/org/openmeetings/utils/PropertiesUtils.java
Fri Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/openmeetings/utils/PropertiesUtils.java
Thu Feb 14 08:34:08 2013
@@ -1,16 +1,21 @@
package org.openmeetings.utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.openmeetings.utils.IOUtils.close;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Pattern;
-import static org.openmeetings.utils.IOUtils.close;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A wrapper for java.util.Properties class
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/SIPCodecAttributes.java Fri
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/SIPCodecAttributes.java Thu
Feb 14 08:34:08 2013
@@ -100,7 +100,7 @@
toStringRet += "Encode attributes:\n";
}
- for ( Enumeration keysEnum = codecEncodeAttributes.keys();
keysEnum.hasMoreElements(); ) {
+ for ( Enumeration<String> keysEnum = codecEncodeAttributes.keys();
keysEnum.hasMoreElements(); ) {
String attributeName = (String) keysEnum.nextElement();
toStringRet += "\t" + attributeName + "=" +
codecEncodeAttributes.get( attributeName );
@@ -116,7 +116,7 @@
toStringRet += "Decode attributes:\n";
}
- for ( Enumeration keysEnum = codecDecodeAttributes.keys();
keysEnum.hasMoreElements(); ) {
+ for ( Enumeration<String> keysEnum = codecDecodeAttributes.keys();
keysEnum.hasMoreElements(); ) {
String attributeName = (String) keysEnum.nextElement();
toStringRet += "\t" + attributeName + "=" +
codecDecodeAttributes.get( attributeName );
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/SIPCodecUtils.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/SIPCodecUtils.java Thu Feb
14 08:34:08 2013
@@ -1,8 +1,5 @@
package org.red5.codecs;
-import java.util.Enumeration;
-import java.util.Vector;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zoolu.sdp.AttributeField;
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/SIPCodeciLBC.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/SIPCodeciLBC.java Thu Feb 14
08:34:08 2013
@@ -1,10 +1,10 @@
package org.red5.codecs;
-import org.red5.codecs.ilbc.ilbc_decoder;
-import org.red5.codecs.ilbc.ilbc_encoder;
import org.red5.codecs.ilbc.bitstream;
import org.red5.codecs.ilbc.ilbc_constants;
+import org.red5.codecs.ilbc.ilbc_decoder;
+import org.red5.codecs.ilbc.ilbc_encoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/asao/Codec.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/asao/Codec.java Thu Feb 14
08:34:08 2013
@@ -149,7 +149,7 @@
int k3 = process( af5, 124, 198, ai );
- for ( int i4 = 0; i4 < 256; i4 += 128 ) {
+ for ( int i4 = 0; i4 < 256; /* FIXME DEAD CODE i4 += 128 */ ) {
for ( int l4 = 0; l4 < 124; l4++ ) {
int k5 = ai[ l4 ];
if ( k5 > 0 ) {
=======================================
--- /branches/red5sip/src/java/org/red5/codecs/g729/Util.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/codecs/g729/Util.java Thu Feb 14
08:34:08 2013
@@ -1,7 +1,7 @@
package org.red5.codecs.g729;
//package org.mobicents.media.server.impl.dsp.audio.g729;
import java.io.IOException;
-import java.io.OutputStream;;
+import java.io.OutputStream;
public class Util {
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/Application.java Wed Feb 13
14:57:45 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/Application.java Thu Feb 14
08:34:08 2013
@@ -1,5 +1,10 @@
package org.red5.sip.app;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
import org.openmeetings.utils.PropertiesUtils;
@@ -7,9 +12,6 @@
import org.slf4j.LoggerFactory;
import org.zoolu.sip.address.NameAddress;
-import java.io.File;
-import java.util.*;
-
public class Application implements Daemon {
private static final Logger log =
LoggerFactory.getLogger(Application.class);
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/Main.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/sip/app/Main.java Thu Feb 14
08:34:08 2013
@@ -1,14 +1,28 @@
package org.red5.sip.app;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class Main {
+ private static final Logger log = LoggerFactory.getLogger(Main.class);
- public static void main(String[] args) {
- Application main = new Application();
- main.init(args);
- try {
- main.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
+ public static void main(String[] args) {
+ final Application main = new Application();
+ main.init(args);
+ try {
+ main.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ public void run() {
+ log.warn("!!! Shutdown hook !!!");
+ try {
+ main.stop();
+ } catch (Exception e) {
+ log.error("Unexpected exception while shutting down", e);
+ }
+ }
+ }));
+ }
}
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/PlayNetStream.java Wed Feb
6 09:31:44 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/PlayNetStream.java Thu Feb
14 08:34:08 2013
@@ -11,9 +11,6 @@
import org.red5.server.stream.AbstractClientStream;
import org.red5.server.stream.IStreamData;
import org.slf4j.Logger;
-import org.zoolu.tools.Random;
-
-import java.util.concurrent.atomic.AtomicLong;
public class PlayNetStream extends AbstractClientStream implements
IEventDispatcher {
@@ -73,7 +70,7 @@
} else if (rtmpEvent instanceof AudioData) {
audioTs = rtmpEvent.getTimestamp();
- IoBuffer audioData = ((IStreamData)
rtmpEvent).getData().asReadOnlyBuffer();
+ IoBuffer audioData = ((AudioData)
rtmpEvent).getData().asReadOnlyBuffer();
byte[] data = SerializeUtils.ByteBufferToByteArray(audioData);
try {
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTMPControlClient.java Tue
Jan 29 03:52:07 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTMPControlClient.java Thu
Feb 14 08:34:08 2013
@@ -1,5 +1,9 @@
package org.red5.sip.app;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
import org.apache.mina.core.RuntimeIoException;
import org.red5.server.api.service.IPendingServiceCall;
import org.red5.server.api.service.IPendingServiceCallback;
@@ -10,8 +14,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.*;
-
public abstract class RTMPControlClient extends RTMPClient implements
ClientExceptionHandler, IPendingServiceCallback{
private static final Logger log =
LoggerFactory.getLogger(RTMPControlClient.class);
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTMPRoomClient.java Sun Feb
10 12:42:20 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTMPRoomClient.java Thu Feb
14 08:34:08 2013
@@ -1,5 +1,13 @@
package org.red5.sip.app;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.mina.core.RuntimeIoException;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.openmeetings.persistence.beans.room.Client;
@@ -10,7 +18,12 @@
import org.red5.server.api.service.IPendingServiceCallback;
import org.red5.server.api.service.IServiceCall;
import org.red5.server.api.service.IServiceInvoker;
-import org.red5.server.net.rtmp.*;
+import org.red5.server.net.rtmp.BaseRTMPClientHandler;
+import org.red5.server.net.rtmp.Channel;
+import org.red5.server.net.rtmp.ClientExceptionHandler;
+import org.red5.server.net.rtmp.INetStreamEventHandler;
+import org.red5.server.net.rtmp.RTMPClient;
+import org.red5.server.net.rtmp.RTMPConnection;
import org.red5.server.net.rtmp.codec.RTMP;
import org.red5.server.net.rtmp.event.AudioData;
import org.red5.server.net.rtmp.event.Notify;
@@ -21,10 +34,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.*;
-
public class RTMPRoomClient extends RTMPClient implements
INetStreamEventHandler, ClientExceptionHandler, IPendingServiceCallback,
IMediaReceiver {
private static final Logger log =
LoggerFactory.getLogger(RTMPRoomClient.class);
@@ -407,6 +416,8 @@
log.error("getSipNumber invalid result: " +
call.getResult());
}
break;
+ default:
+ break;
}
}
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStream.java Wed Feb 6
09:31:44 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStream.java Thu Feb 14
08:34:08 2013
@@ -1,6 +1,7 @@
package org.red5.sip.app;
import local.net.RtpPacket;
+
import org.red5.codecs.asao.ByteStream;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStreamForMultiplex.java
Sun Feb 10 12:42:20 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStreamForMultiplex.java
Thu Feb 14 08:34:08 2013
@@ -1,11 +1,11 @@
package org.red5.sip.app;
+import static
org.red5.sip.app.RTPStreamMultiplexingSender.NELLYMOSER_ENCODED_PACKET_SIZE;
+
import org.red5.codecs.asao.DecoderMap;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
-import static
org.red5.sip.app.RTPStreamMultiplexingSender.NELLYMOSER_ENCODED_PACKET_SIZE;
-
public class RTPStreamForMultiplex implements IMediaStream {
protected static Logger log =
Red5LoggerFactory.getLogger(RTPStreamForMultiplex.class, "sip");
=======================================
---
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamMultiplexingSender.java
Sun Feb 10 12:42:20 2013
+++
/branches/red5sip/src/java/org/red5/sip/app/RTPStreamMultiplexingSender.java
Thu Feb 14 08:34:08 2013
@@ -1,8 +1,13 @@
package org.red5.sip.app;
-import com.laszlosystems.libresample4j.Resampler;
+import java.lang.ref.WeakReference;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.util.Iterator;
+
import local.net.RtpPacket;
import local.net.RtpSocket;
+
import org.apache.mina.util.ConcurrentHashSet;
import org.red5.codecs.SIPCodec;
import org.red5.codecs.asao.ByteStream;
@@ -11,10 +16,7 @@
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
-import java.lang.ref.WeakReference;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.util.*;
+import com.laszlosystems.libresample4j.Resampler;
public class RTPStreamMultiplexingSender implements IMediaSender, Runnable
{
protected static Logger log =
Red5LoggerFactory.getLogger(RTPStreamMultiplexingSender.class, "sip");
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStreamReceiver.java Tue
Jan 29 03:52:07 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStreamReceiver.java Thu
Feb 14 08:34:08 2013
@@ -1,15 +1,14 @@
package org.red5.sip.app;
+import java.net.DatagramSocket;
+
import local.net.RtpPacket;
import local.net.RtpSocket;
+
import org.red5.codecs.SIPCodec;
import org.red5.logging.Red5LoggerFactory;
-import org.red5.server.net.rtmp.codec.RTMPProtocolDecoder;
import org.slf4j.Logger;
-import java.net.DatagramSocket;
-import java.util.Arrays;
-
public class RTPStreamReceiver extends Thread {
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/RTPStreamSender.java Wed
Feb 6 09:31:44 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/RTPStreamSender.java Thu
Feb 14 08:34:08 2013
@@ -1,20 +1,19 @@
package org.red5.sip.app;
+import java.net.DatagramSocket;
+import java.net.InetAddress;
+import java.util.concurrent.atomic.AtomicLong;
+
import local.net.RtpPacket;
import local.net.RtpSocket;
+
import org.red5.codecs.SIPCodec;
-import org.red5.codecs.asao.ByteStream;
import org.red5.codecs.asao.Decoder;
import org.red5.codecs.asao.DecoderMap;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.zoolu.tools.Random;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
public class RTPStreamSender implements IMediaSender {
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SIPAudioLauncher.java Wed
Feb 6 09:31:44 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/SIPAudioLauncher.java Thu
Feb 14 08:34:08 2013
@@ -1,13 +1,14 @@
package org.red5.sip.app;
+import java.net.DatagramSocket;
+
import local.ua.MediaLauncher;
+
import org.red5.codecs.SIPCodec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.net.DatagramSocket;
-
public class SIPAudioLauncher implements MediaLauncher {
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SIPRegisterAgent.java Fri
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/sip/app/SIPRegisterAgent.java Thu
Feb 14 08:34:08 2013
@@ -1,12 +1,24 @@
package org.red5.sip.app;
+import java.util.Vector;
+import java.util.logging.Logger;
+
import local.net.KeepAliveSip;
+
import org.zoolu.net.SocketAddress;
import org.zoolu.sip.address.NameAddress;
import org.zoolu.sip.address.SipURL;
import org.zoolu.sip.authentication.DigestAuthentication;
-import org.zoolu.sip.header.*;
+import org.zoolu.sip.header.AuthorizationHeader;
+import org.zoolu.sip.header.CSeqHeader;
+import org.zoolu.sip.header.CallIdHeader;
+import org.zoolu.sip.header.ContactHeader;
+import org.zoolu.sip.header.ExpiresHeader;
+import org.zoolu.sip.header.Header;
+import org.zoolu.sip.header.StatusLine;
+import org.zoolu.sip.header.ViaHeader;
+import org.zoolu.sip.header.WwwAuthenticateHeader;
import org.zoolu.sip.message.Message;
import org.zoolu.sip.message.MessageFactory;
import org.zoolu.sip.message.SipMethods;
@@ -15,9 +27,6 @@
import org.zoolu.sip.transaction.TransactionClient;
import org.zoolu.sip.transaction.TransactionClientListener;
-import java.util.Vector;
-import java.util.logging.Logger;
-
/** Register User Agent.
* It registers (one time or periodically) a contact address with a
registrar server.
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SIPUserAgent.java Tue Jan
29 03:52:07 2013
+++ /branches/red5sip/src/java/org/red5/sip/app/SIPUserAgent.java Thu Feb
14 08:34:08 2013
@@ -1,8 +1,12 @@
package org.red5.sip.app;
+import java.util.Enumeration;
+import java.util.Vector;
+
import local.media.AudioClipPlayer;
import local.ua.MediaLauncher;
+
import org.red5.codecs.SIPCodec;
import org.red5.codecs.SIPCodecUtils;
import org.slf4j.Logger;
@@ -19,9 +23,6 @@
import org.zoolu.sip.provider.SipProvider;
import org.zoolu.tools.Parser;
-import java.util.Enumeration;
-import java.util.Vector;
-
//import java.util.Iterator;
@@ -407,8 +408,8 @@
int localVideoPort = 0;
// parse local sdp
- for ( Enumeration e = localSdp.getMediaDescriptors().elements();
e.hasMoreElements(); ) {
- MediaField media = ( (MediaDescriptor) e.nextElement()
).getMedia();
+ for ( Enumeration<MediaDescriptor> e =
localSdp.getMediaDescriptors().elements(); e.hasMoreElements(); ) {
+ MediaField media = e.nextElement().getMedia();
if ( media.getMedia().equals( "audio" ) ) {
localAudioPort = media.getPort();
}
@@ -431,9 +432,9 @@
int remoteAudioPort = 0;
int remoteVideoPort = 0;
- for ( Enumeration e = remoteSdp.getMediaDescriptors().elements();
e.hasMoreElements(); ) {
+ for ( Enumeration<MediaDescriptor> e =
remoteSdp.getMediaDescriptors().elements(); e.hasMoreElements(); ) {
- MediaDescriptor descriptor = (MediaDescriptor) e.nextElement();
+ MediaDescriptor descriptor = e.nextElement();
MediaField media = descriptor.getMedia();
if ( media.getMedia().equals( "audio" ) ) {
@@ -768,7 +769,7 @@
/** Callback function called when arriving a 3xx (call redirection) */
- public void onCallRedirection( Call call, String reason, Vector
contact_list, Message resp ) {
+ public void onCallRedirection( Call call, String reason,
Vector<String> contact_list, Message resp ) {
printLog( "onCallRedirection", "Init..." );
=======================================
--- /branches/red5sip/src/java/org/red5/sip/app/SdpUtils.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/red5/sip/app/SdpUtils.java Thu Feb 14
08:34:08 2013
@@ -1,5 +1,8 @@
package org.red5.sip.app;
+import java.util.Enumeration;
+import java.util.Vector;
+
import org.red5.codecs.SIPCodec;
import org.red5.codecs.SIPCodecFactory;
import org.slf4j.Logger;
@@ -9,9 +12,6 @@
import org.zoolu.sdp.MediaField;
import org.zoolu.sdp.SessionDescriptor;
-import java.util.Enumeration;
-import java.util.Vector;
-
public class SdpUtils {
protected static Logger log = LoggerFactory.getLogger( SdpUtils.class
);
@@ -96,18 +96,10 @@
initialDescriptor = new SessionDescriptor( userName,
viaAddress );
- if ( initialDescriptor == null ) {
-
- printLog( "createInitialSdp",
- "Error instantiating the initialDescriptor!" );
-
- return null;
- }
-
if ( audioCodecsNumber > 0 ) {
SIPCodec[] audioCodecs;
- Vector audioAttributes = new Vector();
+ Vector<AttributeField> audioAttributes = new
Vector<AttributeField>();
if ( audioCodecsPrecedence.isEmpty() ) {
@@ -167,9 +159,9 @@
// Calculate the format list to be used on MediaDescriptor
creation.
String formatList = getFormatList( audioAttributes );
- for ( Enumeration attributesEnum =
audioAttributes.elements(); attributesEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> attributesEnum =
audioAttributes.elements(); attributesEnum.hasMoreElements(); ) {
- AttributeField audioAttribute = (AttributeField)
attributesEnum.nextElement();
+ AttributeField audioAttribute =
attributesEnum.nextElement();
if ( initialDescriptor.getMediaDescriptor(
SIPCodec.MEDIA_TYPE_AUDIO ) == null ) {
@@ -223,7 +215,7 @@
if ( videoCodecsNumber > 0 ) {
SIPCodec[] videoCodecs =
SIPCodecFactory.getInstance().getAvailableVideoCodecs();
- Vector videoAttributes = new Vector();
+ Vector<AttributeField> videoAttributes = new
Vector<AttributeField>();
for ( int videoIndex = 0; videoIndex < audioCodecsNumber;
videoIndex++ ) {
@@ -272,9 +264,9 @@
// Calculate the format list to be used on MediaDescriptor
creation.
String formatList = getFormatList( videoAttributes );
- for ( Enumeration attributesEnum =
videoAttributes.elements(); attributesEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> attributesEnum =
videoAttributes.elements(); attributesEnum.hasMoreElements(); ) {
- AttributeField videoAttribute = (AttributeField)
attributesEnum.nextElement();
+ AttributeField videoAttribute =
attributesEnum.nextElement();
if ( initialDescriptor.getMediaDescriptor(
SIPCodec.MEDIA_TYPE_VIDEO ) == null ) {
@@ -331,14 +323,14 @@
}
- private static String getFormatList( Vector mediaAttributes ) {
+ private static String getFormatList( Vector<AttributeField>
mediaAttributes ) {
AttributeField mediaAttribute = null;
String formatList = "";
printLog( "getFormatList", "Init..." );
- for ( Enumeration attributeEnum = mediaAttributes.elements();
attributeEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> attributeEnum =
mediaAttributes.elements(); attributeEnum.hasMoreElements(); ) {
mediaAttribute = (AttributeField) attributeEnum.nextElement();
@@ -412,9 +404,9 @@
newSdp = new SessionDescriptor( remoteSdp.getOrigin(),
remoteSdp.getSessionName(),
localSdp.getConnection(), localSdp.getTime() );
- Vector remoteDescriptors = remoteSdp.getMediaDescriptors();
+ Vector<MediaDescriptor> remoteDescriptors =
remoteSdp.getMediaDescriptors();
- for ( Enumeration descriptorsEnum =
remoteDescriptors.elements(); descriptorsEnum.hasMoreElements(); ) {
+ for ( Enumeration<MediaDescriptor> descriptorsEnum =
remoteDescriptors.elements(); descriptorsEnum.hasMoreElements(); ) {
MediaDescriptor remoteDescriptor = (MediaDescriptor)
descriptorsEnum.nextElement();
MediaDescriptor localDescriptor =
localSdp.getMediaDescriptor(
@@ -422,12 +414,12 @@
if ( localDescriptor != null ) {
- Vector remoteAttributes =
remoteDescriptor.getAttributes( SIPCodec.ATTRIBUTE_RTPMAP );
- Vector newSdpAttributes = new Vector();
+ Vector<AttributeField> remoteAttributes =
remoteDescriptor.getAttributes( SIPCodec.ATTRIBUTE_RTPMAP );
+ Vector<AttributeField> newSdpAttributes = new
Vector<AttributeField>();
- for ( Enumeration attributesEnum =
remoteAttributes.elements(); attributesEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> attributesEnum =
remoteAttributes.elements(); attributesEnum.hasMoreElements(); ) {
- AttributeField remoteAttribute = (AttributeField)
attributesEnum.nextElement();
+ AttributeField remoteAttribute =
attributesEnum.nextElement();
String payloadId = getPayloadIdFromAttribute(
remoteAttribute );
@@ -449,9 +441,9 @@
// Calculate the format list to be used on
MediaDescriptor creation.
String formatList = getFormatList( newSdpAttributes );
- for ( Enumeration attributesEnum =
newSdpAttributes.elements(); attributesEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> attributesEnum =
newSdpAttributes.elements(); attributesEnum.hasMoreElements(); ) {
- AttributeField mediaAttribute = (AttributeField)
attributesEnum.nextElement();
+ AttributeField mediaAttribute =
attributesEnum.nextElement();
if ( newSdp.getMediaDescriptors().size() == 0 ) {
@@ -512,11 +504,11 @@
return;
}
- Vector remoteDescriptors = remoteSdp.getMediaDescriptors();
+ Vector<MediaDescriptor> remoteDescriptors =
remoteSdp.getMediaDescriptors();
- for ( Enumeration descriptorsEnum =
remoteDescriptors.elements(); descriptorsEnum.hasMoreElements(); ) {
+ for ( Enumeration<MediaDescriptor> descriptorsEnum =
remoteDescriptors.elements(); descriptorsEnum.hasMoreElements(); ) {
- MediaDescriptor remoteDescriptor = (MediaDescriptor)
descriptorsEnum.nextElement();
+ MediaDescriptor remoteDescriptor =
descriptorsEnum.nextElement();
MediaDescriptor localDescriptor =
localSdp.getMediaDescriptor(
remoteDescriptor.getMedia().getMedia() );
@@ -525,11 +517,11 @@
// First we make the negotiation of remote attributes
with
// local ones to generate the new SDP "newSdp".
- Vector remoteAttributes =
remoteDescriptor.getAttributes();
+ Vector<AttributeField> remoteAttributes =
remoteDescriptor.getAttributes();
- for ( Enumeration atributesEnum =
remoteAttributes.elements(); atributesEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> atributesEnum =
remoteAttributes.elements(); atributesEnum.hasMoreElements(); ) {
- AttributeField remoteAttribute = (AttributeField)
atributesEnum.nextElement();
+ AttributeField remoteAttribute =
atributesEnum.nextElement();
makeAttributeNegotiation( newSdp, localDescriptor,
remoteAttribute );
}
@@ -537,9 +529,9 @@
// Now we add to "newSdp" all the local attributes that
// were not negotiated yet.
- Vector localAttributes =
localDescriptor.getAttributes();
+ Vector<AttributeField> localAttributes =
localDescriptor.getAttributes();
- for ( Enumeration atributesEnum =
localAttributes.elements(); atributesEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> atributesEnum =
localAttributes.elements(); atributesEnum.hasMoreElements(); ) {
AttributeField localAttribute = (AttributeField)
atributesEnum.nextElement();
MediaDescriptor newLocalDescriptor =
@@ -688,9 +680,9 @@
"attributeName = [" + attributeName +
"], payloadId = [" + payloadId + "]." );
- Vector mediaAttributes = mediaDescriptor.getAttributes(
attributeName );
+ Vector<AttributeField> mediaAttributes =
mediaDescriptor.getAttributes( attributeName );
- for ( Enumeration attributesEnum = mediaAttributes.elements();
attributesEnum.hasMoreElements(); ) {
+ for ( Enumeration<AttributeField> attributesEnum =
mediaAttributes.elements(); attributesEnum.hasMoreElements(); ) {
AttributeField mediaAttribute = (AttributeField)
attributesEnum.nextElement();
=======================================
--- /branches/red5sip/src/java/org/zoolu/net/TcpConnection.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/net/TcpConnection.java Thu Feb 14
08:34:08 2013
@@ -25,7 +25,12 @@
//import java.net.InetAddress;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.io.OutputStream;
/** TcpConnection provides a TCP connection oriented transport service.
=======================================
--- /branches/red5sip/src/java/org/zoolu/net/TcpServer.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/net/TcpServer.java Thu Feb 14
08:34:08 2013
@@ -24,8 +24,8 @@
package org.zoolu.net;
-import java.net.ServerSocket;
import java.io.InterruptedIOException;
+import java.net.ServerSocket;
=======================================
--- /branches/red5sip/src/java/org/zoolu/net/TcpSocket.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/net/TcpSocket.java Thu Feb 14
08:34:08 2013
@@ -24,10 +24,10 @@
package org.zoolu.net;
-import java.net.Socket;
-//import java.net.InetAddress;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.Socket;
+//import java.net.InetAddress;
/** TcpSocket provides a uniform interface to TCP transport protocol,
=======================================
--- /branches/red5sip/src/java/org/zoolu/net/UdpSocket.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/net/UdpSocket.java Thu Feb 14
08:34:08 2013
@@ -24,9 +24,8 @@
package org.zoolu.net;
+import java.net.DatagramPacket;
import java.net.DatagramSocket;
-import java.net.DatagramPacket;
-import java.net.InetAddress;
/** UdpSocket provides a uniform interface to UDP transport protocol,
=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/AttributeField.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sdp/AttributeField.java Thu Feb 14
08:34:08 2013
@@ -24,7 +24,6 @@
package org.zoolu.sdp;
-import org.zoolu.tools.Parser;
/** SDP attribute field.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/MediaDescriptor.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sdp/MediaDescriptor.java Thu Feb
14 08:34:08 2013
@@ -43,15 +43,15 @@
/** Connection field ('c') */
ConnectionField c;
/** Vector of attribute fileds ('a') */
- Vector av;
+ Vector<AttributeField> av;
/** Creates a new MediaDescriptor.
* @param md the cloned MediaDescriptor */
public MediaDescriptor(MediaDescriptor md)
{ m=new MediaField(md.m);
if (md.c!=null) c=new ConnectionField(md.c); else c=null;
- av=new Vector();
- for (int i=0; i<md.av.size(); i++) av.addElement(new
AttributeField((AttributeField)md.av.elementAt(i)));
+ av=new Vector<AttributeField>();
+ for (int i=0; i<md.av.size(); i++) av.addElement(new
AttributeField(md.av.get(i)));
}
/** Creates a new MediaDescriptor with m <i>media</i> and c
<i>connection</i>.
@@ -62,7 +62,7 @@
public MediaDescriptor(MediaField media, ConnectionField connection)
{ m=media;
c=connection;
- av=new Vector();
+ av=new Vector<AttributeField>();
}
/** Creates a new MediaDescriptor with m <i>media</i>, c
<i>connection</i>,
@@ -74,7 +74,7 @@
public MediaDescriptor(MediaField media, ConnectionField connection,
AttributeField attribute)
{ m=media;
c=connection;
- av=new Vector();
+ av=new Vector<AttributeField>();
if (attribute!=null) av.addElement(attribute);
}
@@ -84,10 +84,10 @@
* @param connection the ConnectionField, or null if no ConnectionField
* is present in the MediaDescriptor
* @param attributes the Vector of AttributeField */
- public MediaDescriptor(MediaField media, ConnectionField connection,
Vector attributes)
+ public MediaDescriptor(MediaField media, ConnectionField connection,
Vector<AttributeField> attributes)
{ m=media;
c=connection;
- av=new Vector(attributes.size());
+ av=new Vector<AttributeField>(attributes.size());
av.setSize(attributes.size());
for (int i=0; i<attributes.size(); i++)
av.setElementAt((AttributeField)attributes.elementAt(i),i);
@@ -102,7 +102,7 @@
public MediaDescriptor(String media, String connection, String
attribute)
{ m=new MediaField(media);
if (connection!=null) c=new ConnectionField(connection);
- av=new Vector();
+ av=new Vector<AttributeField>();
if (attribute!=null) av.addElement(new AttributeField(attribute));
}
@@ -134,10 +134,10 @@
/** Gets a Vector of attribute values.
* @return a Vector of AttributeField */
- public Vector getAttributes()
- { Vector v=new Vector(av.size());
+ public Vector<AttributeField> getAttributes()
+ { Vector<AttributeField> v=new Vector<AttributeField>(av.size());
for (int i=0; i<av.size(); i++)
- v.addElement((AttributeField)av.elementAt(i));
+ v.add(av.get(i));
return v;
}
@@ -173,11 +173,11 @@
/** Gets a Vector of attribute values of a particular attribute name.
* @param a_name the attribute name
* @return a Vector of AttributeFields */
- public Vector getAttributes(String a_name)
- { Vector v=new Vector(av.size());
+ public Vector<AttributeField> getAttributes(String a_name)
+ { Vector<AttributeField> v=new Vector<AttributeField>(av.size());
for (int i=0; i<av.size(); i++)
- { AttributeField a=(AttributeField)av.elementAt(i);
- if (a.getAttributeName().equals(a_name)) v.addElement(a);
+ { AttributeField a=av.get(i);
+ if (a.getAttributeName().equals(a_name)) v.add(a);
}
return v;
}
=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/MediaField.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sdp/MediaField.java Thu Feb 14
08:34:08 2013
@@ -24,8 +24,9 @@
package org.zoolu.sdp;
+import java.util.Vector;
+
import org.zoolu.tools.Parser;
-import java.util.Vector;
/** SDP media field.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/SdpParser.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sdp/SdpParser.java Thu Feb 14
08:34:08 2013
@@ -24,10 +24,10 @@
package org.zoolu.sdp;
-import org.zoolu.sdp.*;
-import org.zoolu.tools.Parser;
import java.util.Vector;
+import org.zoolu.tools.Parser;
+
/** Class SdpParser extends class Parser for parsing of SDP strings.
*/
=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/SessionDescriptor.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sdp/SessionDescriptor.java Thu Feb
14 08:34:08 2013
@@ -25,12 +25,9 @@
import java.util.Vector;
-import java.util.Enumeration;
//PersonalJava
//import java.util.HashSet;
//import java.util.Iterator;
-import org.zoolu.tools.HashSet;
-import org.zoolu.tools.Iterator;
/** Class SessionDescriptor handles SIP message bodys formatted according
to
@@ -62,10 +59,10 @@
TimeField t;
/** Vector of session attributes (as Vector of SdpFields). */
- Vector av;
+ Vector<AttributeField> av;
/** Vector of MediaDescriptors. */
- Vector media;
+ Vector<MediaDescriptor> media;
/*private void init(String owner, String session, String connection,
String time)
{ v=new SdpField('v',"0");
@@ -83,8 +80,8 @@
s=session;
c=connection;
t=time;
- av=new Vector();
- media=new Vector();
+ av=new Vector<AttributeField>();
+ media=new Vector<MediaDescriptor>();
}
/** Creates a new SessionDescriptor.
@@ -159,13 +156,13 @@
par.goToNextLine();
}
// parse session attributes
- av=new Vector();
+ av=new Vector<AttributeField>();
while (par.hasMore() && par.startsWith("a="))
{ AttributeField attribute=par.parseAttributeField();
av.addElement(attribute);
}
// parse media descriptors
- media=new Vector();
+ media=new Vector<MediaDescriptor>();
MediaDescriptor md;
while ((md=par.parseMediaDescriptor())!=null)
{ addMediaDescriptor(md);
@@ -240,7 +237,7 @@
* @param media the MediaField
* @param attributes Vector of AttributeField
* @return this SessionDescriptor */
- public SessionDescriptor addMedia(MediaField media, Vector attributes)
+ public SessionDescriptor addMedia(MediaField media,
Vector<AttributeField> attributes)
{ //printlog("DEBUG: media: "+media,5);
//printlog("DEBUG: attribute: "+attributes,5);
addMediaDescriptor(new MediaDescriptor(media,null,attributes));
@@ -259,14 +256,14 @@
/** Adds a Vector of MediaDescriptors
* @param media_descs Vector if MediaDescriptor
* @return this SessionDescriptor */
- public SessionDescriptor addMediaDescriptors(Vector media_descs)
+ public SessionDescriptor addMediaDescriptors(Vector<MediaDescriptor>
media_descs)
{ //media.addAll(media_descs); // not supported by J2ME..
for (int i=0; i<media_descs.size(); i++)
media.addElement(media_descs.elementAt(i));
return this;
}
/** Gets all MediaDescriptors */
- public Vector getMediaDescriptors()
+ public Vector<MediaDescriptor> getMediaDescriptors()
{ return media;
}
@@ -299,8 +296,8 @@
/** Adds a Vector of session attributes.
* @param attribute_fields Vector of AttributeFields
* @return this SessionDescriptor */
- public SessionDescriptor addAttributes(Vector attribute_fields)
- { for (int i=0; i<attribute_fields.size(); i++)
addAttribute((AttributeField)attribute_fields.elementAt(i));
+ public SessionDescriptor addAttributes(Vector<AttributeField>
attribute_fields)
+ { for (int i=0; i<attribute_fields.size(); i++)
addAttribute(attribute_fields.get(i));
return this;
}
@@ -320,10 +317,10 @@
/** Gets a Vector of attribute values.
* @return a Vector of AttributeField */
- public Vector getAttributes()
- { Vector v=new Vector(av.size());
+ public Vector<AttributeField> getAttributes()
+ { Vector<AttributeField> v=new Vector<AttributeField>(av.size());
for (int i=0; i<av.size(); i++)
- v.addElement((AttributeField)av.elementAt(i));
+ v.add(av.get(i));
return v;
}
@@ -351,11 +348,11 @@
/** Gets a Vector of attribute values of a particular attribute name.
* @param a_name the attribute name
* @return a Vector of AttributeField */
- public Vector getAttributes(String attribute_name)
- { Vector v=new Vector(av.size());
+ public Vector<AttributeField> getAttributes(String attribute_name)
+ { Vector<AttributeField> v=new Vector<AttributeField>(av.size());
for (int i=0; i<av.size(); i++)
- { AttributeField a=(AttributeField)av.elementAt(i);
- if (a.getAttributeName().equals(attribute_name)) v.addElement(a);
+ { AttributeField a=av.get(i);
+ if (a.getAttributeName().equals(attribute_name)) v.add(a);
}
return v;
}
=======================================
--- /branches/red5sip/src/java/org/zoolu/sdp/SessionNameField.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sdp/SessionNameField.java Thu Feb
14 08:34:08 2013
@@ -24,7 +24,6 @@
package org.zoolu.sdp;
-import org.zoolu.tools.Parser;
/** SDP session name field.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/address/SipURL.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/address/SipURL.java Thu Feb 14
08:34:08 2013
@@ -24,9 +24,10 @@
package org.zoolu.sip.address;
+import java.util.Vector;
+
import org.zoolu.sip.provider.SipParser;
import org.zoolu.tools.Parser;
-import java.util.Vector;
/**
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/call/Call.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/call/Call.java Thu Feb 14
08:34:08 2013
@@ -24,15 +24,16 @@
package org.zoolu.sip.call;
-import org.zoolu.sip.dialog.*;
-import org.zoolu.sip.provider.*;
-import org.zoolu.sip.message.*;
import org.zoolu.sip.address.NameAddress;
+import org.zoolu.sip.dialog.InviteDialog;
+import org.zoolu.sip.dialog.InviteDialogListener;
import org.zoolu.sip.header.MultipleHeader;
+import org.zoolu.sip.message.Message;
+import org.zoolu.sip.message.SipResponses;
+import org.zoolu.sip.provider.SipProvider;
+import org.zoolu.sip.provider.SipStack;
import org.zoolu.tools.Log;
import org.zoolu.tools.LogLevel;
-import org.zoolu.sdp.*;
-import java.util.Vector;
/** Class Call implements SIP calls.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/call/CallListener.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/call/CallListener.java Thu Feb
14 08:34:08 2013
@@ -23,11 +23,11 @@
package org.zoolu.sip.call;
-import org.zoolu.sip.message.*;
-import org.zoolu.sip.address.NameAddress;
-import org.zoolu.sdp.*;
import java.util.Vector;
+import org.zoolu.sip.address.NameAddress;
+import org.zoolu.sip.message.Message;
+
/** Interface CallListener can be implemented to manage SIP calls
(sipx.call.Call).
* <p> Objects of class Call use CallListener callback methods to signal
@@ -51,7 +51,7 @@
public void onCallRefused(Call call, String reason, Message resp);
/** Callback function called when arriving a 3xx (call redirection) */
- public void onCallRedirection(Call call, String reason, Vector
contact_list, Message resp);
+ public void onCallRedirection(Call call, String reason, Vector<String>
contact_list, Message resp);
/** Callback function called when arriving an ACK method (call
confirmed) */
public void onCallConfirmed(Call call, String sdp, Message ack);
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/call/CallListenerAdapter.java
Fri Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/call/CallListenerAdapter.java
Thu Feb 14 08:34:08 2013
@@ -24,16 +24,12 @@
package org.zoolu.sip.call;
-import org.zoolu.sip.call.*;
-import org.zoolu.sip.provider.SipStack;
+import java.util.Vector;
+
+import org.zoolu.sdp.SessionDescriptor;
import org.zoolu.sip.address.NameAddress;
import org.zoolu.sip.message.Message;
-import org.zoolu.tools.Log;
-import org.zoolu.tools.LogLevel;
-import org.zoolu.sdp.*;
//import java.util.Iterator;
-import java.util.Enumeration;
-import java.util.Vector;
/** Class CallListenerAdapter implements CallListener interface
@@ -134,7 +130,7 @@
/** Redirects the call when remotly requested.
* Callback function called when arriving a 3xx (call redirection) */
- public void onCallRedirection(Call call, String reason, Vector
contact_list, Message resp)
+ public void onCallRedirection(Call call, String reason, Vector<String>
contact_list, Message resp)
{ //printLog("REDIRECTION ("+reason+")");
call.call((String)contact_list.elementAt(0));
}
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/call/ExtendedCall.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/call/ExtendedCall.java Thu Feb
14 08:34:08 2013
@@ -24,18 +24,15 @@
package org.zoolu.sip.call;
-import org.zoolu.sip.call.*;
-import org.zoolu.sip.provider.*;
-import org.zoolu.sip.message.*;
-//import org.zoolu.sip.dialog.*;
-import org.zoolu.sip.header.StatusLine;
import org.zoolu.sip.address.NameAddress;
import org.zoolu.sip.dialog.ExtendedInviteDialog;
import org.zoolu.sip.dialog.ExtendedInviteDialogListener;
-import org.zoolu.tools.Log;
+import org.zoolu.sip.header.StatusLine;
+import org.zoolu.sip.message.Message;
+import org.zoolu.sip.provider.SipProvider;
+import org.zoolu.sip.provider.SipStack;
import org.zoolu.tools.LogLevel;
-import org.zoolu.sdp.*;
-import java.util.Vector;
+//import org.zoolu.sip.dialog.*;
/** Class ExtendedCall extends basic SIP calls.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/call/ExtendedCallListener.java
Fri Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/call/ExtendedCallListener.java
Thu Feb 14 08:34:08 2013
@@ -23,11 +23,8 @@
package org.zoolu.sip.call;
-import org.zoolu.sip.call.*;
-import org.zoolu.sip.message.*;
import org.zoolu.sip.address.NameAddress;
-import org.zoolu.sdp.*;
-import java.util.Vector;
+import org.zoolu.sip.message.Message;
/** Interface ExtendedCallListener can be implemented to manage exteded
SIP calls (sipx.call.ExtendedCall).
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/call/SdpTools.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/call/SdpTools.java Thu Feb 14
08:34:08 2013
@@ -24,10 +24,13 @@
package org.zoolu.sip.call;
-import org.zoolu.sdp.*;
import java.util.Enumeration;
import java.util.Vector;
+import org.zoolu.sdp.AttributeField;
+import org.zoolu.sdp.MediaDescriptor;
+import org.zoolu.sdp.SessionDescriptor;
+
/** Class SdpTools collects some static methods for managing SDP materials.
*/
@@ -40,28 +43,28 @@
* @param sdp the given SessionDescriptor
* @param m_descs Vector of MediaDescriptor with the selecting media
types and attributes
* @return this SessionDescriptor */
- public static SessionDescriptor sdpMediaProduct(SessionDescriptor sdp,
Vector m_descs)
- { Vector new_media=new Vector();
+ public static SessionDescriptor sdpMediaProduct(SessionDescriptor sdp,
Vector<MediaDescriptor> m_descs)
+ { Vector<MediaDescriptor> new_media=new Vector<MediaDescriptor>();
if (m_descs!=null)
- { for (Enumeration e=m_descs.elements(); e.hasMoreElements(); )
- { MediaDescriptor spec_md=(MediaDescriptor)e.nextElement();
+ { for (Enumeration<MediaDescriptor> e=m_descs.elements();
e.hasMoreElements(); )
+ { MediaDescriptor spec_md=e.nextElement();
//System.out.print("DEBUG: SDP:
sdp_select: "+spec_md.toString());
MediaDescriptor
prev_md=sdp.getMediaDescriptor(spec_md.getMedia().getMedia());
//System.out.print("DEBUG: SDP:
sdp_origin: "+prev_md.toString());
if (prev_md!=null)
- { Vector spec_attributes=spec_md.getAttributes();
- Vector prev_attributes=prev_md.getAttributes();
+ { Vector<AttributeField>
spec_attributes=spec_md.getAttributes();
+ Vector<AttributeField>
prev_attributes=prev_md.getAttributes();
if (spec_attributes.size()==0 || prev_attributes.size()==0)
{ new_media.addElement(prev_md);
}
else
- { Vector new_attributes=new Vector();
- for (Enumeration i=spec_attributes.elements();
i.hasMoreElements(); )
- { AttributeField
spec_attr=(AttributeField)i.nextElement();
+ { Vector<AttributeField> new_attributes=new
Vector<AttributeField>();
+ for (Enumeration<AttributeField>
i=spec_attributes.elements(); i.hasMoreElements(); )
+ { AttributeField spec_attr=i.nextElement();
String spec_name=spec_attr.getAttributeName();
String spec_value=spec_attr.getAttributeValue();
- for (Enumeration k=prev_attributes.elements();
k.hasMoreElements(); )
- { AttributeField
prev_attr=(AttributeField)k.nextElement();
+ for (Enumeration<AttributeField>
k=prev_attributes.elements(); k.hasMoreElements(); )
+ { AttributeField prev_attr=k.nextElement();
String prev_name=prev_attr.getAttributeName();
String prev_value=prev_attr.getAttributeValue();
if (prev_name.equals(spec_name) &&
prev_value.equalsIgnoreCase(spec_value))
@@ -89,9 +92,9 @@
* @param a_name the attribute name
* @return this SessionDescriptor */
public static SessionDescriptor sdpAttirbuteSelection(SessionDescriptor
sdp, String a_name)
- { Vector new_media=new Vector();
- for (Enumeration e=sdp.getMediaDescriptors().elements();
e.hasMoreElements(); )
- { MediaDescriptor md=(MediaDescriptor)e.nextElement();
+ { Vector<MediaDescriptor> new_media=new Vector<MediaDescriptor>();
+ for (Enumeration<MediaDescriptor>
e=sdp.getMediaDescriptors().elements(); e.hasMoreElements(); )
+ { MediaDescriptor md=e.nextElement();
AttributeField attr=md.getAttribute(a_name);
if (attr!=null)
{ new_media.addElement(new
MediaDescriptor(md.getMedia(),md.getConnection(),attr));
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/dialog/Dialog.java Fri Feb 10
07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/dialog/Dialog.java Thu Feb 14
08:34:08 2013
@@ -24,16 +24,19 @@
package org.zoolu.sip.dialog;
-import org.zoolu.sip.address.*;
-import org.zoolu.sip.message.*;
-import org.zoolu.sip.header.*;
-import org.zoolu.sip.provider.*;
+import java.util.Vector;
+
+import org.zoolu.sip.header.FromHeader;
+import org.zoolu.sip.header.Header;
+import org.zoolu.sip.header.RecordRouteHeader;
+import org.zoolu.sip.header.ToHeader;
+import org.zoolu.sip.message.Message;
+import org.zoolu.sip.provider.DialogIdentifier;
+import org.zoolu.sip.provider.SipProvider;
+import org.zoolu.sip.provider.SipProviderListener;
+import org.zoolu.sip.provider.SipStack;
import org.zoolu.tools.Log;
import org.zoolu.tools.LogLevel;
-import org.zoolu.tools.AssertException;
-
-
-import java.util.Vector;
/** Class Dialog maintains a complete information status of a generic SIP
dialog.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/dialog/DialogInfo.java Fri Feb
10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/dialog/DialogInfo.java Thu Feb
14 08:34:08 2013
@@ -24,16 +24,9 @@
package org.zoolu.sip.dialog;
-import org.zoolu.sip.address.*;
-import org.zoolu.sip.message.*;
-import org.zoolu.sip.header.*;
-import org.zoolu.sip.provider.*;
-import org.zoolu.tools.Log;
-import org.zoolu.tools.LogLevel;
-import org.zoolu.tools.AssertException;
-
+import java.util.Vector;
-import java.util.Vector;
+import org.zoolu.sip.address.NameAddress;
/** Class DialogInfo maintains a complete information status of a generic
SIP dialog.
=======================================
---
/branches/red5sip/src/java/org/zoolu/sip/dialog/ExtendedInviteDialog.java
Fri Feb 10 07:37:46 2012
+++
/branches/red5sip/src/java/org/zoolu/sip/dialog/ExtendedInviteDialog.java
Thu Feb 14 08:34:08 2013
@@ -24,21 +24,27 @@
package org.zoolu.sip.dialog;
-import org.zoolu.sip.provider.*;
+import java.util.Hashtable;
+
import org.zoolu.sip.address.NameAddress;
-import org.zoolu.sip.header.StatusLine;
+import org.zoolu.sip.authentication.DigestAuthentication;
+import org.zoolu.sip.header.AuthorizationHeader;
import org.zoolu.sip.header.RequestLine;
+import org.zoolu.sip.header.StatusLine;
import org.zoolu.sip.header.ViaHeader;
-import org.zoolu.sip.header.AuthorizationHeader;
import org.zoolu.sip.header.WwwAuthenticateHeader;
-import org.zoolu.sip.header.ProxyAuthenticateHeader;
-import org.zoolu.sip.transaction.*;
-import org.zoolu.sip.message.*;
-import org.zoolu.sip.authentication.DigestAuthentication;
+import org.zoolu.sip.message.Message;
+import org.zoolu.sip.message.MessageFactory;
+import org.zoolu.sip.message.SipMethods;
+import org.zoolu.sip.message.SipResponses;
+import org.zoolu.sip.provider.SipProvider;
+import org.zoolu.sip.provider.SipStack;
+import org.zoolu.sip.provider.TransactionIdentifier;
+import org.zoolu.sip.transaction.AckTransactionClient;
+import org.zoolu.sip.transaction.TransactionClient;
+import org.zoolu.sip.transaction.TransactionServer;
import org.zoolu.tools.LogLevel;
-import java.util.Hashtable;
-
/** Class ExtendedInviteDialog can be used to manage extended invite
dialogs.
* <p>
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/dialog/InviteDialog.java Fri
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/dialog/InviteDialog.java Thu
Feb 14 08:34:08 2013
@@ -24,11 +24,27 @@
package org.zoolu.sip.dialog;
-import org.zoolu.sip.address.*;
-import org.zoolu.sip.transaction.*;
-import org.zoolu.sip.message.*;
-import org.zoolu.sip.header.*;
-import org.zoolu.sip.provider.*;
+import org.zoolu.sip.address.NameAddress;
+import org.zoolu.sip.address.SipURL;
+import org.zoolu.sip.header.ContactHeader;
+import org.zoolu.sip.header.StatusLine;
+import org.zoolu.sip.message.Message;
+import org.zoolu.sip.message.MessageFactory;
+import org.zoolu.sip.message.SipMethods;
+import org.zoolu.sip.message.SipResponses;
+import org.zoolu.sip.provider.ConnectionIdentifier;
+import org.zoolu.sip.provider.SipProvider;
+import org.zoolu.sip.provider.SipProviderListener;
+import org.zoolu.sip.provider.SipStack;
+import org.zoolu.sip.transaction.AckTransactionClient;
+import org.zoolu.sip.transaction.AckTransactionServer;
+import org.zoolu.sip.transaction.AckTransactionServerListener;
+import org.zoolu.sip.transaction.InviteTransactionClient;
+import org.zoolu.sip.transaction.InviteTransactionServer;
+import org.zoolu.sip.transaction.InviteTransactionServerListener;
+import org.zoolu.sip.transaction.TransactionClient;
+import org.zoolu.sip.transaction.TransactionClientListener;
+import org.zoolu.sip.transaction.TransactionServer;
import org.zoolu.tools.LogLevel;
=======================================
---
/branches/red5sip/src/java/org/zoolu/sip/dialog/InviteDialogListener.java
Fri Feb 10 07:37:46 2012
+++
/branches/red5sip/src/java/org/zoolu/sip/dialog/InviteDialogListener.java
Thu Feb 14 08:34:08 2013
@@ -25,8 +25,8 @@
import org.zoolu.sip.address.NameAddress;
-import org.zoolu.sip.message.Message;
import org.zoolu.sip.header.MultipleHeader;
+import org.zoolu.sip.message.Message;
/** An InviteDialogListener listens for InviteDialog events.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/dialog/NotifierDialog.java Fri
Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/dialog/NotifierDialog.java Thu
Feb 14 08:34:08 2013
@@ -28,17 +28,23 @@
package org.zoolu.sip.dialog;
-import org.zoolu.sip.address.*;
-import org.zoolu.sip.transaction.*;
-import org.zoolu.sip.dialog.*;
-import org.zoolu.sip.message.*;
-import org.zoolu.sip.header.*;
-import org.zoolu.sip.header.*;
-import org.zoolu.sip.provider.*;
+import org.zoolu.sip.address.NameAddress;
+import org.zoolu.sip.header.EventHeader;
+import org.zoolu.sip.header.ExpiresHeader;
+import org.zoolu.sip.header.StatusLine;
+import org.zoolu.sip.header.SubscriptionStateHeader;
+import org.zoolu.sip.message.Message;
+import org.zoolu.sip.message.MessageFactory;
+import org.zoolu.sip.message.SipMethods;
+import org.zoolu.sip.message.SipResponses;
+import org.zoolu.sip.provider.MethodIdentifier;
+import org.zoolu.sip.provider.SipProvider;
+import org.zoolu.sip.provider.SipStack;
+import org.zoolu.sip.transaction.TransactionClient;
+import org.zoolu.sip.transaction.TransactionClientListener;
+import org.zoolu.sip.transaction.TransactionServer;
import org.zoolu.tools.LogLevel;
-import java.util.Date;
-
/** NotifierDialog.
*/
=======================================
---
/branches/red5sip/src/java/org/zoolu/sip/dialog/NotifierDialogListener.java
Fri Feb 10 07:37:46 2012
+++
/branches/red5sip/src/java/org/zoolu/sip/dialog/NotifierDialogListener.java
Thu Feb 14 08:34:08 2013
@@ -24,9 +24,8 @@
package org.zoolu.sip.dialog;
+import org.zoolu.sip.address.NameAddress;
import org.zoolu.sip.message.Message;
-import org.zoolu.sip.address.SipURL;
-import org.zoolu.sip.address.NameAddress;
/** A NotifierDialogListener listens for NotifierDialog events.
=======================================
--- /branches/red5sip/src/java/org/zoolu/sip/dialog/SubscriberDialog.java
Fri Feb 10 07:37:46 2012
+++ /branches/red5sip/src/java/org/zoolu/sip/dialog/SubscriberDialog.java
Thu Feb 14 08:34:08 2013
@@ -28,16 +28,21 @@
package org.zoolu.sip.dialog;
-import org.zoolu.sip.address.*;
-import org.zoolu.sip.transaction.*;
-import org.zoolu.sip.dialog.*;
-import org.zoolu.sip.message.*;
-import org.zoolu.sip.header.*;
-import org.zoolu.sip.provider.*;
+import org.zoolu.sip.address.NameAddress;
+import org.zoolu.sip.address.SipURL;
+import org.zoolu.sip.header.AcceptHeader;
+import org.zoolu.sip.header.ExpiresHeader;
+import org.zoolu.sip.header.StatusLine;
+import org.zoolu.sip.message.Message;
+import org.zoolu.sip.message.MessageFactory;
+import org.zoolu.sip.message.SipResponses;
+import org.zoolu.sip.provider.SipProvider;
+import org.zoolu.sip.provider.SipStack;
+import org.zoolu.sip.transaction.TransactionClient;
+import org.zoolu.sip.transaction.TransactionClientListener;
+import org.zoolu.sip.transaction.TransactionServer;
import org.zoolu.tools.LogLevel;
-import java.util.Date;
-
/** SubscriberDialog.
*/
=======================================
---
/branches/red5sip/src/java/org/zoolu/sip/dialog/SubscriberDialogListener.java
Fri Feb 10 07:37:46 2012
+++
/branches/red5sip/src/java/org/zoolu/sip/dialog/SubscriberDialogListener.java
Thu Feb 14 08:34:08 2013
@@ -24,8 +24,8 @@
package org.zoolu.sip.dialog;
-import org.zoolu.sip.message.Message;
import org.zoolu.sip.address.NameAddress;
+import org.zoolu.sip.message.Message;
/** A SubscriberDialogListener listens for SubscriberDialog events.
=======================================
***Additional files exist in this changeset.***