| 1 | |
|---|
| 2 | The quota system |
|---|
| 3 | ---------------- |
|---|
| 4 | |
|---|
| 5 | The quota system works with OpenSIPS data sources. It enforces maximum |
|---|
| 6 | monthly usage limits for post-paid accounts. The system is not stopping in |
|---|
| 7 | real-time ongoing calls but provides in practice a protection against |
|---|
| 8 | fraudulent usage on a platform basis. |
|---|
| 9 | |
|---|
| 10 | To enable quotas you must: |
|---|
| 11 | |
|---|
| 12 | 1. Add the the column quota to the opensips subscriber mysql table: |
|---|
| 13 | |
|---|
| 14 | alter table opensips.subscriber add column quota int unsigned not null; |
|---|
| 15 | |
|---|
| 16 | 2. Set the quota for each subscriber to a value, which represents the cost |
|---|
| 17 | the subscriber is allowed to spend per calendar month. |
|---|
| 18 | |
|---|
| 19 | 3. Configure OpenSIPS to deny sessions initiated by subscribers belonging to |
|---|
| 20 | the quota group: |
|---|
| 21 | |
|---|
| 22 | The quota system then builds incremental statistics, and stores them in |
|---|
| 23 | cdrtool.quota_usage mysql table, with usage information from the normalized |
|---|
| 24 | SIP sessions. It then compares the curent usage with the assigned monthly |
|---|
| 25 | quota and blocks the subscribers when their quota is exceeded by adding them |
|---|
| 26 | to the group 'quota'. |
|---|
| 27 | |
|---|
| 28 | The quota is checked by the cron job: |
|---|
| 29 | |
|---|
| 30 | /var/www/CDRTool/scripts/OpenSIPS/quotaCheck.php |
|---|
| 31 | |
|---|
| 32 | At the beginning of each calendar month the quota usage is reset and all |
|---|
| 33 | users are unblocked: |
|---|
| 34 | |
|---|
| 35 | /var/www/CDRTool/scripts/OpenSIPS/quotaReset.php |
|---|
| 36 | |
|---|
| 37 | The current quota usage can be monitored in Rating -> Quota usage web page. |
|---|
| 38 | |
|---|
| 39 | When quota is exceeded, an email notification is sent to the user and a copy |
|---|
| 40 | of the message to the platform administrator. To customize the email message |
|---|
| 41 | subject, body and other header fields you must create some entries in |
|---|
| 42 | cdrtool.settings table. See CDRTool/setup/mysql/custom_notifications.mysql |
|---|
| 43 | for an example. |
|---|
| 44 | |
|---|