I have successfully set up backup and restore to a remote server as discussed in the High Availability Backup and Restore article in the Technical Corner. Everything seems to be working well with one exception. Our SIP provider requires us to register each DID with them individually. To accomplish this we have a separate registration string for each DID in sip_registrations_custom.conf. The problem is that these registrations listed in sip_registrations_custom.conf are happening on the backup server with each backup and restore causing inbound calls to be routed to the wrong server. The Apply Configs box is unchecked and the disable trunks box is checked in the backup module, but do not seem to affect sip_registrations_customer.conf. I can exclude this file from the backup and manually add the registration strings in the event of the backup server going into production, but this doesn’t seem to be the best avenue. Any suggestions as to how to stop the DIDs from automatically registering with each backup and restore?
FreePBX 188.8.131.52 (Install from Distro)
Backup and Restore 184.108.40.206
I was able to register multiple DIDs by writting the following in the register sting field in the gui: NPANXXXXXX:username:[email protected]/NPANXXXXXX\nregister=NPANXXXXXX:username:[email protected]/NPANXXXXXX\nregister=NPANXXXXXX:username:[email protected]/NPANXXXXXX\n
This causes the register strings to be written in sip_registrations.conf instead of me manually adding them to sip_registrations_custom.conf
However this solution still poses two problems:
1st the gui removes the new line character \n when the page reloads, so subsequent changes to the trunk require the registration field to be retyped each time.
2nd the DIDs still register in the backup server when written the same as when the register strings were written in sip_registrations_customer.conf
Still searching for a solution, and appreciate any help…
This is a known ‘problem’ of the backup and restore module (a feature request ticket should be created for this).
The way I solved it is by writing a custom shell script and have that executed as post-restore hook. The script restores the sip_additional and sip_registrations file and also the sip table in mysql.
@StaceyB - is there any reason you prefer to keep the Apply Configs options unchecked? If the configs CAN be applied, a new set of sip_*.conf files will be written out - without the trunks.
@James83 - this feature (unless I’m misunderstanding or there is a bug) has been out for some time
@mbrevda Checking the apply configs does result in the sip_registrations.conf file to be written out as you state, but does not appear to affect the sip_registrations_custom.conf file.
So, that gets me part way there. The problem I still have is with how to register my DIDs though the trunks module. I can accomplish this by entering the registration strings separated by a new line character in the registration sting box in trunks module of the gui as stated above, but I have to re-enter the strings each time a change is made to the trunk due to the gui stripping out the new line character when the page is reloaded. Otherwise the strings are written to sip_registrations.conf as one line when I apply changes to the trunk, the registations do not occur, and the following warning is logged:
[2012-10-15 13:01:18] WARNING sip/config_parser.c: Format for registration is [peer?]transport://user[@domain][:secret[:authuser]]@host[:port]/extension[~expiry] at line 8
This is why I was using sip_registrations_custom.conf to hold my registration strings.
So it seems I either need a way for the sip_registrations_custom.conf to be disabled until I enable the trunk, or a way for the gui to hold the registration stings as separate lines so they are written to sip_registrations.conf correctly.
FYI - I had opened up a bug report #6022 on Friday thinking this was a bug.
FreePBX doesnt not write out sip_registrations_custom.conf. If you dont want it to be restored, just keep it out of the backup.
As per your question on multiple registrations: are you sure there is no other way to register with them but on a per did basis? (I’m curious, as I never heard of a provider that requires that, and because it doesn’t make technical sense). However if you really require it, you may want to open a feature request to add the ability for multiple registration strings per trunk.
@mbrevda: Not sure if we are talking about the same issue here, let me try to explain:
I have 2 servers, 1 is active and 1 is standby in case something happens with the first one. I cannot have them share the same trunk because my provider only accepts registration from 1 IP at a time. When doing a backup and restore, having the trunk disabled on the standby server is not an option because how can you enable it when the primary server goes down? (manually yes but not automaticly)
So an other option is to register a different trunk on the standby server (that trunk is a failover from the other trunk) but when doing a restore FreePBX copies the sip_additional.conf file which includes not only extension data but also trunk data (this is the part I think should be changed). When it restores this file all trunk data is messed up and the standby server has become useless.
How I currently handle the backup and restore:
I exclude the following mysql tables:
I run a post-restore hook
It runs a shellscript that replaces part of the sip_additional.conf file (at the moment it also replaces part of the sip_registrations.conf file but i’m not sure if this is correct, let me have a look at that).
This script also replaces mysql data in the sip table.
Checked the following options:
Backup & Restore module 220.127.116.11
So basically, you have one set of trunks for your Primary, and another for your secondary, and you want the backup - on restore - to automatically disable the primary trunk and enable the secondary?
@StaceyB - I’m getting confused between the two of you - sorry! Lets start again.
Is backup and restore working for you (without the trunk registrations issue)?
@James83: the scenario you described is different than what I am trying to accomplish. I do not mind having to manually enable the trunk.
@mbrevda: Our provider is XO Communications. Registering each DID is the only way we have been able to receive incoming calls (even after working with their engineers and a third party vendor we hired). However XO has always been reluctant to help because we are not using a “XO Lab Certified System”. If you know of another way to register with them, I am all ears. The one nice thing about the way we are set up, we can register individual DIDs on different systems which has been great for development.
Here are my trunk settings:
Trunk Name: XO
USER context: username
Registration String (one per did):
That would be a nice solution if I was using such a setup (but i’m not).
But this could still be an interesting solution for people who have this kind of setup.
In my configuration: each server has 1 trunk (same DID but different name, username and password).
If there was a way to exclude the trunk settings from being restored it would be ok.
A possible solution for this would be if trunk settings would be stored seperately from extension settings. For example: not store trunk settings in the sip_additional.conf file but in some file called trunk_additional.conf.
And not store some of the trunk settings in the mysql table “sip” but store all settings related to trunk in the table “trunks”.
Offcourse there are other things related to trunk settings like outbound routes
but they are easily to exclude in the current version.
I hope you understand what I’m trying to say.
Ow I thought StaceyB and I had the same issue, that was why I was posting here. My apologies.
This might get confusing, should I open a new post for my issue?
Yes, PLEASE! My head is beging to hurt! (unless this is the same issue, obviously)
@mbrevda Yes Backup and Restore is Working for me except for the “trunk registrations issue”.
@StaceyB good. It sounds like all you really need is the option to add multiple registration strings to a trunk?
@StaceyB yes, it seems that I do need an option to add multiple registration strings to the trunk.
Ok, now were on the same page
It sounds like a valid feature request, feel free to open a ticket referencing this thread for the backstory.
I just opened feature request ticket #6033
Thanks for all your help.