Programmatically change trunk state?

Is it possible to enable/disable trunks via a script? I often enable one set of trunks and disable another and v.v. It’s very tedious via the FreePBX GUI. I would like to use a script to enable/disable the set that I need at the time.

Any way to enable a trunk from the CLI?

I don’t believe so…but happy to be proven wrong.

What are you trying to achieve exactly? Enabling/disabling trunks sounds like quite a heavy handed approach. You may be able to achieve a similar result using the dial plan and things like time conditions.

I’m trying to implement an HA solution. I want to be able to bring the PBX online (and activate the trunks) from the dialplan without leaving the PBX in the precarious state of a reload or reboot causing the trunks to come online. (See

It is possible and works well, and I think is a better solution than leaving the server in this “HA” / “Apply Configuration” state.