> ## Documentation Index
> Fetch the complete documentation index at: https://docs.daily.co/llms.txt
> Use this file to discover all available pages before exploring further.

# useDialOut

> useDialOut tracks the state of PSTN/SIP dial-out sessions and wraps the daily-js dial-out, DTMF and SIP transfer methods.

`useDialOut(params?): Object`

Tracks the state of [dial-out](https://docs.daily.co/docs/daily-js/features/dialin-dialout.md) sessions and returns helper
functions that wrap the `daily-js` dial-out, DTMF and SIP transfer methods. Accepts optional
callbacks for the [dial-out events](https://docs.daily.co/reference/daily-js/events/telephony-events.md).

Dial-out state is tracked per session, keyed by `sessionId`. State is reset when the local
participant leaves the meeting or the call instance is destroyed.

> [!NOTE]
>
> Dial-out requires a paid Daily account, [dial-out approval](https://forms.gle/Q5eaHLEosuKyzC7BA),
> and [`enable_dialout`](https://docs.daily.co/reference/rest-api/rooms/create-room#body-properties-enable-dialout) set on
> the room. See the [Dial-in and dial-out guide](https://docs.daily.co/docs/guides/features/dial-in-dial-out) for setup and
> requirements.

## Parameters

**onDialOutConnected** `Function`

Callback for the [`dialout-connected`](https://docs.daily.co/reference/daily-js/events/telephony-events#dialout-connected) event.

**onDialOutAnswered** `Function`

Callback for the [`dialout-answered`](https://docs.daily.co/reference/daily-js/events/telephony-events#dialout-answered) event.

**onDialOutStopped** `Function`

Callback for the [`dialout-stopped`](https://docs.daily.co/reference/daily-js/events/telephony-events#dialout-stopped) event.

**onDialOutError** `Function`

Callback for the [`dialout-error`](https://docs.daily.co/reference/daily-js/events/telephony-events#dialout-error) event.

**onDialOutWarning** `Function`

Callback for the [`dialout-warning`](https://docs.daily.co/reference/daily-js/events/telephony-events#dialout-warning) event.

## Return value

Returns an object with the following properties:

**sessions** `Object`

A map of active dial-out sessions, keyed by `sessionId`.

**session properties**

**sessions\[sessionId].sessionId** `string`

The session ID of the dial-out participant. Use this value with `stopDialOut`, `sendDTMF`,
`sipCallTransfer` and `sipRefer`.

**sessions\[sessionId].status** `string`

The latest status for the session: `'connected'`, `'answered'`, `'stopped'`, `'error'` or
`'warning'`.

**sessions\[sessionId].provider** `string`

The SIP provider for the session, when reported: `'signalwire'` or `'daily'`.

**sessions\[sessionId].sipCallId** `string`

The SIP call ID for the session, when reported.

**sessions\[sessionId].errorMsg** `string`

The error or warning message, set when `status` is `'error'` or `'warning'`.

**startDialOut** `Function`

Wraps `daily-js` [`startDialOut()`](https://docs.daily.co/reference/daily-js/instance-methods/start-dial-out). Pass `provider: 'daily'` with a `sipUri` to dial through the [Daily SIP provider](https://docs.daily.co/docs/guides/features/dial-in-dial-out#sip-providers).

**stopDialOut** `Function`

Wraps `daily-js` [`stopDialOut()`](https://docs.daily.co/reference/daily-js/instance-methods/stop-dial-out).

**sendDTMF** `Function`

Wraps `daily-js` [`sendDTMF()`](https://docs.daily.co/reference/daily-js/instance-methods/send-dtmf).

**sipCallTransfer** `Function`

Wraps `daily-js` [`sipCallTransfer()`](https://docs.daily.co/reference/daily-js/instance-methods/sip-call-transfer).

**sipRefer** `Function`

Wraps `daily-js` [`sipRefer()`](https://docs.daily.co/reference/daily-js/instance-methods/sip-refer).

> [!NOTE]
>
> A `dialout-error` or `dialout-warning` that arrives before a session is established (with no
> `sessionId`) is delivered through the `onDialOutError` / `onDialOutWarning` callbacks, but is not
> added to `sessions`.

## Example

```jsx theme={null}
import { useDialOut } from '@daily-co/daily-react';

export const DialOutDemo = () => {
  const { sessions, startDialOut, stopDialOut, sendDTMF } = useDialOut({
    onDialOutError: (ev) => console.error('Dial-out failed', ev.errorMsg),
  });

  const callSupport = () =>
    startDialOut({ phoneNumber: '+15551234567' });

  return (
    <div>
      <button onClick={callSupport}>Call support</button>
      {Object.values(sessions).map((session) => (
        <div key={session.sessionId}>
          <span>
            {session.sessionId}: {session.status}
          </span>
          <button
            onClick={() =>
              sendDTMF({ sessionId: session.sessionId, tones: '1' })
            }
          >
            Press 1
          </button>
          <button onClick={() => stopDialOut({ sessionId: session.sessionId })}>
            Hang up
          </button>
        </div>
      ))}
    </div>
  );
};
```

## See also

> [card] Hooks
>
> * [useDialin()](https://docs.daily.co/reference/daily-react/use-dialin.md)

> [card] daily-js methods
>
> * [startDialOut()](https://docs.daily.co/reference/daily-js/instance-methods/start-dial-out.md)
> * [stopDialOut()](https://docs.daily.co/reference/daily-js/instance-methods/stop-dial-out.md)
> * [sendDTMF()](https://docs.daily.co/reference/daily-js/instance-methods/send-dtmf.md)
> * [sipCallTransfer()](https://docs.daily.co/reference/daily-js/instance-methods/sip-call-transfer.md)
> * [sipRefer()](https://docs.daily.co/reference/daily-js/instance-methods/sip-refer.md)

> [card] Events
>
> * [dialout-connected](https://docs.daily.co/reference/daily-js/events/telephony-events.md#dialout-connected)
> * [dialout-answered](https://docs.daily.co/reference/daily-js/events/telephony-events.md#dialout-answered)
> * [dialout-stopped](https://docs.daily.co/reference/daily-js/events/telephony-events.md#dialout-stopped)
> * [dialout-error](https://docs.daily.co/reference/daily-js/events/telephony-events.md#dialout-error)
> * [dialout-warning](https://docs.daily.co/reference/daily-js/events/telephony-events.md#dialout-warning)

> [card] Guides
>
> * [Dial-in and dial-out](https://docs.daily.co/docs/guides/features/dial-in-dial-out)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.