Connection Issues
Client Fails to Connect
Client Fails to Connect
Symptom: Calling
connect() or connectAndCall() throws an error or times out.Possible Causes and Solutions:- Incorrect endpoint URL. Verify that the
endpointUrlin your configuration is correct and accessible. The URL must point to a valid Cognigy Click To Call configuration endpoint. - Network restrictions. Ensure that your network allows WebSocket connections and UDP traffic, both of which are required for SIP/WebRTC communication. Check firewall and proxy settings.
- CORS issues. If the SDK canโt fetch the SIP configuration, the endpoint server may not be configured to allow cross-origin requests from your domain.
SIP Registration Fails
SIP Registration Fails
Symptom: The
registered event is never emitted, or the error event fires after connecting.Possible Causes and Solutions:- Invalid SIP credentials. The SIP configuration returned by the endpoint URL may contain invalid credentials. Contact your Cognigy administrator to verify the configuration.
- SIP server unreachable. Ensure that the SIP server is reachable from the clientโs network. Network firewalls may block the required ports.
Call Issues
Call Not Starting
Call Not Starting
Symptom:
startCall() throws an error or doesnโt initiate a call.Possible Causes and Solutions:- Client not connected. Ensure that
connect()has been called and theregisteredevent has been received before callingstartCall(). Alternatively, useconnectAndCall()to combine both steps. - Microphone permission denied. The browser requires microphone access for Click To Call calls. Ensure that the user has granted microphone permission.
No Audio
No Audio
Symptom: The call connects, but no audio is heard.Possible Causes and Solutions:
-
Autoplay policy. Modern browsers block autoplay of media with audio. Ensure that the call is initiated by a user gesture, for example, a button click. The SDK manages audio playback internally via an
Audioelement, but browser autoplay restrictions still apply. -
ICE/TURN configuration. If audio doesnโt work, it may be a NAT traversal issue. Configure a TURN server in the
pcConfigoption: - No audio tracks in stream. The remote stream may not contain audio tracks. Check the browser developer console for warnings from the SDK such as โStream has no audio tracksโ.
Call Drops Unexpectedly
Call Drops Unexpectedly
Symptom: The
ended or failed event fires shortly after the call starts.Possible Causes and Solutions:- Network instability. Check the network connection. Click To Call is sensitive to network changes, especially on mobile devices.
- Session timeout. The SIP server may have a session timeout configuration. Check the
CallEndInfoobject in theendedorfailedevent callback for thecause,originator, anddescriptionfields.
Transcription Issues
Transcription Events Not Received
Transcription Events Not Received
Symptom: The
transcription event is never emitted during a call.Possible Causes and Solutions:- Transcription not enabled. Ensure that transcription is enabled in your Voice Gateway or Cognigy Flow configuration.
- Info messages without
_transcription. Transcription events are only emitted when an incoming info message contains a_transcriptionproperty. Regular info messages are emitted viainfoReceivedinstead.
Browser Issues
Click To Call Not Supported
Click To Call Not Supported
Symptom:
checkWebRTCSupport() returns { supported: false }.Possible Causes and Solutions:- Unsupported browser. The SDK requires a browser that supports WebRTC APIs:
RTCPeerConnection,getUserMedia. - Insecure context. WebRTC APIs are only available in secure contexts such as HTTPS or
localhost. Ensure your application is served over HTTPS.
Microphone Permission Issues
Microphone Permission Issues
Symptom: The browser prompts for microphone access but the call fails.Possible Causes and Solutions:
- Permission denied. The user must grant microphone permission. If denied, the browser wonโt allow access to the local audio stream.
- Permission previously blocked. If the user previously blocked microphone access, they need to manually reset the permission in the browserโs site settings.
Error Handling
The SDK supports two complementary approaches for catching errors.Promise-Based
Promise-Based
All async methods return promises. Wrap them in the
try and catch blocks:Event-Based
Event-Based
Subscribe to the
error event to catch asynchronous errors during the SDK lifecycle:Debugging Tips
Enable Event Logging
Enable Event Logging
Register listeners for all key events to trace the SDK lifecycle:
Inspect WebRTC Internals
Inspect WebRTC Internals
In Chrome, navigate to
chrome://webrtc-internals/ to view detailed information about active WebRTC connections, including ICE candidates, codec negotiation, and media statistics.Check Network Traffic
Check Network Traffic
Use the browserโs DevTools Network tab to inspect WebSocket connections and verify that the SIP signaling messages are being exchanged correctly.