fix: skip outbound calls in webhook + filter abandon polls by campaign

Webhook controller now skips outbound calls (type=Manual/OutBound).
An unanswered outbound dial is NOT a missed inbound call — it was
being incorrectly created as MISSED with PENDING_CALLBACK status.

MissedQueueService now filters the Ozonetel abandonCalls API response
by campaign name (read from TelephonyConfigService). Prevents
cross-tenant ingestion when multiple sidecars share the same
Ozonetel account.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 16:03:48 +05:30
parent 9665500b63
commit 96d0c32000
4 changed files with 40 additions and 3 deletions

View File

@@ -53,9 +53,17 @@ export class MissedCallWebhookController {
return { received: true, processed: false };
}
// Skip outbound calls — an unanswered outbound dial is NOT a
// "missed call" in the call-center sense. Outbound call records
// are created by the disposition flow, not the webhook.
if (type === 'Manual' || type === 'OutBound') {
this.logger.log(`Skipping outbound call webhook (type=${type}, status=${status})`);
return { received: true, processed: false, reason: 'outbound' };
}
// Determine call status for our platform
const callStatus = status === 'Answered' ? 'COMPLETED' : 'MISSED';
const direction = type === 'InBound' ? 'INBOUND' : 'OUTBOUND';
const direction = 'INBOUND'; // only inbound reaches here now
// Use API key auth for server-to-server writes
const authHeader = this.apiKey ? `Bearer ${this.apiKey}` : '';