Пример #1
0
 internal void GotStunResponse(STUNMessage stunResponse, IPEndPoint remoteEndPoint)
 {
     if (stunResponse.Header.MessageType == STUNMessageTypesEnum.BindingSuccessResponse)
     {
         State           = ChecklistEntryState.Succeeded;
         ChecksSent      = 0;
         LastCheckSentAt = DateTime.MinValue;
     }
     else if (stunResponse.Header.MessageType == STUNMessageTypesEnum.BindingErrorResponse)
     {
         logger.LogWarning($"ICE RTP channel a STUN binding error response was received from {remoteEndPoint}.");
         logger.LogWarning($"ICE RTP channel check list entry set to failed: {RemoteCandidate}");
         State = ChecklistEntryState.Failed;
     }
     else if (stunResponse.Header.MessageType == STUNMessageTypesEnum.CreatePermissionSuccessResponse)
     {
         logger.LogDebug($"A TURN Create Permission success response was received from {remoteEndPoint} (TxID: {Encoding.ASCII.GetString(stunResponse.Header.TransactionId)}).");
         TurnPermissionsResponseAt = DateTime.Now;
     }
     else if (stunResponse.Header.MessageType == STUNMessageTypesEnum.CreatePermissionErrorResponse)
     {
         logger.LogWarning($"ICE RTP channel TURN Create Permission error response was received from {remoteEndPoint}.");
         TurnPermissionsResponseAt = DateTime.Now;
         State = ChecklistEntryState.Failed;
     }
     else
     {
         logger.LogWarning($"ICE RTP channel received an unexpected STUN response {stunResponse.Header.MessageType} from {remoteEndPoint}.");
     }
 }
Пример #2
0
 internal void GotStunResponse(STUNMessage stunResponse, IPEndPoint remoteEndPoint)
 {
     if (stunResponse.Header.MessageType == STUNMessageTypesEnum.BindingSuccessResponse)
     {
         if (Nominated)
         {
             // If the candidate has been nominated then this is a response to a periodic
             // check to whether the connection is still available.
             LastConnectedResponseAt = DateTime.Now;
             RequestTransactionID    = Crypto.GetRandomString(STUNHeader.TRANSACTION_ID_LENGTH);
         }
         else
         {
             State           = ChecklistEntryState.Succeeded;
             ChecksSent      = 0;
             LastCheckSentAt = DateTime.MinValue;
         }
     }
     else if (stunResponse.Header.MessageType == STUNMessageTypesEnum.BindingErrorResponse)
     {
         logger.LogWarning($"ICE RTP channel a STUN binding error response was received from {remoteEndPoint}.");
         logger.LogWarning($"ICE RTP channel check list entry set to failed: {RemoteCandidate}");
         State = ChecklistEntryState.Failed;
     }
     else if (stunResponse.Header.MessageType == STUNMessageTypesEnum.CreatePermissionSuccessResponse)
     {
         logger.LogDebug($"A TURN Create Permission success response was received from {remoteEndPoint} (TxID: {Encoding.ASCII.GetString(stunResponse.Header.TransactionId)}).");
         TurnPermissionsResponseAt = DateTime.Now;
     }
     else if (stunResponse.Header.MessageType == STUNMessageTypesEnum.CreatePermissionErrorResponse)
     {
         logger.LogWarning($"ICE RTP channel TURN Create Permission error response was received from {remoteEndPoint}.");
         TurnPermissionsResponseAt = DateTime.Now;
         State = ChecklistEntryState.Failed;
     }
     else
     {
         logger.LogWarning($"ICE RTP channel received an unexpected STUN response {stunResponse.Header.MessageType} from {remoteEndPoint}.");
     }
 }