iosswifttwiliotwilio-video

iOS - TwilioVideo - Unable to connect on call with remote participant


I am developing app with video calling functionality and I am using Twilio Video for that.

Currently using TwilioVideo SDK v4.6.2 and iOS Version 14.x and Above

I am not able to connect to the TwilioVideo room Below is my code:

    func connect() {
        guard let accessToken = self.accessToken, let roomName = self.roomName else {
            
            return
        }
        
        prepareAudio()
        prepareCamera()
        
        let connectOptions = ConnectOptions(token: accessToken) { (builder) in
            
        
            builder.isDominantSpeakerEnabled = true
            
        
            builder.isNetworkQualityEnabled = true
            
        
            if let localAudioTrack = self.localAudioTrack {
                builder.audioTracks = [localAudioTrack]
            }
            
            if let localVideoTrack = self.localVideoTrack {
                builder.videoTracks = [localVideoTrack]
            }
            
        
            if let preferredAudioCodec = TwiloVideoSettingsManager.shared.audioCodec {
                builder.preferredAudioCodecs = [preferredAudioCodec]
            }
            
        
            if let preferredVideoCodec = TwiloVideoSettingsManager.shared.videoCodec {
                builder.preferredVideoCodecs = [preferredVideoCodec]
            }
            
        
            if let encodingParameters = TwiloVideoSettingsManager.shared.getEncodingParameters()        {
                builder.encodingParameters = encodingParameters
            }
            
        
            builder.region = "gll"
            builder.roomName = roomName
        }
       
        self.room = TwilioVideoSDK.connect(options: connectOptions, delegate: self)
       
        UIApplication.shared.isIdleTimerDisabled = true
    }

Response in not received from Twilio in either of the methods mentioned below

    func didConnect(to room: Room) {
            
            NSLog("Room: \(room.name) SID: \(room.sid)")
            if (room.remoteParticipants.count > 0) {
                self.remoteParticipant = room.remoteParticipants[0]
                self.remoteParticipant.delegate = self
            }
            self.delegate.videoServiceManagerDidConnectToRoom(name:room.name)
        }
    
    func roomDidFailToConnect(room: Room, error: Error) {
            NSLog("Failed to connect to a Room: \(error).")
            self.delegate.videoServiceManagerFailToConnectRoom(error: error.localizedDescription)
            self.leaveRoom()
        }

I am not able connect to the room every time and sometimes I get the error mentioned below :

Failed to connect to a Room: Error Domain=com.twilio.video Code=53000 "Signaling connection error" UserInfo={NSLocalizedDescription=Signaling connection error, NSLocalizedFailureReason=SIP error 408}.

When I check the Twilio logs in debug mode I am not getting any error. Please guide me to rectify if there is any mistake in my code


Solution

  • Twilio employee here. Error 53000 is somewhat vague and could occur due to different things: https://www.twilio.com/docs/api/errors/53000

    I'd suggest the following next steps: