feat: migrate SMS/voice to Telnyx (TeXML), keep browser dial pad on Twilio
Twilio now handles only the in-browser dial pad (Access Token + browser-Device outbound TwiML); Telnyx takes over SMS, inbound voicemail, the AI voice conversation loop, and staff-triggered outbound calls via TeXML. Adds TelnyxSettings model, Communication.provider discriminator, new comms/routes modules, and a real Telnyx Settings page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -413,6 +413,7 @@ exports.Prisma.CommunicationScalarFieldEnum = {
|
||||
channel: 'channel',
|
||||
direction: 'direction',
|
||||
status: 'status',
|
||||
provider: 'provider',
|
||||
body: 'body',
|
||||
callDuration: 'callDuration',
|
||||
twilioSid: 'twilioSid',
|
||||
@@ -441,6 +442,18 @@ exports.Prisma.TwilioSettingsScalarFieldEnum = {
|
||||
templates: 'templates'
|
||||
};
|
||||
|
||||
exports.Prisma.TelnyxSettingsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
apiKey: 'apiKey',
|
||||
accountSid: 'accountSid',
|
||||
phoneNumber: 'phoneNumber',
|
||||
texmlApplicationId: 'texmlApplicationId',
|
||||
messagingProfileId: 'messagingProfileId',
|
||||
webhookPublicKey: 'webhookPublicKey',
|
||||
greetingMessage: 'greetingMessage'
|
||||
};
|
||||
|
||||
exports.Prisma.AiSettingsScalarFieldEnum = {
|
||||
id: 'id',
|
||||
userId: 'userId',
|
||||
@@ -660,6 +673,11 @@ exports.CommunicationStatus = exports.$Enums.CommunicationStatus = {
|
||||
no_answer: 'no_answer'
|
||||
};
|
||||
|
||||
exports.CommunicationProvider = exports.$Enums.CommunicationProvider = {
|
||||
twilio: 'twilio',
|
||||
telnyx: 'telnyx'
|
||||
};
|
||||
|
||||
exports.Prisma.ModelName = {
|
||||
User: 'User',
|
||||
Patient: 'Patient',
|
||||
@@ -687,6 +705,7 @@ exports.Prisma.ModelName = {
|
||||
Communication: 'Communication',
|
||||
PatientDocument: 'PatientDocument',
|
||||
TwilioSettings: 'TwilioSettings',
|
||||
TelnyxSettings: 'TelnyxSettings',
|
||||
AiSettings: 'AiSettings',
|
||||
OfficeHours: 'OfficeHours',
|
||||
OfficeContact: 'OfficeContact',
|
||||
|
||||
+1954
-2
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "prisma-client-11a124b84a93d3e63379c8a6769ab83d8729151f8cca035589101564f7ede8ed",
|
||||
"name": "prisma-client-85ee1e66f23d650a3f0c01310fbe1ede142a47bab2aa7d55e25b3a29308a8e32",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"browser": "default.js",
|
||||
|
||||
@@ -44,6 +44,7 @@ model User {
|
||||
cloudFiles CloudFile[]
|
||||
communications Communication[]
|
||||
twilioSettings TwilioSettings?
|
||||
telnyxSettings TelnyxSettings?
|
||||
aiSettings AiSettings?
|
||||
officeHours OfficeHours?
|
||||
officeContact OfficeContact?
|
||||
@@ -562,6 +563,11 @@ enum CommunicationStatus {
|
||||
no_answer
|
||||
}
|
||||
|
||||
enum CommunicationProvider {
|
||||
twilio
|
||||
telnyx
|
||||
}
|
||||
|
||||
model Communication {
|
||||
id Int @id @default(autoincrement())
|
||||
patientId Int
|
||||
@@ -570,9 +576,13 @@ model Communication {
|
||||
channel CommunicationChannel
|
||||
direction CommunicationDirection
|
||||
status CommunicationStatus
|
||||
// Which platform produced twilioSid — twilio for dial-pad-originated calls,
|
||||
// telnyx for everything else (SMS, inbound/AI voice, staff-triggered outbound calls).
|
||||
provider CommunicationProvider @default(twilio)
|
||||
|
||||
body String?
|
||||
callDuration Int?
|
||||
// Provider SID — Twilio MessageSid/CallSid, or Telnyx message/call id. See `provider`.
|
||||
twilioSid String?
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
@@ -606,6 +616,8 @@ model TwilioSettings {
|
||||
accountSid String
|
||||
authToken String
|
||||
phoneNumber String
|
||||
// Vestigial — inbound voice moved to Telnyx (TelnyxSettings.greetingMessage). No longer
|
||||
// read/written; kept to avoid a destructive migration for a cosmetic cleanup.
|
||||
greetingMessage String?
|
||||
templates Json?
|
||||
|
||||
@@ -614,6 +626,24 @@ model TwilioSettings {
|
||||
@@map("twilio_settings")
|
||||
}
|
||||
|
||||
model TelnyxSettings {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique
|
||||
apiKey String
|
||||
// Telnyx account SID (Mission Control Portal), required to place outbound
|
||||
// TeXML calls via POST /texml/Accounts/{accountSid}/Calls — separate from apiKey.
|
||||
accountSid String?
|
||||
phoneNumber String
|
||||
texmlApplicationId String?
|
||||
messagingProfileId String?
|
||||
webhookPublicKey String?
|
||||
greetingMessage String?
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("telnyx_settings")
|
||||
}
|
||||
|
||||
model AiSettings {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int @unique
|
||||
|
||||
Reference in New Issue
Block a user