Date post: | 08-Jan-2017 |
Category: |
Technology |
Upload: | 2600hz |
View: | 1,861 times |
Download: | 5 times |
PRESENTED BY:
Rating and Limits
● James Aimonetti
@kazoocon
Lets Talk Billing
@kazoocon
People like to talk a lot about "billing"
What IS billing?
The request usually comes in the form "I just need something simple."
That's usually a gross understatement of the actual desire.
@kazoocon
● Recurring Subscriptions (monthly charges)
● Pro-rated monthly subscriptions
● Activation charges
● Per-minute / per-use charges
● Limits on spend (daily, monthly, pre-pay/credit base)
● Allocations of usage (400 minutes included - daily, monthly, etc.)
@kazoocon
● Bursting / overage charges
● Rating of calls
● Pre-pay vs. post-pay
● Auto top up
● Deposit tracking
● Accounts Payable / Accounts Receivable
@kazoocon
● Strategies for warning customers● low balances● overdue● expiring credit card
● Discounts● one time● Continuous
● Rate decks (global + account based)
● Actual cost analysis
@kazoocon
@kazoocon
Rating – What Is It Good For?
@kazoocon
Rate Document
● prefix:"1"● iso_country_code:"US"● description:"US default rate"● direction:"both"● rate_name:"US-1"● routes:["^\\+1\\d+$"]● options:[]● weight:10● rate_increment:60● rate_minimum:60● rate_surcharge:1.00● rate_cost:0.01
@kazoocon
@kazoocon
Testing Your Rate Deck
sup hotornot_maintenance rates_for_did 4158867900Candidates: RATE NAME | COST | INCREMENT | MINIMUM | SURCHARGE | WEIGHT | PREFIX US-1-INBOUND |0.0049 | 60 | 60 | 0.00 | 2 | 1US-1-OUTBOUND |0.0089 | 60 | 60 | 0.00 | 2 | 1Matching: RATE NAME | COST | INCREMENT | MINIMUM | SURCHARGE | WEIGHT | PREFIX* US-1-OUTBOUND | 0.0089 | 60 | 60 | 0.00 | 2 | 1 US-1-INBOUND | 0.0049 | 60 | 60 | 0.00 | 2 | 1
@kazoocon
Limits in Kazoo
@kazoocon
● Inbound● Limit the number of simultaneous inbound calls
that can be received
● Outbound● Limit the number of simultaneous outbound calls
that can be made
● Two-way● Limit the number of simultaneous calls that can be made
● Resource consuming● Any endpoint the system operators likely pay for
(upstream carriers generally)● Limit the number of calls that can consume resources
(internal calls unaffected)
@kazoocon
● Burst● Allows account to consume more trunks than the base
number allotted, typically for short intervals● Good for seasonal, customer support, radio shows, call
centers, schools, etc
● Bundled Trunks● Inbound, Outbound, Twoway as well● Limit determined by the number of users or devices
(configurable)● "twoway_bundled":"user", for example
● Prepay● Pay up front, deduct until 0● No simultaneous call limit
● Postpay● Basically prepay that can go negative
@kazoocon
● Allotments● Buckets of minutes per time-period● Monthly, Weekly, Daily, Hourly, Minutely (seriously)
Emergency calls are immediately authorized, as are outbound calls to tollfree numbers.
Each CDR is augmented with two fields showing the trunk usage for the account and the reseller at the time of the call.
The format is:{INBOUND}/{OUTBOUND}/{TWOWAY}/{BURST}.
@kazoocon
@kazoocon
@kazoocon
Limits – Behind the Curtains
@kazoocon
Track temporal data in temporal databases
● Affectionately called MODBs (month-only databases)
● Stores temporal data for a given month (ACCTID-YYYYMM)
● Keeps account database small and fast
● Monthly rollovers for transactions and other ledger-based work
● Views with map/reduce maintain the month's balances
● Once out of scope, MODBs can be archived and deleted
@kazoocon
● Rate real-time, in parallel with authorization● Helps with fraud
● Scales by accounts, so technically infinitely
● Tracks funny money● Allows external billing systems● Admins can easily apply credits to accounts
@kazoocon
Setup, Configuration, and Monitoring
@kazoocon
Setup Authorization
● Enable authorization on calls● sup whapps_config set_default ecallmgr authz_enabled true● sup whapps_config flush ecallmgr● sup -necallmgr ecallmgr_config flush
● Authorize local resource usage● sup whapps_config set_default ecallmgr authz_local_resources true● sup whapps_config flush ecallmgr● sup -necallmgr ecallmgr_config flush
● Dry Run authz attempts (useful when testing authz)● sup whapps_config set_default ecallmgr authz_dry_run true● Still allows a call that would have been denied
● Require a rate to continue call● sup whapps_config set_default ecallmgr {DIRECTION}_rate_required true● If enabled, ensures a rate is found for the leg; otherwise kills the channel
● Default Authz action (if authz request fails)● sup whapps_config set_default ecallmgr authz_default_action deny● Alternative setting is “allow”
@kazoocon
Adding limits to an account
Add limits to an account:
POST /v2/accounts/{ACCOUNT_ID}/limits{ "data": { "twoway_trunks": 0, "inbound_trunks": 11, "allow_prepay": true, "outbound_trunks": 5 }}
Check the limits schema for various limits to be set here and read more about the limits API in applications/crossbar/doc/limits.md
Resellers and system admins can perform this request.
@kazoocon
Manually limit account limit settings
System admins can manually restrict an account's limits:
Prefixing any of the limit doc's keys with “pvt_” will restrict the account's ability to set that limit.
Setting “pvt_enabled" to false on the account's limit doc
@kazoocon
Authz Summary
sup jonny5_maintenance authz_summary [{ACCOUNT_ID}]+--------------+----+-----+------------+---------+----------+---------+| Account ID | Cs | RCs | Allotments | Inbound | Outbound | Per Min |+==============+====+=====+============+=========+==========+=========+|{ACCOUNT_ID_1}| 1 | 1 | 0 | 1 | 0 | 0 |+--------------+----+-----+------------+---------+----------+---------+|{ACCOUNT_ID_2}| 1 | 1 | 0 | 1 | 0 | 0 |+--------------+----+-----+------------+---------+----------+---------+|{ACCOUNT_ID_3}| 1 | 1 | 0 | 1 | 0 | 0 |+--------------+----+-----+------------+---------+----------+---------+
sup jonny5_maintenance limits_summary [{ACCOUNT_ID}]+--------------+----+-----+----+-----------------+--------+-------------+|Account ID | Cs | RCs | As | Trunks | PerMin | Max Postpay || | | | |In|Out|Both|Burst| | |+==============+====+=====+====+=================+========+=============+|{ACCOUNT_ID_1}| -1 | -1 | 0 |3 |0 |3 |0 | 124.668| disabled |+--------------+----+-----+----+-----------------+--------+-------------+|{ACCOUNT_ID_2}| -1 | -1 | 0 |20|0 |20 |0 | 814.201| disabled |+--------------+----+-----+----+-----------------+--------+-------------+|{ACCOUNT_ID_3}| -1 | -1 | 0 |0 |0 |0 |0 | 693.675| -5000.0 |+--------------+----+-----+----+-----------------+--------+-------------+
@kazoocon
Managing credit for accounts
sup whistle_services_maintenance credit {ACCOUNT_ID} 5.0
sup whistle_services_maintenance debit {ACCOUNT_ID} 5.0
@kazoocon
Logs to Look For
This call is consuming a flat rate trunk
|{CALL_ID}|j5_request:186 (<0.29272.139>) account {ACCOUNT_ID} authorized channel: flat_rate|{CALL_ID}|j5_request:177 (<0.29272.139>) reseller {RESELLER_ID} authorized channel: flat_rate
This call was authorized because it is an outbound tollfree call
|{CALL_ID}|j5_authz_req:153 (<0.14181.140>) allowing outbound tollfree call|{CALL_ID}|j5_request:186 (<0.14181.140>) account {ACCOUNT_ID} authorized channel: limits_disabled|{CALL_ID}|j5_request:177 (<0.14181.140>) reseller {RESELLER_ID} authorized channel: limits_disabled
@kazoocon
What to look for in the CDR{ "_id": "201509-{CALL_ID}", "_rev": "1-efde475f92bd0ef742d8de4d788125ac", "billing_seconds": "10", "call_direction": "inbound", "custom_channel_vars": { "base_cost": "49", "rate_name": "US-1-INBOUND", "surcharge": "0", "rate_minimum": "60", "rate_increment": "60", "rate": "49", "account_id": "{ACCOUNT_ID}", "account_billing": "limits_disabled", "reseller_id": "{RESELLER_ID}", "reseller_billing": "limits_disabled", "channel_authorized": "true", "global_resource": "false", "account_trunk_usage": "0/0/0/0", "reseller_trunk_usage": "0/0/0/0" },}
Thank You!
#kazoocon14