Skip to contentSkip to navigationSkip to topbar

Call Forwarding with Voicemail

Created by: Twilio
  • Voice
  • PHP
  • Go
  • JavaScript
  • .NET
  • Quick Deploy

This app will show you how to build a call forwarding app that forwards calls during a specific time window and records voicemails if calls are unanswered or outside that time window.

How it works:

  1. Call is placed to your Twilio number
  2. Your app checks the time
  3. If the time is within the defined window, it will forward the call to another phone number
  4. If it is not in the defined time window, it will record a voicemail
Report this template(link takes you to an external page)
Quick Deploy to TwilioGet CodeUse Twilio CLI
Launch and test this app in a few minutes with Quick Deploy. No server needed. Quick Deploy will automatically configure and deploy this app using Twilio Functions. Learn more about Twilio Functions(link takes you to an external page)
  1. Log in to Twilio

    Access your Twilio account to get started.

    Checking for existing account...

  2. Get a Twilio phone number

    Your app requires a Twilio phone number to operate, this is your application's source number to receive messages or calls.

    You will get a US number that is configured for this application. You can change this or port over an existing number later. International number regulations(link takes you to an external page)
  3. My Phone Number

    Calls made to your Twilio number will get forwarded to this E.164-formatted phone number

  4. Timezone Offset

    The timezone offset from UTC to check for business hours (-8 for PST, -5 for EST)

  5. Work Week Start

    Day of the week where the business hours should start applying. 0-6 = Sunday - Saturday. Default is set to 1, which is Monday

  6. Work Week End

    Day of the week after which the business hours should stop applying. 0-6 = Sunday - Saturday. Default is set to 5, which is Friday

  7. Work Hour Start

    Hour of the day where business hours should start. 0-23. Default is set to 8, meaning business hours start at 8:00:00AM

  8. Work Hour End

    Hour of the day where business hours should stop. 0-23. Default is set to 18, meaning business hours end at 18:59:59 or 6:59:59PM

  9. Click the button below to deploy your app

    This will use the details entered above to deploy your application to Twilio Functions.

    You will be able to view the application in the browser and edit it using the Functions UI.

Need some help?

We all do sometimes; code is hard. Get help now from our support team(link takes you to an external page), or lean on the wisdom of the crowd by browsing the Twilio tag(link takes you to an external page)on Stack Overflow.

Terms of servicePrivacy Policy

Copyright © 2025 Twilio Inc.