Scheduling infrastructure for absolutely everyone.
refactor: remove depreceated fields (#19279)
Udit Takkar37f1535e1a60
diff --git a/apps/api/v2/src/ee/event-types/event-types_2024_06_14/outputs/create-phone-call.output.ts b/apps/api/v2/src/ee/event-types/event-types_2024_06_14/outputs/create-phone-call.output.tsindex ac4c2dd9651..897292e381b 100644--- a/apps/api/v2/src/ee/event-types/event-types_2024_06_14/outputs/create-phone-call.output.ts+++ b/apps/api/v2/src/ee/event-types/event-types_2024_06_14/outputs/create-phone-call.output.ts@@ -1,6 +1,6 @@import { ApiProperty } from "@nestjs/swagger";import { Type } from "class-transformer";-import { IsEnum, IsString, ValidateNested } from "class-validator";+import { IsEnum, IsString, ValidateNested, IsOptional } from "class-validator";import { SUCCESS_STATUS, ERROR_STATUS } from "@calcom/platform-constants";@@ -10,8 +10,9 @@ class Data {callId!: string;@IsString()+ @IsOptional()@ApiProperty()- agentId!: string;+ agentId?: string;}export class CreatePhoneCallOutput {diff --git a/packages/features/ee/cal-ai-phone/retellAIService.ts b/packages/features/ee/cal-ai-phone/retellAIService.tsindex b903c8883f4..74531634957 100644--- a/packages/features/ee/cal-ai-phone/retellAIService.ts+++ b/packages/features/ee/cal-ai-phone/retellAIService.ts@@ -36,7 +36,11 @@ type initProps = {generalPrompt: string;};-const updateAgentWebsocketUrl = async (phoneNumber: string, llmWebsocketUrl: string): Promise<void> => {+const updateAgentWebsocketUrl = async (+ phoneNumber: string,+ llmWebsocketUrl: string,+ llmId: string+): Promise<void> => {try {const phoneNumberDetails = await fetcher(`/get-phone-number/${phoneNumber}`).then(ZGetPhoneNumberSchema.parse@@ -45,7 +49,11 @@ const updateAgentWebsocketUrl = async (phoneNumber: string, llmWebsocketUrl: strawait fetcher(`/update-agent/${phoneNumberDetails.outbound_agent_id}`, {method: "PATCH",body: JSON.stringify({- llm_websocket_url: llmWebsocketUrl,+ response_engined: {+ type: "retell-llm",+ llm_websocket_url: llmWebsocketUrl,+ llm_id: llmId,+ },}),});} catch (error) {@@ -94,8 +102,12 @@ class CreateRetellLLMCommand implements Command<TCreateRetellLLMSchema> {}),}).then(ZCreateRetellLLMSchema.parse);- const llmWebSocketUrlToBeUpdated = createdRetellLLM.llm_websocket_url;- await updateAgentWebsocketUrl(this.props.yourPhoneNumber, llmWebSocketUrlToBeUpdated);+ const llmWebSocketUrlToBeUpdated = createdRetellLLM.inbound_dynamic_variables_webhook_url;+ await updateAgentWebsocketUrl(+ this.props.yourPhoneNumber,+ llmWebSocketUrlToBeUpdated,+ createdRetellLLM.llm_id+ );return createdRetellLLM;} catch (error) {@@ -133,8 +145,12 @@ class UpdateRetellLLMCommand implements Command<TGetRetellLLMSchema> {}),}).then(ZGetRetellLLMSchema.parse);- const llmWebSocketUrlToBeUpdated = updatedRetellLLM.llm_websocket_url;- await updateAgentWebsocketUrl(this.props.yourPhoneNumber, llmWebSocketUrlToBeUpdated);+ const llmWebSocketUrlToBeUpdated = updatedRetellLLM.inbound_dynamic_variables_webhook_url;+ await updateAgentWebsocketUrl(+ this.props.yourPhoneNumber,+ llmWebSocketUrlToBeUpdated,+ updatedRetellLLM.llm_id+ );return updatedRetellLLM;} catch (err) {@@ -172,7 +188,7 @@ class CreateRetellPhoneCallCommand implements Command<TCreatePhoneSchema> {async execute(): Promise<TCreatePhoneSchema> {try {- const createPhoneCallRes = await fetcher("/create-phone-call", {+ const createPhoneCallRes = await fetcher("/v2/create-phone-call", {method: "POST",body: JSON.stringify({from_number: this.props.yourPhoneNumber,@@ -187,8 +203,8 @@ class CreateRetellPhoneCallCommand implements Command<TCreatePhoneSchema> {return createPhoneCallRes;} catch (err) {- log.error("Unable to Get Phone number", safeStringify(err));- throw new Error("Something went wrong! Unable to Get Phone number");+ log.error("Unable to create phone call", safeStringify(err));+ throw new Error("Something went wrong! Unable to create phone call");}}}diff --git a/packages/features/ee/cal-ai-phone/zod-utils.ts b/packages/features/ee/cal-ai-phone/zod-utils.tsindex 16452a296e1..2e0c54c7742 100644--- a/packages/features/ee/cal-ai-phone/zod-utils.ts+++ b/packages/features/ee/cal-ai-phone/zod-utils.ts@@ -44,7 +44,8 @@ export type TCreatePhoneCallSchema = z.infer<typeof createPhoneCallSchema>;export const ZGetPhoneNumberSchema = z.object({- agent_id: z.string(),+ agent_id: z.string().optional(),+ nickname: z.string(),inbound_agent_id: z.string(),outbound_agent_id: z.string(),error_message: z.string().optional(),@@ -56,7 +57,7 @@ export type TGetPhoneNumberSchema = z.infer<typeof ZGetPhoneNumberSchema>;export const ZCreatePhoneSchema = z.object({call_id: z.string(),- agent_id: z.string(),+ agent_id: z.string().optional(),}).passthrough();@@ -121,7 +122,8 @@ export type Fields = z.infer<typeof FieldsSchema>;export const ZCreateRetellLLMSchema = z.object({llm_id: z.string(),- llm_websocket_url: z.string(),+ llm_websocket_url: z.string().optional(),+ inbound_dynamic_variables_webhook_url: z.string(),}).passthrough();@@ -132,7 +134,8 @@ export const ZGetRetellLLMSchema = zgeneral_prompt: z.string(),begin_message: z.string().nullable().optional(),llm_id: z.string(),- llm_websocket_url: z.string(),+ llm_websocket_url: z.string().optional(),+ inbound_dynamic_variables_webhook_url: z.string(),general_tools: z.array(z.object({