Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to know twilio call status( completed or not )
    text
    copied!<p>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...</p> <p><strong>callMeAction</strong></p> <pre><code> $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-&gt;account-&gt;calls-&gt;create($from, $to, $url . 'callback.php?number=' . $_POST['contactno'] . '&amp;wav=' . $_POST['wav']); /* redirect back to the main page with CallSid */ $msg = urlencode("Connecting... " . $call-&gt;sid); //header("Location: index.php?msg=$msg"); $this-&gt;view-&gt;msg = $msg; if($call-&gt;status == 'COMPLETED'){ /* * Deduct credit if call completed */ $this-&gt;view-&gt;msg = $msg; } </code></pre> <p><strong>callback.php</strong></p> <pre><code>&lt;?php echo "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\n"; ?&gt; &lt;?php if($_REQUEST['wav']){ ?&gt; &lt;Response&gt; &lt;Say&gt;A customer at the number &lt;?php echo $_REQUEST['number']?&gt; is calling&lt;/Say&gt; &lt;Dial&gt;&lt;?php echo $_REQUEST['number']?&gt;&lt;/Dial&gt; &lt;Play&gt;&lt;?php echo $_REQUEST['wav'] ;?&gt;&lt;/Play&gt; &lt;/Response&gt; &lt;?php } ?&gt; </code></pre> <p>please help me... Thanks In advance. :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload