Starting point on a script to change trunk sequence for outbound routes

We have a VSP that has a fair use policy (FUP) that allows 100 cell/mobile calls per month and 300 local and 300 national calls per a month for a fixed fee. The catch is that if you exceed any one of these limits, your account is suspended for the balance of the month.

I am looking to develop a script that can be run via a cron job that will change the trunk sequence for the cell/mobile outbound route once it reaches 90 calls, as we will be hard pressed to hit the other limits.

I thought about updating the DB directly and issuing a CLI reload, but have read that this is less than ideal for adding users and it does not work, so I am looking for some pointers as to where to look or even where to start for something like this.

Thanks.

For this situation, you should be safe updating the database and then running /var/lib/asterisk/bin/module_admin reload (this rewrites the config files and then reloads asterisk).

Note that this is equivalent to pressing “apply changes” in the GUI - so if you have outstanding changes (perhaps because they are unfinished) running this script WILL apply them.

The reason you can’t do the same for users/devices/extensions is because those all have a number of astdb values, in addition to stuff stored in mysql.

Thanks Greg.

Once I get some spare time I will give it a go.