A Django package for call center functionality using Twilio
Project description
django-twilio-call
django-twilio-call is an enterprise-grade Django package for building sophisticated call center applications using Twilio's powerful communication APIs. Build production-ready call centers with features like IVR, call routing, recording, real-time monitoring, and comprehensive analytics.
โจ Features
Core Call Center Functionality
- ๐ Inbound/Outbound Calls - Handle both incoming and outgoing calls with ease
- ๐ Intelligent Call Routing - Route calls based on skills, availability, and priority
- ๐ฅ Agent Management - Complete agent system with status tracking and queue assignment
- ๐ Queue Management - Sophisticated queue system with priority and overflow handling
- ๐๏ธ Call Recording - Record calls with compliance features and transcription support
- ๐ IVR System - Build complex Interactive Voice Response flows
- ๐ฏ Real-time Monitoring - Track call center metrics and agent performance in real-time
Enterprise Features
- ๐ JWT Authentication - Secure API access with JSON Web Tokens
- โก Rate Limiting - Protect your APIs from abuse with configurable rate limits
- ๐ก๏ธ RBAC - Role-Based Access Control for agents and supervisors
- ๐ Analytics & Reporting - Comprehensive call analytics and performance metrics
- ๐ WebSocket Support - Real-time updates for live dashboards
- ๐ก Webhook Handling - Secure webhook processing with signature validation
- โ๏ธ Celery Integration - Asynchronous task processing for scalability
Production Ready
- ๐ณ Docker Support - Complete Docker configuration for easy deployment
- โธ๏ธ Kubernetes Ready - Kubernetes manifests for cloud-native deployment
- ๐ Monitoring - Prometheus metrics and health check endpoints
- ๐ Performance - Redis caching and database optimization
- ๐ Security - Enterprise-grade security with input validation and encryption
- ๐ Documentation - Comprehensive documentation with examples
๐ Quick Start
Installation
pip install django-twilio-call
Basic Setup
- Add to INSTALLED_APPS
INSTALLED_APPS = [
...
'django_twilio_call',
'rest_framework',
'corsheaders',
...
]
- Configure Twilio Settings
# settings.py
TWILIO_ACCOUNT_SID = 'your_account_sid'
TWILIO_AUTH_TOKEN = 'your_auth_token'
TWILIO_PHONE_NUMBER = '+1234567890'
TWILIO_WEBHOOK_URL = 'https://your-domain.com/webhooks/twilio/'
- Run Migrations
python manage.py migrate django_twilio_call
- Include URLs
# urls.py
urlpatterns = [
...
path('api/call-center/', include('django_twilio_call.urls')),
...
]
๐ Usage Examples
Making an Outbound Call
from django_twilio_call import call_service
# Make a call
call = call_service.create_call(
to_number='+1987654321',
from_number='+1234567890',
agent_id=agent.id
)
Handling Inbound Calls
from django_twilio_call.webhooks import VoiceWebhookView
class InboundCallHandler(VoiceWebhookView):
def handle_incoming_call(self, call_data):
# Route to available agent
agent = self.find_available_agent()
if agent:
return self.route_to_agent(call, agent)
else:
return self.route_to_queue(call)
Managing Agents
from django_twilio_call import agent_service
# Update agent status
agent_service.update_status(agent_id, 'available')
# Assign agent to queue
agent_service.assign_to_queue(agent_id, queue_id)
# Get agent statistics
stats = agent_service.get_statistics(agent_id)
Queue Management
from django_twilio_call import queue_service
# Create a queue
queue = queue_service.create_queue(
name='Support Queue',
max_size=50,
timeout_seconds=300
)
# Get queue statistics
stats = queue_service.get_queue_statistics(queue_id)
๐ง Advanced Configuration
Celery Setup
# settings.py
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
# Enable async task processing
DJANGO_TWILIO_ASYNC_TASKS = True
JWT Authentication
# settings.py
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=15),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
'ROTATE_REFRESH_TOKENS': True,
}
Rate Limiting
# settings.py
REST_FRAMEWORK = {
'DEFAULT_THROTTLE_RATES': {
'burst': '60/min',
'sustained': '1000/hour',
'call_api': '100/hour',
}
}
๐ณ Docker Deployment
# Build and run with Docker Compose
docker-compose up -d
# Scale workers
docker-compose scale celery_worker=3
๐ Monitoring
The package includes built-in monitoring endpoints:
/health/- Basic health check/health/detailed/- Detailed component status/metrics/- Prometheus metrics
๐งช Testing
# Run tests
pytest
# Run with coverage
pytest --cov=django_twilio_call
# Run with tox for multiple environments
tox
๐ Documentation
Full documentation is available at https://django-twilio-call.readthedocs.io/
Key Documentation Sections:
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
# Clone the repository
git clone https://github.com/hmesfin/django-twilio-call.git
# Install development dependencies
pip install -e .[dev]
# Run tests
pytest
# Run linters
ruff check .
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with Django and Django REST Framework
- Powered by Twilio APIs
- Async tasks handled by Celery
๐ Support
- ๐ง Email: admin@gojjotech.com
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
๐ฆ Project Status
This project is actively maintained and ready for production use. We follow semantic versioning and maintain backward compatibility within major versions.
Made with โค๏ธ by Gojjo Tech
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_twilio_call-0.1.9.tar.gz.
File metadata
- Download URL: django_twilio_call-0.1.9.tar.gz
- Upload date:
- Size: 234.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a4d97be85895d74c57bf4a1868250b71a22d9e60fdec9e8ce704bdfa611c8a7
|
|
| MD5 |
a9ffcc6aa2b3879aed82d8d615e44857
|
|
| BLAKE2b-256 |
7dca6fea061e756d7943794589e759bc9b428d6958a74b3afdff35a4490311a7
|
File details
Details for the file django_twilio_call-0.1.9-py2.py3-none-any.whl.
File metadata
- Download URL: django_twilio_call-0.1.9-py2.py3-none-any.whl
- Upload date:
- Size: 273.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cae3578196fe44e8db912b7d3a8e306a7e2b6780077400cf69c7c41fec7ac5fd
|
|
| MD5 |
3431b01fc06d1f7c0ecb9cc6a71d27b9
|
|
| BLAKE2b-256 |
93dc07aa3f1d476435f659aacdd5472272556802ebd7d586c56551e8aa0eb53c
|