Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ secure/*.sqlite
*.php~

app/yealink/resources/firmware/*

# Laravel Admin Panel
laravel-admin-panel/vendor/
laravel-admin-panel/node_modules/
laravel-admin-panel/.env
laravel-admin-panel/storage/*.key
laravel-admin-panel/storage/logs/
laravel-admin-panel/storage/framework/cache/
laravel-admin-panel/storage/framework/sessions/
laravel-admin-panel/storage/framework/views/
207 changes: 207 additions & 0 deletions LARAVEL_ADMIN_PANEL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# Laravel Admin Panel for FusionPBX

## 📦 What's Included

This repository now includes a complete **Laravel-based Admin Panel** with AI integration that works alongside your existing FusionPBX installation.

### Location
- **Source Code**: `/laravel-admin-panel/` directory in this repository
- **Installation Target**: `/var/www/admin/user-panel` on your server
- **Access URL**: `http://your-server-ip/admin/user-panel`

## 🚀 Quick Install

```bash
# Clone this repository (if not already)
cd /path/to/fusionpbx

# Run the automated installer
sudo bash laravel-admin-panel/install.sh

# Add your OpenAI API key
sudo nano /var/www/admin/user-panel/.env
# Set: OPENAI_API_KEY=your-key-here

# Access the panel
# http://your-server-ip/admin/user-panel
```

## ✨ Key Features

### 🤖 AI Integration
- **OpenAI GPT-4** powered call analysis
- **Hybrid Routing**: Human/AI/Hybrid modes
- **Chat Interface**: Natural language queries
- **Smart Insights**: Automated call analysis and recommendations

### 📞 Modern CDR Viewer
- Advanced filtering by date, direction, caller
- Real-time search and pagination
- Export to CSV
- AI analysis for each call

### 📊 Live Dashboard
- Real-time statistics (auto-refresh every 30s)
- Today's call metrics
- Recent calls monitoring
- Extension status

### 🎨 Modern Interface
- Responsive design (works on mobile, tablet, desktop)
- Tailwind CSS styling
- Alpine.js interactivity
- Professional UI/UX

## 📋 Requirements

- **OS**: Debian 11 or 12
- **PHP**: 8.2+
- **Database**: PostgreSQL (uses existing FusionPBX DB)
- **Web Server**: Nginx or Apache
- **Node.js**: 16+
- **OpenAI API Key**: Required for AI features

## 📚 Documentation

- **[QUICKSTART.md](laravel-admin-panel/QUICKSTART.md)** - 5-minute setup guide
- **[INSTALLATION.md](laravel-admin-panel/INSTALLATION.md)** - Detailed installation instructions
- **[README.md](laravel-admin-panel/README.md)** - Overview and features

## 🔧 Configuration

The panel is pre-configured to:
- ✅ Read database credentials from `/etc/fusionpbx/config.conf`
- ✅ Connect to existing FusionPBX PostgreSQL database
- ✅ Work alongside FusionPBX without modifications
- ✅ Use tables: `v_xml_cdr`, `v_extensions`, etc.

You only need to add your **OpenAI API Key**.

## 🎯 AI Agent Modes

### Human Only
All calls route to human agents. AI available for analysis only.

### Hybrid (Recommended)
AI analyzes context and routes calls intelligently between human and AI agents.

### AI Only
All calls handled by AI system. Good for simple inquiries or after-hours.

## 📸 What You Get

### Dashboard
- Live call statistics
- Recent calls with status
- Performance metrics
- Quick access to all features

### CDR Records Page
- Searchable call history
- Advanced filters
- AI analysis button for each call
- CSV export

### AI Agent Page
- Chat interface
- Mode selector (Human/AI/Hybrid)
- Quick action buttons
- Natural language queries

## 🛡️ Security

- Environment variables for sensitive data
- CSRF protection enabled
- Proper file permissions
- API key security guidelines
- Production-ready configuration

## 📦 Technical Stack

- **Backend**: Laravel 12 (PHP 8.2)
- **Frontend**: Tailwind CSS, Alpine.js
- **Database**: PostgreSQL (FusionPBX)
- **AI**: OpenAI GPT-4 API
- **Charts**: Chart.js

## 🔄 Integration with FusionPBX

### ✅ Seamless Integration
- Uses existing FusionPBX database
- No modifications to FusionPBX required
- Separate URL path (`/admin/user-panel`)
- Shares same database credentials

### ✅ Data Access
- Reads CDR records from `v_xml_cdr` table
- Accesses extensions from `v_extensions` table
- Real-time data synchronization
- No data duplication

## 💡 Use Cases

### Call Center Managers
- Monitor call performance in real-time
- Get AI insights on call quality
- Export data for reports
- Track agent performance

### System Administrators
- Modern interface for system monitoring
- Quick access to call records
- AI-powered troubleshooting
- Efficient data export

### Business Owners
- Understand call patterns
- Get AI recommendations for improvement
- Monitor customer interactions
- Make data-driven decisions

## 🚨 Common Issues & Solutions

### Installation Failed?
```bash
# Check logs
sudo tail -f /var/log/syslog

# Re-run installation
sudo bash laravel-admin-panel/install.sh
```

### AI Not Working?
1. Verify OpenAI API key in `.env`
2. Check `AI_AGENT_ENABLED=true`
3. Review logs: `/var/www/admin/user-panel/storage/logs/`

### Database Connection Error?
1. Verify FusionPBX is running
2. Check PostgreSQL is accessible
3. Confirm credentials in `.env`

## 📞 Support

- **FusionPBX**: https://www.fusionpbx.com
- **Laravel**: https://laravel.com/docs
- **OpenAI**: https://platform.openai.com/docs

## 📄 License

- **Laravel Framework**: MIT License
- **FusionPBX Integration**: MPL 1.1 License
- **OpenAI API**: Commercial (usage-based pricing)

## 🎉 Get Started Now!

```bash
cd /path/to/fusionpbx
sudo bash laravel-admin-panel/install.sh
```

Then access: `http://your-server-ip/admin/user-panel`

---

**Built for the FusionPBX Community with ❤️**

Combines the power of Laravel, FusionPBX, and AI to create a modern call center management experience.
18 changes: 18 additions & 0 deletions laravel-admin-panel/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[compose.yaml]
indent_size = 4
65 changes: 65 additions & 0 deletions laravel-admin-panel/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

# PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
# CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"
11 changes: 11 additions & 0 deletions laravel-admin-panel/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
12 changes: 12 additions & 0 deletions laravel-admin-panel/.github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Issues

on:
issues:
types: [labeled]

permissions:
issues: write

jobs:
help-wanted:
uses: laravel/.github/.github/workflows/issues.yml@main
12 changes: 12 additions & 0 deletions laravel-admin-panel/.github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Pull Requests

on:
pull_request_target:
types: [opened]

permissions:
pull-requests: write

jobs:
uneditable:
uses: laravel/.github/.github/workflows/pull-requests.yml@main
47 changes: 47 additions & 0 deletions laravel-admin-panel/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tests

on:
push:
branches:
- master
- '*.x'
pull_request:
schedule:
- cron: '0 0 * * *'

permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.2, 8.3, 8.4]

name: PHP ${{ matrix.php }}

steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: none

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Copy environment file
run: cp .env.example .env

- name: Generate app key
run: php artisan key:generate

- name: Execute tests
run: php artisan test
Loading