Skip to main content
useDialin(params?): Object Tracks the dial-in readiness of the current room and the state of incoming caller sessions, and wraps the daily-js startDialIn() method. Accepts optional callbacks for the dial-in events. Readiness is set when a dialin-ready event is received. Incoming callers are tracked per session, keyed by sessionId. State is reset when the local participant leaves the meeting or the call instance is destroyed.
Dial-in requires a paid Daily account with a credit card on file. See the Dial-in and dial-out guide for setup and requirements.

Parameters

onDialinReady
Function
Callback for the dialin-ready event.
onDialinConnected
Function
Callback for the dialin-connected event.
onDialinStopped
Function
Callback for the dialin-stopped event.
onDialinError
Function
Callback for the dialin-error event.
onDialinWarning
Function
Callback for the dialin-warning event.

Return value

Returns an object with the following properties:
isReady
boolean
true once a dialin-ready event has been received, meaning the room’s SIP endpoint is ready to receive incoming calls.
sipEndpoint
string
The room’s SIP endpoint. Populated after dialin-ready.
provider
string
The SIP/PSTN service provider. Populated after dialin-ready.
sessions
Object
A map of incoming dial-in caller sessions, keyed by sessionId.
startDialIn
Function
Wraps daily-js’s startDialIn() method.

Example

import { useDialin } from '@daily-co/daily-react';

export const DialinStatus = () => {
  const { isReady, sipEndpoint, sessions } = useDialin({
    onDialinError: (ev) => console.error('Dial-in error', ev.errorMsg),
  });

  return (
    <div>
      <p>
        Dial-in {isReady ? 'ready' : 'not ready'}
        {sipEndpoint ? ` at ${sipEndpoint}` : ''}
      </p>
      <p>{Object.keys(sessions).length} caller(s) connected</p>
    </div>
  );
};

See also