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 6912215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:03:49+00:00 2026-05-27T09:03:49+00:00

I am new in twilio api. In a web application am working on, i

  • 0

I am new in twilio api. In a web application am working on, i have to check call completed or not and I am sending wav file to twiml. If completed i have to deduct credit of user.. i am using the following code…

callMeAction

        $AccountSid = "**********************";
        $AuthToken = "***************";

        /* Your Twilio Number or an Outgoing Caller ID you have previously validated
          with Twilio */
        $from = '**************';

        /* Number you wish to call */
        $to = $_POST['contactno'];

        /* Directory location for callback.php file (for use in REST URL) */
        $url = 'http://'.$_SERVER['HTTP_HOST'].'/public/';

        /* Instantiate a new Twilio Rest Client */
        $client = new Services_Twilio($AccountSid, $AuthToken);



        /* make Twilio REST request to initiate outgoing call */
        $call = $client->account->calls->create($from, $to, $url . 'callback.php?number=' . $_POST['contactno'] . '&wav=' . $_POST['wav']);

        /* redirect back to the main page with CallSid */
        $msg = urlencode("Connecting... " . $call->sid);
        //header("Location: index.php?msg=$msg");

         $this->view->msg = $msg;

        if($call->status == 'COMPLETED'){

            /*
             *  Deduct credit if call completed
             */


          $this->view->msg = $msg;
        }

callback.php

<?php
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>



<?php if($_REQUEST['wav']){ ?>
<Response>
    <Say>A customer at the number <?php echo $_REQUEST['number']?> is calling</Say>
    <Dial><?php echo $_REQUEST['number']?></Dial>
    <Play><?php echo $_REQUEST['wav'] ;?></Play>
</Response>
<?php } ?>

please help me…
Thanks In advance. 🙂

  • 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-27T09:03:49+00:00Added an answer on May 27, 2026 at 9:03 am

    Set a URL for the StatusCallback (docs halfway down this page), and put your charge logic in that script.

    You pass the StatusCallback URL when creating the call, you should be able to pass an array of optional parameters as the 4th argument to: $client->account->calls->create().

    For incoming calls, the URL is (optionally) defined for each number (or application, if you use that method).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Scala API (for Twilio, by the way) where operations have
Azure web role (MVC 3 project) wont' start with Twilio controller class I have
New-style status messages (as in mobile apps and web interface) have new properties e.g.
New to using Backbone and have a very simple application. Basically there are Clients
I'm working with the Twilio API and it provides examples in PHP and Ruby.
New to xml. Looking for XPath to search a xml file with python ElementTree
I have followed the sample code on the Twilio github page and it doesn't
NEW EDIT: I have narrowed my problem to this - i have a view
new to java and brand new to the site. I have a JLabel added
I've developed a Web application in ASP.net web Forms (.net v4.0) which uses the

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.