mirror of
https://github.com/vitalityAI/therapist.git
synced 2025-04-08 05:40:17 -04:00
fix: fixed session create
This commit is contained in:
parent
ce91c23674
commit
297bcb9704
|
@ -31,7 +31,6 @@ app.post("/receive", async (req, res) => {
|
||||||
const twiml = new VoiceResponse();
|
const twiml = new VoiceResponse();
|
||||||
|
|
||||||
await createSession(req.body.CallSid, req.body.From);
|
await createSession(req.body.CallSid, req.body.From);
|
||||||
console.log(`created session with CallSid: ${callId}`);
|
|
||||||
|
|
||||||
const gather = twiml.gather({
|
const gather = twiml.gather({
|
||||||
action: "/call/respond",
|
action: "/call/respond",
|
||||||
|
|
|
@ -2,6 +2,9 @@ import { Role } from "@prisma/client";
|
||||||
import { db } from "./db.js";
|
import { db } from "./db.js";
|
||||||
|
|
||||||
export const createSession = async (callId, callerPhone) => {
|
export const createSession = async (callId, callerPhone) => {
|
||||||
|
let session = await findSessionByCallId(callId);
|
||||||
|
if (session) return session;
|
||||||
|
|
||||||
return await db.session.create({
|
return await db.session.create({
|
||||||
data: {
|
data: {
|
||||||
callId: callId,
|
callId: callId,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user