twilio-labs / call-gpt

Generative AI phone call toolkit using Twilio Media Streams.
MIT License
273 stars 114 forks source link

Fix the issue of Twilio sometimes starting a new websocket connection for the same call concurrently #61

Open kevinmershon opened 2 days ago

kevinmershon commented 2 days ago

I noticed in testing that Twilio sometimes re-invokes a websocket connection during the call which was resulting in duplicated streams running and me hearing multiple confused TTS voices at different stages of my call flow. By refusing to initiate more than one call per unique calling phone number, this problem was completely eliminated for me.

If it helps, I was calling from a cellphone with wifi-based calling enabled so I considered it's possible that when a cellphone switches from wifi-calling back to the 4G network that Twilio thinks the stream was interrupted and tries to open a new webosocket.

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.