hacktronaut / azure-avatar-demo

Text To Speech Demo in ReactJS Application using Azure Avatar AI Service.
17 stars 10 forks source link

Receive Error | Unable to contact server. StatusCode: 1006, undefined Reason: undefined #2

Open justintham opened 2 months ago

justintham commented 2 months ago

Hi,

I have update necessary API keys and settings in the config.js file with using speech service Azure and ICE. But, it still give me an error.

js error

hacktronaut commented 2 months ago

@justintham Can you add console log and see which line is throwing error ?. I believe ICE server URL from azure may not work anymore. Please let me know the status.

justintham commented 2 months ago

image @hacktronaut Hi. I keep getting issue. I also tried to add "atob" in front the icerUsername, iceCredential. It seems like unable connect to the ICE Server.

hacktronaut commented 2 months ago

@justintham Please check whether your resources were created in "westus2" region. All azure resources must be present in this region.

If your region is already westus2 for all azure resources then try to setup your own ICE server. Please check this article -> https://raokarthik83.medium.com/azure-avatar-tts-update-migrating-from-azure-turn-to-coturn-14b6ac86d60c

Let me know if you are not able to fix it.

justintham commented 2 months ago

Hi @hacktronaut,

Previously my resource is in "east us" and I changed to the "wetus2" region and I get another new issue. The issue log has provided below: image

hacktronaut commented 2 months ago

@justintham Can you setup your own turn server and check again ?. Please follow the medium link I shared.

Here is the announcement from Microsoft on retirement of TURN servers.

https://azure.microsoft.com/en-gb/updates/retirement-notice-azure-communication-services-network-traversal-turn-public-preview-is-retiring/#:~:text=Azure%20Communication%20Services%20Network%20Traversal%20(TURN)%20will,March%202024.Please%20migrate%20to%20an%20external%20service

crypticatul commented 1 month ago

I'm also getting the same error. I have deployment in West US2, have deployed a TURN server on EC2 and updated the config file.

Uncaught (in promise) Unable to contact server. StatusCode: 1006, undefined Reason: undefined localhost/:1 Uncaught (in promise) SyntaxError: "[object Object]" is not valid JSON at JSON.parse () at l._storageChangeDispatcher (content.js:2:855976) at _storageChangeDispatcherCallback (content.js:2:855424)

image
hacktronaut commented 4 weeks ago

Hi @crypticatul I tried to replicate the issue by passing incorrect cogSvcSubKey. I got the same error. Please check your config parameters.

crypticatul commented 4 weeks ago

Seems that is fixed, however, still the Avatar is not visible on the page.

image

On clicking CONNECT, I get following in the Console: RTCPeerConnection {localDescription: null, currentLocalDescription: null, pendingLocalDescription: null, remoteDescription: null, currentRemoteDescription: null, …}canTrickleIceCandidates: nullconnectionState: "new"currentLocalDescription: nullcurrentRemoteDescription: nulliceConnectionState: "new"iceGatheringState: "gathering"localDescription: RTCSessionDescription {type: 'offer', sdp: 'v=0\r\no=- 4358711154243846191 2 IN IP4 127.0.0.1\r\ns…213 msid:- 3a11b96f-2eac-435c-a7b6-f6bb959afcca\r\n'}onaddstream: nullonconnectionstatechange: nullondatachannel: nullonicecandidate: nullonicecandidateerror: nulloniceconnectionstatechange: e => {…}onicegatheringstatechange: () => {…}onnegotiationneeded: nullonremovestream: nullonsignalingstatechange: nullontrack: event => {…}pendingLocalDescription: RTCSessionDescription {type: 'offer', sdp: 'v=0\r\no=- 4358711154243846191 2 IN IP4 127.0.0.1\r\ns…213 msid:- 3a11b96f-2eac-435c-a7b6-f6bb959afcca\r\n'}pendingRemoteDescription: nullremoteDescription: nullsctp: nullsignalingState: "have-local-offer"[[Prototype]]: RTCPeerConnectionaddIceCandidate: ƒ addIceCandidate()addStream: ƒ addStream()addTrack: ƒ addTrack()addTransceiver: ƒ addTransceiver()canTrickleIceCandidates: (...)close: ƒ close()connectionState: (...)createAnswer: ƒ createAnswer()createDTMFSender: ƒ createDTMFSender()createDataChannel: ƒ createDataChannel()createOffer: ƒ createOffer()currentLocalDescription: (...)currentRemoteDescription: (...)getConfiguration: ƒ getConfiguration()getLocalStreams: ƒ getLocalStreams()getReceivers: ƒ getReceivers()getRemoteStreams: ƒ getRemoteStreams()getSenders: ƒ getSenders()getStats: ƒ getStats()getTransceivers: ƒ getTransceivers()iceConnectionState: (...)iceGatheringState: (...)localDescription: (...)onaddstream: (...)onconnectionstatechange: (...)ondatachannel: (...)onicecandidate: (...)onicecandidateerror: (...)oniceconnectionstatechange: (...)onicegatheringstatechange: (...)onnegotiationneeded: (...)onremovestream: (...)onsignalingstatechange: (...)ontrack: (...)pendingLocalDescription: (...)pendingRemoteDescription: (...)remoteDescription: (...)removeStream: ƒ removeStream()removeTrack: ƒ removeTrack()restartIce: ƒ restartIce()sctp: (...)setConfiguration: ƒ setConfiguration()setLocalDescription: ƒ setLocalDescription()setRemoteDescription: ƒ setRemoteDescription()signalingState: (...)constructor: ƒ RTCPeerConnection()Symbol(Symbol.toStringTag): "RTCPeerConnection"get canTrickleIceCandidates: ƒ canTrickleIceCandidates()get connectionState: ƒ connectionState()get currentLocalDescription: ƒ currentLocalDescription()get currentRemoteDescription: ƒ currentRemoteDescription()get iceConnectionState: ƒ iceConnectionState()get iceGatheringState: ƒ iceGatheringState()get localDescription: ƒ localDescription()get onaddstream: ƒ onaddstream()set onaddstream: ƒ onaddstream()get onconnectionstatechange: ƒ onconnectionstatechange()set onconnectionstatechange: ƒ onconnectionstatechange()get ondatachannel: ƒ ondatachannel()set ondatachannel: ƒ ondatachannel()get onicecandidate: ƒ onicecandidate()set onicecandidate: ƒ onicecandidate()get onicecandidateerror: ƒ onicecandidateerror()set onicecandidateerror: ƒ onicecandidateerror()get oniceconnectionstatechange: ƒ oniceconnectionstatechange()set oniceconnectionstatechange: ƒ oniceconnectionstatechange()get onicegatheringstatechange: ƒ onicegatheringstatechange()set onicegatheringstatechange: ƒ onicegatheringstatechange()get onnegotiationneeded: ƒ onnegotiationneeded()set onnegotiationneeded: ƒ onnegotiationneeded()get onremovestream: ƒ onremovestream()set onremovestream: ƒ onremovestream()get onsignalingstatechange: ƒ onsignalingstatechange()set onsignalingstatechange: ƒ onsignalingstatechange()get ontrack: ƒ ontrack()set ontrack: ƒ ontrack()get pendingLocalDescription: ƒ pendingLocalDescription()get pendingRemoteDescription: ƒ pendingRemoteDescription()get remoteDescription: ƒ remoteDescription()get sctp: ƒ sctp()get signalingState: ƒ signalingState()[[Prototype]]: EventTarget

hacktronaut commented 4 weeks ago

Check network tab. Check whether inbound and outbound rules are applied properly to EC2 instance. Double check your TURN server. Did you expose the service to the internet ?

crypticatul commented 3 weeks ago

Getting following on clicking connect and/or Speak:

image

TURN server seems configured correctly with following inbound rules

image

Please confirm in config cogSvcSubKey is the same as Resource key on this page

image

And we do have to use stun and not turn in iceUrl

iceUrl : "stun:instance_IP",

}