[sip-comm-dev] Re: svn commit: r7048 - trunk/src/net/java/sip/communicator: impl/neomedia impl/neomedia/transform/zrtp impl/protocol/sip service/neomedia


#1

Hi Damian,

see some comments/questions inline please.

Regards,
Werner

Author: damencho
Date: 2010-04-28 12:54:46+0000
New Revision: 7048

Modified:
   trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java
   trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java
   trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java
   trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java
   trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java

Log:
Fix secure conference call and participants loosing audio if in secure call.

Modified: trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java&p2=trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java 2010-04-28 12:54:46+0000
@@ -880,6 +880,42 @@
     }

     /**
+ * Resets the state of secure communication and restart the secure
+ * communication negotiation.
+ * @return the newly created <tt>ZrtpControl</tt>.
+ */
+ public ZrtpControl restartZrtpControl()
+ {
+ ZrtpControlImpl oldZrtpControl = zrtpControl;
+
+ this.zrtpControl = new ZrtpControlImpl();
+
+ // as we are recreating this stream and it was obviously secured
+ // it may happen we receive unencrepted data and we will hear
+ // noise, so we mute it till secure connection is again established
+ zrtpControl.getZrtpEngine().setStartMuted(true);
+
+ this.zrtpControl.setConnector(rtpConnector);
+ rtpConnector.setEngine(createTransformEngineChain());
+
+ if(oldZrtpControl != null)
+ {

Why do you copy over the multi-stram parameters from the old ZRTP to the new one?
You close the old ZRTP engine and return the new ZrtpControl. Using this new
control a new ZRTP session is set up. Is this understanding correct?
If yoes - then don't copy over multi-stream parameters. Multi-stream will be used
only in case you add a video session to an existing audio session. Do we implement
video conferencing :slight_smile: ?

In ZrtpControl you buffer the multi-stream data - there is no reason to do this.
If SC start a video session then the info callback takes care to initialize the
multi-stream data vor the video stream.

···

Am 28.04.2010 14:54, schrieb damencho@dev.java.net:

+ if(oldZrtpControl.getMultiStrParams() != null)
+ zrtpControl.setMultistream(oldZrtpControl.getMultiStrParams());
+
+ ZRTPTransformEngine engine = oldZrtpControl.getZrtpEngine();
+
+ if(engine != null)
+ {
+ engine.stopZrtp();
+ engine.cleanup();
+ }
+ }
+
+ return zrtpControl;
+ }
+
+ /**
      * Determines whether this <tt>MediaStream</tt> is set to transmit "silence"
      * instead of the media being fed from its <tt>MediaDevice</tt>. "Silence"
      * for video is understood as video data which is not the captured video

Modified: trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java&p2=trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java 2010-04-28 12:54:46+0000
@@ -28,11 +28,10 @@
      */
     private ZrtpListener zrtpListener = null;

- /**
- * Toggles default (from the call start) activation
- * of secure communication
- */
- private boolean usingZRTP = false;
+ /**
+ * The current multi-stream data if any.
+ */
+ private byte[] multiStreamData = null;

     /**
      * Additional info codes for and data to support ZRTP4J.
@@ -93,7 +92,10 @@
      */
     public boolean getSecureCommunicationStatus()
     {
- return usingZRTP;
+ if(zrtpEngine != null)
+ return zrtpEngine.getSecureCommunicationStatus();
+ else
+ return false;
     }

     /**
@@ -137,14 +139,15 @@
      */
     public void start(boolean masterSession)
     {
- usingZRTP = true;
-
         // Create security user callback for each peer.
         SecurityEventManager securityEventManager
             = new SecurityEventManager(this);

         boolean zrtpAutoStart = false;

+ // ZRTP engine initialization
+ ZRTPTransformEngine engine = getZrtpEngine();
+
         // Decide if this will become the ZRTP Master session:
         // - Statement: audio media session will be started before video
         // media session
@@ -175,19 +178,16 @@
                 SecurityEventManager.VIDEO_SESSION);
         }

- // ZRTP engine initialization
- ZRTPTransformEngine engine = getZrtpEngine();
         // tells the engine whether to autostart(enable)
         // zrtp communication, if false it just passes packets without
         // transformation
         engine.setEnableZrtp(zrtpAutoStart);

- zrtpEngine.setConnector(zrtpConnector);
+ engine.setConnector(zrtpConnector);

- zrtpEngine.setUserCallback(securityEventManager);
+ engine.setUserCallback(securityEventManager);

- usingZRTP = true;
- zrtpEngine.sendInfo(
+ engine.sendInfo(
             ZrtpCodes.MessageSeverity.Info,
             EnumSet.of(
                     ZRTPCustomInfoCodes.ZRTPEnabledByDefault));
@@ -204,12 +204,20 @@
      */
     public void setMultistream(byte[] multiStreamData)
     {
- if(usingZRTP)
- {
- ZRTPTransformEngine engine = getZrtpEngine();
- engine.setMultiStrParams(multiStreamData);
- engine.setEnableZrtp(true);
- }
+ ZRTPTransformEngine engine = getZrtpEngine();
+ this.multiStreamData = multiStreamData;
+ engine.setMultiStrParams(multiStreamData);
+ engine.setEnableZrtp(true);
+ }
+
+ /**
+ * Gets the multistream params
+ *
+ * @return the multistream params
+ */
+ public byte[] getMultiStrParams()
+ {
+ return multiStreamData;
     }

     /**

Modified: trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java&p2=trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java (original)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java 2010-04-28 12:54:46+0000
@@ -18,7 +18,7 @@
import net.java.sip.communicator.util.*;

import java.io.*;
-import java.util.EnumSet;
+import java.util.*;

/**
  * JMF extension/connector to support GNU ZRTP4J.
@@ -349,6 +349,14 @@
     private boolean started = false;

     /**
+ * Sometimes we need to start muted so we will discard any packets during
+ * some time after the start of the transformer. This is needed when for
+ * this time we can receive encrypted packets but we hadn't established
+ * a secure communication. This happens when a secure stream is recreated.
+ */
+ private boolean muted = false;
+
+ /**
      * Construct a ZRTPTransformEngine.
      *
      */
@@ -506,6 +514,39 @@
     }

     /**
+ *
+ * @param startMuted whether to be started as muted if no secure
+ * communication is established
+ */
+ public void setStartMuted(boolean startMuted)
+ {
+ muted = startMuted;
+ if(startMuted)
+ {
+ // make sure we don't mute for long time as secure communication
+ // may fail.
+ new Timer().schedule(new TimerTask()
+ {
+ public void run()
+ {
+ ZRTPTransformEngine.this.muted = false;
+ }
+ }, 1500);
+ }
+ }
+
+ /**
+ * Method for getting the default secure status value for communication
+ *
+ * @return the default enabled/disabled status value for secure
+ * communication
+ */
+ public boolean getSecureCommunicationStatus()
+ {
+ return srtpInTransformer != null || srtpOutTransformer != null;
+ }
+
+ /**
      * Start the ZRTP stack immediately, not autosensing mode.
      */
     public void startZrtp()
@@ -604,7 +645,12 @@
         if (!ZrtpRawPacket.isZrtpData(pkt))
         {
             if (srtpInTransformer == null)
- return pkt;
+ {
+ if(muted)
+ return null;
+ else
+ return pkt;
+ }

             pkt = srtpInTransformer.reverseTransform(pkt);
             // if packet was valid (i.e. not null) and ZRTP engine started and
@@ -764,6 +810,7 @@
                         .getKeyResponder(), secrets.getSaltResponder(),
                         srtpPolicy, srtpPolicy);
                 srtpInTransformer = engine.getRTPTransformer();
+ this.muted = false;
             }
             else
             {
@@ -779,6 +826,7 @@
                         .getKeyInitiator(), secrets.getSaltInitiator(),
                         srtpPolicy, srtpPolicy);
                 srtpInTransformer = engine.getRTPTransformer();
+ this.muted = false;
             }
         }
         return true;

Modified: trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java 2010-04-28 12:54:46+0000
@@ -901,9 +901,14 @@
         if(peer.getCall().isDefaultEncrypted())
         {
             // we use the audio stream for master stream
- //when using zrtp multistreams
+ // when using zrtp multistreams
             ZrtpControl zrtpControl = stream.getZrtpControl();

+ if(zrtpControl.getSecureCommunicationStatus())
+ {
+ zrtpControl = stream.restartZrtpControl();
+ }
+
             zrtpControl.setZrtpListener(peer);
             zrtpControl.start(stream instanceof AudioMediaStream);
         }

Modified: trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java&p2=trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java (original)
+++ trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java 2010-04-28 12:54:46+0000
@@ -277,4 +277,12 @@
      * @return the <tt>ZrtpControl</tt> for the current stream.
      */
     public ZrtpControl getZrtpControl();
+
+ /**
+ * Resets the state of secure communication and restart the secure
+ * communication negotiation.
+ * @return the reseted <tt>ZrtpControl</tt>, which may be the old one
+ * or can be newly created one.
+ */
+ public ZrtpControl restartZrtpControl();
}

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hi,

Hi Damian,

see some comments/questions inline please.

Regards,
Werner

Author: damencho
Date: 2010-04-28 12:54:46+0000
New Revision: 7048

Modified:
trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java
trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java
trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java
trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java
trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java

Log:
Fix secure conference call and participants loosing audio if in secure call.

Modified: trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java&p2=trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/MediaStreamImpl.java 2010-04-28 12:54:46+0000
@@ -880,6 +880,42 @@
}

 /\*\*

+ * Resets the state of secure communication and restart the secure
+ * communication negotiation.
+ * @return the newly created <tt>ZrtpControl</tt>.
+ */
+ public ZrtpControl restartZrtpControl()
+ {
+ ZrtpControlImpl oldZrtpControl = zrtpControl;
+
+ this.zrtpControl = new ZrtpControlImpl();
+
+ // as we are recreating this stream and it was obviously secured
+ // it may happen we receive unencrepted data and we will hear
+ // noise, so we mute it till secure connection is again established
+ zrtpControl.getZrtpEngine().setStartMuted(true);
+
+ this.zrtpControl.setConnector(rtpConnector);
+ rtpConnector.setEngine(createTransformEngineChain());
+
+ if(oldZrtpControl != null)
+ {

Why do you copy over the multi-stram parameters from the old ZRTP to the new one?
You close the old ZRTP engine and return the new ZrtpControl. Using this new
control a new ZRTP session is set up. Is this understanding correct?
If yoes - then don't copy over multi-stream parameters. Multi-stream will be used
only in case you add a video session to an existing audio session. Do we implement
video conferencing :slight_smile: ?

About mutlistream params, I was thinking of that I had to set them in
order to rebuild zrtp state. I was thinking :
what if there was already a video stream, if I restart zrtp will the
whole mechanism call again setMultistreamParams. Ok I will remove it
:slight_smile:
All this restarts of zrtp is done on all reinvites in a call, which
will trigger a stream reinitialisation. Those reinvites are triggered
on switching video on and off, when holding and unholding someone and
of course when creating conferences.

In ZrtpControl you buffer the multi-stream data - there is no reason to do this.
If SC start a video session then the info callback takes care to initialize the
multi-stream data vor the video stream.

Aha I see, I will remove it.

+ if(oldZrtpControl.getMultiStrParams() != null)
+ zrtpControl.setMultistream(oldZrtpControl.getMultiStrParams());

Thanks
damencho

···

On Wed, Apr 28, 2010 at 6:48 PM, Werner Dittmann <Werner.Dittmann@t-online.de> wrote:

Am 28.04.2010 14:54, schrieb damencho@dev.java.net:

+
+ ZRTPTransformEngine engine = oldZrtpControl.getZrtpEngine();
+
+ if(engine != null)
+ {
+ engine.stopZrtp();
+ engine.cleanup();
+ }
+ }
+
+ return zrtpControl;
+ }
+
+ /**
* Determines whether this <tt>MediaStream</tt> is set to transmit "silence"
* instead of the media being fed from its <tt>MediaDevice</tt>. "Silence"
* for video is understood as video data which is not the captured video

Modified: trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java&p2=trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/ZrtpControlImpl.java 2010-04-28 12:54:46+0000
@@ -28,11 +28,10 @@
*/
private ZrtpListener zrtpListener = null;

- /**
- * Toggles default (from the call start) activation
- * of secure communication
- */
- private boolean usingZRTP = false;
+ /**
+ * The current multi-stream data if any.
+ */
+ private byte[] multiStreamData = null;

 /\*\*
  \* Additional info codes for and data to support ZRTP4J\.

@@ -93,7 +92,10 @@
*/
public boolean getSecureCommunicationStatus()
{
- return usingZRTP;
+ if(zrtpEngine != null)
+ return zrtpEngine.getSecureCommunicationStatus();
+ else
+ return false;
}

 /\*\*

@@ -137,14 +139,15 @@
*/
public void start(boolean masterSession)
{
- usingZRTP = true;
-
// Create security user callback for each peer.
SecurityEventManager securityEventManager
= new SecurityEventManager(this);

     boolean zrtpAutoStart = false;

+ // ZRTP engine initialization
+ ZRTPTransformEngine engine = getZrtpEngine();
+
// Decide if this will become the ZRTP Master session:
// - Statement: audio media session will be started before video
// media session
@@ -175,19 +178,16 @@
SecurityEventManager.VIDEO_SESSION);
}

- // ZRTP engine initialization
- ZRTPTransformEngine engine = getZrtpEngine();
// tells the engine whether to autostart(enable)
// zrtp communication, if false it just passes packets without
// transformation
engine.setEnableZrtp(zrtpAutoStart);

- zrtpEngine.setConnector(zrtpConnector);
+ engine.setConnector(zrtpConnector);

- zrtpEngine.setUserCallback(securityEventManager);
+ engine.setUserCallback(securityEventManager);

- usingZRTP = true;
- zrtpEngine.sendInfo(
+ engine.sendInfo(
ZrtpCodes.MessageSeverity.Info,
EnumSet.of(
ZRTPCustomInfoCodes.ZRTPEnabledByDefault));
@@ -204,12 +204,20 @@
*/
public void setMultistream(byte[] multiStreamData)
{
- if(usingZRTP)
- {
- ZRTPTransformEngine engine = getZrtpEngine();
- engine.setMultiStrParams(multiStreamData);
- engine.setEnableZrtp(true);
- }
+ ZRTPTransformEngine engine = getZrtpEngine();
+ this.multiStreamData = multiStreamData;
+ engine.setMultiStrParams(multiStreamData);
+ engine.setEnableZrtp(true);
+ }
+
+ /**
+ * Gets the multistream params
+ *
+ * @return the multistream params
+ */
+ public byte[] getMultiStrParams()
+ {
+ return multiStreamData;
}

 /\*\*

Modified: trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java&p2=trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java (original)
+++ trunk/src/net/java/sip/communicator/impl/neomedia/transform/zrtp/ZRTPTransformEngine.java 2010-04-28 12:54:46+0000
@@ -18,7 +18,7 @@
import net.java.sip.communicator.util.*;

import java.io.*;
-import java.util.EnumSet;
+import java.util.*;

/**
* JMF extension/connector to support GNU ZRTP4J.
@@ -349,6 +349,14 @@
private boolean started = false;

 /\*\*

+ * Sometimes we need to start muted so we will discard any packets during
+ * some time after the start of the transformer. This is needed when for
+ * this time we can receive encrypted packets but we hadn't established
+ * a secure communication. This happens when a secure stream is recreated.
+ */
+ private boolean muted = false;
+
+ /**
* Construct a ZRTPTransformEngine.
*
*/
@@ -506,6 +514,39 @@
}

 /\*\*

+ *
+ * @param startMuted whether to be started as muted if no secure
+ * communication is established
+ */
+ public void setStartMuted(boolean startMuted)
+ {
+ muted = startMuted;
+ if(startMuted)
+ {
+ // make sure we don't mute for long time as secure communication
+ // may fail.
+ new Timer().schedule(new TimerTask()
+ {
+ public void run()
+ {
+ ZRTPTransformEngine.this.muted = false;
+ }
+ }, 1500);
+ }
+ }
+
+ /**
+ * Method for getting the default secure status value for communication
+ *
+ * @return the default enabled/disabled status value for secure
+ * communication
+ */
+ public boolean getSecureCommunicationStatus()
+ {
+ return srtpInTransformer != null || srtpOutTransformer != null;
+ }
+
+ /**
* Start the ZRTP stack immediately, not autosensing mode.
*/
public void startZrtp()
@@ -604,7 +645,12 @@
if (!ZrtpRawPacket.isZrtpData(pkt))
{
if (srtpInTransformer == null)
- return pkt;
+ {
+ if(muted)
+ return null;
+ else
+ return pkt;
+ }

         pkt = srtpInTransformer\.reverseTransform\(pkt\);
         // if packet was valid \(i\.e\. not null\) and ZRTP engine started and

@@ -764,6 +810,7 @@
.getKeyResponder(), secrets.getSaltResponder(),
srtpPolicy, srtpPolicy);
srtpInTransformer = engine.getRTPTransformer();
+ this.muted = false;
}
else
{
@@ -779,6 +826,7 @@
.getKeyInitiator(), secrets.getSaltInitiator(),
srtpPolicy, srtpPolicy);
srtpInTransformer = engine.getRTPTransformer();
+ this.muted = false;
}
}
return true;

Modified: trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandler.java 2010-04-28 12:54:46+0000
@@ -901,9 +901,14 @@
if(peer.getCall().isDefaultEncrypted())
{
// we use the audio stream for master stream
- //when using zrtp multistreams
+ // when using zrtp multistreams
ZrtpControl zrtpControl = stream.getZrtpControl();

+ if(zrtpControl.getSecureCommunicationStatus())
+ {
+ zrtpControl = stream.restartZrtpControl();
+ }
+
zrtpControl.setZrtpListener(peer);
zrtpControl.start(stream instanceof AudioMediaStream);
}

Modified: trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java?view=diff&rev=7048&p1=trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java&p2=trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java&r1=7047&r2=7048

--- trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java (original)
+++ trunk/src/net/java/sip/communicator/service/neomedia/MediaStream.java 2010-04-28 12:54:46+0000
@@ -277,4 +277,12 @@
* @return the <tt>ZrtpControl</tt> for the current stream.
*/
public ZrtpControl getZrtpControl();
+
+ /**
+ * Resets the state of secure communication and restart the secure
+ * communication negotiation.
+ * @return the reseted <tt>ZrtpControl</tt>, which may be the old one
+ * or can be newly created one.
+ */
+ public ZrtpControl restartZrtpControl();
}

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Some clarifications inline.

Hi,

Why do you copy over the multi-stram parameters from the old ZRTP to the new one?
You close the old ZRTP engine and return the new ZrtpControl. Using this new
control a new ZRTP session is set up. Is this understanding correct?
If yoes - then don't copy over multi-stream parameters. Multi-stream will be used
only in case you add a video session to an existing audio session. Do we implement
video conferencing :slight_smile: ?

About mutlistream params, I was thinking of that I had to set them in
order to rebuild zrtp state. I was thinking :
what if there was already a video stream, if I restart zrtp will the
whole mechanism call again setMultistreamParams. Ok I will remove it
:slight_smile:
All this restarts of zrtp is done on all reinvites in a call, which
will trigger a stream reinitialisation. Those reinvites are triggered
on switching video on and off, when holding and unholding someone and
of course when creating conferences.

A lot of re-invites and resetting :slight_smile: . Why is it necessary
to do this if SC just adds a video session? Is it necessary
to reset the audio session also in this case? And if yes: make
sure the new audio session is _always_ started (ZRTP) before
the video channel.

The audio session is the "master" (DH) session that really negotiates
the SRTP key data and produces the multi-stream parameters once it has
negotiated the fresh key data for SRTP. If the audio session
switches to secure state then the SecurityEventHandler calls
the security listener with the multi-stream data. The security
listener then sets this data to the video ZRTP session and starts it.

The audio session always holds the multi-stream parameters until it
is terminated - thus if you just add another media session (for
example to do 3D video :wink: ) you just need to get them from the master
DH session and set them in the new media session.

Werner

···

Am 28.04.2010 18:17, schrieb Damian Minkov:

In ZrtpControl you buffer the multi-stream data - there is no reason to do this.
If SC start a video session then the info callback takes care to initialize the
multi-stream data vor the video stream.

Aha I see, I will remove it.

+ if(oldZrtpControl.getMultiStrParams() != null)
+ zrtpControl.setMultistream(oldZrtpControl.getMultiStrParams());

Thanks
damencho

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net