linkedid = $linkedid; } // ========================================================================= public function handle(): void { $linkedid = $this->linkedid; if (OutboundReport::where('linkedid', $linkedid)->exists()) { if (CompanySettings::get(SettingsHelper::S_COMPANY_CONSOLE_DEBUG_LOGS)) { Log::info("[ProcessOutboundCallJob] Report already exists for {$linkedid} — skipping."); } return; } $result = app(OutboundCallsService::class)->processSingleOutboundCall($linkedid); if ($result) { if (CompanySettings::get(SettingsHelper::S_COMPANY_CONSOLE_DEBUG_LOGS)) { Log::info("[ProcessOutboundCallJob] Report created for {$linkedid}."); } } else { if (CompanySettings::get(SettingsHelper::S_COMPANY_CONSOLE_DEBUG_LOGS)) { Log::warning("[ProcessOutboundCallJob] processSingleOutboundCall returned false for {$linkedid}."); } // Re-throw so the queue retries (CDR may not be written yet) throw new \RuntimeException("Outbound CDR not available yet for {$linkedid}"); } } public function failed(\Throwable $exception): void { if (CompanySettings::get(SettingsHelper::S_COMPANY_CONSOLE_DEBUG_LOGS)) { Log::error("[ProcessOutboundCallJob] All attempts exhausted for {$this->linkedid}: " . $exception->getMessage()); } } // ========================================================================= }