I have a Twilio application that handles calls through a WebSocket, where the application sends and receives audio in ulaw at 8000 Hz. I'm looking to integrate this flow with Amazon Connect. The calls will initially arrive at Amazon Connect, which will then redirect them to Twilio via PSTN. Depending on certain conditions within my application, some calls may be terminated, while others will need to be redirected back to a different Amazon Connect queue than the one they originated from.
I am wondering what the best way to achieve this redirection is. Can it be done from the twilio Python client via PSTN? How so? Most examples I've seen involve XML and webhooks, but my scenario involves direct interaction with the WebSocket.
Additionally, are there any extra costs involved in this process? Will Twilio continue to charge for the call once it's redirected back to Amazon Connect?
I appreciate any guidance or insights you can provide on integrating these services effectively.