How to use StatusCallback url in twilio
<?php
$options = array(
"StatusCallback" => 'http://173.203.104.63/call/out/log-callback.php? id='.$id
);
$client = new Services_Twilio($sid, $token, $version);
try {
// Initiate a new outbound call
$call = $client->account->calls->create(
$phonenumber, // The number of the phone initiating the call
$cphonenumber, // The number of the phone receiving call
'60',
'http://173.203.104.63/call/out/three.php?id='.$id, // The URL Twilio will request when the call is answered
$options
);
...
here i have set url for statuscallback but i dont know what weather is redirecting or not and also how to get my callstatus values ββin this url
+3
user1280818
source
to share
3 answers
The third argument should be URL, not '60'
. When the call completes, all data will be passed to your callback url as normal parameters POST
or GET
(depending on what you configured in your account).
+1
Tim lytle
source
to share
you forgot to provide a method for the statuscallback url
I have included it here in the code
<?php
//"StatusCallbackMethod" can be "POST" or "GET", depends on the way you recieve it on your StatusCallback,
$options = array(
"StatusCallbackMethod"=>"GET",
"StatusCallback" => 'http://173.203.104.63/call/out/log-callback.php? id='.$id
);
$client = new Services_Twilio($sid, $token, $version);
try {
// Initiate a new outbound call
$call = $client->account->calls->create(
$phonenumber, // The number of the phone initiating the call
$cphonenumber, // The number of the phone receiving call
'60',
'http://173.203.104.63/call/out/three.php?id='.$id, // The URL Twilio will request when the call is answered
$options
);
0
shridatt
source
to share
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); //
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC5ef8732a3c49700934481addd5ce1659";
$token = "{{ auth_token }}";
$client = new Services_Twilio($sid, $token);
$call = $client->account->calls->create("+18668675309", "+14155551212", "http://demo.twilio.com/docs/voice.xml", array(
"Method" => "GET",
"StatusCallback" => "https://www.myapp.com/events",
"StatusCallbackMethod" => "POST",
"StatusCallbackEvent" => array("initiated", "ringing", "answered", "completed"),
));
echo $call->sid;
See https://www.twilio.com/docs/api/rest/making-calls
0
Padonou Boris
source
to share