## Calls A `DialerCall` is one call. Outbound calls come back from `dialer.call()`; inbound calls arrive on the session's `incoming` event and must be accepted or rejected. ### Fields | Field | Type | Notes | | --- | --- | --- | | `direction` | `"outbound" \| "inbound"` | Which way the call was placed. | | `remoteNumber` | `string \| null` | The number you dialed, or the caller's number, in E.164 when known. | | `callerName` | `string \| null` | Inbound only. The caller's display name from your CRM, when the line has one. | | `lineName` | `string \| null` | Inbound only. The name of the line being called. | ### Methods | Method | Notes | | --- | --- | | `accept()` | Inbound only. Answer the call. | | `reject()` | Inbound only. Decline without answering. | | `hangup()` | End the call from your side. | | `mute(shouldMute = true)` | Mute or unmute the microphone. Emits `mute`. | | `isMuted()` | Current mute state. | | `sendDigits(digits)` | DTMF tones for phone menus, e.g. `"1"` or `"123#"`. | | `status()` | One of the statuses below. | | `isActive()` | True from `connecting` through `reconnecting`; false once `closed`. | ### status() values `pending`, `connecting`, `ringing`, `open`, `reconnecting`, `closed` | Value | Meaning | | --- | --- | | `pending` | Created, no signaling yet. | | `connecting` | Signaling in progress. | | `ringing` | The remote side is being rung. | | `open` | Media is flowing. | | `reconnecting` | Lost the connection and trying to recover. | | `closed` | Ended. | ### Events | Event | Payload | When | | --- | --- | --- | | `ringing` | `{ hasEarlyMedia }` | Outbound: the remote side is being rung. hasEarlyMedia means carrier audio is already playing. | | `accepted` | `—` | Media is flowing. | | `disconnected` | `—` | The call ended, by either side. | | `cancelled` | `—` | Inbound: the caller hung up before you answered. | | `rejected` | `—` | You called reject(), or the remote side declined. | | `error` | `DialerError` | The call failed. | | `reconnecting` | `DialerError` | Connection lost; the SDK is trying to recover. | | `reconnected` | `—` | Recovered. | | `mute` | `boolean` | Mute state changed. | | `warning` | `string` | Non-fatal media quality warning, e.g. high-jitter. | | `warningCleared` | `string` | A previous warning cleared. | Exactly one of `disconnected`, `cancelled`, or `rejected` fires when a call ends, and never more than once. Clear your UI on all three. ### Inbound calls A session receives calls only while its token was minted with `inboundEnabled: true`. That requires the line to have an inbound number and at least one person in your workspace in its ring set; the SDK then rings **alongside** them, never instead of them. A line with nobody in its ring set still answers "no one is available", SDK or not. Because `inboundEnabled` is evaluated at every mint, it can change mid-session. Read the value from each `ready` event rather than caching it at start, and show an inbound UI only when it is true. > **Answering needs a user gesture** > > Browsers block audio until the page has been interacted with. Wire `accept()` to a button the user clicks; do not auto-answer from the `incoming` handler. **Outbound — browser.ts** ```javascript const call = await dialer.call('+15551234567'); // E.164, leading + required call.on('ringing', ({ hasEarlyMedia }) => setStatus(hasEarlyMedia ? 'Ringing…' : 'Connecting…')); call.on('accepted', () => setStatus('Connected')); call.on('disconnected', () => setStatus('Ended')); call.on('reconnecting', () => setStatus('Reconnecting…')); call.on('warning', (name) => console.warn('call quality:', name)); muteButton.onclick = () => call.mute(!call.isMuted()); keypad.onpress = (digit) => call.sendDigits(digit); hangupButton.onclick = () => call.hangup(); ``` **Inbound — browser.ts** Only fires when the token was minted with inboundEnabled: true. ```javascript dialer.on('incoming', (call) => { showIncomingUi(call.remoteNumber, call.callerName, call.lineName, { answer: () => call.accept(), decline: () => call.reject(), }); call.on('cancelled', hideIncomingUi); // caller hung up before you answered call.on('accepted', () => setStatus('Connected')); call.on('disconnected', () => setStatus('Ended')); }); ```