- From: Bernard Aboba <Bernard.Aboba@microsoft.com>
- Date: Sun, 27 Dec 2015 01:02:16 +0000
- To: "public-ortc@w3.org" <public-ortc@w3.org>
Filed PR to address this:
https://github.com/openpeer/ortc/issues/310
-----Original Message-----
From: IƱaki Baz Castillo via GitHub [mailto:sysbot+gh@w3.org]
Sent: Saturday, December 26, 2015 5:37 AM
To: public-ortc@w3.org
Subject: [ortc] Example 6 is wrong
ibc has just created a new issue for https://github.com/openpeer/ortc:
== Example 6 is wrong ==
```js
RTCCertificate.generateCertificate(keygenAlgorithm).then(function(certificate){
var cert = certificate;
// Obtain the fingerprint of the created certificate
dtlsParameters.fingerprints[0] = cert.fingerprint;
}, function(){
trace('Certificate could not be created');
});
// Prepare to handle remote ICE candidates
mySignaller.onRemoteCandidate = function(remote) {
// Figure out which IceTranport a remote candidate relates to by matching the userNameFragment/password
var j = 0;
for (j = 0; j < iceTransport.length; j++) {
var transport = iceTransports[j];
if (transport.getRemoteParameters().userNameFragment ===
remote.parameters.userNameFragment)
transport.addRemoteCandidate(remote.candidate);
}
} };
// ... create RtpSender/RtpReceiver objects as illustrated in Section 6.5 Example 9.
mySignaller.mySendInitiate({
"ice": iceGatherer.getLocalParameters(),
"dtls": dtlsParameters,
// ... marshall RtpSender/RtpReceiver capabilities as illustrated in Section 6.5 Example 9.
}, function(remote) {
// Create the ICE and DTLS transports
var iceTransport = new RTCIceTransport(iceGatherer);
iceTransport.start(iceGatherer, https://na01.safelinks.protection.outlook.com/?url=remote.ice&data=01%7c01%7cBernard.Aboba%40microsoft.com%7c2b7b8f1273d54821a48308d30df9c08b%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=toRlwrAm5bJikqSq8j4QgNrbVQaxNZgVYmuyvUHGJoE%3d,
RTCIceRole.controlling);
iceTransports.push(iceTransport);
// Construct a RTCDtlsTransport object with the same certificate and fingerprint as in the Offer
// so that the remote peer can verify it.
var dtlsTransport = new RTCDtlsTransport(iceTransport, cert);
// <---- There is no `cert` var
dtlsTransport.start(remote.dtls);
dtlsTransports.push(dtlsTransport);
// ... configure RtpSender/RtpReceiver objects as illustrated in Section 6.5 Example 9.
});
```
In `var dtlsTransport = new RTCDtlsTransport(iceTransport, cert);` such a `cert` variable does not exist in that scope. It was defined in the `resolve` function of the `RTCCertificate.generateCertificate()`
returned Promise.
For this to be valid, `var cert` should be declared above the `RTCCertificate.generateCertificate()` call.
Please view or discuss this issue at
https://github.com/openpeer/ortc/issues/310 using your GitHub account
Received on Sunday, 27 December 2015 01:02:47 UTC