We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at github.com/twilio-labs/code-exchange/issues and we'll try to help you.
Learn how to send an SMS to someone who's called your Twilio phone number while they're on the call.
This small sample application will say a short message to an inbound caller and, at the same time, send them an SMS.
Implementations in other languages:
PHP | Java | Python | Ruby | Node |
---|---|---|---|---|
Done | Done | Done | Done | Done |
- .NET Framework
- A Twilio account - sign up
- ngrok
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:
Config Value | Description |
---|---|
Account Sid | Your primary Twilio account identifier - find this in the Console. |
Auth Token | Used to authenticate - just like the above, you'll find this here. |
After the above requirements have been met:
- Clone this repository and
cd
into it
git clone [email protected]:TwilioDevEd/send-sms-during-inbound-calls-csharp.git
cd send-sms-during-inbound-calls-csharp
- Set your configuration variables
copy TwilioApp/Local.config.example TwilioApp/Local.config
See Twilio Account Settings to locate the necessary environment variables.
-
Build the solution
-
Run the application
-
Expose the application to the wider Internet using ngrok.
$ ngrok http 49341 -host-header="localhost:49341"
Or, use ngrok Extensions for Visual Studio. Select "Tools... Start ngrok Tunnel".
- Configure Twilio to call your webhooks
You will need to configure Twilio to call your application when calls are received in your Twilio Number. The voice url should look something like this:
https://<your-ngrok-subdomain>.ngrok.io/answer
- Make a call to your number.
That's it!
- The CodeExchange repository can be found here.
This template is open source and welcomes contributions. All contributions are subject to our Code of Conduct.
No warranty expressed or implied. Software is as is.