Skip to content

twilio-samples/call-forwarding-voicemail-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twilio

Twilio Verify Quickstart with .NET core

About

This app shows how to build a call forwarding system with voicemail using C# and Twilio.

How it works:

  • Call is placed to your Twilio number
  • Your app checks the time
  • If the time is within the defined window, it will forward the call to another phone number
  • If it is not in the defined time window, it will record a voicemail

Set up

Requirements

Twilio Account Settings

This application should give you a ready-made starting point for writing your own application. Before we begin, we need to collect all the config values we need to run the application:

Local development

After the above requirements have been met:

  1. Clone this repository and cd into it
git clone [email protected]:twilio-samples/call-forwarding-csharp
cd call-forwarding-csharp
  1. Add necessary nuget packages
dotnet add package Twilio
dotnet add package Twilio.AspNet.Core
  1. Tweak phone number and time variables.

Necessary settings are located in the appsettings.json file in this project. Go into appsettings.json and fill in the phone number you want to forward your calls to under PhoneNumber. You can also change DayStart and DayEnd variables. Times are in UTC in this demo.

  1. Build to install the dependencies
dotnet build
  1. Run the application
dotnet run
  1. Use ngrok or other tunneling service to expose your application to the internet

You will need to use ngrok or another tunneling service to allow Twilio to reach your running application. Use the following command, replacing the port number that's shown here with the port that your application is running on.

ngrock http http://localhost:5183
  1. Set your ngrok endpoint as a Webhook in the Twilio console. Remember to append /voice to the ngrok URL.

That's it!

Resources

  • The CodeExchange repository can be found here.

Contributing

This template is open source and welcomes contributions. All contributions are subject to our Code of Conduct.

License

MIT

Disclaimer

No warranty expressed or implied. Software is as is.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages