> ## 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](/docs/daily-js/features/dialin-dialout) 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](/reference/daily-js/events/telephony-events).

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`](/reference/rest-api/rooms/create-room#body-properties-enable-dialout) set on
  the room. See the [Dial-in and dial-out guide](/docs/guides/features/dial-in-dial-out) for setup and
  requirements.
</Note>

## Parameters

<ParamField body="onDialOutConnected" type="Function">
  Callback for the [`dialout-connected`](/reference/daily-js/events/telephony-events#dialout-connected) event.
</ParamField>

<ParamField body="onDialOutAnswered" type="Function">
  Callback for the [`dialout-answered`](/reference/daily-js/events/telephony-events#dialout-answered) event.
</ParamField>

<ParamField body="onDialOutStopped" type="Function">
  Callback for the [`dialout-stopped`](/reference/daily-js/events/telephony-events#dialout-stopped) event.
</ParamField>

<ParamField body="onDialOutError" type="Function">
  Callback for the [`dialout-error`](/reference/daily-js/events/telephony-events#dialout-error) event.
</ParamField>

<ParamField body="onDialOutWarning" type="Function">
  Callback for the [`dialout-warning`](/reference/daily-js/events/telephony-events#dialout-warning) event.
</ParamField>

## Return value

Returns an object with the following properties:

<ResponseField name="sessions" type="Object">
  A map of active dial-out sessions, keyed by `sessionId`.

  <Expandable title="session properties">
    <ResponseField name="sessions[sessionId].sessionId" type="string">
      The session ID of the dial-out participant. Use this value with `stopDialOut`, `sendDTMF`,
      `sipCallTransfer` and `sipRefer`.
    </ResponseField>

    <ResponseField name="sessions[sessionId].status" type="string">
      The latest status for the session: `'connected'`, `'answered'`, `'stopped'`, `'error'` or
      `'warning'`.
    </ResponseField>

    <ResponseField name="sessions[sessionId].provider" type="string">
      The SIP/PSTN service provider for the session, when reported.
    </ResponseField>

    <ResponseField name="sessions[sessionId].sipCallId" type="string">
      The SIP call ID for the session, when reported.
    </ResponseField>

    <ResponseField name="sessions[sessionId].errorMsg" type="string">
      The error or warning message, set when `status` is `'error'` or `'warning'`.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="startDialOut" type="Function">
  Wraps `daily-js` [`startDialOut()`](/reference/daily-js/instance-methods/start-dial-out).
</ResponseField>

<ResponseField name="stopDialOut" type="Function">
  Wraps `daily-js` [`stopDialOut()`](/reference/daily-js/instance-methods/stop-dial-out).
</ResponseField>

<ResponseField name="sendDTMF" type="Function">
  Wraps `daily-js` [`sendDTMF()`](/reference/daily-js/instance-methods/send-dtmf).
</ResponseField>

<ResponseField name="sipCallTransfer" type="Function">
  Wraps `daily-js` [`sipCallTransfer()`](/reference/daily-js/instance-methods/sip-call-transfer).
</ResponseField>

<ResponseField name="sipRefer" type="Function">
  Wraps `daily-js` [`sipRefer()`](/reference/daily-js/instance-methods/sip-refer).
</ResponseField>

<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`.
</Note>

## 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

<CardGroup>
  <Card title="Hooks" icon="code" iconType="solid">
    * [useDialin()](/reference/daily-react/use-dialin)
  </Card>

  <Card title="daily-js methods" icon="code" iconType="solid">
    * [startDialOut()](/reference/daily-js/instance-methods/start-dial-out)
    * [stopDialOut()](/reference/daily-js/instance-methods/stop-dial-out)
    * [sendDTMF()](/reference/daily-js/instance-methods/send-dtmf)
    * [sipCallTransfer()](/reference/daily-js/instance-methods/sip-call-transfer)
    * [sipRefer()](/reference/daily-js/instance-methods/sip-refer)
  </Card>

  <Card title="Events" icon="bolt" iconType="solid">
    * [dialout-connected](/reference/daily-js/events/telephony-events#dialout-connected)
    * [dialout-answered](/reference/daily-js/events/telephony-events#dialout-answered)
    * [dialout-stopped](/reference/daily-js/events/telephony-events#dialout-stopped)
    * [dialout-error](/reference/daily-js/events/telephony-events#dialout-error)
    * [dialout-warning](/reference/daily-js/events/telephony-events#dialout-warning)
  </Card>

  <Card title="Guides" icon="book-open" iconType="solid">
    * [Dial-in and dial-out](/docs/guides/features/dial-in-dial-out)
  </Card>
</CardGroup>
