Skip to main content

django-twilio-call

PyPI version Python Support Django Support License: MIT Tests Coverage Documentation

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

  1. Add to INSTALLED_APPS
INSTALLED_APPS = [
    ...
    'django_twilio_call',
    'rest_framework',
    'corsheaders',
    ...
]
  1. 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/'
  1. Run Migrations
python manage.py migrate django_twilio_call
  1. 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

📞 Support

🚦 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

Metadata

Release files for django-twilio-call 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-twilio-call 0.1.9
File Size Uploaded Provenance
django_twilio_call-0.1.9.tar.gz 234.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-twilio-call 0.1.9
File Interpreter ABI Platform
django_twilio_call-0.1.9-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 508.3 kB

Release files / django_twilio_call-0.1.9.tar.gz

Download URL django_twilio_call-0.1.9.tar.gz
Size 234.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a4d97be85895d74c57bf4a1868250b71a22d9e60fdec9e8ce704bdfa611c8a7
BLAKE2b-256 checksum
How to use checksums
7dca6fea061e756d7943794589e759bc9b428d6958a74b3afdff35a4490311a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release files / django_twilio_call-0.1.9-py2.py3-none-any.whl

Download URL django_twilio_call-0.1.9-py2.py3-none-any.whl
Size 273.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cae3578196fe44e8db912b7d3a8e306a7e2b6780077400cf69c7c41fec7ac5fd
BLAKE2b-256 checksum
How to use checksums
93dc07aa3f1d476435f659aacdd5472272556802ebd7d586c56551e8aa0eb53c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Security for django-twilio-call 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page