Great question — answering as the UphillTech team:
I'm Megan from Twilio. Not sure what language you're working with and I typically write Python, but I'll share an example in PHP below. It looks like what you're trying to do here involves the Twiml <Gather> verb, where in the following example you would set http://example.com/complex_gather.xml as the URL in your Voice Request URL configuration of your Twilio number per Carter's suggestion in the comments. The <action> verb then allows you to redirect the caller to your custom Voice Request URL after they input the access code. <?xml version="1.0" encoding="UTF-8"?> <!-- page located at http://example.com/complex_gather.xml --> <Response> <Gather numDigits="4" action="/customVoiceUrl"...
Full answer by Megan Speir: https://stackoverflow.stackexchange.com/a/33311712 (CC BY-SA 3.0).
Need it done for your business? UphillTech.