Adds modifications to correctly support the XEP-0262 (ZRTP).

cusax-fix
Sebastien Vincent 15 years ago
parent e8ad929388
commit 3b7b97bef6

@ -289,7 +289,6 @@ public void processOffer(List<ContentPacketExtension> offer)
= content.getFirstChildOfType(
IceUdpTransportPacketExtension.class);
// stream target
MediaStreamTarget target
= JingleUtils.extractDefaultTarget(content);
@ -347,12 +346,17 @@ public void processOffer(List<ContentPacketExtension> offer)
if(helloHash != null && helloHash[1].length() > 0)
{
EncryptionPacketExtension encryption = new
EncryptionPacketExtension();
ZrtpHashPacketExtension hash
= new ZrtpHashPacketExtension();
hash.setVersion(helloHash[0]);
hash.setValue(helloHash[1]);
ourContent.addChildExtension(hash);
encryption.addChildExtension(hash);
RtpDescriptionPacketExtension rtpDescription =
JingleUtils.getRtpDescription(ourContent);
rtpDescription.setEncryption(encryption);
}
}
@ -550,13 +554,18 @@ private ContentPacketExtension createContent(MediaDevice dev)
if(helloHash != null && helloHash[1].length() > 0)
{
EncryptionPacketExtension encryption = new
EncryptionPacketExtension();
ZrtpHashPacketExtension hash
= new ZrtpHashPacketExtension();
hash.setVersion(helloHash[0]);
hash.setValue(helloHash[1]);
content.addChildExtension(hash);
encryption.addChildExtension(hash);
RtpDescriptionPacketExtension description =
JingleUtils.getRtpDescription(content);
description.setEncryption(encryption);
}
}
@ -670,12 +679,17 @@ public List<ContentPacketExtension> createContentList()
if(helloHash != null && helloHash[1].length() > 0)
{
EncryptionPacketExtension encryption = new
EncryptionPacketExtension();
ZrtpHashPacketExtension hash
= new ZrtpHashPacketExtension();
hash.setVersion(helloHash[0]);
hash.setValue(helloHash[1]);
content.addChildExtension(hash);
encryption.addChildExtension(hash);
RtpDescriptionPacketExtension description =
JingleUtils.getRtpDescription(content);
description.setEncryption(encryption);
}
}

@ -21,6 +21,11 @@
public class EncryptionPacketExtension
extends AbstractPacketExtension
{
/**
* The namespace of the "encryption" element.
*/
public static final String NAMESPACE = null;
/**
* The name of the "encryption" element.
*/
@ -43,7 +48,7 @@ public class EncryptionPacketExtension
*/
public EncryptionPacketExtension()
{
super(null, ELEMENT_NAME);
super(NAMESPACE, ELEMENT_NAME);
}
/**
@ -104,6 +109,10 @@ public boolean isRequired()
@Override
public List<? extends PacketExtension> getChildExtensions()
{
return getCryptoList();
List<PacketExtension> ret = new ArrayList<PacketExtension>();
ret.addAll(getCryptoList());
ret.addAll(super.getChildExtensions());
return ret;
}
}

@ -57,6 +57,13 @@ public JingleIQProvider()
new DefaultPacketExtensionProvider
<RTPHdrExtPacketExtension>(RTPHdrExtPacketExtension.class));
//<encryption/> provider
providerManager.addExtensionProvider(
EncryptionPacketExtension.ELEMENT_NAME,
EncryptionPacketExtension.NAMESPACE,
new DefaultPacketExtensionProvider
<EncryptionPacketExtension>(EncryptionPacketExtension.class));
//<zrtp-hash/> provider
providerManager.addExtensionProvider(
ZrtpHashPacketExtension.ELEMENT_NAME,

@ -24,7 +24,7 @@ public class ZrtpHashPacketExtension extends AbstractPacketExtension
/**
* The namespace for the "zrtp-hash" element.
*/
public static final String NAMESPACE = "urn:xmpp:jingle:apps:rtp:zrtp:0";
public static final String NAMESPACE = "urn:xmpp:jingle:apps:rtp:zrtp:1";
/**
* The name of the <tt>version</tt> attribute.

Loading…
Cancel
Save