Skip to main content
The Cognigy Click To Call SDK uses an event-driven architecture. You can subscribe to events using client.on() and unsubscribe using client.off(). All events are fully typed when using TypeScript.

Connection Events

EventDescriptionCallback Parameters
connectingSIP connection is starting()
connectedSIP connection established()
disconnectedSIP connection lost()
registeredSIP client registered successfully()
unregisteredSIP client unregistered()

Call Events

EventDescriptionCallback Parameters
ringingCall is ringing (progress)(session: CallSession)
answeredCall was answered by the remote party(session: CallSession)
endedCall ended normally(session: CallSession, endInfo: CallEndInfo)
failedCall failed to connect or was rejected(session: CallSession, endInfo: CallEndInfo)
mutedLocal microphone was muted(session: CallSession)
unmutedLocal microphone was unmuted(session: CallSession)

Audio Events

EventDescriptionCallback Parameters
captureAudioRemote audio stream is available for advanced processing. Requires captureAudio: true in the client config(stream: MediaStream)
audioEndedRemote audio stream ended()

Info Message Events

EventDescriptionCallback Parameters
infoSentInfo message was sent successfully(text: string, data: Record<string, any>)
infoReceivedInfo message received from the remote party(data: { originator: string, info: { body: string } })

Transcription Events

EventDescriptionCallback Parameters
transcriptionTranscription data received(transcription: { originator: string; messages: { text: string }[] })

Error Events

EventDescriptionCallback Parameters
errorAn error occurred(error: Error)

Unsubscribing from Events

To remove an event listener, use client.off() with the same event name and callback reference:
const onAnswered = (session) => {
  console.log('Call answered:', session.id);
};

// Subscribe
client.on('answered', onAnswered);

// Unsubscribe
client.off('answered', onAnswered);
When using off(), you must pass the same function reference that was used with on(). Anonymous functions can’t be removed.