I am media streaming incoming calls, but i wanna forward the call during the stream. As understond from documentation etc, you have to stop the stream, make another route and stream again to the web socket.
But the issue is i get the error the call is not found, and i'm sure it are the right sid's, because after the call they appear in the call logs.
twilio_client = Client(account_sid, auth_token)
@app.route('/call', methods=['POST'])
def call():
"""Accept a phone call."""
response = VoiceResponse()
start = Start()
start.stream(url=f'wss://{request.host}/stream')
response.append(start)
response.pause(length=60)
return str(response), 200, {'Content-Type': 'text/xml'}
@sock.route('/stream')
def handle_audio(ws):
... # here i get the message/data which corresponds to the call.
call_sid = data["start"]['callSid']
current_stream = data["start"]['streamSid']
# Trying to stop stream
stream = (
twilio_client.calls(call_sid)
.streams(current_stream)
.update(status="stopped")
)
print(stream.sid)
# Same issue for forwarding call.
Exception/Log
HTTP Error Your request was:
POST /Accounts/ACabab69208370712b3a55192e90f8ef14/Calls/CAf1a2660034ad045400c4dbb23552c253/Streams/MZ2f1cf876ba7cdd0b66a15d3485220486.json
Twilio returned the following information:
Unable to update record: The requested resource /2010-04-01/Accounts/ACabab69208370712b3a55192e90f8ef14/Calls/CAf1a2660034ad045400c4dbb23552c253/Streams/MZ2f1cf876ba7cdd0b66a15d3485220486.json was not found
More information may be available here:
https://www.twilio.com/docs/errors/20404
# paste exception/log here
Issue Summary
I am media streaming incoming calls, but i wanna forward the call during the stream. As understond from documentation etc, you have to stop the stream, make another route and stream again to the web socket.
But the issue is i get the error the call is not found, and i'm sure it are the right sid's, because after the call they appear in the call logs.
All the sids match with the call logs.
I am using the auth tokens from the home console page: https://console.twilio.com/
I have a paid for number.
Steps to Reproduce
Code Snippet
Exception/Log
Technical details: