h1. Consumption profile {{>toc}} h2. Idea _Consumption profile_ - specific set of pre-paid services, which is assigned to _Billing subject_, for example _user_ or _company_. Thus, the customer is not charged per call for the services which are defined this way. Payment for such services usually is included in [[Periodic write-offs]], which are configured separately. Also _Consumption profile_ could be a part of promo-action to attract clients. In this case payment for the services is not written-off at all. Consumption profile can be activated on the basis of next rule types: * *duration*. You specify how many minutes per time period will be free. This rule enables you to define conditions like "30 minutes per month are free". * *cost*. You specify how much cost per time period is free. This rule enables you to define conditions like "30 USD per month is not written off from balance". For each rule you can define [[E.164 codes]] on which this rule is active. For example, you can specify rule this way: "30 minutes per month for destinations from North America are free". For this you need to type needed destination codes or import them from file. h2. Theory of operation System calculates time limits from [[Balances]] for each call which hits the consumption profile. This needs to limit call duration basing on current balance of _Billing subject_ and volume of used part of _consumption profile_. Thus, if [[Balance cut-off]] is configured, balance could be maintained non-negative even for the calls which hit consumption profile. There can be cases, when only *part of a call* hits into consumption profile. For example, for rule above, customer began conversation on 29th minute of a profile, and finished it in 3 minutes. In this case 1th minute of a call will be accounted as "in consumption profile", and the rest 2 - as accounted using regular billing rulesкак оцененные по обычным правилам биллинга. You can specify several rules of any type. To determine if the call hits consumption profile, system will check all confugured rules using next algorithm: - in case if matching rule if found (for example, there is a match on destination code), and according to this rule call is out of profile: it's assumed that call doesn't hit whole consumption profile, even if it hits some other rules - in case if call matches several rules, however limits allow to place into consumption profile only part of a call, then minimally possible limits are used. To determine *period of activity* of consumption profile, the system uses next algorithm: - in case if _Billing subject_ has been activated (see section [[Activation and deactivation]]), then *activation date* is chosen as beginning of period - in case if _Billing subject_ hasn't been activated (see section [[Activation and deactivation]]), then first calendar day and time of _period measure_ is chosen. For example, if _period measure_ - month, then the beginning of period will be first day of a month. Consumption profiles are configured in web-interface section [[Consumption profiles]] [[Профиль потребления|Русский перевод]]