I am writing an application in which we would like to receive an incoming call and stream it. To achieve this we have configured the following twiml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Start>
<Stream url='wss://<URL>/api/twilio/audio/stream' />
</Start>
<Say language='en-US'>Hello</Say>
<Gather method='Get' action='http://<URL>/api/twilio/incoming/response' input='speech'/>
</Response>
The idea is to start the streaming as soon as the call is connected, and then make the call continue using gather. The gather action would respond back with another gather. The call will be disconnected once the necessary actions are done. What we are observing is that the stream starts, but the call gets disconnected post that and the gather action is never called.
Would appreciate if someone can point out what I am doing wrong and how to resolve the issue.
Finally figured out what the issue was, with some help from Twilio support In this case the request was being sent to http:///api/twilio/incoming/response
The response from the /incoming/response API was a Twmil, but the content type was text/plain;charset=UTF-8 This made Twilio just play out the string. Modified it to text/xml and that fixed the issue.