Open illgitthat opened 1 week ago
hey legend :) Very good point. I may not have refined my V1 code as I built this V2, but to solve this I would just log the incoming twilio call (just ask AI to console.log the inbound twilio call that comes into /incoming-call) and inspect the payload. You can throw the payload into AI and ask it to set the sessionId correctly to the Call SID, as this will be consistent between both webhooks
I would then also log the inbound payload at the /media-stream webhook, as this package of info is different to the incoming-call webhook, so after you log it you should put it back into AI and ask it to appropriately capture the Call SID as well
Hope this helps!
Hi @Barty-Bart thanks for publishing your changes here!
I'm confused on the session management piece that you are using. In particular, where are you getting this header from?
const sessionId = req.headers['x-twilio-call-sid'] ||
session_${Date.now()}``When I run it, it always resolves to Date.now() - the issue with this approach is that Date.now() will be different in /incoming-call vs. /media-stream (different timestamps) so the /media-stream session isn't actually able to reference any of the session info that was previously set.