[SOLVED] Trunk rotation on outbound route

Hello,

i have several (5) trunks configured and set them in a sequence on a specific outobund route.
Each of those trunks has an account configured with a number of minutes free.

What I want to do is to set up a rotation of those trunks on outbound (like daily) in order to distribute the costs evenly on those accounts.

Is it possible via freepbx ?

My other alternative is to set up a cron with a perl script that would change the trunks but i’m not quite sure how its done.

Thank you

Third party module, Trunk Balancing, exists expressly for this purpose.

2 Likes

thank you , thats what I needed, i’m testing it right now

i’m reading the documentaiton but still cant get to work. any hints on how to configure it with 5 providers to balance outbound calls ?

1 Like

Not much of a user of this module myself. You have two approaches, you can try to balance outbound calls evenly over the 5 trunks, or you can use up Trunk A’s minutes then Trunk B, etc. Either way you want to create 5 new balanced trunks, each corresponding to one of the existing trunks, then either fill out the fields that correspond to the monthly limits you want, or use the load ratio.

To try to evenly spread calls over 5 trunks, you would use a load ratio of 5 for the first trunk, then 4 for the second, then 3, then 2 then 1.

Once the balanced trunks have been created, go into your outbound route(s) and configure them to use these new trunks instead of the existing ones. Don’t delete your old trunks.

First thank you for your reply.

So if i have 4 providers i wuld set up 4 balanced trunks with loads of 4,3,2 and 1 right ?

as in the documentation was somethings similar like if you have 3 providers you set up 2 balanced trunks and in the outbound route you set your third provider as last

So if i have 4 providers i wuld set up 4 balanced trunks with loads of 4,3,2 and 1 right ?

Correct.

1 Like

thank for clarifying that,
the module wont let me enter decimal numbers but i’ve set 4,3,2,1 and weirdly is working fine.

I’ll makr this as solved
thnx again

I went back and reread the module wiki and everything I typed above about load balancing is wrong. You are correct, to properly balance four trunks, you use load ratios of 4, 3, 2, and 1 as you have done. I have edited the posts above with the correct info.

The first trunk takes 1/4 of the calls so the load ratio is 4/1 = 4. The second trunk takes 1/3 of the remaining calls so 3/1=3. Third trunk takes half of the remaining calls…etc.

1 Like

Hello Igaetz
I installed asterisk 16.16.1 with chan-dongle (10 dongles)
and try use trunk balancing 1.1.1.5 to balance between 10 dongles trunks
i make load ratio each trunk 10 to 1(trunk 1 load ratio 10, trunk 2 load ratio 9 …etc to trunk 10 load ratio 1)
and choose new balance trunk in out bound
but when make calls give me all-circuits-busy-now
in asterisk logs
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: res_agi.c:2223 launch_script: Failed to execute ‘/var/lib/asterisk/agi-bin/trunkbalance.php’: File does not exist.
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: channel.c:6248 request_channel: No channel type registered for ‘Balancedtrunk’
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: app_dial.c:2576 dial_exec_full: Unable to create channel of type ‘Balancedtrunk’ (cause 66 - Channel not implemented)
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: res_agi.c:2223 launch_script: Failed to execute ‘/var/lib/asterisk/agi-bin/trunkbalance.php’: File does not exist.
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: channel.c:6248 request_channel: No channel type registered for ‘Balancedtrunk’
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: app_dial.c:2576 dial_exec_full: Unable to create channel of type ‘Balancedtrunk’ (cause 66 - Channel not implemented)
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: res_agi.c:2223 launch_script: Failed to execute ‘/var/lib/asterisk/agi-bin/trunkbalance.php’: File does not exist.
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: channel.c:6248 request_channel: No channel type registered for ‘Balancedtrunk’
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: app_dial.c:2576 dial_exec_full: Unable to create channel of type ‘Balancedtrunk’ (cause 66 - Channel not implemented)
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: res_agi.c:2223 launch_script: Failed to execute ‘/var/lib/asterisk/agi-bin/trunkbalance.php’: File does not exist.
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: channel.c:6248 request_channel: No channel type registered for ‘Balancedtrunk’
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: app_dial.c:2576 dial_exec_full: Unable to create channel of type ‘Balancedtrunk’ (cause 66 - Channel not implemented)
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: res_agi.c:2223 launch_script: Failed to execute ‘/var/lib/asterisk/agi-bin/trunkbalance.php’: File does not exist.
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: channel.c:6248 request_channel: No channel type registered for ‘Balancedtrunk’
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: app_dial.c:2576 dial_exec_full: Unable to create channel of type ‘Balancedtrunk’ (cause 66 - Channel not implemented)
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: res_agi.c:2223 launch_script: Failed to execute ‘/var/lib/asterisk/agi-bin/trunkbalance.php’: File does not exist.
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: channel.c:6248 request_channel: No channel type registered for ‘Balancedtrunk’
[2021-08-19 20:02:16] WARNING[6892][C-00000001]: app_dial.c:2576 dial_exec_full: Unable to create channel of type ‘Balancedtrunk’ (cause 66 - Channel not implemented)
[2021-08-19 20:02:18] WARNING[6892][C-00000001]: file.c:789 ast_openstream_full: File pls-try-call-later does not exist in any format
[2021-08-19 20:02:18] WARNING[6892][C-00000001]: file.c:1262 ast_streamfile: Unable to open pls-try-call-later (format (ulaw)): No such file or directory
[2021-08-19 20:02:18] WARNING[6892][C-00000001]: app_playback.c:497 playback_exec: Playback failed on SIP/2023-00000000 for all-circuits-busy-now&pls-try-call-later, noanswer
[2021-08-19 20:02:18] WARNING[6892][C-00000001]: channel.c:4968 ast_prod: Prodding channel ‘SIP/2023-00000000’ failed
what is problem?

‘/var/lib/asterisk/agi-bin/trunkbalance.php’: File does not exist.

how can i restore it agian?
and if i did not use all dongles in same time may be use 7 dongle of 10 but i add 10 trunks in asterisk , did trunk balance work well in this case ?
thanks