diff --git a/src/call.js b/src/call.js index ee82e5c..4fbec1c 100644 --- a/src/call.js +++ b/src/call.js @@ -31,7 +31,6 @@ app.post("/receive", async (req, res) => { const twiml = new VoiceResponse(); await createSession(req.body.CallSid, req.body.From); - console.log(`created session with CallSid: ${callId}`); const gather = twiml.gather({ action: "/call/respond", diff --git a/src/session.js b/src/session.js index 832bc4f..3b2b4e7 100644 --- a/src/session.js +++ b/src/session.js @@ -2,6 +2,9 @@ import { Role } from "@prisma/client"; import { db } from "./db.js"; export const createSession = async (callId, callerPhone) => { + let session = await findSessionByCallId(callId); + if (session) return session; + return await db.session.create({ data: { callId: callId,