# Set Key Events Based on Time Conditions

An Interactive Voice Response (IVR) menu is the automated greeting that answers a call and asks the caller to press a key to reach a department or destination. That menu does not have to send callers to the same place around the clock. Cloud Voice lets you attach a time condition to your key press events, so pressing 1 during business hours can reach one destination while the same key after hours, or on a holiday, reaches another. You can hold every key to a single schedule, or give each key its own.

:::note
This feature requires system version 84.18.0.59 or later.
:::

:::caution
Clicking **Apply** at the end of these steps makes your routing changes take effect for live calls straight away. Double-check every destination before you apply, or callers could be sent to the wrong place.
:::

## Apply one time condition to every key

Choose this approach when the whole menu should follow the same schedule.

1. Sign in to the phone system web portal and open **Call Features > IVR**.
2. Edit the IVR you want to change.
3. On the **Key Press Event** tab, set up the destinations each key should reach.
4. In the top-right corner, click **Advanced Settings**.

   ![Advanced Settings button at the top of the IVR editor](/images/pbx/enable-advanced-settings-for-ivr.png)

5. Select the **Time Condition** checkbox, then choose **Same time condition for all key presses**.

   ![Time Condition enabled with the same-condition-for-all-keys option selected](/images/pbx/select-apply-same-time-condition-for-ivr.png)

6. From the **Time-based Mode** drop-down, pick the schedule that every key will follow, then continue with the matching steps below.

### Follow the business hours of a time zone

This mode reuses the business hours, non-working hours, and holidays you maintain under **Call Control > Business Hours and Holidays** for a given time zone.

1. Select **Based on Business Hours Configured for the Time Zone**, choose the time zone, then click **Confirm**. The schedule for that time zone now governs every key in the IVR.

   ![Time-based Mode set to a time zone's business hours](/images/pbx/select-global-hours-1.png)

2. For each key, set its routing destinations:

   ![Business-hours, outside-hours, and holiday destinations for a key press](/images/pbx/time-ir-settings.png)

   - **Business Hours Destination**
   - **Outside Business Hours Destination**
   - **Holidays Destination**

   :::note
   To route holiday calls by the business and non-working hours instead of a separate holiday destination, select the **Ignore the Holiday Destination** checkbox.
   :::

3. Repeat step 2 for every key you want to route.
4. Click **Save**, then **Apply**.

### Follow custom business hours

Define a business-hours schedule in the system's default time zone and apply it to the whole menu.

1. From **Time-based Mode**, select **Based on Custom Business Hours**.

   ![Time-based Mode set to custom business hours](/images/pbx/select-custom-business-hours.png)

2. Click **Add Custom Business Hours** to build the schedule.

   ![Building a custom business-hours schedule with start and end times and workdays](/images/pbx/create-a-custom-business-hour.png)

   1. Click **Add** and enter the start time and end time.
   2. Under **Date Settings**, choose the workdays.
   3. Click **Confirm**.

3. Click **Confirm** to apply these hours to every key in the IVR.
4. For each key, set its routing destinations:

   ![Destinations for a key that follows custom business hours](/images/pbx/time-ir-settings.png)

   - **Business Hours Destination**
   - **Outside Business Hours Destination**
   - **Holidays Destination**

   :::note
   To route holiday calls by the custom business and non-working hours instead of a separate holiday destination, select the **Ignore the Holiday Destination** checkbox.
   :::

5. Repeat step 4 for every key you want to route.
6. Click **Save**, then **Apply**.

### Follow custom time periods

Here the time periods are created per key, even though the menu shares this mode.

1. From **Time-based Mode**, select **Based on Custom Time Periods**.

   ![Time-based Mode set to custom time periods](/images/pbx/select-custom-time-periods.png)

2. Under a key, click **Add Custom Time Periods** to create a period in the system's default time zone.

   ![Creating a custom time period for a key](/images/pbx/create-a-custom-time-period.png)

   1. Click **Add** and enter the start time and end time.
   2. In the **Destination** drop-down, choose where calls that arrive within the period should go.
   3. Under **Date Settings**, choose the workdays.
   4. Click **Confirm**.

   :::note
   These custom time periods take effect only for this key press event.
   :::

3. Set the remaining destinations for the key:

   ![Holiday and default destinations for a key using custom time periods](/images/pbx/custom-time-period.png)

   - **Holidays Destination**: where calls go during holidays.

     :::note
     To route holiday calls by the custom time periods instead of a separate holiday destination, select the **Ignore the Holiday Destination** checkbox.
     :::
   - **Default Destination**: where calls go outside the custom time periods.

4. Repeat steps 2 and 3 for every key you want to route.
5. Click **Save**, then **Apply**.

## Apply a different time condition to each key

Choose this approach when individual keys need their own schedules.

1. Sign in to the phone system web portal and open **Call Features > IVR**.
2. Edit the IVR you want to change.
3. On the **Key Press Event** tab, turn on per-key time conditions:

   ![Per-key time condition option enabled in Advanced Settings](/images/pbx/ivr-custom-time-condition-for-each-key-presses.png)

   1. In the top-right corner, click **Advanced Settings**.
   2. Select **Time Condition**.
   3. Select **Custom time condition for each key press**.
   4. Click **Confirm**.

4. For each key, open its **Time-based Mode** drop-down, pick one of the modes below, and set the destinations.

   **All Time**: always send the key's calls to a single destination.

   ![A key set to route calls at all times to one destination](/images/pbx/ivr-custom-time-all-time.png)

   1. In **Time-based Mode**, select **All Time**.
   2. In the **Destination** drop-down, choose the destination.

   **Based on Business Hours Configured for the Time Zone**: follow the business hours, non-working hours, and holidays of a time zone defined under **Call Control > Business Hours and Holidays**.

   ![A key following the business hours of a selected time zone](/images/pbx/ivr-custom-time-global-business-hours-1.png)

   1. In **Time-based Mode**, select **Based on Business Hours Configured for the Time Zone**, then choose the time zone.
   2. Set the routing destinations:
      - **Business Hours Destination**
      - **Outside Business Hours Destination**
      - **Holidays Destination**

      :::note
      To route holiday calls by the business and non-working hours instead of a separate holiday destination, select the **Ignore the Holiday Destination** checkbox.
      :::

   **Based on Custom Business Hours**: define a business-hours schedule in the system's default time zone for this key.

   ![A key set to use custom business hours](/images/pbx/ivr-custom-time-custombusiness-hours.png)

   1. In **Time-based Mode**, select **Based on Custom Business Hours**.
   2. Click **Add Custom Business Hours** to build the schedule.

      ![Defining custom business hours for a single key](/images/pbx/ivr-custom-business-hours-create.png)

   1. Click **Add** and enter the start time and end time.
   2. Under **Date Settings**, choose the workdays.
   3. Click **Confirm**.

   3. Set the routing destinations:

      ![Destinations for a key that follows custom business hours](/images/pbx/ivr-custom-business-hours-destinations.png)

      - **Business Hours Destination**
      - **Outside Business Hours Destination**
      - **Holidays Destination**

      :::note
      To route holiday calls by the custom business and non-working hours instead of a separate holiday destination, select the **Ignore the Holiday Destination** checkbox.
      :::

   **Based on Custom Time Periods**: define one or more time periods in the system's default time zone for this key.

   ![A key set to use custom time periods](/images/pbx/ivr-custom-time-periods.png)

   1. In **Time-based Mode**, select **Based on Custom Time Periods**.
   2. Click **Add Custom Time Periods** to create a period.

      ![Creating a custom time period for a key](/images/pbx/ivr-create-a-custom-time-period.png)

   1. Click **Add** and enter the start time and end time.
   2. In the **Destination** drop-down, choose where calls that arrive within the period should go.
   3. Under **Date Settings**, choose the workdays.
   4. Click **Confirm**.

   3. Set the remaining destinations:

      ![Holiday and default destinations for a key with custom time periods](/images/pbx/ivr-custom-time-periods-destinations.png)

      - **Holidays Destination**: where calls go during holidays.

        :::note
        To route holiday calls by the custom time periods instead of a separate holiday destination, select the **Ignore the Holiday Destination** checkbox.
        :::
      - **Default Destination**: where calls go outside the custom time periods.

5. Repeat step 4 for every key you want to route.
6. Click **Save**, then **Apply**.
