Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
72 lines (46 sloc) 2.1 KB
Twilio

Send an SMS during a phone call. Powered by Twilio and PHP/Slim

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.

Read the full tutorial here!

Local Development

This project is built using the Slim web framework, PHP 7, and the Twilio PHP Helper Library.

  1. First clone this repository and cd into it.

    $ git clone https://github.com/TwilioDevEd/send-sms-during-inbound-calls-php.git
    $ cd send-sms-during-inbound-calls-php
  2. Install the dependencies.

    $ composer install
  3. Create an environment file (.env) and define your Twilio Account SID and Auth Token. Both of these can be found in your Twilio console.

    export ACCOUNT_SID=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    export AUTH_TOKEN=your_auth_token
  4. Load the created file into your environment.

    source .env
  5. Start the server.

    $ php -S localhost:8080
  6. Expose the application to the wider Internet using ngrok.

    $ ngrok http 8080 -host-header="localhost:8080"
  7. 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

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.
You can’t perform that action at this time.