### Eclipse Workspace Patch 1.0
#P Spark
Index: src/plugins/sip/src/java/net/java/sipmack/sip/InterlocutorUI.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/InterlocutorUI.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/InterlocutorUI.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 import net.java.sipmack.softphone.gui.GuiCallback;
Index: src/plugins/sip/src/java/net/java/sipmack/common/AlertManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/common/AlertManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/common/AlertManager.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
@@ -25,7 +25,7 @@
  */
 
 public class AlertManager {
-    private Hashtable alertClips = new Hashtable();
+    private Hashtable<String, AudioClip> alertClips = new Hashtable<String, AudioClip>();
 
     public AlertManager() {
     }
@@ -45,9 +45,9 @@
     }
 
     public void stopAllAlerts() {
-        Enumeration alertClipsEnum = alertClips.keys();
+        Enumeration<String> alertClipsEnum = alertClips.keys();
         while (alertClipsEnum.hasMoreElements()) {
-            String alert = (String) alertClipsEnum.nextElement();
+            String alert = alertClipsEnum.nextElement();
             stopAlert(alert);
         }
     }
Index: src/plugins/sip/src/java/net/java/sipmack/common/Scheduler.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/common/Scheduler.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/common/Scheduler.java	(working copy)
@@ -1,61 +1,14 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
 
+
 package net.java.sipmack.common;
 
 import net.java.sipmack.common.scheduler.Timer;
@@ -63,24 +16,6 @@
 
 import java.util.Date;
 
-/**
- * <p/>
- * Title: SIP Communicator
- * </p>
- * <p/>
- * Description: A SIP UA
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2004
- * </p>
- * <p/>
- * Company: Network Research Team, Louis Pasteur University
- * </p>
- *
- * @author Emil Ivov
- * @version 1.0
- */
-
 public class Scheduler {
 
     private static Scheduler singleton = null;
Index: src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreference.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreference.java	(revision 0)
+++ src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreference.java	(revision 0)
@@ -0,0 +1,82 @@
+package org.jivesoftware.sparkimpl.preference.media;
+
+import javax.swing.Icon;
+import javax.swing.JComponent;
+
+import org.jivesoftware.resource.Res;
+import org.jivesoftware.resource.SparkRes;
+import org.jivesoftware.spark.preference.Preference;
+import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
+import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
+
+public class MediaPreference implements Preference {
+
+	private MediaPreferencePanel panel = new MediaPreferencePanel();
+	public static final String NAMESPACE = "http://www.jivesoftware.org/spark/media";
+	
+	@Override
+	public Object getData() {
+		return null;
+	}
+
+	@Override
+	public String getErrorMessage() {
+		return null;
+	}
+
+	@Override
+	public JComponent getGUI() {
+		return panel;
+	}
+
+	@Override
+	public Icon getIcon() {
+		return SparkRes.getImageIcon(SparkRes.HEADSET_IMAGE);
+	}
+
+	@Override
+	public String getListName() {
+		return Res.getString("title.general.media");
+	}
+
+	@Override
+	public String getNamespace() {
+		return NAMESPACE;
+	}
+
+	@Override
+	public String getTitle() {
+		return Res.getString("title.general.media");
+	}
+
+	@Override
+	public String getTooltip() {
+		return Res.getString("title.general.media");
+	}
+
+	@Override
+	public boolean isDataValid() {
+		return true;
+	}
+
+	@Override
+	public void load() {
+		 LocalPreferences localPreferences = SettingsManager.getLocalPreferences();
+		 panel.setVideoDevice(localPreferences.getVideoDevice());
+		 panel.setAudioDevice(localPreferences.getAudioDevice());
+	}
+
+	@Override
+	public void commit() {
+		LocalPreferences pref = SettingsManager.getLocalPreferences();
+		pref.setAudioDevice(panel.getAudioDevice());
+		pref.setVideoDevice(panel.getVideoDevice());
+		SettingsManager.saveSettings();
+	}
+	
+	@Override
+	public void shutdown() {
+		commit();
+	}
+
+}
Index: src/plugins/sip/src/java/net/java/sipmack/softphone/gui/GuiManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/softphone/gui/GuiManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/softphone/gui/GuiManager.java	(working copy)
@@ -10,16 +10,16 @@
 
 package net.java.sipmack.softphone.gui;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import net.java.sipmack.common.AlertManager;
 import net.java.sipmack.common.Log;
-import net.java.sipmack.events.UserActionListener;
 import net.java.sipmack.sip.Call;
 import net.java.sipmack.sip.Interlocutor;
 import net.java.sipmack.sip.InterlocutorUI;
 import net.java.sipmack.softphone.listeners.InterlocutorListener;
-
-import java.util.ArrayList;
-import java.util.List;
+import net.java.sipmack.events.UserActionListener;
 
 /**
  * The <code>GuiManager</code> class that Manage all the actions and Events of
@@ -288,7 +288,6 @@
             Log.debug("hangup", "No interlocutors");
             return false;
         }
-        int selectedRow = 0;
         Interlocutor inter;
         for (int i = 0; i < interlocutors.size(); i++) {
             inter = (Interlocutor) interlocutors.get(i);
Index: src/plugins/sip/src/java/net/java/sipmack/media/event/MediaErrorEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/event/MediaErrorEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/event/MediaErrorEvent.java	(working copy)
@@ -1,86 +1,20 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.media.event;
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR-1.1
- * </p>
- * <p/>
- * Description: JAIN-SIP-1.1 Audio/Video Phone Application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company: Organisation: LSIIT Laboratory (http://lsiit.u-strasbg.fr) \nNetwork
- * Research Team (http://www-r2.u-strasbg.fr))\nLouis Pasteur University -
- * Strasbourg - France
- * </p>
- *
- * @author Emil Ivov
- * @version 1.1
- */
 public class MediaErrorEvent extends EventObject {
-    public MediaErrorEvent(Throwable source) {
+	private static final long serialVersionUID = -223468673281672684L;
+
+	public MediaErrorEvent(Throwable source) {
         super(source);
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/Interlocutor.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/Interlocutor.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/Interlocutor.java	(working copy)
@@ -2,12 +2,11 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 import net.java.sipmack.common.Log;
Index: src/plugins/sip/src/java/net/java/sipmack/media/MediaException.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/MediaException.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/MediaException.java	(working copy)
@@ -1,88 +1,18 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.media;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR-1.1
- * </p>
- * <p/>
- * Description: JAIN-SIP-1.1 Audio/Video Phone Application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company: Organisation: LSIIT Laboratory (http://lsiit.u-strasbg.fr)
- * <p/>
- * </p>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * <p/>
- * </p>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov
- * @version 1.1
- */
 public class MediaException extends Exception {
-    public MediaException(String message) {
+	private static final long serialVersionUID = 8803493468468690847L;
+
+	public MediaException(String message) {
         super(message);
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/common/DialSoundManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/common/DialSoundManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/common/DialSoundManager.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
Index: src/plugins/sip/src/java/net/java/sipmack/media/JmfMediaManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/JmfMediaManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/JmfMediaManager.java	(working copy)
@@ -10,26 +10,37 @@
 
 package net.java.sipmack.media;
 
-import org.jivesoftware.sparkimpl.plugin.phone.JMFInit;
-import org.jivesoftware.Spark;
-
-import javax.sdp.*;
-import javax.media.format.AudioFormat;
-import javax.media.format.VideoFormat;
 import java.io.File;
 import java.io.IOException;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.List;
 import java.util.Vector;
-import java.util.Hashtable;
-import java.net.InetSocketAddress;
-import java.net.InetAddress;
-import java.net.Inet6Address;
+
+import javax.media.format.AudioFormat;
+import javax.media.format.VideoFormat;
+import javax.sdp.Connection;
+import javax.sdp.Media;
+import javax.sdp.MediaDescription;
+import javax.sdp.Origin;
+import javax.sdp.SdpException;
+import javax.sdp.SdpFactory;
+import javax.sdp.SdpParseException;
+import javax.sdp.SessionDescription;
+import javax.sdp.SessionName;
+import javax.sdp.TimeDescription;
+import javax.sdp.Version;
 
 import net.java.sipmack.common.Log;
+import net.java.sipmack.sip.Call;
 import net.java.sipmack.sip.NetworkAddressManager;
 import net.java.sipmack.sip.SIPConfig;
-import net.java.sipmack.sip.Call;
+
+import org.jivesoftware.sparkimpl.plugin.phone.JMFInit;
+import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
 
 /**
  * JmfMediaManager using JMF based API.
@@ -41,6 +52,7 @@
 public class JmfMediaManager {
 
     private List<AudioFormat> audioFormats = new ArrayList<AudioFormat>();
+    private List<VideoFormat> videoFormats = new ArrayList<VideoFormat>();
     protected SdpFactory sdpFactory = SdpFactory.getInstance();
 
     /**
@@ -48,6 +60,7 @@
      */
     public JmfMediaManager() {
         setupAudioFormats();
+        setupVideoFormats();
     }
 
     /**
@@ -58,12 +71,8 @@
      * @param local
      * @return
      */
-    public AudioMediaSession createMediaSession(final AudioFormat audioFormat, final TransportCandidate remote, final TransportCandidate local) {
-        String locator = "javasound://";
-        if (Spark.isWindows()) {
-            locator = "dsound://";
-        }
-        return new AudioMediaSession(audioFormat, remote, local, locator);
+    public AudioMediaSession createMediaSession(final AudioFormat audioFormat, final TransportCandidate remote, final TransportCandidate local) {    	
+        return new AudioMediaSession(audioFormat, remote, local, SettingsManager.getLocalPreferences().getAudioDevice());
     }
 
     /**
@@ -73,9 +82,18 @@
         audioFormats.add(new AudioFormat(AudioFormat.GSM_RTP));
         audioFormats.add(new AudioFormat(AudioFormat.G723_RTP));
         audioFormats.add(new AudioFormat(AudioFormat.ULAW_RTP));
+        audioFormats.add(new AudioFormat(AudioFormat.ALAW));
     }
 
     /**
+     * Setup API supported VideoFormats
+     */
+    private void setupVideoFormats() {
+    	videoFormats.add(new VideoFormat(VideoFormat.H261_RTP));
+    	videoFormats.add(new VideoFormat(VideoFormat.H263_RTP));
+    }
+    
+    /**
      * Return all supported Payloads for this Manager
      *
      * @return The Payload List
@@ -83,7 +101,179 @@
     public List<AudioFormat> getAudioFormats() {
         return audioFormats;
     }
+    
+    /**
+     * Return all supported Payloads for this Manager
+     *
+     * @return The Payload List
+     */
+    public List<VideoFormat> getVideoFormats() {
+        return videoFormats;
+    }
+
+    /**
+     * Creates a new VideoMedia Session for a given sdpData
+     *
+     * @param sdpData
+     * @return
+     * @throws MediaException
+     */
+    public VideoMediaSession createVideoMediaSession(String sdpData, int localPort) throws MediaException {
+        SessionDescription sessionDescription = null;
+        if (sdpData == null) {
+            throw new MediaException("The SDP data was null! Cannot open "
+                    + "a stream withour an SDP Description!");
+        }
+        try {
+            sessionDescription = sdpFactory
+                    .createSessionDescription(sdpData);
+
+        }
+        catch (SdpParseException ex) {
+
+            throw new MediaException("Incorrect SDP data!", ex);
+        }
+        Vector mediaDescriptions;
+        try {
+            mediaDescriptions = sessionDescription
+                    .getMediaDescriptions(true);
+        }
+        catch (SdpException ex) {
+            throw new MediaException(
+                    "Failed to extract media descriptions from provided session description!",
+                    ex);
+        }
+        Connection sessionConnection = sessionDescription.getConnection();
+        String sessionRemoteAddress = null;
+        if (sessionConnection != null) {
+            try {
+                sessionRemoteAddress = sessionConnection.getAddress();
+            }
+            catch (SdpParseException ex) {
+                throw new MediaException(
+                        "Failed to extract the connection address parameter"
+                                + "from privided session description", ex);
+            }
+        }
+        int mediaPort = -1;
+        boolean atLeastOneTransmitterStarted = false;
+        ArrayList mediaTypes = new ArrayList();
+        ArrayList<String> remoteAddresses = new ArrayList<String>();
+        // A hashtable that indicates what addresses are different media
+        // types
+        // coming from.
+        Hashtable<String, String> remoteTransmisionDetails = new Hashtable<String, String>();
+        // by default everything is supposed to be coming from the address
+        // specified in the session (global) connection parameter so store
+        // this address for now.
+        if (sessionRemoteAddress != null) {
+            remoteTransmisionDetails.put("audio", sessionRemoteAddress);
+            remoteTransmisionDetails.put("video", sessionRemoteAddress);
+        }
+        ArrayList<Integer> ports = new ArrayList<Integer>();
+        ArrayList formatSets = new ArrayList();
+        ArrayList<String> contents = new ArrayList<String>();
+        ArrayList<Integer> localPorts = new ArrayList<Integer>();
+        for (int i = 0; i < mediaDescriptions.size(); i++) {
+            MediaDescription mediaDescription = (MediaDescription) mediaDescriptions
+                    .get(i);
+            Media media = mediaDescription.getMedia();
+            // Media Type
+            String mediaType = null;
+            try {
+                mediaType = media.getMediaType();
+            }
+            catch (SdpParseException ex) {
+                continue;
+            }
+            // Find ports
+            try {
+                mediaPort = media.getMediaPort();
+            }
+            catch (SdpParseException ex) {
+                throw (new MediaException(
+                        "Failed to extract port for media type ["
+                                + mediaType + "]. Ignoring description!",
+                        ex));
+            }
+            // Find formats
+            Vector sdpFormats = null;
+            try {
+                sdpFormats = media.getMediaFormats(true);
+            }
+            catch (SdpParseException ex) {
+                throw (new MediaException(
+                        "Failed to extract media formats for media type ["
+                                + mediaType + "]. Ignoring description!",
+                        ex));
+
+            }
+
+            Connection mediaConnection = mediaDescription.getConnection();
+            String mediaRemoteAddress = null;
+            if (mediaConnection == null) {
+                if (sessionConnection == null) {
+                    throw new MediaException(
+                            "A connection parameter was not present in provided session/media description");
+                } else {
+                    mediaRemoteAddress = sessionRemoteAddress;
+                }
+            } else {
+                try {
+                    mediaRemoteAddress = mediaConnection.getAddress();
+                }
+                catch (SdpParseException ex) {
+                    throw new MediaException(
+                            "Failed to extract the connection address parameter"
+                                    + "from privided media description", ex);
+                }
+            }
+
+            // update the remote address for the current media type in case
+            // it is specific for this media (i.e. differs from the main
+            // connection address)
+            remoteTransmisionDetails.put(mediaType, mediaRemoteAddress);
+            // START TRANSMISSION
+            try {
+                remoteAddresses.add(mediaRemoteAddress);
+                ports.add(new Integer(mediaPort));
+                contents.add(mediaType);
+
+                // Selecting local ports for NAT
+
+                if (mediaType.trim().equals("video"))
+                    localPorts.add(Integer.valueOf(22444));
+                else if (mediaType.trim().equals("audio"))
+                    localPorts.add(Integer.valueOf(localPort));
+                else
+                    localPorts.add(Integer.valueOf(mediaPort));
+
+                formatSets.add(extractTransmittableJmfFormats(sdpFormats));
+            }
+            catch (MediaException ex) {
+                Log.error("StartMedia", ex);
+                throw (new MediaException(
+                        "Could not start a transmitter for media type ["
+                                + mediaType + "]\nIgnoring media ["
+                                + mediaType + "]!", ex));
+            }
+            atLeastOneTransmitterStarted = true;
+        }
+        if (atLeastOneTransmitterStarted) {
+
+            TransportCandidate.Fixed remote = new TransportCandidate.Fixed(remoteAddresses.get(0).toString(), (Integer) ports.get(0));
+            TransportCandidate.Fixed local = new TransportCandidate.Fixed(NetworkAddressManager.getLocalHost().getHostAddress(), localPort);
 
+            // TODO : FORCED TO JPEG_RTP -> deteced format
+            // VideoFormat videoFormat = new VideoFormat((String) (((ArrayList) formatSets.get(0)).get(0)));
+            VideoFormat videoFormat = new VideoFormat(VideoFormat.JPEG_RTP);         
+            VideoMediaSession videoMediaSession = new VideoMediaSession(videoFormat, remote, local, SettingsManager.getLocalPreferences().getVideoDevice());;
+
+            return videoMediaSession;
+        }
+        return null;
+    }
+    
     /**
      * Creates a new AudioMedia Session for a given sdpData
      *
@@ -92,10 +282,6 @@
      * @throws MediaException
      */
     public AudioMediaSession createAudioMediaSession(String sdpData, int localPort) throws MediaException {
-        String locator = "javasound://";
-        if (Spark.isWindows()) {
-            locator = "dsound://";
-        }
         SessionDescription sessionDescription = null;
         if (sdpData == null) {
             throw new MediaException("The SDP data was null! Cannot open "
@@ -135,11 +321,11 @@
         int mediaPort = -1;
         boolean atLeastOneTransmitterStarted = false;
         ArrayList mediaTypes = new ArrayList();
-        ArrayList remoteAddresses = new ArrayList();
+        ArrayList<String> remoteAddresses = new ArrayList<String>();
         // A hashtable that indicates what addresses are different media
         // types
         // coming from.
-        Hashtable remoteTransmisionDetails = new Hashtable();
+        Hashtable<String, String> remoteTransmisionDetails = new Hashtable<String, String>();
         // by default everything is supposed to be coming from the address
         // specified in the session (global) connection parameter so store
         // this address for now.
@@ -147,10 +333,10 @@
             remoteTransmisionDetails.put("audio", sessionRemoteAddress);
             remoteTransmisionDetails.put("video", sessionRemoteAddress);
         }
-        ArrayList ports = new ArrayList();
+        ArrayList<Integer> ports = new ArrayList<Integer>();
         ArrayList formatSets = new ArrayList();
-        ArrayList contents = new ArrayList();
-        ArrayList localPorts = new ArrayList();
+        ArrayList<String> contents = new ArrayList<String>();
+        ArrayList<Integer> localPorts = new ArrayList<Integer>();
         for (int i = 0; i < mediaDescriptions.size(); i++) {
             MediaDescription mediaDescription = (MediaDescription) mediaDescriptions
                     .get(i);
@@ -219,11 +405,11 @@
                 // Selecting local ports for NAT
 
                 if (mediaType.trim().equals("video"))
-                    localPorts.add(new Integer(22444));
+                    localPorts.add(Integer.valueOf(22445));
                 else if (mediaType.trim().equals("audio"))
-                    localPorts.add(new Integer(localPort));
+                    localPorts.add(Integer.valueOf(localPort));
                 else
-                    localPorts.add(new Integer(mediaPort));
+                    localPorts.add(Integer.valueOf(mediaPort));
 
                 formatSets
                         .add(extractTransmittableJmfFormats(sdpFormats));
@@ -244,7 +430,7 @@
 
             AudioFormat audioFormat = new AudioFormat((String) (((ArrayList) formatSets.get(0)).get(0)));
 
-            AudioMediaSession audioMediaSession = new AudioMediaSession(audioFormat, remote, local, locator);
+            AudioMediaSession audioMediaSession = new AudioMediaSession(audioFormat, remote, local, SettingsManager.getLocalPreferences().getAudioDevice());
 
             return audioMediaSession;
         }
@@ -275,9 +461,8 @@
      */
     protected ArrayList<String> extractTransmittableJmfFormats(Vector sdpFormats)
             throws MediaException {
-        ArrayList jmfFormats = new ArrayList();
+        ArrayList<String> jmfFormats = new ArrayList<String>();
         for (int i = 0; i < sdpFormats.size(); i++) {
-            int sdpFormat = -1;
             String jmfFormat = AudioFormatUtils.findCorrespondingJmfFormat(sdpFormats
                     .elementAt(i).toString());
             if (jmfFormat != null) {
@@ -330,33 +515,39 @@
                     publicIpAddress.getHostAddress());
             // "t=0 0"
             TimeDescription t = sdpFactory.createTimeDescription();
-            Vector timeDescs = new Vector();
+            Vector<TimeDescription> timeDescs = new Vector<TimeDescription>();
             timeDescs.add(t);
             // --------Audio media description
             // make sure preferred formats come first
-            String[] formats = new String[getAudioFormats().size()];
+            String[] aformats = new String[getAudioFormats().size()];
 
             int i = 0;
             for (AudioFormat audioFormat : getAudioFormats()) {
-                formats[i++] = AudioFormatUtils.findCorrespondingSdpFormat(audioFormat.getEncoding());
+                aformats[i++] = AudioFormatUtils.findCorrespondingSdpFormat(audioFormat.getEncoding());
             }
 
             MediaDescription am = sdpFactory.createMediaDescription(
                     "audio", publicAudioAddress.getPort(), 1, "RTP/AVP",
-                    formats);
-            //if (!isAudioTransmissionSupported()) {
-            //am.setAttribute("recvonly", null);
-            // --------Video media description
-            //} else {
+                    aformats);
             am.setAttribute("sendrecv", null);
-            //}
-
+            
             am.setAttribute("rtmap:101", "telephone-event/"
                     + publicAudioAddress.getPort());
 
-            Vector mediaDescs = new Vector();
+            i = 0;
+            String[] vformats = new String[getVideoFormats().size()];
+            for (VideoFormat videoFormat : getVideoFormats()) {
+                vformats[i++] = AudioFormatUtils.findCorrespondingSdpFormat(videoFormat.getEncoding());
+            }
+            
+            MediaDescription vam = sdpFactory.createMediaDescription(
+                    "video", publicVideoAddress.getPort(), 1, "RTP/AVP",
+                    vformats);
+            
+            Vector<MediaDescription> mediaDescs = new Vector<MediaDescription>();
 
             mediaDescs.add(am);
+            mediaDescs.add(vam);
 
             sessDescr.setVersion(v);
             sessDescr.setOrigin(o);
@@ -400,7 +591,7 @@
             Origin o = sdpFactory.createOrigin(SIPConfig.getUserName()
                     .replace(' ', '_'), 20109217, 2, "IN", addrType,
                     publicIpAddress.getHostAddress());
-            SessionName s = sdpFactory.createSessionName("<SIPmack>");
+            SessionName s = sdpFactory.createSessionName("<SparkPhone>");
             Connection c = sdpFactory.createConnection("IN", addrType,
                     publicIpAddress.getHostAddress());
             TimeDescription t = sdpFactory.createTimeDescription();
Index: src/plugins/sip/src/java/net/java/sipmack/softphone/listeners/RegisterEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/softphone/listeners/RegisterEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/softphone/listeners/RegisterEvent.java	(working copy)
@@ -16,7 +16,9 @@
 
 public class RegisterEvent extends EventObject {
 
-    private SipRegisterStatus status = SipRegisterStatus.Unregistered;
+	private static final long serialVersionUID = 6673006341746488777L;
+
+	private SipRegisterStatus status = SipRegisterStatus.Unregistered;
 
     private String reason = "";
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/CallEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/CallEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/CallEvent.java	(working copy)
@@ -1,92 +1,23 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import net.java.sipmack.sip.Call;
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR
- * </p>
- * <p/>
- * Description:JAIN-SIP Audio/Video phone application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr)
- * </p>
- * <p/>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * </p>
- * <p/>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov (http://www.emcho.com)
- * @version 1.1
- */
+
 public class CallEvent extends EventObject {
-    public CallEvent(Object source) {
+	private static final long serialVersionUID = -7791513047352316593L;
+
+	public CallEvent(Object source) {
         super(source);
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/security/CredentialsCache.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/security/CredentialsCache.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/security/CredentialsCache.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.security;
 
 import java.util.Hashtable;
@@ -73,7 +24,7 @@
 
 class CredentialsCache {
     // Contains call->realms mappings
-    private Hashtable authenticatedRealms = new Hashtable();
+    private Hashtable<String, CredentialsCacheEntry> authenticatedRealms = new Hashtable<String, CredentialsCacheEntry>();
 
     /**
      * Cache credentials for the specified call and realm
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/MessageEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/MessageEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/MessageEvent.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import javax.sip.header.FromHeader;
@@ -63,27 +14,10 @@
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR-1.1
- * </p>
- * <p/>
- * Description: JAIN-SIP-1.1 Audio/Video Phone Application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company: Organisation: LSIIT Laboratory (http://lsiit.u-strasbg.fr) \nNetwork
- * Research Team (http://www-r2.u-strasbg.fr))\nLouis Pasteur University -
- * Strasbourg - France
- * </p>
- *
- * @author Emil Ivov
- * @version 1.1
- */
 public class MessageEvent extends EventObject {
-    public MessageEvent(Request source) {
+	private static final long serialVersionUID = 5165120956285347269L;
+
+	public MessageEvent(Request source) {
         super(source);
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/CommunicationsListener.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/CommunicationsListener.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/CommunicationsListener.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import java.util.EventListener;
Index: src/plugins/sip/src/java/net/java/sipmack/sip/Call.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/Call.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/Call.java	(working copy)
@@ -63,8 +63,6 @@
 
     private long start = 0;
 
-    private int id = (int)Math.round(Math.random() * 50000);
-
     private Dialog dialog = null;
 
     private SessionDescription localSdpDescription = null;
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/CallListener.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/CallListener.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/CallListener.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import java.util.EventListener;
Index: src/plugins/sip/src/java/org/jivesoftware/sparkplugin/ui/components/SnapWindow.java
===================================================================
--- src/plugins/sip/src/java/org/jivesoftware/sparkplugin/ui/components/SnapWindow.java	(revision 11009)
+++ src/plugins/sip/src/java/org/jivesoftware/sparkplugin/ui/components/SnapWindow.java	(working copy)
@@ -33,7 +33,9 @@
  */
 public class SnapWindow extends JWindow implements ComponentListener, WindowListener, FocusListener, MouseMotionListener {
 
-    private final JFrame parentFrame;
+	private static final long serialVersionUID = -3546188378308911117L;
+
+	private final JFrame parentFrame;
 
     private int preferredWidth = 300;
 
@@ -97,9 +99,7 @@
         if (width == 0) {
             width = preferredWidth;
         }
-        if ((int)screenSize.getWidth() - width >= x) {
-        }
-        else {
+        if ((int)screenSize.getWidth() - width < x) {
             x = (int)mainWindowLocation.getX() - width;
         }
 
Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioFormatUtils.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/AudioFormatUtils.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/AudioFormatUtils.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/CallStateEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/CallStateEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/CallStateEvent.java	(working copy)
@@ -1,92 +1,22 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import net.java.sipmack.sip.Call;
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR
- * </p>
- * <p/>
- * Description:JAIN-SIP Audio/Video phone application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr)
- * </p>
- * <p/>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * </p>
- * <p/>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov (http://www.emcho.com)
- * @version 1.1
- */
 public class CallStateEvent extends EventObject {
-    String oldStatus;
+
+	private static final long serialVersionUID = -9218156329743857188L;
+	private String oldStatus;
 
     public CallStateEvent(Call source) {
         super(source);
Index: src/plugins/sip/src/java/net/java/sipmack/sip/CommunicationsException.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/CommunicationsException.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/CommunicationsException.java	(working copy)
@@ -2,20 +2,18 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 /**
  * @author thiagoc
  */
 public class CommunicationsException extends Exception {
-    /**
-     */
+	private static final long serialVersionUID = -4143243596000097474L;
     private boolean isFatal = false;
 
     public CommunicationsException() {
Index: src/java/org/jivesoftware/sparkimpl/plugin/phone/JMFInit.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/plugin/phone/JMFInit.java	(revision 11009)
+++ src/java/org/jivesoftware/sparkimpl/plugin/phone/JMFInit.java	(working copy)
@@ -22,7 +22,9 @@
 
 public class JMFInit extends Frame implements Runnable {
 
-    public JMFInit(String[] args, boolean visible) {
+	private static final long serialVersionUID = 6591937615313371376L;
+
+	public JMFInit(String[] args, boolean visible) {
         super("Initializing JMF...");
 
         Registry.set("secure.allowCaptureFromApplets", true);
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/CommunicationsErrorEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/CommunicationsErrorEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/CommunicationsErrorEvent.java	(working copy)
@@ -1,86 +1,20 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR-1.1
- * </p>
- * <p/>
- * Description: JAIN-SIP-1.1 Audio/Video Phone Application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company: Organisation: LSIIT Laboratory (http://lsiit.u-strasbg.fr) \nNetwork
- * Research Team (http://www-r2.u-strasbg.fr))\nLouis Pasteur University -
- * Strasbourg - France
- * </p>
- *
- * @author Emil Ivov
- * @version 1.1
- */
 public class CommunicationsErrorEvent extends EventObject {
-    public CommunicationsErrorEvent(Throwable source) {
+	private static final long serialVersionUID = 2374012965831445563L;
+
+	public CommunicationsErrorEvent(Throwable source) {
         super(source);
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/softphone/listeners/SoftPhoneListener.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/softphone/listeners/SoftPhoneListener.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/softphone/listeners/SoftPhoneListener.java	(working copy)
@@ -10,11 +10,10 @@
 
 package net.java.sipmack.softphone.listeners;
 
+import net.java.sipmack.sip.event.CallRejectedEvent;
 import net.java.sipmack.sip.event.CallStateEvent;
 import net.java.sipmack.sip.event.MessageEvent;
 import net.java.sipmack.sip.event.UnknownMessageEvent;
-import net.java.sipmack.sip.event.CallRejectedEvent;
-import net.java.sipmack.sip.InterlocutorUI;
 
 /**
  * Title: SIPark
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/UnknownMessageEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/UnknownMessageEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/UnknownMessageEvent.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import javax.sip.message.Message;
@@ -64,27 +15,10 @@
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR-1.1
- * </p>
- * <p/>
- * Description: JAIN-SIP-1.1 Audio/Video Phone Application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company: Organisation: LSIIT Laboratory (http://lsiit.u-strasbg.fr) \nNetwork
- * Research Team (http://www-r2.u-strasbg.fr))\nLouis Pasteur University -
- * Strasbourg - France
- * </p>
- *
- * @author Emil Ivov
- * @version 1.1
- */
 public class UnknownMessageEvent extends EventObject {
-    public UnknownMessageEvent(Message source) {
+	private static final long serialVersionUID = 239781911809975348L;
+
+	public UnknownMessageEvent(Message source) {
         super(source);
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/security/MessageDigestAlgorithm.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/security/MessageDigestAlgorithm.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/security/MessageDigestAlgorithm.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.security;
 
 import java.security.MessageDigest;
Index: src/java/org/jivesoftware/spark/preference/PreferenceManager.java
===================================================================
--- src/java/org/jivesoftware/spark/preference/PreferenceManager.java	(revision 11009)
+++ src/java/org/jivesoftware/spark/preference/PreferenceManager.java	(working copy)
@@ -10,22 +10,23 @@
 
 package org.jivesoftware.spark.preference;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JDialog;
+
 import org.jivesoftware.MainWindowListener;
 import org.jivesoftware.spark.SparkManager;
 import org.jivesoftware.sparkimpl.preference.PreferenceDialog;
 import org.jivesoftware.sparkimpl.preference.PreferencesPanel;
 import org.jivesoftware.sparkimpl.preference.chat.ChatPreference;
 import org.jivesoftware.sparkimpl.preference.groupchat.GroupChatPreference;
+import org.jivesoftware.sparkimpl.preference.media.MediaPreference;
 import org.jivesoftware.sparkimpl.settings.local.LocalPreference;
 
-import javax.swing.JDialog;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
 /**
  * Usage of the PreferenceManager to handle loading of preferences within Spark.
  *
@@ -44,6 +45,10 @@
         GroupChatPreference groupChatPreferences = new GroupChatPreference();
         addPreference(groupChatPreferences);
         groupChatPreferences.load();
+        
+        MediaPreference preferenes = new MediaPreference();
+        addPreference(preferenes);
+        preferenes.load();
 
         LocalPreference localPreferences = new LocalPreference();
         addPreference(localPreferences);
@@ -90,7 +95,7 @@
         return getPreference(namespace).getData();
     }
 
-    public Iterator getPreferences() {
+    public Iterator<Preference> getPreferences() {
         final List<Preference> returnList = new ArrayList<Preference>();
         for (String namespace : map.keySet()) {
             returnList.add(map.get(namespace));
Index: src/plugins/sip/src/java/net/java/sipmack/sip/NetworkAddressManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/NetworkAddressManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/NetworkAddressManager.java	(working copy)
@@ -2,12 +2,11 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 import net.java.sipmack.common.Log;
@@ -93,7 +92,7 @@
             return cachedLocalhost;
         }
 
-        Enumeration ifaces = null;
+        Enumeration<NetworkInterface> ifaces = null;
         int i = 0;
 
         // Try to get the Preferred IP Address
@@ -120,10 +119,10 @@
             while (ifaces.hasMoreElements()) {
 
                 NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
-                Enumeration iaddresses = iface.getInetAddresses();
+                Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
 
                 while (iaddresses.hasMoreElements()) {
-                    InetAddress iaddress = (InetAddress) iaddresses.nextElement();
+                    InetAddress iaddress = iaddresses.nextElement();
                     if (iaddress.getHostAddress().equals(SIPConfig.getPreferredNetworkAddress())) {
                         addresses.add(new InetAddressWrapper(iaddress, i++));
                         break;
@@ -144,7 +143,7 @@
         while (ifaces.hasMoreElements()) {
 
             NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
-            Enumeration iaddresses = iface.getInetAddresses();
+            Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
 
             while (iaddresses.hasMoreElements()) {
                 InetAddress iaddress = (InetAddress) iaddresses.nextElement();
@@ -165,7 +164,7 @@
         while (ifaces.hasMoreElements()) {
 
             NetworkInterface iface = (NetworkInterface) ifaces.nextElement();
-            Enumeration iaddresses = iface.getInetAddresses();
+            Enumeration<InetAddress> iaddresses = iface.getInetAddresses();
 
             while (iaddresses.hasMoreElements()) {
                 InetAddress iaddress = (InetAddress) iaddresses.nextElement();
Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiver.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiver.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiver.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
@@ -46,10 +46,9 @@
      */
     public synchronized void update(ReceiveStreamEvent evt) {
 
-        RTPManager mgr = (RTPManager) evt.getSource();
         Participant participant = evt.getParticipant();    // could be null.
         ReceiveStream stream = evt.getReceiveStream();  // could be null.
-
+        
         if (evt instanceof RemotePayloadChangeEvent) {
 
             System.err.println("  - Received an RTP PayloadChangeEvent.");
Index: src/plugins/sip/src/java/net/java/sipmack/sip/security/Credentials.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/security/Credentials.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/security/Credentials.java	(working copy)
@@ -1,81 +1,14 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.security;
 
-/**
- * <p/>
- * Title: SIP Communicator
- * </p>
- * <p/>
- * Description: A SIP UA
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2004
- * </p>
- * <p/>
- * Company: Network Research Team, Louis Pasteur University
- * </p>
- *
- * @author Emil Ivov
- * @version 1.0
- */
-
 public class Credentials {
     private static String userName = null;
     private static char[] password = null;
Index: src/plugins/sip/src/java/net/java/sipmack/common/scheduler/TimerTask.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/common/scheduler/TimerTask.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/common/scheduler/TimerTask.java	(working copy)
@@ -1,72 +1,14 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.common.scheduler;
 
-/**
- * A task that can be scheduled for one-time or repeated execution by a Timer.
- *
- * @author Josh Bloch
- * @version 1.8, 01/23/03
- * @see Timer
- * @since 1.3
- */
-
 public abstract class TimerTask implements Runnable {
     /**
      * This object is used to control access to the TimerTask internals.
Index: src/plugins/sip/src/java/net/java/sipmack/sip/security/SipSecurityManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/security/SipSecurityManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/security/SipSecurityManager.java	(working copy)
@@ -2,12 +2,11 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.security;
 
 import net.java.sipmack.common.Log;
Index: src/plugins/sip/src/java/net/java/sipmack/common/Log.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/common/Log.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/common/Log.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
Index: src/plugins/sip/src/java/net/java/sipmack/common/scheduler/Timer.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/common/scheduler/Timer.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/common/scheduler/Timer.java	(working copy)
@@ -1,109 +1,17 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
 
 package net.java.sipmack.common.scheduler;
 
 import java.util.Date;
 
-/**
- * A facility for threads to schedule tasks for future execution in a background
- * thread. Tasks may be scheduled for one-time execution, or for repeated
- * execution at regular intervals.
- * <p/>
- * Corresponding to each <tt>Timer</tt> object is a single background thread
- * that is used to execute all of the timer's tasks, sequentially. Timer tasks
- * should complete quickly. If a timer task takes excessive time to complete, it
- * "hogs" the timer's task execution thread. This can, in turn, delay the
- * execution of subsequent tasks, which may "bunch up" and execute in rapid
- * succession when (and if) the offending task finally completes.
- * <p/>
- * After the last live reference to a <tt>Timer</tt> object goes away <i>and</i>
- * all outstanding tasks have completed execution, the timer's task execution
- * thread terminates gracefully (and becomes subject to garbage collection).
- * However, this can take arbitrarily long to occur. By default, the task
- * execution thread does not run as a <i>daemon thread</i>, so it is capable of
- * keeping an application from terminating. If a caller wants to terminate a
- * timer's task execution thread rapidly, the caller should invoke the the
- * timer's <tt>cancel</tt> method.
- * <p/>
- * If the timer's task execution thread terminates unexpectedly, for example,
- * because its <tt>stop</tt> method is invoked, any further attempt to
- * schedule a task on the timer will result in an <tt>IllegalStateException</tt>,
- * as if the timer's <tt>cancel</tt> method had been invoked.
- * <p/>
- * This class is thread-safe: multiple threads can share a single <tt>Timer</tt>
- * object without the need for external synchronization.
- * <p/>
- * This class does <i>not</i> offer real-time guarantees: it schedules tasks
- * using the <tt>Object.wait(long)</tt> method.
- * <p/>
- * Implementation note: This class scales to large numbers of concurrently
- * scheduled tasks (thousands should present no problem). Internally, it uses a
- * binary heap to represent its task queue, so the cost to schedule a task is
- * O(log n), where n is the number of concurrently scheduled tasks.
- *
- * @author Josh Bloch
- * @version 1.9, 01/23/03
- * @see TimerTask
- * @see Object#wait(long)
- * @since 1.3
- */
-
 public class Timer {
     /**
      * The timer task queue. This data structure is shared with the timer
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/CallRejectedEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/CallRejectedEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/CallRejectedEvent.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.event;
 
 import net.java.sipmack.sip.Call;
@@ -64,28 +15,11 @@
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title:
- * </p>
- * <p/>
- * Description:
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company:
- * </p>
- *
- * @author Emil Ivov
- * @version 1.0
- */
 public class CallRejectedEvent extends EventObject {
-    /**
-     */
-    String reason = null;
-    Call call = null;
+
+	private static final long serialVersionUID = 5078823819392681774L;
+	private String reason = null;
+	private Call call = null;
 
     public CallRejectedEvent(String reason, Message source, Call call) {
         super(source);
Index: src/plugins/sip/src/java/net/java/sipmack/media/event/MediaListener.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/event/MediaListener.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/event/MediaListener.java	(working copy)
@@ -1,86 +1,14 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.media.event;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR
- * </p>
- * <p/>
- * Description:JAIN-SIP Audio/Video phone application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr)
- * </p>
- * <p/>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * </p>
- * <p/>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov (http://www.emcho.com)
- * @version 1.1
- */
 public interface MediaListener extends java.util.EventListener {
     public void nonFatalMediaErrorOccurred(MediaErrorEvent evt);
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/CallDispatcher.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/CallDispatcher.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/CallDispatcher.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 import net.java.sipmack.sip.event.CallListener;
@@ -67,35 +18,12 @@
 import java.util.Enumeration;
 import java.util.Hashtable;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR
- * </p>
- * <p/>
- * Description:JAIN-SIP Audio/Video phone application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr)
- * </p>
- * <p/>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * </p>
- * <p/>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov (http://www.emcho.com)
- * @version 1.1
- */
 class CallDispatcher implements CallListener {
 
     /**
      * All currently active calls.
      */
-    Hashtable calls = new Hashtable();
+    Hashtable<Integer, Call> calls = new Hashtable<Integer, Call>();
 
     Call createCall(Dialog dialog, Request initialRequest) {
         Call call = null;
@@ -108,13 +36,13 @@
         call.setDialog(dialog);
         call.setInitialRequest(initialRequest);
         // call.setState(Call.DIALING);
-        calls.put(new Integer(call.getID()), call);
+        calls.put(Integer.valueOf(call.getID()), call);
         call.addStateChangeListener(this);
         return call;
     }
 
     Call getCall(int id) {
-        return (Call) calls.get(new Integer(id));
+        return (Call) calls.get(Integer.valueOf(id));
     }
 
     /**
@@ -128,7 +56,7 @@
             return null;
         }
         synchronized (calls) {
-            Enumeration callsEnum = calls.elements();
+            Enumeration<Call> callsEnum = calls.elements();
             while (callsEnum.hasMoreElements()) {
                 Call item = (Call) callsEnum.nextElement();
                 if (item.getDialog().getCallId().equals(dialog.getCallId())) {
@@ -150,7 +78,7 @@
             return null;
         }
         synchronized (calls) {
-            Enumeration callsEnum = calls.elements();
+            Enumeration<Call> callsEnum = calls.elements();
             while (callsEnum.hasMoreElements()) {
                 Call item = (Call) callsEnum.nextElement();
                 if (item.getDialog().getCallId().equals(callId)) {
@@ -167,7 +95,7 @@
     }
 
     private void removeCall(Call call) {
-        calls.remove(new Integer(call.getID()));
+        calls.remove(Integer.valueOf(call.getID()));
     }
 
     // ================================ DialogListener =================
Index: src/plugins/sip/src/java/net/java/sipmack/events/UserCallControlEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/events/UserCallControlEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/events/UserCallControlEvent.java	(working copy)
@@ -1,90 +1,20 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.events;
 
 import net.java.sipmack.sip.InterlocutorUI;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR
- * </p>
- * <p/>
- * Description:JAIN-SIP Audio/Video phone application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr)
- * </p>
- * <p/>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * </p>
- * <p/>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov (http://www.emcho.com)
- * @version 1.1
- */
 public class UserCallControlEvent extends java.util.EventObject {
-    public UserCallControlEvent() {
+	private static final long serialVersionUID = -7959924232399983785L;
+
+	public UserCallControlEvent() {
         super(null);
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/RegisterProcessing.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/RegisterProcessing.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/RegisterProcessing.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
@@ -10,10 +10,10 @@
 
 package net.java.sipmack.sip;
 
-import net.java.sipmack.common.Log;
-import net.java.sipmack.sip.event.RegistrationEvent;
-import net.java.sipmack.sip.security.SipSecurityException;
-import net.java.sipmack.softphone.SoftPhoneManager;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Timer;
+import java.util.TimerTask;
 
 import javax.sip.ClientTransaction;
 import javax.sip.InvalidArgumentException;
@@ -23,14 +23,24 @@
 import javax.sip.address.Address;
 import javax.sip.address.SipURI;
 import javax.sip.address.URI;
-import javax.sip.header.*;
+import javax.sip.header.AllowHeader;
+import javax.sip.header.CSeqHeader;
+import javax.sip.header.CallIdHeader;
+import javax.sip.header.ContactHeader;
+import javax.sip.header.EventHeader;
+import javax.sip.header.ExpiresHeader;
+import javax.sip.header.FromHeader;
+import javax.sip.header.MaxForwardsHeader;
+import javax.sip.header.ToHeader;
+import javax.sip.header.UserAgentHeader;
+import javax.sip.header.ViaHeader;
 import javax.sip.message.Request;
 import javax.sip.message.Response;
 
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Timer;
-import java.util.TimerTask;
+import net.java.sipmack.common.Log;
+import net.java.sipmack.sip.event.RegistrationEvent;
+import net.java.sipmack.sip.security.SipSecurityException;
+import net.java.sipmack.softphone.SoftPhoneManager;
 
 /**
  * Title: SIPark
@@ -147,9 +157,6 @@
     void processAuthenticationChallenge(ClientTransaction clientTransaction,
                                         Response response) {
         try {
-
-            Request register = clientTransaction.getRequest();
-
             ClientTransaction retryTran = sipManCallback.sipSecurityManager
                     .handleChallenge(response, clientTransaction);
 
@@ -248,7 +255,7 @@
             }
             // User Agent Header
             UserAgentHeader uaHeader = null;
-            ArrayList userAgentList = new ArrayList();
+            ArrayList<String> userAgentList = new ArrayList<String>();
             userAgentList.add(SoftPhoneManager.userAgent);
 
             try {
@@ -263,7 +270,7 @@
             }
 
             // Via Headers
-            ArrayList viaHeaders = sipManCallback.getLocalViaHeaders();
+            ArrayList<ViaHeader> viaHeaders = sipManCallback.getLocalViaHeaders();
             // MaxForwardsHeader
             MaxForwardsHeader maxForwardsHeader = sipManCallback
                     .getMaxForwardsHeader();
@@ -450,7 +457,7 @@
         }
         // User Agent Header
         UserAgentHeader uaHeader = null;
-        ArrayList userAgentList = new ArrayList();
+        ArrayList<String> userAgentList = new ArrayList<String>();
         userAgentList.add(SoftPhoneManager.userAgent);
 
         try {
@@ -465,7 +472,7 @@
         }
 
         // Via Headers
-        ArrayList viaHeaders = sipManCallback.getLocalViaHeaders();
+        ArrayList<ViaHeader> viaHeaders = sipManCallback.getLocalViaHeaders();
         // MaxForwardsHeader
         MaxForwardsHeader maxForwardsHeader = sipManCallback
                 .getMaxForwardsHeader();
@@ -599,7 +606,7 @@
         public KeepAliveTask(int s) {
             sec = s;
         }
-
+       
         public void run() {
             try {
                 if (sipManCallback.isRegistered()) {
Index: src/plugins/sip/src/java/net/java/sipmack/sip/SipManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/SipManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/SipManager.java	(working copy)
@@ -11,28 +11,16 @@
 package net.java.sipmack.sip;
 
 import gov.nist.javax.sip.stack.SIPTransaction;
-import net.java.sipmack.common.Log;
-import net.java.sipmack.sip.event.CallEvent;
-import net.java.sipmack.sip.event.CallRejectedEvent;
-import net.java.sipmack.sip.event.CommunicationsErrorEvent;
-import net.java.sipmack.sip.event.CommunicationsListener;
-import net.java.sipmack.sip.event.MessageEvent;
-import net.java.sipmack.sip.event.RegistrationEvent;
-import net.java.sipmack.sip.event.UnknownMessageEvent;
-import net.java.sipmack.sip.security.SecurityAuthority;
-import net.java.sipmack.sip.security.SipSecurityManager;
-import net.java.sipmack.sip.security.Credentials;
-import net.java.sipmack.sip.simple.MessageProcessing;
 
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
-import java.net.Inet4Address;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.TooManyListenersException;
 
+import javax.sdp.SessionDescription;
 import javax.sip.ClientTransaction;
 import javax.sip.Dialog;
 import javax.sip.DialogTerminatedEvent;
@@ -69,7 +57,19 @@
 import javax.sip.message.MessageFactory;
 import javax.sip.message.Request;
 import javax.sip.message.Response;
-import javax.sdp.SessionDescription;
+
+import net.java.sipmack.common.Log;
+import net.java.sipmack.sip.event.CallEvent;
+import net.java.sipmack.sip.event.CallRejectedEvent;
+import net.java.sipmack.sip.event.CommunicationsErrorEvent;
+import net.java.sipmack.sip.event.CommunicationsListener;
+import net.java.sipmack.sip.event.MessageEvent;
+import net.java.sipmack.sip.event.RegistrationEvent;
+import net.java.sipmack.sip.event.UnknownMessageEvent;
+import net.java.sipmack.sip.security.Credentials;
+import net.java.sipmack.sip.security.SecurityAuthority;
+import net.java.sipmack.sip.security.SipSecurityManager;
+import net.java.sipmack.sip.simple.MessageProcessing;
 
 /**
  * Title: SIPark
@@ -190,7 +190,7 @@
      */
     protected ContactHeader contactHeader = null;
 
-    protected ArrayList viaHeaders = null;
+    protected ArrayList<ViaHeader> viaHeaders = null;
 
     protected static final int MAX_FORWARDS = 70;
 
@@ -985,7 +985,7 @@
     public ArrayList<ViaHeader> getLocalViaHeaders() throws CommunicationsException {
 
         ListeningPoint lp = sipProvider.getListeningPoint();
-        viaHeaders = new ArrayList();
+        viaHeaders = new ArrayList<ViaHeader>();
         try {
 
             ViaHeader viaHeader = headerFactory.createViaHeader(SIPConfig
Index: src/plugins/sip/src/java/net/java/sipmack/sip/security/CredentialsCacheEntry.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/security/CredentialsCacheEntry.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/security/CredentialsCacheEntry.java	(working copy)
@@ -1,62 +1,13 @@
-package net.java.sipmack.sip.security;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
+package net.java.sipmack.sip.security;
 
 import java.util.Vector;
 
@@ -78,7 +29,7 @@
      * not reached this class). The transactionHistory's elements are Strings
      * corresponding to branch ids.
      */
-    private Vector transactionHistory = new Vector();
+    private Vector<String> transactionHistory = new Vector<String>();
 
     /**
      * Adds the specified branch id to the transaction history list.
Index: src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneSecurity.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneSecurity.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneSecurity.java	(working copy)
@@ -1,3 +1,12 @@
+/**
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2007 Jive Software. All rights reserved.
+ *
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
+ */
 package net.java.sipmack.softphone;
 
 import net.java.sipmack.sip.security.SecurityAuthority;
Index: src/plugins/sip/src/java/net/java/sipmack/media/event/MediaEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/event/MediaEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/event/MediaEvent.java	(working copy)
@@ -1,92 +1,20 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.media.event;
 
 import java.util.EventObject;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR
- * </p>
- * <p/>
- * Description:JAIN-SIP Audio/Video phone application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr)
- * </p>
- * <p/>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * </p>
- * <p/>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov (http://www.emcho.com)
- * @version 1.1
- */
-
 public class MediaEvent extends EventObject {
 
-    private String user;
+	private static final long serialVersionUID = 2025524719587153767L;
+	private String user;
 
     public MediaEvent(Object source) {
         super(source);
@@ -96,4 +24,8 @@
         super(source);
         user = u;
     }
+    
+    public String getUser() {
+    	return user;
+    }
 }
\ No newline at end of file
Index: src/plugins/jingle/src/java/org/jivesoftware/sparkplugin/JinglePlugin.java
===================================================================
--- src/plugins/jingle/src/java/org/jivesoftware/sparkplugin/JinglePlugin.java	(revision 11009)
+++ src/plugins/jingle/src/java/org/jivesoftware/sparkplugin/JinglePlugin.java	(working copy)
@@ -44,6 +44,7 @@
 import org.jivesoftware.spark.util.SwingWorker;
 import org.jivesoftware.spark.util.log.Log;
 import org.jivesoftware.sparkimpl.plugin.gateways.transports.TransportUtils;
+import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
 
 import javax.swing.*;
 import javax.swing.text.BadLocationException;
@@ -71,6 +72,7 @@
 
         // Set Jingle Enabled
         JingleManager.setJingleServiceEnabled();
+        JingleManager.setServiceEnabled(SparkManager.getConnection(), true);
         
         // Add to PhoneManager
         PhoneManager.getInstance().addPhone(this);
@@ -98,8 +100,8 @@
                 JingleTransportManager transportManager = new ICETransportManager(SparkManager.getConnection(), stunServer, stunPort);
                 List<JingleMediaManager> mediaManagers = new ArrayList<JingleMediaManager>();
 
-                // if running on Windows use Direct Sound for better performance
-                String locator = Spark.isWindows() ? "dsound://" : "javasound://";
+                // Get the Locator from the Settings
+                String locator =  SettingsManager.getLocalPreferences().getAudioDevice();
 
                 mediaManagers.add(new JmfMediaManager(locator, transportManager));
                 mediaManagers.add(new SpeexMediaManager(transportManager));
@@ -143,6 +145,7 @@
         // Listen in for new incoming Jingle requests.
         jingleManager.addJingleSessionRequestListener(new JingleSessionRequestListener() {
             public void sessionRequested(final JingleSessionRequest request) {
+            	System.out.println("REQUEST:" + request);
                 SwingUtilities.invokeLater(new Runnable() {
                     public void run() {
                         incomingJingleSession(request);
@@ -211,7 +214,6 @@
         if (PhoneManager.isUseStaticLocator() && PhoneManager.isUsingMediaLocator()) {
             return;
         }
-
         PhoneManager.setUsingMediaLocator(true);
 
         jid = SparkManager.getUserManager().getFullJID(jid);
Index: src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreferencePanel.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreferencePanel.java	(revision 0)
+++ src/java/org/jivesoftware/sparkimpl/preference/media/MediaPreferencePanel.java	(revision 0)
@@ -0,0 +1,118 @@
+package org.jivesoftware.sparkimpl.preference.media;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.util.Vector;
+
+import javax.media.CaptureDeviceInfo;
+import javax.media.CaptureDeviceManager;
+import javax.media.Format;
+import javax.media.format.AudioFormat;
+import javax.media.format.VideoFormat;
+import javax.swing.BorderFactory;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import net.sf.fmj.media.RegistryDefaults;
+import net.sf.fmj.media.cdp.GlobalCaptureDevicePlugger;
+
+import org.jivesoftware.resource.Res;
+import org.jivesoftware.spark.component.VerticalFlowLayout;
+
+public class MediaPreferencePanel  extends JPanel {
+	private static final long serialVersionUID = 8297469864676223072L;
+	private Vector<CaptureDeviceInfo> vectorAudioDevices;
+	private Vector<CaptureDeviceInfo> vectorVideoDevices;
+	
+	private JComboBox audioDevice = new JComboBox();
+	private JComboBox videoDevice = new JComboBox();
+	
+	public MediaPreferencePanel() {
+		setLayout(new VerticalFlowLayout());
+		
+		JPanel panel = new JPanel();
+		panel.setBorder(BorderFactory.createTitledBorder(Res.getString("title.general.media")));
+		add(panel);
+			
+		panel.setLayout(new GridBagLayout());
+		
+		
+		panel.add(new JLabel("Audio Device"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0));
+		panel.add(audioDevice, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0));
+		
+		
+		
+		panel.add(new JLabel("Video Device"), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0));
+        panel.add(videoDevice, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(10, 15, 5, 0), 0, 0));
+	
+        scanDevices();
+	}
+	
+	public void scanDevices()
+	{
+		// Remove all Items
+		audioDevice.removeAllItems();
+		videoDevice.removeAllItems();
+		
+		// FMJ
+		RegistryDefaults.registerAll(RegistryDefaults.FMJ | RegistryDefaults.FMJ_NATIVE);
+
+		// Add Device
+		GlobalCaptureDevicePlugger.addCaptureDevices(); 
+		
+		// LOG ALL Devices
+		final Vector<CaptureDeviceInfo> vectorDevices = CaptureDeviceManager.getDeviceList(null);
+		for ( CaptureDeviceInfo infoCaptureDevice : vectorDevices )
+		{
+			System.err.println(infoCaptureDevice.getName());
+			for (Format format : infoCaptureDevice.getFormats())
+			{
+				System.err.println(format);
+			}		
+		}
+		
+		vectorAudioDevices = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.LINEAR));	
+		for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices)
+		{			     
+			audioDevice.addItem(infoCaptureDevice.getName());
+		}
+		
+		vectorVideoDevices = CaptureDeviceManager.getDeviceList(new VideoFormat(VideoFormat.RGB));
+		for (  CaptureDeviceInfo infoCaptureDevice : vectorVideoDevices )
+		{
+            videoDevice.addItem(infoCaptureDevice.getName());		
+		}
+	}
+	
+	public String getAudioDevice() {
+		if (videoDevice.getSelectedIndex() >= 0) {
+			return vectorAudioDevices.get(audioDevice.getSelectedIndex()).getLocator().toExternalForm();
+		}
+		return "";
+	}
+	
+	public void setAudioDevice(String device) {
+		for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices) {
+			if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) {
+				audioDevice.setSelectedItem(infoCaptureDevice.getName());
+			}
+		}	
+	}
+	
+	public void setVideoDevice(String device) {
+		for ( CaptureDeviceInfo infoCaptureDevice : vectorVideoDevices) {
+			if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) {
+				videoDevice.setSelectedItem(infoCaptureDevice.getName());
+			}
+		}	
+	}
+	
+	public String getVideoDevice() {
+		if (videoDevice.getSelectedIndex() >= 0) {
+			return vectorVideoDevices.get(videoDevice.getSelectedIndex()).getLocator().toExternalForm();
+		}
+		return "";
+	}
+}
Index: src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneManager.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneManager.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/softphone/SoftPhoneManager.java	(working copy)
@@ -10,73 +10,20 @@
 
 package net.java.sipmack.softphone;
 
-import org.jivesoftware.sparkplugin.calllog.LogManager;
-import org.jivesoftware.sparkplugin.calllog.LogPacket;
-import org.jivesoftware.sparkplugin.preferences.SipPreference;
-import org.jivesoftware.sparkplugin.preferences.SipPreferences;
-import org.jivesoftware.sparkplugin.sipaccount.SipAccount;
-import org.jivesoftware.sparkplugin.sipaccount.SipAccountPacket;
-import org.jivesoftware.sparkplugin.ui.call.MissedCalls;
-import org.jivesoftware.spark.plugin.phone.resource.PhoneRes;
-import net.java.sipmack.common.DialSoundManager;
-import net.java.sipmack.common.Log;
-import net.java.sipmack.events.UserActionListener;
-import net.java.sipmack.media.AudioMediaSession;
-import net.java.sipmack.media.AudioReceiverChannel;
-import net.java.sipmack.media.JmfMediaManager;
-import net.java.sipmack.media.MediaException;
-import net.java.sipmack.sip.Call;
-import net.java.sipmack.sip.CommunicationsException;
-import net.java.sipmack.sip.Interlocutor;
-import net.java.sipmack.sip.InterlocutorUI;
-import net.java.sipmack.sip.NetworkAddressManager;
-import net.java.sipmack.sip.SIPConfig;
-import net.java.sipmack.sip.SipManager;
-import net.java.sipmack.sip.SipRegisterStatus;
-import net.java.sipmack.sip.event.CallEvent;
-import net.java.sipmack.sip.event.CallListener;
-import net.java.sipmack.sip.event.CallRejectedEvent;
-import net.java.sipmack.sip.event.CallStateEvent;
-import net.java.sipmack.sip.event.CommunicationsErrorEvent;
-import net.java.sipmack.sip.event.CommunicationsListener;
-import net.java.sipmack.sip.event.MessageEvent;
-import net.java.sipmack.sip.event.RegistrationEvent;
-import net.java.sipmack.sip.event.UnknownMessageEvent;
-import net.java.sipmack.softphone.gui.DefaultGuiManager;
-import net.java.sipmack.softphone.gui.GuiManager;
-import net.java.sipmack.softphone.listeners.InterlocutorListener;
-import net.java.sipmack.softphone.listeners.RegisterEvent;
-import net.java.sipmack.softphone.listeners.SoftPhoneListener;
-import org.jivesoftware.resource.Res;
-import org.jivesoftware.smack.XMPPConnection;
-import org.jivesoftware.smack.provider.ProviderManager;
-import org.jivesoftware.smack.util.StringUtils;
-import org.jivesoftware.smackx.packet.VCard;
-import org.jivesoftware.spark.SparkManager;
-import org.jivesoftware.spark.phone.PhoneManager;
-import org.jivesoftware.spark.preference.PreferenceManager;
-import org.jivesoftware.spark.util.ModelUtil;
-
-import javax.sdp.MediaDescription;
-import javax.sdp.SessionDescription;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JMenu;
-
 import java.awt.Component;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 import java.util.concurrent.CopyOnWriteArrayList;
-import org.jivesoftware.sparkplugin.calllog.LogManager;
-import org.jivesoftware.sparkplugin.calllog.LogPacket;
-import org.jivesoftware.sparkplugin.preferences.SipPreference;
-import org.jivesoftware.sparkplugin.preferences.SipPreferences;
-import org.jivesoftware.sparkplugin.sipaccount.SipAccount;
-import org.jivesoftware.sparkplugin.sipaccount.SipAccountPacket;
-import org.jivesoftware.sparkplugin.ui.call.MissedCalls;
-import org.jivesoftware.spark.plugin.phone.resource.PhoneRes;
+
+import javax.sdp.MediaDescription;
+import javax.sdp.SessionDescription;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+
 import net.java.sipmack.common.DialSoundManager;
 import net.java.sipmack.common.Log;
 import net.java.sipmack.events.UserActionListener;
@@ -84,6 +31,7 @@
 import net.java.sipmack.media.AudioReceiverChannel;
 import net.java.sipmack.media.JmfMediaManager;
 import net.java.sipmack.media.MediaException;
+import net.java.sipmack.media.VideoMediaSession;
 import net.java.sipmack.sip.Call;
 import net.java.sipmack.sip.CommunicationsException;
 import net.java.sipmack.sip.Interlocutor;
@@ -106,6 +54,7 @@
 import net.java.sipmack.softphone.listeners.InterlocutorListener;
 import net.java.sipmack.softphone.listeners.RegisterEvent;
 import net.java.sipmack.softphone.listeners.SoftPhoneListener;
+
 import org.jivesoftware.resource.Res;
 import org.jivesoftware.smack.XMPPConnection;
 import org.jivesoftware.smack.provider.ProviderManager;
@@ -113,21 +62,17 @@
 import org.jivesoftware.smackx.packet.VCard;
 import org.jivesoftware.spark.SparkManager;
 import org.jivesoftware.spark.phone.PhoneManager;
+import org.jivesoftware.spark.plugin.phone.resource.PhoneRes;
 import org.jivesoftware.spark.preference.PreferenceManager;
 import org.jivesoftware.spark.util.ModelUtil;
-
-import javax.sdp.MediaDescription;
-import javax.sdp.SessionDescription;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JMenu;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
+import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
+import org.jivesoftware.sparkplugin.calllog.LogManager;
+import org.jivesoftware.sparkplugin.calllog.LogPacket;
+import org.jivesoftware.sparkplugin.preferences.SipPreference;
+import org.jivesoftware.sparkplugin.preferences.SipPreferences;
+import org.jivesoftware.sparkplugin.sipaccount.SipAccount;
+import org.jivesoftware.sparkplugin.sipaccount.SipAccountPacket;
+import org.jivesoftware.sparkplugin.ui.call.MissedCalls;
 
 /**
  * Title: SIPark
@@ -168,7 +113,7 @@
 
     protected String msgBuffer = "";
 
-    protected Integer unregistrationLock = new Integer(0);
+    protected Integer unregistrationLock = Integer.valueOf(0);
 
     private static SipRegisterStatus status = SipRegisterStatus.Unregistered;
 
@@ -513,8 +458,8 @@
      * @param evt CallRejectedEvent
      */
     public void callRejectedLocally(CallRejectedEvent evt) {
-        String reason = evt.getReason();
-        String detailedReason = evt.getDetailedReason();
+//        String reason = evt.getReason();
+//        String detailedReason = evt.getDetailedReason();
     }
 
     /**
@@ -687,18 +632,44 @@
                     PhoneManager.setUsingMediaLocator(false);
                 }
 
-                int localPort = ((MediaDescription) (call.getLocalSdpDescription().getMediaDescriptions(true).get(0))).getMedia().getMediaPort();
-
-                AudioMediaSession audioMediaSession = mediaManager.createAudioMediaSession(call.getRemoteSdpDescription().toString(), localPort);
+                int localAudioPort = -1;
+                int localVideoPort = -1;
+                
+               
+                Vector<MediaDescription> mediaDescriptions = call.getLocalSdpDescription().getMediaDescriptions(true);
+                for (MediaDescription mediaDescription : mediaDescriptions)
+                {
+                	if (mediaDescription.getMedia().getMediaType().equals("audio"))
+                		localAudioPort = mediaDescription.getMedia().getMediaPort();
+                	else if (mediaDescription.getMedia().getMediaType().equals("video"))
+                		localVideoPort = mediaDescription.getMedia().getMediaPort();
+                }
+                
+                AudioMediaSession audioMediaSession = mediaManager.createAudioMediaSession(call.getRemoteSdpDescription().toString(), localAudioPort);                
                 call.setAudioMediaSession(audioMediaSession);
 
                 if (audioMediaSession != null) {
                     audioMediaSession.startTrasmit();
                     audioMediaSession.startReceive();
                 }
+                
+                // If remote client have video
+                if (localVideoPort > 0)
+                {
+                	System.out.println("Port:" + localVideoPort);
+                	if (SettingsManager.getLocalPreferences().getVideoDevice() != null)
+                	{
+		                VideoMediaSession videoMediaSession = mediaManager.createVideoMediaSession(call.getRemoteSdpDescription().toString(), localVideoPort);
+		                if (videoMediaSession != null) {
+		                	videoMediaSession.startTrasmit();
+		                	videoMediaSession.startReceive();
+		                }
+                	}
+                }
 
+                
                 evt.getSourceCall().start();
-
+                
                 Log.debug("MEDIA STREAMS OPENED");
 
             } else if (evt.getNewState() == Call.RINGING) {
Index: src/plugins/sip/src/java/net/java/sipmack/sip/security/SipSecurityException.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/security/SipSecurityException.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/security/SipSecurityException.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.security;
 
 /**
@@ -66,8 +17,9 @@
  * @version 1.0
  */
 public class SipSecurityException extends Exception {
+	private static final long serialVersionUID = 3158525577631441256L;
 
-    public SipSecurityException() {
+	public SipSecurityException() {
 
         this("SipSecurityException");
     }
Index: src/plugins/sip/src/java/net/java/sipmack/media/VideoReceiver.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/VideoReceiver.java	(revision 0)
+++ src/plugins/sip/src/java/net/java/sipmack/media/VideoReceiver.java	(revision 0)
@@ -0,0 +1,181 @@
+/**
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2009 Jive Software. All rights reserved.
+ *
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
+ */
+
+package net.java.sipmack.media;
+
+import java.awt.Color;
+import java.awt.Component;
+
+import javax.media.ControllerErrorEvent;
+import javax.media.ControllerEvent;
+import javax.media.ControllerListener;
+import javax.media.Player;
+import javax.media.RealizeCompleteEvent;
+import javax.media.protocol.DataSource;
+import javax.media.rtp.Participant;
+import javax.media.rtp.RTPControl;
+import javax.media.rtp.ReceiveStream;
+import javax.media.rtp.ReceiveStreamListener;
+import javax.media.rtp.SessionListener;
+import javax.media.rtp.event.ByeEvent;
+import javax.media.rtp.event.NewParticipantEvent;
+import javax.media.rtp.event.NewReceiveStreamEvent;
+import javax.media.rtp.event.ReceiveStreamEvent;
+import javax.media.rtp.event.RemotePayloadChangeEvent;
+import javax.media.rtp.event.SessionEvent;
+import javax.media.rtp.event.StreamMappedEvent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+/**
+ * This class implements receive methods and listeners to be used in VideoChannel
+ *
+ * @author Thiago Camargo 
+ */
+public class VideoReceiver implements ReceiveStreamListener, SessionListener,
+        ControllerListener {
+
+    boolean dataReceived = false;
+
+    Object dataSync;
+
+    public VideoReceiver(Object dataSync) {
+        this.dataSync = dataSync;
+    }
+
+    /**
+     * JingleSessionListener.
+     */
+    public synchronized void update(SessionEvent evt) {
+        if (evt instanceof NewParticipantEvent) {
+            Participant p = ((NewParticipantEvent) evt).getParticipant();
+            System.err.println("  - A new participant had just joined: " + p.getCNAME());
+        }
+    }
+
+    /**
+     * ReceiveStreamListener
+     */
+    public synchronized void update(ReceiveStreamEvent evt) {
+
+        Participant participant = evt.getParticipant();    // could be null.
+        ReceiveStream stream = evt.getReceiveStream();  // could be null.
+        
+        if (evt instanceof RemotePayloadChangeEvent) {
+
+            System.err.println("  - Received an RTP PayloadChangeEvent.");
+            System.err.println("Sorry, cannot handle payload change.");
+            // System.exit(0);
+
+        } else if (evt instanceof NewReceiveStreamEvent) {
+
+            try {
+                stream = ((NewReceiveStreamEvent) evt).getReceiveStream();
+                DataSource ds = stream.getDataSource();
+
+                System.out.println("DataSource:" + ds);
+                
+                // Find out the formats.
+                RTPControl ctl = (RTPControl) ds.getControl("javax.jmf.rtp.RTPControl");
+                if (ctl != null) {
+                    System.err.println("  - Recevied new RTP stream: " + ctl.getFormat());
+                } else
+                    System.err.println("  - Recevied new RTP stream");
+
+                if (participant == null)
+                    System.err.println("      The sender of this stream had yet to be identified.");
+                else {
+                    System.err.println("      The stream comes from: " + participant.getCNAME());
+                }
+
+                // create a player by passing datasource to the Media Manager
+                Player p = javax.media.Manager.createPlayer(ds);
+                if (p == null)
+                    return;
+                
+                p.addControllerListener(this);
+                p.realize();	
+  
+                // Notify intialize() that a new stream had arrived.
+                synchronized (dataSync) {
+                    dataReceived = true;
+                    dataSync.notifyAll();
+                }
+
+                
+                
+                System.out.println("Start2");
+                
+            } catch (Exception e) {
+                System.err.println("NewReceiveStreamEvent exception " + e.getMessage());
+                return;
+            }
+
+        } else if (evt instanceof StreamMappedEvent) {
+
+            if (stream != null && stream.getDataSource() != null) {
+                DataSource ds = stream.getDataSource();
+                // Find out the formats.
+                RTPControl ctl = (RTPControl) ds.getControl("javax.jmf.rtp.RTPControl");
+                System.err.println("  - The previously unidentified stream ");
+                if (ctl != null)
+                    System.err.println("      " + ctl.getFormat());
+                System.err.println("      had now been identified as sent by: " + participant.getCNAME());
+            }
+        } else if (evt instanceof ByeEvent) {
+
+            System.err.println("  - Got \"bye\" from: " + participant.getCNAME());
+
+        }
+
+    }
+
+    /**
+     * ControllerListener for the Players.
+     */
+    public synchronized void controllerUpdate(ControllerEvent ce) {
+
+        Player p = (Player) ce.getSourceController();
+
+        if (p == null)
+            return;
+
+        // Get this when the internal players are realized.
+        if (ce instanceof RealizeCompleteEvent) {
+            p.start();
+            
+            Component vc = p.getVisualComponent();
+            System.out.println("Start1.1" + vc);
+            if ( null != vc )
+            {
+                System.out.println("### visual component is " + vc);
+
+                JFrame aFrame = new JFrame("Video Frame");
+                JPanel aPanel = new JPanel();
+                aPanel.setBounds(0, 0, 176, 144);
+                aPanel.add(vc);
+                aFrame.add(aPanel);
+
+                aPanel.setBackground(Color.gray);
+
+                vc.setVisible(true);
+                aPanel.setVisible(true);
+                aFrame.setVisible(true);
+                aFrame.pack();
+            }
+        }
+
+        if (ce instanceof ControllerErrorEvent) {
+            p.removeControllerListener(this);
+            System.err.println("Receiver internal error: " + ce);
+        }
+
+    }
+}
Index: src/plugins/sip/src/java/net/java/sipmack/sip/CallProcessing.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/CallProcessing.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/CallProcessing.java	(working copy)
@@ -1,68 +1,18 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 import gov.nist.javax.sip.header.CSeq;
-import gov.nist.javax.sip.header.Via;
-import gov.nist.javax.sip.message.SIPRequest;
-import net.java.sipmack.common.Log;
-import net.java.sipmack.sip.security.SipSecurityException;
+
+import java.text.ParseException;
+import java.util.ArrayList;
 
 import javax.sip.ClientTransaction;
 import javax.sip.Dialog;
@@ -74,12 +24,21 @@
 import javax.sip.address.Address;
 import javax.sip.address.SipURI;
 import javax.sip.address.URI;
-import javax.sip.header.*;
+import javax.sip.header.AllowHeader;
+import javax.sip.header.CSeqHeader;
+import javax.sip.header.CallIdHeader;
+import javax.sip.header.ContactHeader;
+import javax.sip.header.ContentLengthHeader;
+import javax.sip.header.ContentTypeHeader;
+import javax.sip.header.FromHeader;
+import javax.sip.header.MaxForwardsHeader;
+import javax.sip.header.ToHeader;
+import javax.sip.header.ViaHeader;
 import javax.sip.message.Request;
 import javax.sip.message.Response;
 
-import java.text.ParseException;
-import java.util.ArrayList;
+import net.java.sipmack.common.Log;
+import net.java.sipmack.sip.security.SipSecurityException;
 
 import org.jivesoftware.spark.phone.PhoneManager;
 
@@ -278,8 +237,6 @@
     void processAuthenticationChallenge(ClientTransaction clientTransaction,
                                         Response response) {
         try {
-            Request challengedRequest = clientTransaction.getRequest();
-
             ClientTransaction retryTran = sipManCallback.sipSecurityManager
                     .handleChallenge(response, clientTransaction);
             // There is a new dialog that will be started with this request. Get
Index: src/plugins/sip/src/java/net/java/sipmack/sip/SipCommRouter.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/SipCommRouter.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/SipCommRouter.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 import net.java.sipmack.common.Log;
@@ -122,13 +73,13 @@
      *
      * @param sipRequest is the sip request to route.
      */
-    public ListIterator getNextHops(Request sipRequest) {
+    public ListIterator<Hop> getNextHops(Request sipRequest) {
 
         URI requestURI = sipRequest.getRequestURI();
         if (requestURI == null) {
             throw new IllegalArgumentException("Bad message: Null requestURI");
         }
-        LinkedList hops = new LinkedList();
+        LinkedList<Hop> hops = new LinkedList<Hop>();
         if (outboundProxy != null) {
             hops.add(outboundProxy);
         }
Index: src/plugins/sip/src/java/net/java/sipmack/sip/SipCommHop.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/SipCommHop.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/SipCommHop.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
 import net.java.sipmack.common.Log;
Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioMediaSession.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/AudioMediaSession.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/AudioMediaSession.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
@@ -10,14 +10,16 @@
 
 package net.java.sipmack.media;
 
-import org.jivesoftware.spark.phone.PhoneManager;
-
-import javax.media.MediaLocator;
-import javax.media.rtp.ReceiveStreamListener;
-import javax.media.format.AudioFormat;
 import java.io.IOException;
 import java.net.ServerSocket;
 
+import javax.media.format.AudioFormat;
+import javax.media.rtp.ReceiveStreamListener;
+
+import org.jivesoftware.spark.phone.PhoneManager;
+import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
+
+
 /**
  * This Class implements a complete JingleMediaSession.
  * It sould be used to transmit and receive audio captured from the Mic.
@@ -30,9 +32,8 @@
  */
 public class AudioMediaSession {
 
-    private AudioFormat format;
     private AudioChannel audioChannel;
-    private String locator = "dsound://";
+    private String locator = "javasound://";
     // AudioFormat of the Session
     private AudioFormat audioFormat;
     // Local Transport details
@@ -49,7 +50,7 @@
      */
     public AudioMediaSession(final AudioFormat audioFormat, final TransportCandidate remote,
                              final TransportCandidate local) {
-        this(audioFormat, remote, local, "dsound://");
+        this(audioFormat, remote, local, SettingsManager.getLocalPreferences().getAudioDevice());
     }
 
     /**
@@ -66,6 +67,7 @@
         this.audioFormat = audioFormat;
         if (locator != null && !locator.equals(""))
             this.locator = locator;
+        
         initialize();
     }
 
Index: src/plugins/sip/src/java/net/java/sipmack/media/VideoChannel.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/VideoChannel.java	(revision 0)
+++ src/plugins/sip/src/java/net/java/sipmack/media/VideoChannel.java	(revision 0)
@@ -0,0 +1,547 @@
+/**
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2009 Jive Software. All rights reserved.
+ *
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
+ */
+package net.java.sipmack.media;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import javax.media.CaptureDeviceInfo;
+import javax.media.CaptureDeviceManager;
+import javax.media.Controller;
+import javax.media.ControllerClosedEvent;
+import javax.media.ControllerEvent;
+import javax.media.ControllerListener;
+import javax.media.Format;
+import javax.media.MediaLocator;
+import javax.media.NoDataSourceException;
+import javax.media.NoProcessorException;
+import javax.media.PlugInManager;
+import javax.media.Processor;
+import javax.media.control.BufferControl;
+import javax.media.control.PacketSizeControl;
+import javax.media.control.TrackControl;
+import javax.media.format.AudioFormat;
+import javax.media.format.VideoFormat;
+import javax.media.protocol.ContentDescriptor;
+import javax.media.protocol.DataSource;
+import javax.media.protocol.PushBufferDataSource;
+import javax.media.protocol.PushBufferStream;
+import javax.media.rtp.RTPManager;
+import javax.media.rtp.ReceiveStreamListener;
+import javax.media.rtp.SendStream;
+import javax.media.rtp.SessionAddress;
+
+import net.java.sipmack.sip.SIPConfig;
+import net.sf.fmj.media.RegistryDefaults;
+import net.sf.fmj.media.cdp.GlobalCaptureDevicePlugger;
+import net.sf.fmj.utility.PlugInUtility;
+
+
+public class VideoChannel {
+
+    private MediaLocator locator;
+    private String localIpAddress;
+    private String ipAddress;
+    private int localPort;
+    private int portBase;
+    private Format format;
+
+    private Processor processor = null;
+    private RTPManager rtpMgrs[];
+    private DataSource dataOutput = null;
+    private VideoReceiver videoReceiver;
+
+    private List<SendStream> sendStreams = new ArrayList<SendStream>();
+
+    private List<ReceiveStreamListener> receiveListeners = new ArrayList<ReceiveStreamListener>();
+
+    private boolean started = false;
+
+    /**
+     * Creates an Audio Channel for a desired jmf locator. For instance: new MediaLocator("dsound://")
+     *
+     * @param locator
+     * @param ipAddress
+     * @param localPort
+     * @param remotePort
+     * @param format
+     */
+    public VideoChannel(MediaLocator locator,
+                        String localIpAddress,
+                        String ipAddress,
+                        int localPort,
+                        int remotePort,
+                        Format format) {
+
+        this.locator = locator;
+        this.localIpAddress = localIpAddress;
+        this.ipAddress = ipAddress;
+        this.localPort = localPort;
+        this.portBase = remotePort;
+        
+        this.format = new VideoFormat(VideoFormat.JPEG_RTP);
+        
+        
+    }
+
+    /**
+     * Starts the transmission. Returns null if transmission started ok.
+     * Otherwise it returns a string with the reason why the setup failed.
+     * Starts receive also.
+     */
+    public synchronized String start() {
+        if (started) return null;
+        started = true;
+        String result;
+
+        // Create a processor for the specified jmf locator
+        result = createProcessor();
+        if (result != null) {
+            started = false;
+            return result;
+        }
+
+        // Create an RTP session to transmit the output of the
+        // processor to the specified IP address and port no.
+        result = createTransmitter();
+        if (result != null) {
+            processor.close();
+            processor = null;
+            started = false;
+            return result;
+        }
+
+        // Start the transmission
+        processor.start();
+
+        return null;
+    }
+
+    /**
+     * Add Receive Listeners. It monitors RTCP packets and signalling.
+     *
+     * @param listener listener to add
+     */
+    public void addReceiverListener(ReceiveStreamListener listener) {
+        this.receiveListeners.add(listener);
+        for (int i = 0; i < rtpMgrs.length; i++) {
+            rtpMgrs[i].addReceiveStreamListener(listener);
+        }
+    }
+
+    /**
+     * Removes Receive Listener.
+     *
+     * @param listener listener to remove
+     */
+    public void removeReceiverListener(ReceiveStreamListener listener) {
+        this.receiveListeners.remove(listener);
+        for (int i = 0; i < rtpMgrs.length; i++) {
+            rtpMgrs[i].removeReceiveStreamListener(listener);
+        }
+    }
+
+    /**
+     * Removes All Receive Listeners.
+     */
+    private void remevoAllReceiverListener() {
+        for (ReceiveStreamListener listener : receiveListeners) {
+            for (int i = 0; i < rtpMgrs.length; i++) {
+                rtpMgrs[i].removeReceiveStreamListener(listener);
+            }
+        }
+        this.receiveListeners.clear();
+    }
+
+    /**
+     * Stops the transmission if already started.
+     * Stops the receiver also.
+     */
+    public void stop() {
+        if (!started) return;
+        synchronized (this) {
+            try {
+                started = false;
+
+                remevoAllReceiverListener();
+
+                if (processor != null) {
+                    processor.stop();
+                    processor = null;
+
+                    for (int i = 0; i < rtpMgrs.length; i++) {
+                        rtpMgrs[i].removeReceiveStreamListener(videoReceiver);
+                        rtpMgrs[i].removeSessionListener(videoReceiver);
+                        rtpMgrs[i].removeTargets("Session ended.");
+                        rtpMgrs[i].dispose();
+                    }
+
+                    sendStreams.clear();
+
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        System.err.println("RTP Transmission Stopped.");
+    }
+
+    /**
+     * Creates a JMF media PRocessor
+     *
+     * @return
+     */
+    private String createProcessor() {
+        if (locator == null)
+            return "Locator is null";
+
+        
+        System.out.println("CREATE PROCESSOR:" + locator);
+        
+        // Try to create a processor to handle the input jmf locator
+        try {
+            try {
+				processor = javax.media.Manager.createProcessor( javax.media.Manager.createDataSource(locator));
+			} catch (NoDataSourceException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+        } catch (NoProcessorException npe) {
+            npe.printStackTrace();
+            return "Couldn't create processor";
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+            return "IOException creating processor";
+        }
+
+        // Wait for it to configure
+        boolean result = waitForState(processor, Processor.Configured);
+        if (result == false)
+            return "Couldn't configure processor";
+
+        // Get the tracks from the processor
+        TrackControl[] tracks = processor.getTrackControls();
+
+        // Do we have atleast one track?
+        if (tracks == null || tracks.length < 1)
+            return "Couldn't find tracks in processor";
+
+        // Set the output content descriptor to RAW_RTP
+        // This will limit the supported formats reported from
+        // Track.getSupportedFormats to only valid RTP formats.
+        ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
+        processor.setContentDescriptor(cd);
+
+        Format supported[];
+        Format chosen = null;
+        boolean atLeastOneTrack = false;
+
+        // Program the tracks.
+        for (int i = 0; i < tracks.length; i++) {
+            if (tracks[i].isEnabled()) {
+            	
+                supported = tracks[i].getSupportedFormats();                
+               
+                if (supported.length > 0) {
+                    for (Format format : supported) {
+                        if (format instanceof VideoFormat) {
+                        	System.out.println(format);
+                            if (this.format.matches(format))
+                                chosen = format;
+                        }
+                    }
+                
+                    if (chosen != null) {
+                        tracks[i].setFormat(chosen);
+                        System.err.println("Track " + i + " is set to transmit as:");
+                        System.err.println("  " + chosen);
+
+                        if (tracks[i].getFormat() instanceof AudioFormat) {
+                            int packetRate = 20;
+                            PacketSizeControl pktCtrl = (PacketSizeControl) processor.getControl(PacketSizeControl.class.getName());
+                            if (pktCtrl != null) {
+                                try {
+                                    pktCtrl.setPacketSize(getPacketSize(tracks[i].getFormat(), packetRate));
+                                } catch (IllegalArgumentException e) {
+                                    pktCtrl.setPacketSize(160);
+                                    // Do nothing
+                                }
+                            }
+                        }
+
+                        atLeastOneTrack = true;
+                    } else
+                        tracks[i].setEnabled(false);
+                } else
+                    tracks[i].setEnabled(false);
+            }
+        }
+
+        if (!atLeastOneTrack)
+            return "Couldn't set any of the tracks to a valid RTP format";
+
+        result = waitForState(processor, Controller.Realized);
+        if (result == false)
+            return "Couldn't realize processor";
+
+        // Get the output data source of the processor
+        dataOutput = processor.getDataOutput();
+
+        return null;
+    }
+
+    /**
+     * Get the best packet size for a given codec and a codec rate
+     *
+     * @param codecFormat
+     * @param milliseconds
+     * @return
+     * @throws IllegalArgumentException
+     */
+    private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException {
+        String encoding = codecFormat.getEncoding();
+        if (encoding.equalsIgnoreCase(AudioFormat.G729) ||
+                encoding.equalsIgnoreCase(AudioFormat.G729_RTP)) {
+            return milliseconds * 1; // 1 byte per millisec
+        } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) ||
+                encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) {
+            return milliseconds * 8;
+        } else {
+            throw new IllegalArgumentException("Unknown codec type");
+        }
+    }
+
+    /**
+     * Use the RTPManager API to create sessions for each jmf
+     * track of the processor.
+     */
+    private String createTransmitter() {
+
+        // Cheated.  Should have checked the type.
+        PushBufferDataSource pbds = (PushBufferDataSource) dataOutput;
+        PushBufferStream pbss[] = pbds.getStreams();
+
+        rtpMgrs = new RTPManager[pbss.length];
+        SessionAddress localAddr, destAddr;
+        InetAddress ipAddr;
+        SendStream sendStream;
+
+        videoReceiver = new VideoReceiver(this);
+
+        int port;
+
+        for (int i = 0; i < pbss.length; i++) {
+            try {
+                rtpMgrs[i] = RTPManager.newInstance();
+
+                port = portBase + 2 * i;
+                ipAddr = InetAddress.getByName(ipAddress);
+
+                localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress),
+                        localPort);
+
+                destAddr = new SessionAddress(ipAddr, port);
+
+                rtpMgrs[i].addReceiveStreamListener(videoReceiver);
+                rtpMgrs[i].addSessionListener(videoReceiver);
+
+                BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl");
+                if (bc != null) {
+                    int bl = 125;
+                    bl = SIPConfig.getDefaultBufferLength() != -1 ? SIPConfig.getDefaultBufferLength()
+                            : bl;
+
+                    bc.setBufferLength(bl);
+                }
+
+                rtpMgrs[i].initialize(localAddr);
+                rtpMgrs[i].addTarget(destAddr);
+
+                System.err.println("Created RTP session at " + localPort + " to: " + ipAddress + " " + port);
+
+                sendStream = rtpMgrs[i].createSendStream(dataOutput, i);
+
+                sendStreams.add(sendStream);
+
+                sendStream.start();
+
+            } catch (Exception e) {
+                e.printStackTrace();
+                return e.getMessage();
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Set transmit activity. If the active is true, the instance should trasmit.
+     * If it is set to false, the instance should pause transmit.
+     *
+     * @param active
+     */
+    public void setTrasmit(boolean active) {
+        for (SendStream sendStream : sendStreams) {
+            try {
+                if (active) {
+                    sendStream.start();
+                    System.out.println("START");
+                } else {
+                    sendStream.stop();
+                    System.out.println("STOP");
+                }
+            }
+            catch (IOException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+    /**
+     * *************************************************************
+     * Convenience methods to handle processor's state changes.
+     * **************************************************************
+     */
+
+    private Integer stateLock = new Integer(0);
+    private boolean failed = false;
+
+    Integer getStateLock() {
+        return stateLock;
+    }
+
+    void setFailed() {
+        failed = true;
+    }
+
+    private synchronized boolean waitForState(Processor p, int state) {
+        p.addControllerListener(new StateListener());
+        failed = false;
+
+        // Call the required method on the processor
+        if (state == Processor.Configured) {
+            p.configure();
+        } else if (state == Processor.Realized) {
+            p.realize();
+        }
+
+        // Wait until we get an event that confirms the
+        // success of the method, or a failure event.
+        // See StateListener inner class
+        while (p.getState() < state && !failed) {
+            synchronized (getStateLock()) {
+                try {
+                    getStateLock().wait();
+                } catch (InterruptedException ie) {
+                    return false;
+                }
+            }
+        }
+
+        if (failed)
+            return false;
+        else
+            return true;
+    }
+
+    /**
+     * *************************************************************
+     * Inner Classes
+     * **************************************************************
+     */
+
+    class StateListener implements ControllerListener {
+
+        public void controllerUpdate(ControllerEvent ce) {
+
+            // If there was an error during configure or
+            // realize, the processor will be closed
+            if (ce instanceof ControllerClosedEvent)
+                setFailed();
+
+            // All controller events, send a notification
+            // to the waiting thread in waitForState method.
+            if (ce instanceof ControllerEvent) {
+                synchronized (getStateLock()) {
+                    getStateLock().notifyAll();
+                }
+            }
+        }
+    }
+
+    public static void main(String args[]) {
+
+        InetAddress localhost;
+        try {
+    		// FMJ
+    		RegistryDefaults.registerAll(RegistryDefaults.FMJ | RegistryDefaults.FMJ_NATIVE );
+    		//PlugInManager.addPlugIn(, in, out, type)
+
+    		// Add Device
+    		GlobalCaptureDevicePlugger.addCaptureDevices();
+    		
+    		// LOG ALL Devices
+    		final Vector<CaptureDeviceInfo> vectorDevices = CaptureDeviceManager.getDeviceList(null);
+    		for ( CaptureDeviceInfo infoCaptureDevice : vectorDevices )
+    		{
+    			System.err.println("===========> " + infoCaptureDevice.getName());
+    			for (Format format : infoCaptureDevice.getFormats())
+    			{
+    				System.err.println(format);
+    			}		
+    		}
+        	
+        	
+            localhost = InetAddress.getLocalHost();
+
+            VideoChannel videoChannel0 = new VideoChannel(new MediaLocator("civil:/dev/video0"), localhost.getHostAddress(), localhost.getHostAddress(), 7002, 7020, new VideoFormat(VideoFormat.JPEG_RTP));
+            VideoChannel videoChannel1 = new VideoChannel(new MediaLocator("civil:/dev/video1"), localhost.getHostAddress(), localhost.getHostAddress(), 7020, 7002, new VideoFormat(VideoFormat.JPEG_RTP));
+
+            videoChannel0.start();
+            videoChannel1.start();
+
+            try {
+                Thread.sleep(50000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            videoChannel0.setTrasmit(false);
+            videoChannel1.setTrasmit(false);
+
+            try {
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            videoChannel0.setTrasmit(true);
+            videoChannel1.setTrasmit(true);
+
+            try {
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            videoChannel0.stop();
+            videoChannel1.stop();
+
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+
+    }
+}
\ No newline at end of file
Index: src/plugins/sip/src/java/net/java/sipmack/media/TransportCandidate.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/TransportCandidate.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/TransportCandidate.java	(working copy)
@@ -2,22 +2,17 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.media;
 
-import org.jivesoftware.smack.XMPPConnection;
+import java.net.SocketException;
+import java.net.UnknownHostException;
 
-import java.io.IOException;
-import java.net.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.Arrays;
+import org.jivesoftware.smack.XMPPConnection;
 
 /**
  * Transport candidate.
Index: src/plugins/sip/src/java/net/java/sipmack/sip/simple/MessageProcessing.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/simple/MessageProcessing.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/simple/MessageProcessing.java	(working copy)
@@ -2,19 +2,18 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.simple;
 
-import net.java.sipmack.common.Log;
-import net.java.sipmack.sip.CommunicationsException;
-import net.java.sipmack.sip.SIPConfig;
-import net.java.sipmack.sip.SipManager;
-import net.java.sipmack.sip.security.SipSecurityException;
+import gov.nist.javax.sip.stack.SIPClientTransaction;
+
+import java.net.InetAddress;
+import java.text.ParseException;
+import java.util.ArrayList;
 
 import javax.sip.ClientTransaction;
 import javax.sip.InvalidArgumentException;
@@ -31,18 +30,15 @@
 import javax.sip.header.FromHeader;
 import javax.sip.header.MaxForwardsHeader;
 import javax.sip.header.ToHeader;
+import javax.sip.header.ViaHeader;
 import javax.sip.message.Request;
 import javax.sip.message.Response;
 
-import java.net.InetAddress;
-import java.text.ParseException;
-import java.util.ArrayList;
-
-import gov.nist.javax.sip.message.SIPRequest;
-import gov.nist.javax.sip.message.SIPMessage;
-import gov.nist.javax.sip.stack.MessageChannel;
-import gov.nist.javax.sip.stack.SIPClientTransaction;
-import gov.nist.javax.sip.ListeningPointImpl;
+import net.java.sipmack.common.Log;
+import net.java.sipmack.sip.CommunicationsException;
+import net.java.sipmack.sip.SIPConfig;
+import net.java.sipmack.sip.SipManager;
+import net.java.sipmack.sip.security.SipSecurityException;
 
 
 public class MessageProcessing {
@@ -69,10 +65,6 @@
     void processAuthenticationChallenge(ClientTransaction clientTransaction,
                                         Response response) {
         try {
-
-            Request challengedRequest = clientTransaction.getRequest();
-            Request reoriginatedRequest = null;
-
             ClientTransaction retryTran = sipManCallback.sipSecurityManager
                     .handleChallenge(response, clientTransaction);
 
@@ -230,7 +222,7 @@
             }
 
             // ViaHeaders
-            ArrayList viaHeaders = sipManCallback.getLocalViaHeaders();
+            ArrayList<ViaHeader> viaHeaders = sipManCallback.getLocalViaHeaders();
             // MaxForwards
             MaxForwardsHeader maxForwards = sipManCallback
                     .getMaxForwardsHeader();
Index: src/plugins/sip/src/java/net/java/sipmack/common/Utils.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/common/Utils.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/common/Utils.java	(working copy)
@@ -1,90 +1,19 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
 
+
 package net.java.sipmack.common;
 
 import java.io.InputStream;
 import java.net.URL;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR-1.1
- * </p>
- * <p/>
- * Description: JAIN-SIP-1.1 Audio/Video Phone Application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company: Organisation: LSIIT Laboratory (http://lsiit.u-strasbg.fr)
- * <p/>
- * </p>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * <p/>
- * </p>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov
- * @version 1.1
- */
-
 public class Utils {
 
     public static String getSystemProperty(String property) {
Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioChannel.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/AudioChannel.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/AudioChannel.java	(working copy)
@@ -2,57 +2,46 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.media;
 
-import net.java.sipmack.sip.SIPConfig;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
 
-import javax.media.*;
-import javax.media.control.TrackControl;
+import javax.media.Controller;
+import javax.media.ControllerClosedEvent;
+import javax.media.ControllerEvent;
+import javax.media.ControllerListener;
+import javax.media.Format;
+import javax.media.MediaLocator;
+import javax.media.NoProcessorException;
+import javax.media.Processor;
 import javax.media.control.BufferControl;
 import javax.media.control.PacketSizeControl;
+import javax.media.control.TrackControl;
 import javax.media.format.AudioFormat;
 import javax.media.protocol.ContentDescriptor;
 import javax.media.protocol.DataSource;
 import javax.media.protocol.PushBufferDataSource;
 import javax.media.protocol.PushBufferStream;
 import javax.media.rtp.RTPManager;
+import javax.media.rtp.ReceiveStreamListener;
 import javax.media.rtp.SendStream;
 import javax.media.rtp.SessionAddress;
-import javax.media.rtp.ReceiveStreamListener;
-import javax.media.rtp.rtcp.SourceDescription;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
 
-import org.jivesoftware.sparkimpl.plugin.phone.JMFInit;
+import net.java.sipmack.sip.SIPConfig;
+
 import org.jivesoftware.spark.phone.PhoneManager;
+import org.jivesoftware.sparkimpl.plugin.phone.JMFInit;
 
-/**
- * An Easy to use Audio Channel implemented using JMF.
- * It sends and receives jmf for and from desired IPs and ports.
- * Also has a rport Symetric behavior for better NAT Traversal.
- * It send data from a defined port and receive data in the same port, making NAT binds easier.
- * <p/>
- * Send from portA to portB and receive from portB in portA.
- * <p/>
- * Sending
- * portA ---> portB
- * <p/>
- * Receiving
- * portB ---> portA
- * <p/>
- * <i>Transmit and Receive are interdependents. To receive you MUST trasmit. </i>
- *
- * @author Thiago Camargo
- */
+
 public class AudioChannel {
 
     private MediaLocator locator;
@@ -259,6 +248,9 @@
                         System.err.println("Track " + i + " is set to transmit as:");
                         System.err.println("  " + chosen);
 
+         
+                        
+                        
                         if (tracks[i].getFormat() instanceof AudioFormat) {
                             int packetRate = 20;
                             PacketSizeControl pktCtrl = (PacketSizeControl) processor.getControl(PacketSizeControl.class.getName());
@@ -270,22 +262,24 @@
                                     // Do nothing
                                 }
                             }
+                            
 
-                            if (tracks[i].getFormat().getEncoding().equals(AudioFormat.ULAW_RTP)) {
-                                Codec codec[] = new Codec[3];
 
-                                codec[0] = new com.ibm.media.codec.audio.rc.RCModule();
-                                codec[1] = new com.ibm.media.codec.audio.ulaw.JavaEncoder();
-                                codec[2] = new com.sun.media.codec.audio.ulaw.Packetizer();
-                                ((com.sun.media.codec.audio.ulaw.Packetizer) codec
-                                        [2]).setPacketSize(160);
-
-                                try {
-                                    tracks[i].setCodecChain(codec);
-                                } catch (UnsupportedPlugInException e) {
-                                    e.printStackTrace();
-                                }
-                            }
+//                            if (tracks[i].getFormat().getEncoding().equals(AudioFormat.ULAW_RTP)) {
+//                                Codec codec[] = new Codec[3];
+//
+//                                codec[0] = new com.ibm.media.codec.audio.rc.RCModule();
+//                                codec[1] = new com.ibm.media.codec.audio.ulaw.JavaEncoder();
+//                                codec[2] = new com.sun.media.codec.audio.ulaw.Packetizer();
+//                                ((com.sun.media.codec.audio.ulaw.Packetizer) codec
+//                                        [2]).setPacketSize(160);
+//
+//                                try {
+//                                    tracks[i].setCodecChain(codec);
+//                                } catch (UnsupportedPlugInException e) {
+//                                    e.printStackTrace();
+//                                }
+//                            }
 
                         }
 
@@ -347,7 +341,6 @@
         SendStream sendStream;
         audioReceiver = new AudioReceiver(this);
         int port;
-        SourceDescription srcDesList[];
 
         for (int i = 0; i < pbss.length; i++) {
             try {
Index: src/plugins/sip/src/java/org/jivesoftware/sparkplugin/ui/components/JavaMixer.java
===================================================================
--- src/plugins/sip/src/java/org/jivesoftware/sparkplugin/ui/components/JavaMixer.java	(revision 11009)
+++ src/plugins/sip/src/java/org/jivesoftware/sparkplugin/ui/components/JavaMixer.java	(working copy)
@@ -9,21 +9,42 @@
  */
 
 package org.jivesoftware.sparkplugin.ui.components;
-import javax.sound.sampled.*;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeNode;
-import javax.swing.*;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.border.TitledBorder;
-import javax.swing.border.EtchedBorder;
-import java.util.List;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.util.ArrayList;
 import java.util.Enumeration;
-import java.awt.*;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.BooleanControl;
+import javax.sound.sampled.CompoundControl;
+import javax.sound.sampled.Control;
+import javax.sound.sampled.DataLine;
+import javax.sound.sampled.EnumControl;
+import javax.sound.sampled.FloatControl;
+import javax.sound.sampled.Line;
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.Mixer;
+import javax.sound.sampled.Port;
+import javax.swing.AbstractButton;
+import javax.swing.BoundedRangeModel;
+import javax.swing.ButtonModel;
+import javax.swing.DefaultBoundedRangeModel;
+import javax.swing.DefaultButtonModel;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JTree;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
 
 /**
  * Pure Java Audio Mixer. Control Volume and Settings for any Sound device in the OS.
@@ -149,8 +170,9 @@
     }
 
     private void createMixerChildren(JavaMixer.MixerNode mixerNode) {
-        Mixer mixer = mixerNode.getMixer();
+        Mixer mixer = mixerNode.getMixer();       
         Line.Info[] infosToCheck = getPortInfo(mixer);
+        
         for (Line.Info anInfosToCheck : infosToCheck) {
             if (mixer.isLineSupported(anInfosToCheck)) {
                 Port port = null;
@@ -172,7 +194,7 @@
                         }
                     }
                     catch (LineUnavailableException e) {
-                        e.printStackTrace();
+                        // Do Nothing
                     }
                     catch (Exception e) {
                         // Do Nothing
Index: src/plugins/sip/src/java/net/java/sipmack/sip/ErrorProcessing.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/ErrorProcessing.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/ErrorProcessing.java	(working copy)
@@ -1,82 +1,14 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR-1.1
- * </p>
- * <p/>
- * Description: JAIN-SIP-1.1 Audio/Video Phone Application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Company: Organisation: LSIIT Laboratory (http://lsiit.u-strasbg.fr) \nNetwork
- * Research Team (http://www-r2.u-strasbg.fr))\nLouis Pasteur University -
- * Strasbourg - France
- * </p>
- *
- * @author Emil Ivov
- * @version 1.1
- */
 public class ErrorProcessing {
     private SipManager sipManCallback = null;
 
@@ -90,5 +22,9 @@
     void setSipManagerCallBack(SipManager sipManCallback) {
         this.sipManCallback = sipManCallback;
     }
+    
+    public SipManager getCallback() {
+    	return sipManCallback;
+    }
 
 }
\ No newline at end of file
Index: src/plugins/sip/src/java/net/java/sipmack/media/VideoMediaSession.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/VideoMediaSession.java	(revision 0)
+++ src/plugins/sip/src/java/net/java/sipmack/media/VideoMediaSession.java	(revision 0)
@@ -0,0 +1,229 @@
+/**
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2009 Jive Software. All rights reserved.
+ *
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
+ */
+
+package net.java.sipmack.media;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+
+import javax.media.MediaLocator;
+import javax.media.format.VideoFormat;
+import javax.media.rtp.ReceiveStreamListener;
+
+import org.jivesoftware.spark.phone.PhoneManager;
+import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
+
+/**
+ * This Class implements a complete JingleMediaSession.
+ * It sould be used to transmit and receive audio captured from the Mic.
+ * This Class should be automaticly controlled by JingleSession.
+ * But you could also use in any VOIP application.
+ * For better NAT Traversal support this implementation don�t support only receive or only transmit.
+ * To receive you MUST transmit. So the only implemented and functionally methods are startTransmit() and stopTransmit()
+ *
+ * @author Thiago Camargo
+ */
+public class VideoMediaSession {
+
+    private VideoChannel videoChannel;
+    private String locator = "civil://";
+    // AudioFormat of the Session
+    private VideoFormat videoFormat;
+    // Local Transport details
+    private TransportCandidate local;
+    // Remote Transport details
+    private TransportCandidate remote;
+
+    /**
+     * Creates a AudioMediaSession with defined payload type, remote and local candidates
+     *
+     * @param audioFormat jmf AudioFormat
+     * @param remote      The remote information. The candidate that the jmf will be sent to.
+     * @param local       The local information. The candidate that will receive the jmf
+     */
+    public VideoMediaSession(final VideoFormat audioFormat, final TransportCandidate remote,
+                             final TransportCandidate local) {
+        this(audioFormat, remote, local, SettingsManager.getLocalPreferences().getVideoDevice());
+    }
+
+    /**
+     * Creates a AudioMediaSession with defined payload type, remote and local candidates
+     *
+     * @param audioFormat Payload of the jmf
+     * @param remote      The remote information. The candidate that the jmf will be sent to.
+     * @param local       The local information. The candidate that will receive the jmf
+     */
+    public VideoMediaSession(final VideoFormat videoFormat, final TransportCandidate remote,
+                             final TransportCandidate local, String locator) {
+        this.local = local;
+        this.remote = remote;
+        this.videoFormat = videoFormat;
+        this.locator = locator;
+        initialize();
+    }
+
+
+    /**
+     * Returns the AudioFormat of the Media Session
+     *
+     * @return
+     */
+    public VideoFormat getVideoFormat() {
+        return videoFormat;
+    }
+
+    /**
+     * Returns the Media Session local Candidate
+     *
+     * @return
+     */
+    public TransportCandidate getLocal() {
+        return local;
+    }
+
+    /**
+     * Returns the Media Session remote Candidate
+     *
+     * @return
+     */
+    public TransportCandidate getRemote() {
+        return remote;
+    }
+
+    /**
+     * Initialize the Audio Channel to make it able to send and receive audio
+     */
+    public void initialize() {
+
+        String ip;
+        String localIp;
+        int localPort;
+        int remotePort;
+
+        if (this.getLocal().getSymmetric() != null) {
+            ip = this.getLocal().getIp();
+            localIp = this.getLocal().getLocalIp();
+            localPort = getFreePort();
+            remotePort = this.getLocal().getSymmetric().getPort();
+
+            System.out.println(this.getLocal().getConnection() + " " + ip + ": " + localPort + "->" + remotePort);
+
+        } else {
+            ip = this.getRemote().getIp();
+            localIp = this.getLocal().getLocalIp();
+            localPort = this.getLocal().getPort();
+            remotePort = this.getRemote().getPort();
+        }
+
+        videoChannel = new VideoChannel(new MediaLocator(locator), localIp, ip, localPort, remotePort, videoFormat);
+    }
+
+    /**
+     * Add Receive Listeners. It monitors RTCP packets and signalling.
+     *
+     * @param listener listener to add
+     */
+    public void addReceiverListener(ReceiveStreamListener listener) {
+    	videoChannel.addReceiverListener(listener);
+    }
+
+    /**
+     * Removes Receive Listener.
+     *
+     * @param listener listener to remove
+     */
+    public void removeReceiverListener(ReceiveStreamListener listener) {
+    	videoChannel.removeReceiverListener(listener);
+    }
+
+    /**
+     * Starts transmission and for NAT Traversal reasons start receiving also.
+     */
+    public void startTrasmit() {
+    	videoChannel.start();
+    }
+
+    /**
+     * Set transmit activity. If the active is true, the instance should trasmit.
+     * If it is set to false, the instance should pause transmit.
+     *
+     * @param active
+     */
+    public void setTrasmit(boolean active) {
+    	videoChannel.setTrasmit(active);
+    }
+
+    /**
+     * For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf
+     */
+    public void startReceive() {
+        // Do nothing
+    }
+
+    /**
+     * Stops transmission and for NAT Traversal reasons stop receiving also.
+     */
+    public void stopTrasmit() {
+        if (videoChannel != null)
+        	videoChannel.stop();
+    }
+
+    /**
+     * For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf
+     */
+    public void stopReceive() {
+        // Do nothing
+    }
+
+    /**
+     * Closes and finalizes the session.
+     * Very important to release static MediaLocator.
+     */
+    public void close(){
+
+        stopTrasmit();
+        stopReceive();
+        PhoneManager.setUsingMediaLocator(false);
+
+    }
+
+    /**
+     * Obtain a free port we can use.
+     *
+     * @return A free port number.
+     */
+    protected int getFreePort() {
+        ServerSocket ss;
+        int freePort = 0;
+
+        for (int i = 0; i < 10; i++) {
+            freePort = (int) (10000 + Math.round(Math.random() * 10000));
+            freePort = freePort % 2 == 0 ? freePort : freePort + 1;
+            try {
+                ss = new ServerSocket(freePort);
+                freePort = ss.getLocalPort();
+                ss.close();
+                return freePort;
+            }
+            catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        try {
+            ss = new ServerSocket(0);
+            freePort = ss.getLocalPort();
+            ss.close();
+        }
+        catch (IOException e) {
+            e.printStackTrace();
+        }
+        return freePort;
+    }
+}
Index: src/plugins/sip/src/java/net/java/sipmack/sip/security/SecurityAuthority.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/security/SecurityAuthority.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/security/SecurityAuthority.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.security;
 
 /**
Index: src/plugins/sip/src/java/net/java/sipmack/events/UserActionListener.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/events/UserActionListener.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/events/UserActionListener.java	(working copy)
@@ -1,34 +1,21 @@
+/**
+ * $Revision: $
+ * $Date: $
+ *
+ * Copyright (C) 2009 Jive Software. All rights reserved.
+ *
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
+ */
 package net.java.sipmack.events;
 
+import java.util.EventListener;
+
 import net.java.sipmack.media.MediaException;
 import net.java.sipmack.sip.Interlocutor;
 import net.java.sipmack.sip.InterlocutorUI;
 
-/**
- * <p/>
- * Title: SIP COMMUNICATOR
- * </p>
- * <p/>
- * Description:JAIN-SIP Audio/Video phone application
- * </p>
- * <p/>
- * Copyright: Copyright (c) 2003
- * </p>
- * <p/>
- * Organisation: LSIIT laboratory (http://lsiit.u-strasbg.fr)
- * </p>
- * <p/>
- * Network Research Team (http://www-r2.u-strasbg.fr))
- * </p>
- * <p/>
- * Louis Pasteur University - Strasbourg - France
- * </p>
- *
- * @author Emil Ivov (http://www.emcho.com)
- * @version 1.1
- */
-
-public interface UserActionListener extends java.util.EventListener {
+public interface UserActionListener extends EventListener {
 
     public void createSoftPhone(String server) throws MediaException;
 
Index: src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java
===================================================================
--- src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java	(revision 11009)
+++ src/java/org/jivesoftware/sparkimpl/settings/local/LocalPreferences.java	(working copy)
@@ -801,6 +801,22 @@
 		return getBoolean("showVCards", true);
 	}
 
+	public void setAudioDevice(String device) {
+		 props.setProperty("audioDevice", device);
+	}
+	
+	public String getAudioDevice() {
+		return props.getProperty("audioDevice","javasound://");
+	}
+	
+	public void setVideoDevice(String device) {
+		 props.setProperty("videoDevice", device);
+	}
+	
+	public String getVideoDevice() {
+		return props.getProperty("videoDevice",null);
+	}
+	
 	private boolean getBoolean(String property, boolean defaultValue) {
 		return Boolean.parseBoolean(props.getProperty(property, Boolean
 				.toString(defaultValue)));
Index: src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiverChannel.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiverChannel.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/media/AudioReceiverChannel.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
@@ -10,26 +10,13 @@
 
 package net.java.sipmack.media;
 
-import net.java.sipmack.sip.SIPConfig;
+import java.net.InetAddress;
 
-import javax.media.*;
-import javax.media.format.AudioFormat;
-import javax.media.control.TrackControl;
-import javax.media.control.PacketSizeControl;
 import javax.media.control.BufferControl;
-import javax.media.protocol.DataSource;
-import javax.media.protocol.ContentDescriptor;
-import javax.media.protocol.PushBufferDataSource;
-import javax.media.protocol.PushBufferStream;
 import javax.media.rtp.RTPManager;
-import javax.media.rtp.SendStream;
 import javax.media.rtp.SessionAddress;
-import javax.media.rtp.rtcp.SourceDescription;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
+
+import net.java.sipmack.sip.SIPConfig;
 
 /**
  * An Easy to use Audio Channel implemented using JMF.
@@ -130,11 +117,7 @@
 
         rtpMgrs = new RTPManager[1];
         SessionAddress localAddr, destAddr;
-        InetAddress ipAddr;
-        SendStream sendStream;
         audioReceiver = new AudioReceiver(this);
-        int port;
-        SourceDescription srcDesList[];
 
         for (int i = 0; i < 3; i++) {
             try {
Index: src/plugins/sip/src/java/net/java/sipmack/sip/event/RegistrationEvent.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/event/RegistrationEvent.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/event/RegistrationEvent.java	(working copy)
@@ -2,7 +2,7 @@
  * $Revision: $
  * $Date: $
  *
- * Copyright (C) 2007 Jive Software. All rights reserved.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
  * This software is published under the terms of the GNU Lesser Public License (LGPL),
  * a copy of which is included in this distribution.
@@ -12,16 +12,10 @@
 
 import java.util.EventObject;
 
-/**
- * Title: SIP Register Tester
- * Description:JAIN-SIP Test application
- *
- * @author Thiago Rocha Camargo (thiago@jivesoftware.com)
- */
-
 public class RegistrationEvent extends EventObject {
+	private static final long serialVersionUID = 6759871915588020048L;
 
-    public enum Type {
+	public enum Type {
         Normal, WrongPass, NotFound, Forbidden, WrongAuthUser, TimeOut
     };
 
Index: src/plugins/sip/src/java/net/java/sipmack/sip/simple/ContactUri.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/simple/ContactUri.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/simple/ContactUri.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.simple;
 
 /**
Index: src/plugins/sip/src/java/net/java/sipmack/sip/simple/GenericURI.java
===================================================================
--- src/plugins/sip/src/java/net/java/sipmack/sip/simple/GenericURI.java	(revision 11009)
+++ src/plugins/sip/src/java/net/java/sipmack/sip/simple/GenericURI.java	(working copy)
@@ -1,61 +1,12 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:
- *       "This product includes software developed by the
- *        Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself,
- *    if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written
- *    permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- *    nor may "Apache" appear in their name, without prior written
- *    permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
+/**
+ * $Revision: $
+ * $Date: $
  *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation.  For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
+ * Copyright (C) 2009 Jive Software. All rights reserved.
  *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
+ * This software is published under the terms of the GNU Lesser Public License (LGPL),
+ * a copy of which is included in this distribution.
  */
-
 package net.java.sipmack.sip.simple;
 
 /**
