Closed CourageousJoe closed 1 year ago
I'm trying to find a way to stream audio back to Twilio via websockets. I'm referring this documentation: https://www.twilio.com/docs/voice/twiml/stream#websocket-messages-to-twilio
Make a phone call using Twilio API and initiate callback as below:
response = VoiceResponse() start = Start() start.stream(url=f'wss://some-local-wss-url/twilio') response.append(start) response.say('Hello there!') response.pause(length=60) return str(response), 200, {'Content-Type': 'text/xml'}
async def twilio_sender(twilio_ws): print('twilio_sender started') streamsid = await streamsid_queue.get() while True: chunk = 'xyz' # a base64 encoded string of 8000/mulaw message = { 'event': 'media', 'streamSid': streamsid, 'media': { 'payload': base64.b64encode(chunk).decode() } } res = await twilio_ws.send(json.dumps(message))
No exceptions. The value of the res above is None.
res
None
# paste exception/log here
8.8.0
3.10.4
I faced the same issue, how did you fix it?
Issue Summary
I'm trying to find a way to stream audio back to Twilio via websockets. I'm referring this documentation: https://www.twilio.com/docs/voice/twiml/stream#websocket-messages-to-twilio
Steps to Reproduce
Make a phone call using Twilio API and initiate callback as below:
Code Snippet
Exception/Log
No exceptions. The value of the
res
above isNone
.Technical details:
8.8.0
3.10.4