Company
Date Published
Author
Hector Ortega
Word count
3115
Language
English
Hacker News points
None

Summary

This PHP application uses Twilio to connect incoming phone calls to other phone numbers based on the caller's location. The application allows users to call their senators by providing their 5-digit zip code, and then connects them with both of their senator's offices. The application uses TwiML to build a response that welcomes the caller, asks for confirmation of their state of residence, and redirects them to either the first or second senator based on the user's input. If the user's state is not recognized, they are prompted to enter their 5-digit zip code again. Once the call with the first senator ends, the caller is forwarded to the second senator. The application uses a webhook endpoint to accept inbound calls and trigger actions inside the application. The application also includes a `setState` function that sets the user's state from confirmation or user-provided Zip.