Exclude Trunks on Warm Spare

Hi,

I have set up Warm Spare many times. This time though, since the destination PBX is on DR site I want to exclude Trunks.

So naturally I have selected to “Exclude Trunks” to YES.

The result is that indeed in PBX GUI there is nothing in Trunks.

However the trunks configuration still exists in file sip_additional.conf and when I do a ‘sip show peers’ from asterisk cli, the trunks are there and sending registration requests.

Is this normal behaviour? Have I neglected something in the configuration?

| backup              | 16.0.66    | Enabled                                 | GPLv3+      | Sangoma   |

I suspect this is a bug as it sounds like it might be related to this issue:

https://community.freepbx.org/t/warm-spare-trunks-are-not-disabled-on-restore

Hi Utelit.
Philip Joseph picked up my ticket and responded to say that the current implementation only disables trunks with a registration string, e.g. CHAN_SIP. He’s closed my ticket and instead opened one against the core module, as FREEPBX-24185

Ahh, not a bug then but not the expected functionality either.

Hey,

From what I understand, your problem is about having copied but disabled.

My problem is that I don’t want ANY trunk to get transferred to WARM SPARE. I am not sure how Backup & Restore works in the background in such case but what I would expect is:

  • Disable Trunks = Copy the trunks but have them disabled
  • Exclude Trunks = Don’t copy trunks AT ALL, not only at FreePBX level (which works perfectly), but also on asterisk level (aka from the configuration file).

In reality I am not sure how “exclude” is handled.

So I want to exclude because all the Trunks on Main Site are on-premise stuff (Vega devices, ISP modems etc) that don’t exist on DR Site.

You are correct. These are different things and I don’t think there is a spot in the current backup facility to exclude trunks because they are so integral to everything else.

Hi @utelit - You’re correct and I apologise I hadn’t read closely enough before posting. Hope you get a satisfactory solution… it does sound like a strange behaviour but given the complexity of asterisk + FreePBX I suspect there will always be some anomalies.
Could a post-restore hook remove the config you don’t want from sip-additional.conf on the target machine (if the devs decide not to change the current behaviour)?
Mike

Hi,

Yes, agreed! Currently I am leaning towards post-restore script indeed.

I just need to find a way to isolate a whole stanza of the configuration file from command line, so I can delete it from configuration on post-restore. But that’s another topic and irrelevant to the thread.

Actually I started going down the route of creating a post restore script to disable the trunks and documentation for it is sparse so maybe somebody here can assist.

First, I am assuming that the script needs to be stored on the system that runs the backup, correct?

Is there a preferred directory to store these scripts?

Who needs to be the owner of the script for it to be executed properly? asterisk or root?

Unless there is any surprise, it sounds like it should be in the same system that initiates the Restore Job, so yeah on the system that runs the backup. Correct me if I’m wrong.

I haven’t created before, but I would assume that a “proper” directory would be either one that gets its permissions updated when you issue the command “fwconsole chown”, or a directory in asterisk user home folder.

asterisk.

So based off of that we would need the script to SSH from the system to run the fwconsole command to disable the trunk. Something like this maybe?

/usr/bin/ssh <user>@<warm spare ip> /usr/sbin/fwconsole trunks --disable <trunk>

Hmm, created a script inside /home/asterisk/bin/disable_trunks.sh:

# ll disable_trunks.sh
-rwxr-xr-x 1 asterisk asterisk 390 May 15 11:50 disable_trunks.sh

Specified it as a Post-Restore Hook but it doesn’t seem to get executed at all.

Doing it manually from the CLI seems to work just fine and actually disables the trunks.

Can you test on your end and let me know if it’s working for you?

I believe this is a separate issue to discuss and it should be on another thread where I’ll be glad to help in any way I can. Also to answer, I would first look if there is any relevant post in this forum. After a quick search for example I found https://community.freepbx.org/t/backup-restore-hooks-not-working/70486/4.

So that anyone that accesses this thread 6 months from now, finds information that is relevant to the title and maybe pitch in.

So in order to conclude, from what I understand there is no direct solution at the moment. In order to exclude trunks it needs to happen on both FreePBX level and asterisk level. Right now it only happens on FreePBX level.

Most possible solution seems to be a post-restore script.

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