Alaznah

CallingClient methods, media controls, push helpers, and events.

Client methods

Obtain a client with useCallingClient() or createCallingClient(config).

Connection & session

MethodDescription
connect()Connect to signaling
disconnect()Disconnect and tear down media
syncPendingCalls()Pull pending invites after resume
registerPushToken(token, platform)Register FCM / APNs device token ('ios' | 'android')
drainNativeIncomingAction()Apply native Accept/Decline before showing JS incoming UI
setNativeIncomingSuppressed(suppressed)Suppress Android system incoming UI while in-app UI is visible
isWakingForCall()Cold-start accept in progress
isAutoAcceptingCall(callId)This invite was accepted natively — skip JS incoming

Call lifecycle

MethodDescription
startCall({ calleeId, mediaType?, conversationId?, kind? })Place outbound call
accept(callId?)Accept ringing inbound
reject(callId?, reason?)Decline — busy | declined | unavailable
end(callId?, reason?)Hang up
getCall(callId?)Snapshot by id
getActiveCall()Current non-terminal call

In-call media

MethodDescription
setMuted(muted, callId?)Mute / unmute mic
setVideoEnabled(enabled, callId?)Camera on / off
switchCamera(callId?)Front ↔ back
setTorch(enabled, callId?)Torch when available
setSpeaker(enabled, callId?)Earpiece ↔ speaker

Events

ts
const off = client.on('call:incoming', (call) => {
  // show UI
});
off(); // unsubscribe
EventPayload
ready
disconnectedreason?
errorError
call:updatedActiveCall
call:incomingActiveCall
call:endedActiveCall
quality:updated(callId, quality)
signaling:messagelow-level signaling message
waking:for-callboolean — kill-state / CallKit accept wake

Permissions helper

ts
import { requestCallPermissions } from '@alaznah/calling';

await requestCallPermissions({ video: true });

Config highlights (CallingClientConfig)

FieldPurpose
userIdStable end-user id (must match token)
getAuthTokenAsync token mint
signalingUrl?Override Hosted Signaling
iceServers? / iceTransportPolicy?ICE overrides / force relay
ringTimeoutMs?Auto-drop unanswered rings (default ~60s)
facingMode?Preferred camera
enableCallKeep?Optional second CallKit provider — usually false on iOS
entitlementProvider?Paid feature / session provider
logger?debug / info / warn / error

See also Authentication and Hosted Signaling.