From d42351dd7397df3b2bc0225a1029436a62130f4a Mon Sep 17 00:00:00 2001 From: mgabrielramos <83740829+mgabrielramos@users.noreply.github.com> Date: Fri, 13 Feb 2026 23:50:23 +0000 Subject: [PATCH] feat(voice-call): handle hangup for rejected inbound calls Implemented call hangup logic for rejected inbound calls in `CallManager`. Previously, rejected inbound calls were simply ignored by the `processEvent` method. The code now explicitly creates a call record and hangs it up immediately. - Verified logic manually as tests cannot be run due to missing dependencies. - Handles potential errors from `endCall`. --- extensions/voice-call/src/manager.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/extensions/voice-call/src/manager.ts b/extensions/voice-call/src/manager.ts index 8ffbf855f606..2500f586ab89 100644 --- a/extensions/voice-call/src/manager.ts +++ b/extensions/voice-call/src/manager.ts @@ -552,7 +552,24 @@ export class CallManager { if (!call && event.direction === "inbound" && event.providerCallId) { // Check if we should accept this inbound call if (!this.shouldAcceptInbound(event.from)) { - // TODO: Could hang up the call here + if (this.provider) { + // Create record to track the rejected call + call = this.createInboundCall( + event.providerCallId, + event.from || "unknown", + event.to || this.config.fromNumber || "unknown", + ); + + // End it immediately + this.endCall(call.callId).then((result) => { + if (!result.success) { + console.error( + `[voice-call] Failed to hang up rejected call ${call?.callId}:`, + result.error, + ); + } + }); + } return; }