Vivek Kumar Vivek Kumar - 2 months ago 18
PHP Question

Modifying a live call disconnects the call

I am using the twilio php library to implement the calling ..
I am running through an issue .. the issue is that ..
I am using the following code to redirect the call to a particular url

require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

$sid = "ACXXXXX";
$token = "YYYYY";
$client = new Services_Twilio($sid, $token);

$call = $client->account->calls->get("CAe1644a7eed5088b159577c5802d8be38");
$call->update(array(
"Url" => "example.php",
"Method" => "POST"
));


and after redirecting I am making the machine to speak particular text using the following code

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello</Say>
</Response>


but the problem is that after saying the text.. the call gets disconnected at both ends.. I want that the call should continue after this also ... please help me out with this!

Answer

Twilio developer evangelist here.

Your call disconnects because once the <Say> command is complete there are no more instructions for the call, so Twilio hangs up. In order to carry on the call you will need to either <Redirect> the caller back to the original state or add more TwiML after the <Say>.

Comments