provider === null) { $providerName = Setting::where('key', 'voip_provider')->value('value') ?? 'mock'; $this->provider = match ($providerName) { 'ami' => new AmiProvider(), 'api' => new ApiProvider(), 'socket' => new SocketProvider(), default => new MockProvider(), }; } return $this->provider; } public function initiateCall(string $phone, string $callerId = null): array { return $this->provider()->initiateCall($phone, $callerId); } public function getCallStatus(string $providerCallId): array { return $this->provider()->getCallStatus($providerCallId); } public function getRecordingUrl(string $providerCallId): ?string { return $this->provider()->getRecordingUrl($providerCallId); } public function testConnection(): array { return $this->provider()->testConnection(); } }