info('🔌 Testing FreePBX API Connection...'); $this->line(''); try { $isConnected = $extensionManager->checkConnection(); if ($isConnected) { $this->info('✅ Successfully connected to FreePBX API!'); $this->line(''); $this->info('The system can communicate with FreePBX REST API.'); return 0; } else { $this->error('❌ Failed to connect to FreePBX API'); $this->line(''); $this->comment('Please check:'); $this->line('1. FreePBX REST API module is installed and enabled'); $this->line('2. API credentials are valid (run: php artisan pbx:generate-credentials)'); $this->line('3. FreePBX is accessible at the configured URL'); $this->line('4. Check logs for detailed error information'); return 1; } } catch (\Exception $e) { $this->error('❌ Connection test failed: ' . $e->getMessage()); $this->line(''); $this->comment('Error details: ' . $e->getTraceAsString()); return 1; } } }