Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3457748
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:53:54+00:00 2026-05-18T09:53:54+00:00

I have an application that runs with Twilio. The idea is that you will

  • 0

I have an application that runs with Twilio. The idea is that you will call a phone number twilio will answer and give you menu options. Once you press a digit it will submit the post data and then hang up (That part all works correctly) The problem I’m having is finding out if there is a way to submit post data if the user just hangs up as soon as twilio answers… I found the following code on their documentation.

<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://example.com/gather_hints.xml -->
<Response>
 <Gather action="/process_gather.php" method="GET">
     <Say>Enter something, or not</Say>
 </Gather>
 <Redirect method="GET">
     /process_gather.php?Digits=TIMEOUT
 </Redirect>
</Response>

The problem with this is you need to wait until the end of the message for gather to time out. Is there a way to make it so as soon as starts, if the user hangs up it’ll do something like go to the redirect tag?

Thanks!

Edit: So on the process_gather.php page, I can save the completed status as a variable?

$Completed = $_POST["completed"]; //which would set $Completed == 'completed'

and then in that page I can just basically say if if(!empty($Completed)) do something
(I have to work it into my logic, but I just want to make sure I get the general idea)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:53:54+00:00Added an answer on May 18, 2026 at 9:53 am

    The best way to solve this is by using the StatusCallback URL. You can set this URL for inbound calls in the Number configuration in your account, or through an optional argument for outbound calls.

    When the call completes, Twilio will POST (or GET) to the URL with all the same variables it passes during a normal request. The CallStatus variable will be set to completed.

    If that URL is called before you get input from the user (to your `/process_gather.php’ script), then they hung up.

    Note: You can use cookies to manage session state within a call: all requests made by Twilio during the same call (and the StatusCallback request) will contain any cookies you send. This allows you to use a session variable to track call progress.

    PHP Example for /proces_gather.php:

     <?php 
     session_start(); 
     // adds it to our session 
     $_SESSION['gather_result']=$_POST["Digits"]; 
     // then do whatever else you want your gather script to do.
     ?> 
    

    PHP Example for /status_callback.php, which should be configured as the StatusCallback URL for the phone number in the Twilio Account screen:

    <?php
    session_start();
    //check for gather_result
    if(isset($_SESSION['gather_result'])){
      //user did enter digits
    } else {
      //do whatever you want to do if the user entered no digits.
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that runs on the Nokia E71 phone. My questions are:
I have an application that runs only once. But after finishing ( finish() ),
I have a application that runs very well on JBoss using JSF 2. I
I have an application that runs on a shared hosting website - it is
I have an application that runs through the rounds in a tournament, and I
I have an application that runs on a client's server built on a SQL
I have an application that runs the a command as below: <command> <switches> >&
I use node.js and socket.io. I have an application that runs on the IP
I have a web application that runs fine under IIS5 or IIS6. I just
We have a WPF Application that runs from both desktop and as a XBAP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.