Skip to main content

@dialstack/sdk / react / UseCallsOptions

Interface: UseCallsOptions

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:50

Extends

  • PhoneOptions

Properties

apiBaseUrl?

optional apiBaseUrl?: string;

Defined in: sdk/src/webrtc/types.ts:15

Inherited from

PhoneOptions.apiBaseUrl

autoConnect?

optional autoConnect?: boolean;

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:55

Connect automatically once the phone is constructed (default: true). Set false to render the UI without connecting yet (e.g. token still loading).


autoReconnect?

optional autoReconnect?: boolean;

Defined in: sdk/src/webrtc/types.ts:31

Inherited from

PhoneOptions.autoReconnect

createSignalingSocket?

optional createSignalingSocket?: SignalingSocketFactory;

Defined in: sdk/src/webrtc/types.ts:63

Opens the signaling WebSocket. Defaults to a bare new WebSocket(url, protocols). React Native supplies a variant that attaches a User-Agent header (the signaling ingress 403s a handshake without one, and iOS's WebSocket sends none by default); browsers forbid overriding it, so web uses the default.

Inherited from

PhoneOptions.createSignalingSocket

emergencyAddressId?

optional emergencyAddressId?: string;

Defined in: sdk/src/webrtc/types.ts:39

The emergency-address resource id (emerg_…) this softphone uses for E911. Presented on the authenticate handshake so the server can bind it to the current network. When omitted, a previously persisted id (see setEmergencyAddress) is loaded from storage if available.

Inherited from

PhoneOptions.emergencyAddressId

iceServers?

optional iceServers?: RTCIceServer[];

Defined in: sdk/src/webrtc/types.ts:32

Inherited from

PhoneOptions.iceServers

onAppResume?

optional onAppResume?: AppResumeSubscribe;

Defined in: sdk/src/webrtc/types.ts:72

Subscribe to "the app/tab returned to the foreground". Defaults to the web DOM lifecycle events (visibilitychange/focus/online/pageshow); React Native has no document, so the RN softphone provider supplies an AppState-backed variant here. On resume the transport actively re-verifies the connection (a backgrounded tab's throttled event loop may never have processed the socket's close), reconnecting if it's dead.

Inherited from

PhoneOptions.onAppResume

onCallActivated?

optional onCallActivated?: (call) => void;

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:68

Fired when a call is answered (becomes active). The web softphone ignores this (remote audio auto-plays through its <audio> element); React Native uses it to take the audio session (InCallManager.start).

Parameters

call

Call

Returns

void


onCallEnded?

optional onCallEnded?: (e) => void;

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:74

Fired when the foreground call ends. React Native uses it to release the audio session (InCallManager.stop).

Parameters

e
reason

CallEndReason

Returns

void


onCallStarted?

optional onCallStarted?: (e) => void;

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:61

Fired when a call (in or out) becomes the foreground call.

Parameters

e
direction

"inbound" | "outbound"

peer

string

Returns

void


onError?

optional onError?: (e) => void;

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:77

Fired on a non-fatal or fatal phone error.

Parameters

e
code

string

message

string

Returns

void


onIncomingCall?

optional onIncomingCall?: (e) => void;

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:58

Fired when an inbound call arrives and becomes the foreground call.

Parameters

e
from

string

fromName

string | null

Returns

void


onNetworkChanged?

optional onNetworkChanged?: () => void;

Defined in: sdk/src/react/softphone/hooks/useCalls.ts:84

Fired when the server rejects the session's emergency address for the current network (the network.changed signal). Outbound PSTN is gated until an address valid here is confirmed; 911/933 still flow.

Returns

void


onTokenExpiring?

optional onTokenExpiring?: () => Promise<string>;

Defined in: sdk/src/webrtc/types.ts:30

Returns

Promise<string>

Inherited from

PhoneOptions.onTokenExpiring

ringback?

optional ringback?: Ringback;

Defined in: sdk/src/webrtc/types.ts:55

Outbound ringback tone. Defaults to the WebAudio RingbackTone. React Native has no AudioContext, so the RN softphone provider supplies an InCallManager-backed implementation here. One instance is shared across calls (outbound ringback plays one call at a time).

Inherited from

PhoneOptions.ringback

signalingBaseUrl?

optional signalingBaseUrl?: string;

Defined in: sdk/src/webrtc/types.ts:29

Base URL of the signaling server the phone opens its WebSocket to, e.g. wss://webrtc.dialstack.ai. The signaling host is separate from apiBaseUrl (the REST API) and is served by region-aware infrastructure, so latency-based DNS routes each client to the nearest region automatically — no client-side region selection is needed.

When omitted, it defaults to the standard signaling host derived from apiBaseUrl (the api. hostname label becomes webrtc.). Override only for self-hosting, staging, or a proxy. ws/wss and http/https are accepted; http(s) is upgraded to ws(s). A trailing /v1/webrtc path is appended automatically if absent.

Inherited from

PhoneOptions.signalingBaseUrl

storage?

optional storage?: PlatformStorage;

Defined in: sdk/src/webrtc/types.ts:48

Synchronous key/value store used to persist the selected E911 address id across launches. Optional at this layer: it defaults to the platform seam's store — localStorage on web, an in-memory (non-persisting) store on React Native. On React Native the softphone provider requires the host to supply a real store (e.g. an AsyncStorage- or MMKV-backed adapter), because the SDK takes no persistence dependency of its own.

Inherited from

PhoneOptions.storage

token

token: string;

Defined in: sdk/src/webrtc/types.ts:14

Inherited from

PhoneOptions.token