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. Make sure your network allows WebSocket connections and UDP traffic. SIP/WebRTC communication needs both. Check firewall and proxy settings.
- CORS issues. If the SDK can’t fetch the SIP configuration, the endpoint server might not allow cross-origin requests from your domain.
SIP registration fails
SIP registration fails
Symptom: The Possible Causes and Solutions:
registered event is never emitted, or the error event emits after connecting.Endpoints that don’t require SIP registration never emit the
registered event. In this case, the missing event isn’t an error.- 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. Call
connect()and wait for it to finish before you callstartCall(). If your endpoint requires registration,connect()finishes after theregisteredevent. If you callstartCall()before that, it fails withClient not connected. Call connect() first.orSIP client not registered. 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. Start the call from a user gesture, for example, a button click. The SDK plays audio through an internal
Audioelement, but browser autoplay restrictions still apply. - 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 control methods fail
Call control methods fail
Symptom:
endCall(), mute(), sendInfo(), or sendDTMF() rejects with an error that contains No active session or Session not established.Possible Causes and Solutions:- Call not answered yet. These methods work only on an answered call. While the call is ringing, they fail. Wait for the
answeredevent before you call them. - Call already ended. After the call ends or fails, no session is active.
The
unmute() method does nothing if there’s no answered call and doesn’t throw an error.Call drops unexpectedly
Call drops unexpectedly
Symptom: The
ended or failed event emits 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 might have a session timeout configured. Check the
cause,originator, anddescriptionfields of theCallEndInfoobject. You get this object in theendedorfailedevent callback.
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 Cognigy Voice or Cognigy Flow configuration.
- Info messages without
_transcription. The SDK emits atranscriptionevent only 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. Serve your application 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 the user denies it, the browser blocks access to the local audio stream.
- Permission previously blocked. If the user blocked microphone access before, they must reset the permission manually 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, open
chrome://webrtc-internals/. The page shows active WebRTC connections, including ICE candidates, codec negotiation, and media statistics.Check network traffic
Check network traffic
Use the Network tab in the browser’s DevTools. Inspect the WebSocket connections to check that the SIP signaling messages are exchanged correctly.