docs: function(err, pc) {
            if (err) {
              triggerError('Failed to create PeerConnection, exception: ' +
                  err.toString(), 'NewPeerConnection');
  
              _peerConnectionCompletionHandlers = [];
              return;
            }
  
            OT.debug('OT attachEventsToPeerConnection');
            _peerConnection = pc;
            _stateLogger = connectionStateLogger(_peerConnection);
            _channels = new PeerConnectionChannels(_peerConnection);
            if (config.channels) _channels.addMany(config.channels);
  
            _peerConnection.addEventListener('icecandidate',
                                        iceCandidateForwarder(delegateMessage), false);
            _peerConnection.addEventListener('addstream', onRemoteStreamAdded, false);
            _peerConnection.addEventListener('removestream', onRemoteStreamRemoved, false);
            _peerConnection.addEventListener('signalingstatechange', routeStateChanged, false);
  
            if (_peerConnection.oniceconnectionstatechange !== void 0) {
              var failedStateTimer;
              _peerConnection.addEventListener('iceconnectionstatechange', function (event) {
                if (event.target.iceConnectionState === 'failed') {
                  if (failedStateTimer) {
                    clearTimeout(failedStateTimer);
                  }
  
                  // We wait 5 seconds and make sure that it's still in the failed state
                  // before we trigger the error. This is because we sometimes see
                  // 'failed' and then 'connected' afterwards.
                  failedStateTimer = setTimeout(function () {
                    if (event.target.iceConnectionState === 'failed') {
                      triggerError('The stream was unable to connect due to a network error.' +
                       ' Make sure your connection isn\'t blocked by a firewall.', 'ICEWorkflow');
                    }
                  }, 5000);
                }
              }, false);
            }
  
            triggerPeerConnectionCompletion(null);
          }