2017-05-31 4 views
0

Wie würde ich Play Inside Gather Nest? Ich habe folgendes Twiml xml:Wie nistet man Twilio Twiml <Play> innerhalb <Gather> mit Twilio Twiml php

$twiml = new Twiml(); 
    $twiml->gather('gather',array()); 
    $twiml->play('https://api.twilio.com/cowbell.mp3', array("loop" => 5)); 
    $response = Response::make($twiml, 200); 
    $response->header('Content-Type', 'text/xml'); 
    return $response; 

gewünschte Ergebnis:

<?xml version="1.0" encoding="UTF-8"?> 
<Response> 
<Gather input="speech" action="/completed"> 
    <Play loop="5">https://api.twilio.com/cowbell.mp3</Play> 
</Gather> 

Antwort

1

verwenden:

$twiml = new Twilio\Twiml(); 
$gather = $twiml->gather(array('input' => 'speech', 'action' => '/completed')); 
$gather->play('https://api.twilio.com/cowbell.mp3', array("loop" => 5)); 

$response = Response::make($twiml, 200); 
$response->header('Content-Type', 'text/xml'); 
return $response; 
Verwandte Themen