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:
@@ -18,6 +18,7 @@ import { patientDocumentsStorage } from './patientDocuments-storage';
|
||||
import * as exportPaymentsReportsStorage from "./export-payments-reports-storage";
|
||||
import { cronJobLogStorage } from "./cron-job-log-storage";
|
||||
import { twilioStorage } from "./twilio-storage";
|
||||
import { telnyxStorage } from "./telnyx-storage";
|
||||
import { aiSettingsStorage } from "./ai-settings-storage";
|
||||
import { officeHoursStorage } from "./office-hours-storage";
|
||||
import { officeContactStorage } from "./office-contact-storage";
|
||||
@@ -47,6 +48,7 @@ export const storage = {
|
||||
...exportPaymentsReportsStorage,
|
||||
...cronJobLogStorage,
|
||||
...twilioStorage,
|
||||
...telnyxStorage,
|
||||
...aiSettingsStorage,
|
||||
...officeHoursStorage,
|
||||
...officeContactStorage,
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { prisma as db } from "@repo/db/client";
|
||||
|
||||
export type TelnyxSettingsData = {
|
||||
apiKey: string;
|
||||
accountSid?: string | null;
|
||||
phoneNumber: string;
|
||||
texmlApplicationId?: string | null;
|
||||
messagingProfileId?: string | null;
|
||||
webhookPublicKey?: string | null;
|
||||
greetingMessage?: string | null;
|
||||
};
|
||||
|
||||
export const telnyxStorage = {
|
||||
async getTelnyxSettings(userId: number) {
|
||||
return db.telnyxSettings.findUnique({ where: { userId } });
|
||||
},
|
||||
|
||||
async upsertTelnyxSettings(userId: number, data: TelnyxSettingsData) {
|
||||
return db.telnyxSettings.upsert({
|
||||
where: { userId },
|
||||
update: data,
|
||||
create: { userId, ...data },
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -24,6 +24,9 @@ export type CommunicationCreateData = {
|
||||
body?: string;
|
||||
callDuration?: number;
|
||||
twilioSid?: string;
|
||||
// Which platform produced twilioSid — defaults to "twilio" (dial-pad calls) when
|
||||
// omitted; Telnyx call sites (everything else) pass "telnyx" explicitly.
|
||||
provider?: "twilio" | "telnyx";
|
||||
};
|
||||
|
||||
export const twilioStorage = {
|
||||
|
||||
Reference in New Issue
Block a user