Greetings,
I’d like to propose a modification to core in terms of managing trunk status.
Presently there is a “Disable Trunk” with a checkbox. The setting of this is stored in the trunks table under the column disabled of type varchar(4). I’d like to propose that this be changed to “Trunk Status” in the GUI and a pop-up menu with the values:
Enabled - Trunk will be enabled on both primary and backup
Primary Only - Trunk will be enabled on primary only.
Backup Only - Trunk will be enabled on backup only.
Disabled - Trunk will be disabled on both primary and backup.
In the database the values would be stored with the corresponding values:
Enabled - on
Primary Only - pri
Backup Only - bak
Disabled - off
In the processing the values of ‘pri’ and ‘on’ will be interpreted exactly the same. If a trunk is set to ‘pri’ on any system, the trunk will be enabled. Similarly, the values of ‘bak’ and ‘off’ will be interpreted exactly the same. There is nothing in the processing of these values which needs to know if the configuration being built is on the primary or the backup.
The remote backup and subsequent restore process would then handle the new values. Prior to the freshly “restored” configuration being applied on the backup system the database is adjusted with something like:
update trunk set disabled = 'on' where disabled = 'bak';
update trunk set disabled = 'off' where disabled = 'pri';
There should be no modification of the trunks with disabled entries of “off” or “on” through this process. At this point the freshly “restored” configuration can safely be applied.
The benefit from this change: SIP trunks for both primary and backup could be defined on the primary system with states that reflect their usage. Both systems can have the same configuration beyond the trunk state. Both the primary and backup trunks could then be defined in the Outbound Routes and the rest of the configuration would be the same. This should take us closer to a HA solution.
An alternate to this is to modify the 2.8 Backup/Restore module to add a hook that will be executed on the non-primary system. This will allow l33t an opportunity to do more customized fiddling of the database directly (as well as other system things like aastra scripts?). This hook would similarly need to be called just prior to automatically applying the configuration. The exit value of the hook could be ignored or a non-zero exit status would prevent the auto-applying of the freshly “restored” configuration.
Thank you for this consideration,