This is a fair question. Although our termination SIP trunk is unlimited, it is not for free. It wouldn't make sense if you just consume a few minutes in a month. We give some examples of how to calculate the optimal number of channels. After all, this is all about saving money and maximize your VoIP business profit.

## Simple Average Approach

Let's assume a month has 30.41 days (on average). A month has 43800 minutes. Our one channel trunk has a current value of 14.99 USD. Doing fast maths, 14.99 / 43800 gives 0.000342 USD / minute.

If your current consumption is 50000 minutes at a rate of 0.003 USD / minute, this means you are paying 150 USD monthly. So, if you want to cut this expense by half, you would need to hire five channels from To Connect Me. Five channels give you the ability to pass your 50000 monthly minutes at an average rate of 0.001499 USD / minute rate.

## Probabilistic CDR Analysis

Although the simple average approach may work for some people, others may want to have a more accurate calculation. The thing here is to apply some statistics to know the likelihood of having N simultaneous calls when there is at least one. The best approach is using the standard deviation. If you want to read more about it, you cant start with this Wikipedia article https://en.wikipedia.org/wiki/Standard_deviation.

This distribution has the particularity that it is divided into 8 deviations. Each deviation implies a probability.

For this análicys, we will aim to the first deviation +1σ, which implies 84.1% of probability.

The good news here is that almost any software can calculate it. Therefore there is no need to do complex math, for example. the following SQL query will calculate for us.:

For MySQL/MariaDB:`SELECT YEAR(start_stamp) y, MONTH(start_stamp) m, MIN(c), AVG(c), MAX(c), STDDEV(c) FROM (SELECT start_epoch, start_stamp, COUNT(*) AS c FROM v_xml_cdr WHERE (start_epoch BETWEEN start_epoch AND end_epoch) OR (end_epoch BETWEEN start_epoch AND end_epoch) GROUP BY start_epoch ) a GROUP BY y, m ORDER BY y DESC, m DESC;`

For PostgreSQL:

`SELECT EXTRACT(ISOYEAR FROM start_stamp) y , EXTRACT(MONTH FROM start_stamp) m, MIN(c), AVG(c), MAX(c), STDDEV(c) FROM (SELECT start_s``tamp, COUNT(*) AS c FROM v_xml_cdr WHERE (start_epoch BETWEEN start_epoch AND end_epoch) OR (end_epoch BETWEEN start_epoch AND end_epoch) GROUP BY ``start_stamp ) a GROUP BY y, m ORDER BY y DESC, m DESC;`

The field description is as follows (fit this to your own CDR format):

- start_stamp and end_stamp are DateTime fields such as 2019-12-31 23:59:59

The query gives an output like this:

+-------------------+--------------------+--------+--------+--------+-----------+

| year(start_stamp) | month(start_stamp) | min(c) | AVG(c) | max(c) | STDDEV(c) |

+-------------------+--------------------+--------+--------+--------+-----------+

| 2019 | 3 | 1 | 2.0000 | 3 | 1.0000 |

| 2019 | 4 | 1 | 1.0743 | 5 | 0.3027 |

| 2019 | 5 | 1 | 1.1300 | 10 | 0.5955 |

| 2019 | 6 | 1 | 1.2794 | 10 | 0.9008 |

| 2019 | 7 | 1 | 1.2957 | 6 | 0.8261 |

| 2019 | 8 | 1 | 1.2526 | 6 | 0.7437 |

| 2019 | 9 | 1 | 1.2542 | 6 | 0.7222 |

| 2019 | 10 | 1 | 1.2039 | 7 | 0.6260 |

| 2019 | 11 | 1 | 1.1978 | 7 | 0.6453 |

| 2019 | 12 | 1 | 1.1830 | 6 | 0.6368 |

| 2020 | 1 | 1 | 1.1332 | 6 | 0.5223 |

+-------------------+--------------------+--------+--------+--------+-----------+

Because when writing this article it was January 2020, the month was not complete, to show an example December 2019 average will be used. Then using the data, we can read that:

- The average number of simultaneous calls was 1.1830
- The standard deviation is 0.6468

Because we are aiming to +1σ, 1.1830 + 0.6468 = 1.8298.

This means, that in this example:

- There is 84.1% of the probability of having 1.8298 calls (or less), and
- 68.2% of the time, there will be between 0.5352 and 1.8298 calls.

After rounding, our magic number is two channels to maximize the savings.