Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated using 4PSA automated script


Note

Applies to VoipNow 3 and higher!

This article explains how to use the best cost algorithm to route outgoing calls based on the available channels and the charged cost.

Default best route algorithm

The Best Cost Routing Rules rules are used to route the call using the best cost available. The server finds all the channels with costs for the target number (including free channels), selects the best matches from each channel, and in the end orders the channels starting with the "lowest cost first". It takes the first channel in the list and uses it to connect the outgoing call. If the route fails, then the application will take the next lowest cost channel available, so on and so forth, moving upwards to more expensive channels.

Use case

Let us take for example the following rule:

Routing Rule 1 set up for number 12. routing the call through the Best Cost rule.

There are four channels defined in the system:

  1. Channel #1, with costs: 0.01 USD per second for calls to 123.
  2. Channel #2, with only one cost: 0.02 USD per second for calls to 12.
  3. Channel #3, which is free of charge.
  4. Channel #4, with only one cost: 0.04 USD per second for calls to 22.

If an extension dials 12345:

  1. Routing Rule 1 applies. All the available enabled channels are inspected. The server selects all channels with costs defined for number 12345.
  2. The following channels are found, ordered by cost: Channel #3, Channel #1 and Channel #2.
  3. The call is routed through Channel #3. This is the first channel because it is the free one.
  4. If the call fails and the failure reason is rejection, the call is re-routed through Channel #1. Next, the cost of area code 1234 is selected because it represents the best match on this channel.
  5. If the call fails and the failure reason is rejection, the call is re-routed through Channel #2.
  6. If the call fails again, then Routing Rule 1 ends here.

How to get the best cost route

The setup cost can influence the choice of the best cost route only if the parameter Average call duration was set in System preferences >> Charging tab.

For example, let us assume that we have two channels with the following call costs:

  • Channel #1

    Charge 0.1 USD/60 seconds with a setup cost of 1 USD

  • Channel #2

    Charge 0.9 USD/60 seconds with a setup cost of 0.2 USD

The server finds all the channels with costs for the target number (including free channels), selects the best matches from each channel, and in the end orders the channels, considering the most cost-effective alternative to route the call by means of the following formula:

min((setup_cost/average_call*charging_interval + call_cost)/ charging_interval*average_call)

For example, if the average_call duration is 180 seconds, the results are:

  • Channel #1

    (1 USD/180 s * 60 s + 0.1 USD)/60 s * 180 s = (0.33 + 0.1)*3 = 1.3 USD

  • Channel #2

    (0.2 USD/180 s * 60 s + 0.9 USD)/60 s * 180 s = (0.3 + 0.2) * 3 = 1.5 USD

In conclusion, even if the setup fee is bigger, the cost of an average length call is smaller via Channel #1. VoipNow Professional normally routes average and longer length calls using the channel with the best cost.

Content by Label
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("cost","calls","route") and space = currentSpace()
labelskb-how-to-article valls cost

Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.