open-wa
DocsAPI reference

Calls Client API

Generated client method reference for the calls namespace.

Calls Client API

This page documents 11 schema-registry client methods in the calls namespace.

Restricted

acceptCall

Prepare media and accept this incoming call.

Signature client.acceptCall(call: { generation: string; id: string; sessionId: string }, media?: { camera?: any; microphone?: any; onMediaFailure?: "end" \| "keep-open"; speaker?: any }): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.acceptCall({});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall, media
Aliasescalls.acceptCall
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/acceptCallacceptCallActive
AliasPOST/api/acceptCallacceptCallActive
Restricted

clearCallAudio

Discard queued outgoing audio.

Signature client.clearCallAudio(call: { generation: string; id: string; sessionId: string }): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.clearCallAudio({});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall
Aliasescalls.clearCallAudio
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/clearCallAudioclearCallAudioActive
AliasPOST/api/clearCallAudioclearCallAudioActive
Restricted

endCall

Request hangup for this call.

Signature client.endCall(call: { generation: string; id: string; sessionId: string }): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.endCall({});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall
Aliasescalls.endCall
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/endCallendCallActive
AliasPOST/api/endCallendCallActive
Restricted

getActiveCall

Get the current call snapshot. SDK clients hydrate its bound methods.

Signature client.getActiveCall(): Promise<{ id: string; sessionId: string; generation: string; peer: string; state: string; direction: "incoming" \| "outgoing"; video: boolean; terminal: boolean; observedAt: number \| "Infinity" \| "-Infinity" \| "NaN"; endReason?: { code: string; message: string; source: "local" \| "media" \| "license" \| "session" \| "whatsapp" } \| null; media?: { state: "attached" \| "ended"; reason?: string \| null } \| null>

Usage

const result = await client.getActiveCall();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<{ id: string; sessionId: string; generation: string; peer: string; state: string; direction: "incoming" | "outgoing"; video: boolean; terminal: boolean; observedAt: number | "Infinity" | "-Infinity" | "NaN"; endReason?: { code: string; message: string; source: "local" | "media" | "license" | "session" | "whatsapp" } | null; media?: { state: "attached" | "ended"; reason?: string | null } | null>

Resolves to { id: string; sessionId: string; generation: string; peer: string; state: string; direction: "incoming" \| "outgoing"; video: boolean; terminal: boolean; observedAt: number \| "Infinity" \| "-Infinity" \| "NaN"; endReason?: { code: string; message: string; source: "local" \| "media" \| "license" \| "session" \| "whatsapp" } \| null; media?: { state: "attached" \| "ended"; reason?: string \| null } \| null. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<Call \| null>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter order-
Aliasescalls.getActiveCall
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/getActiveCallgetActiveCallActive
AliasPOST/api/getActiveCallgetActiveCallActive

getCallCapabilities

Optional calling availability for UI and diagnostics. Actions perform admission automatically.

Signature client.getCallCapabilities(): Promise<{ control: boolean; audio: boolean; video: boolean; reason?: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" } }>

Usage

const result = await client.getCallCapabilities();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<{ control: boolean; audio: boolean; video: boolean; reason?: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" } }>

Resolves to { control: boolean; audio: boolean; video: boolean; reason?: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" } }. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallCapabilities>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter order-
Aliasescalls.getCallCapabilities
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/getCallCapabilitiesgetCallCapabilitiesActive
AliasPOST/api/getCallCapabilitiesgetCallCapabilitiesActive
Restricted

muteCall

Mute or unmute the microphone without ending reception.

Signature client.muteCall(call: { generation: string; id: string; sessionId: string }, muted: boolean): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.muteCall({}, true);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall, muted
Aliasescalls.muteCall
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/muteCallmuteCallActive
AliasPOST/api/muteCallmuteCallActive
Restricted

observeCallAudio

Attach an isolated receive-only audio sink. Its failure does not interrupt the call owner.

Signature client.observeCallAudio(call: { generation: string; id: string; sessionId: string }, speaker?: unknown): Promise<{ ok: true; status: "requested"; observerId: string } \| { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.observeCallAudio({});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; observerId: string } | { ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; observerId: string } \| { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult & { observerId?: string }>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall, speaker
Aliasescalls.observeCallAudio
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/observeCallAudioobserveCallAudioActive
AliasPOST/api/observeCallAudioobserveCallAudioActive
Restricted

rejectCall

Reject this call with native state confirmation.

Signature client.rejectCall(call: { generation: string; id: string; sessionId: string }): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.rejectCall({});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall
Aliasescalls.rejectCall
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/rejectCallrejectCallActive
AliasPOST/api/rejectCallrejectCallActive
Restricted

setCallMedia

Prepare a replacement before releasing the working media.

Signature client.setCallMedia(call: { generation: string; id: string; sessionId: string }, media?: { camera?: any; microphone?: any; onMediaFailure?: "end" \| "keep-open"; speaker?: any }): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.setCallMedia({});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall, media
Aliasescalls.setCallMedia
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/setCallMediasetCallMediaActive
AliasPOST/api/setCallMediasetCallMediaActive
Restricted

startCall

Prepare media and place an outgoing audio or video call.

Signature client.startCall(to: string, microphone?: unknown, speaker?: unknown, camera?: unknown): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.startCall("to");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter orderto, microphone, speaker, camera
Aliasescalls.startCall
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/startCallstartCallActive
AliasPOST/api/startCallstartCallActive
Restricted

stopCallAudioObserver

Stop an audio observer and finalize its sink.

Signature client.stopCallAudioObserver(call: { generation: string; id: string; sessionId: string }, observerId: string): Promise<{ ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string>

Usage

const result = await client.stopCallAudioObserver({}, "observerId");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<{ ok: true; status: "requested"; callId?: string | null } | { ok: false; status: "unavailable" | "failed" | "unknown"; reason: { code: string; message: string; status: number | "Infinity" | "-Infinity" | "NaN" }; callId?: string>

Resolves to { ok: true; status: "requested"; callId?: string \| null } \| { ok: false; status: "unavailable" \| "failed" \| "unknown"; reason: { code: string; message: string; status: number \| "Infinity" \| "-Infinity" \| "NaN" }; callId?: string. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<CallActionResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacecalls
Actionupdate
Functionalityboth
Positional parameter ordercall, observerId
Aliasescalls.stopCallAudioObserver
Deprecated aliases-
Licenserestricted
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/calls/stopCallAudioObserverstopCallAudioObserverActive
AliasPOST/api/stopCallAudioObserverstopCallAudioObserverActive

Was this helpful?

Your answer includes the page path and docs version.

On this page