When someone dials in to a phone number instead of routing the person to a specific room or call (usually identified by PIN Code), in the pinless dialin, a new room is created and the Daily Bot joins that room. If someone re-dials the phone number, they will be connected to a new room.

Another thing to note, unlike an RTVI webapp, which sends the config, in the dial-in case, the

The workflow is as follows:

  1. Buy a phone number and configure it for Pinless dial-in
  2. When a phone call is received on Daily, Daily will trigger a webhook ($DIALIN_URL) to your application infrastructure. Meanwhile the call is put on hold and the end user will hear hold music
  3. Within the webhook, your app will set up the RTVI config and services and call Daily’s https://api.daily.co/v1/bots/start
  4. When the bot joins the call, the end-user is forwarded to the call and should hear the bot speak shortly after joining.

Things to have handy:

  • Your account’s API Key
  • Your hosted application’s URL ($DIALIN_URL), the URL should contain the path that will receive the dial-in webhook from Daily, for example, https://www.example.com/api/dialin. See our tutorial on Dial-in for more details.

Purchase a phone number

There are a couple of steps here

  1. To buy a random phone number
  2. To buy a specific phone number

To quickly buy a numbner, make a POST request with no data field, the response will return a random phone number

curl --request POST \
  --url 'https://api.daily.co/v1/buy-phone-number' \
  --header 'Authorization: Bearer $TOKEN' \
  --header 'Content-Type: application/json'

Alternatively, if you are looking for a particular type of phone number, you can search for the available numbers and buy a number of your choosing.

Setting up a Pinless Dial-in phone number

The pinless dial-in will invoke an HTTP call to your infrastructure, which would then call Daily’s /bot/start endpoint. The $DIALIN_URL is triggered when a call is received on the phone_number. The pinless_dialin configuration is set on your Daily domain and sets up the first part of that workflow, i.e., connecting the phone number to the $DIALIN_URL.

curl --request POST \
--location 'https://api.daily.co/v1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $TOKEN' \
--data '{
    "properties": {
        "pinless_dialin": [{
            "phone_number":"+19499870006",
            "room_creation_api": "$DIALIN_URL"
        }]
    }
}'

pinless_dialin is an array that can contain forwarding rules for several phone_numbers. These phone numbers can map to the same room_creation_api or different URLs.

If you have configured multiple phone numbers, make note that the all phone_numbers should be present when updating a single phone_number. The API does not do partial array updates, i.e., a POST request will override the existing pinless_dialin array with the new value. Hence, to keep existing routes, you should them all.

How does it work

Daily triggers a POST request to the URL specified by the room_creation_api in the pinless_dialin configuration (e.g., $DIALIN_URL). The following payload is received at the $DIALIN_URL:

// data received on the webhook, map it to `dialin_settings`
{
  "From": "+CALLERS_PHONE",
  "To": "$NUMBER",
  "callId": "callid-read-only-string",
  "callDomain": "callDomain-read-only-string"
}

Your server-side application will have to construct the appropriate bot config and call /bot/start:

const payload = {
  bot_profile: defaultBotProfile,
  services: defaultServices,
  api_keys: {
    together: TOGETHER_API_KEY,
    cartesia: CARTESIA_API_KEY,
  },
  config: defaultConfig,
  dialin_settings: {
    callId,
    callDomain,
  },
  max_duration: defaultMaxDuration,
};

Finally, when you call the phone number, you will initially hear the hold music until the bot connects. The bot should start speaking immediately after the call connects.

Voila, you now have a bot that responds to dial-in calls!