Automated Billing (Autobill)
CDR Processing & Automated Billing Configuration
The Autobill system processes call detail records (CDRs) and generates automated billing for VoIP services. This automated process ensures accurate and timely billing for all VoIP usage.
Overview
Autobill is a critical component that processes CDRs from your PBX servers and generates billing records in WHMCS. The system runs as a scheduled CRON job and integrates seamlessly with WHMCS billing cycles.
Key Features: * Automated CDR processing * Real-time billing generation * Multi-server support * Flexible scheduling * Debug and testing capabilities
CRON Configuration
Scheduling Requirements:
The Autobill script must run before your WHMCS daily CRON job to ensure proper billing processing.
Recommended Schedule:
WHMCS Daily CRON: 1:00 AM
Autobill CRON: 12:55 AM (5 minutes before)
Alternative Schedule:
WHMCS Daily CRON: 2:00 AM
Autobill CRON: 12:45 AM (75 minutes before)
CRON Entry Format:
Replace MYMODULE with your installed server module:
# Standard CRON format
55 00 * * * GET https://www.mywhmcsserver.com/modules/servers/MYMODULE/autobill.php?runfrom=cron
# Alternative format with more time
45 00 * * * GET https://www.mywhmcsserver.com/modules/servers/MYMODULE/autobill.php?runfrom=cron
CRON Parameters:
55 00 - Time (12:55 AM)
* * * - Daily execution
GET - HTTP method
runfrom=cron - Execution parameter
Server Module Examples:
FusionPBX: fusionpbx/autobill.php
Vodia: vodia/autobill.php
Custom: custom/autobill.php
Manual Testing
Browser Testing:
Test your Autobill installation by accessing the script directly in your browser:
URL: https://www.mywhmcsserver.com/modules/servers/MYMODULE/autobill.php
Method: GET
Authentication: Required
Test Configuration:
Before testing, ensure proper configuration:
Set Test Date - Configure client’s next due date to current date
Enable Debug - Activate debug mode for detailed output
Check Permissions - Verify script access permissions
Review Logs - Monitor execution logs
Test Process:
Access Script - Open autobill URL in browser
Monitor Output - Watch for processing results
Review Results - Check billing calculations
Verify Billing - Confirm invoice generation
Debug Configuration
Enable Debug Mode:
Activate debug mode to view detailed processing information:
Navigate to ictVoIP Billing → Billing Management
Enable CDR Autobill Debug
Run manual autobill execution
Review debug output
Debug Information:
Debug mode provides detailed information including: * CDR processing status * Rate calculations * Billing summaries * Error messages * Processing timestamps
Debug Output Example:
[DEBUG] Starting Autobill Process
[DEBUG] Processing Server: FusionPBX-01
[DEBUG] Found 150 CDR records
[DEBUG] Applied rates to 145 records
[DEBUG] Generated billing for 5 clients
[DEBUG] Process completed successfully
Billing Integration
WHMCS Integration:
Autobill integrates with WHMCS billing cycles:
Invoice Generation - Creates invoices for processed CDRs
Billing Date Management - Updates next due dates
Product Billing - Processes monthly/annual billing
Invoice Delivery - Sends invoices to clients
Billing Cycle Process:
Autobill Execution - Process CDRs and calculate charges
WHMCS Daily CRON - Generate invoices and update billing dates
Invoice Delivery - Send invoices to clients
Payment Processing - Handle payment collection
Important Notes:
Autobill does not increment product next billing dates
WHMCS daily CRON handles billing date updates
Monthly invoices are generated after Autobill processing
Billing dates are updated during WHMCS daily CRON execution
Performance Optimization
Processing Time Considerations:
Small Installations - 5 minutes before WHMCS CRON
Medium Installations - 15 minutes before WHMCS CRON
Large Installations - 30+ minutes before WHMCS CRON
Factors Affecting Processing Time:
Number of Servers - More servers = longer processing
CDR Volume - Higher call volume = longer processing
Server Performance - CPU and memory limitations
Network Latency - API response times
Optimization Tips:
Monitor Processing Time - Track execution duration
Adjust Scheduling - Increase time buffer if needed
Server Optimization - Improve server performance
CDR Cleanup - Regular CDR database maintenance
Error Handling
Common Errors:
Connection Timeout - Server unavailable
Authentication Failed - Invalid credentials
Permission Denied - File access issues
Database Errors - CDR processing issues
Error Resolution:
Check Server Status - Verify PBX server availability
Review Credentials - Confirm API authentication
Check Permissions - Verify file and database access
Monitor Logs - Review error logs for details
Log Monitoring:
Monitor autobill logs for issues:
# Check autobill logs
tail -f /var/log/autobill.log
# Check WHMCS logs
tail -f /var/log/whmcs.log
# Check system logs
tail -f /var/log/syslog
Security Considerations
Access Control:
HTTPS Required - Always use secure connections
Authentication - Implement proper access controls
IP Restrictions - Limit access to trusted IPs
Log Monitoring - Monitor access attempts
Best Practices:
Secure Credentials - Use strong API passwords
Regular Updates - Keep scripts updated
Backup Configuration - Maintain backup copies
Audit Logs - Review access logs regularly
Troubleshooting
Common Issues:
Script Not Executing - Check CRON configuration
No CDRs Processed - Verify server connectivity
Billing Errors - Check rate configuration
Performance Issues - Monitor processing time
Debug Steps:
Check CRON Status - Verify CRON job execution
Test Manual Execution - Run script manually
Review Error Logs - Check for error messages
Verify Configuration - Confirm settings
Support Information:
For autobill issues, provide: * CRON configuration * Error messages and logs * Server module details * Processing time information
Next Steps
After configuring autobill:
Test Execution - Run manual tests
Monitor Performance - Track processing times
Review Billing - Verify invoice generation
Production Deployment - Enable automated execution