init().kpt_...). Treat it like a password; on the web it should be deliveredKlinkCallSdk.init(config)| Option | Type | Default | Description |
|---|---|---|---|
userEmail | string | — (required) | K-Link member email whose extension to use |
accessToken | string | — (required) | K-Link API token (kpt_...) |
apiBaseUrl | string | https://apigw.klinkcx.com | Public API origin |
requestTimeoutMs | number | 15000 | Credential-fetch timeout |
Promise<KlinkCallSdk>. Throws KlinkCallSdkError with code:invalid_config · auth_failed · extension_not_found ·extension_not_provisioned · network_error · init_failed.| Event | Payload | When |
|---|---|---|
ready | — | Engine started, registration in progress |
incoming | { call } | Inbound call ringing |
sessionStarted | { call } | Call established / dialing |
sessionEnded | { callId, cause } | Call ended |
remoteStream | { callId, stream } | Remote call audio available |
connected / disconnected | — | PBX socket transport state |
registeredChange | { registered } | SIP registration state |
registrationFailed | { code, message } | Registration rejected |
error | { scope, detail } | Runtime errors |
destroyed | — | After destroy() |
on(event, fn) returns an unsubscribe function. once and off are alsocall(number) · answer(callId) · reject(callId) · hangup(callId) ·hold/unhold(callId) · mute/unmute(callId) · dtmf(callId, tones) ·attachAudio(element) · getCalls() · isRegistered · destroy()<audio> element once and remote streams are piped in and releasedsdk.attachAudio(document.querySelector('audio')!)remoteStream event:sdk.on('remoteStream', ({ callId, stream }) => {
myAudioElement.srcObject = stream
})examples/basic for a complete working app.examples/basic@klink.cloud/call-sdk from npm):init calls with a revoked token fail with auth_failed.