Limiting Minutes on a Trunk per Month (Trunk Balancing Module?)

Hi all,
I would like to be able to set a minutes limit on a trunk for both incoming and outgoing. I found the Trunk Balancing module, but it isn’t signed and I don’t know how to get it to work yet. If I have a single trunk with a specific DID on it, can I set it up purely to disable the trunk if it hits that monthly limit? I don’t need it to load balance, just purely stop calls from coming in / out on it.

Also, does the trunk turn back on for the next month billing cycle?

Does anyone have any experience working with Trunk Balancing that could help, or is there a different solution that I should be looking into?

I am reading the wiki, but still a little confused… I know that it can do inbound as well, but I need to wrap my head around it further. If someone here can let me know if it is possible to do what I am speaking about, that would be great

There are so many variables involved in what you want to do, especially if you have a bunch of trunks, that handing you a simple solution isn’t going to do you any good.

For example, trunk selection is often a very ‘voo-doo’ sort of process. Combine that with the system’s natural tendency to complete calls, and you end up with a solution that gets harder and harder to balance.

Also, granularity is an issue. Is a “daily” total enough? When do you turn the trunk back on? Are you blocking by $ or by minutes? The entire thing is just kind of fraught with peril, if you know what I mean.

Writing something external to the server (that communicates with it through the AMI or “Asterisk CLI” Interfaces) would give you a lot of control and let you control when and how all of this will go.

Yes, daily totals are fine. I’d just like to make sure that the monthly totals don’t go too much over.

The next month billing cycle. From what I read, Trunk Balancing should be able to do this, but I was hoping that someone had some experience with it and could give me some info.

By minutes. So if the trunk is only allowed 2000 minutes, then I would want the trunk to be disabled.

No clue how to do this.

You might be able to “pass the buck” on this one depending on your trunking provider. For example, point your trunk to an account or sub-account with a spending or time limit and then recharge the account at the beginning of each month.

1 Like

@lgaetz Can you provide any input? I saw the module was updated in March, but I can’t get it working.

I’ve not touched this module in years. If the module will install on a current system, it probably can be used to do what you want. I would not expect it to work with PJSIP trunks, that tech didn’t exist when it was written.

Ohhh…ok. I’ll have to get a chansip trunk to test then. Probably a silly question for you. If I have all of my extensions set to PJSIP, will there be issues having them use a chansip trunk?

Otherwise, here is what my config was for testing. Does everything look ok here? Other than the 1 minute?

@lgaetz Also, if the Trunk Balancing works as intended does it stop incoming and outgoing routes, or only outgoing routes? I don’t see anything in the documentation that would somehow disable the original trunk for inbound as well.

I would help if I could, but I’m sincere when I say I’ve not touched this module in years. Commit history shows that it’s been 6 years since I’ve done anything substantial with this module. I didn’t originally write it, nor have I ever used it in production.

1 Like

It could probably be done with custom code, but doesn’t seem like the best tool for the job. Have you though about a SIP router, like Kamailio? That might yield a better result.

No I didn’t even know it was an option. Does it sit in front of freepbx? Does it integrate well?

Yes, and yes.

Ahh I only have 1 box at that location.

Doesn’t have to be in the same location/network.

hmm…I’ll have to look into it. Thanks for the heads up. Have you used it and are you open to questions if I have some?

Kamailio works fine on a $5 droplet, Dsiprouter gives it a friendlier front end (kamailio NOT particularly friendly for Gooey folks :wink: ) , So $5 bucks later and RingTFM while :-

And you are 'up and at ‘em’


Seconded for dSIPRouter.

What VPS / droplet service have you used in the past where this works well? What would you recommend?

I will not endorse anyone in particular but any entity that is still here after 5 years would likely be AOK.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.