Time group migration

Hi,
I have created a set of time group, and I want to replicate them on another freepbx server (same versions).
Do you know where this information is stored so that I can copy paste them? There is no import button, could it be stored in a file? Or do I have to create them from scratch?

Any ideas?

Time groups are usually pretty simple. Normally, it is faster to just recreate them than to try copying stuff around.

Now - if you are setting up a “replication” kind of thing (change something on server A and it gets changed on server B), that’s a different question. I don’t know of a way to do that, but I’m sure James @jfinstrom or Lorne @lgaetz might be able to make some suggestions.

I have 3 servers on 3 sites,
I want similar time groups for the IVR setup for the whole year around.
It is simple yes, but time consuming. We are engineers, there should be a smarter way other than writing everything 3 times.

Does anybody know where the information is stored?

Do not recommend manipulating tables manually, but you asked…

[root@lgaetzdev2 ~]# mysql

mysql> use asterisk
mysql> select * from timegroups_groups;
±—±------------+
| id | description |
±—±------------+
| 2 | Bus hours |
| 3 | test |
±—±------------+
2 rows in set (0.00 sec)

mysql> select * from timegroups_details;
±—±------------±------------------------+
| id | timegroupid | time |
±—±------------±------------------------+
| 17 | 2 | 18:00-19:00|mon-fri|| |
| 16 | 2 | 08:00-12:00|mon-fri|| |
| 15 | 2 | 13:00-17:00|mon-fri|| |
| 23 | 3 | 18:00-19:00|mon-fri|| |
| 22 | 3 | 13:00-17:00|mon-fri|| |
| 21 | 3 | 08:00-12:00|mon-fri|| |
| 24 | 3 | 10:00-13:00|sat|| |
±—±------------±------------------------+
7 rows in set (0.00 sec)

thank you for your reply and I agree, not touching tables. Creating from scratch. Thanks

1 Like

@lgaetz - I’m not curious enough to look, but curious enough to ask.

Does FreePBX read that information from the Asterisk tables, or does It get recoded from a FreePBX table? If you don’t know off the top of your head, never mind. I’m not curious enough for you look either :wink:

If it pulls from Asterisk, changing the tables manually (while never being the recommended method) would actually work reliably and still be manageable from the UI. If that was the case, setting up a cron job to copy the table data around within a server “pool” would be trivial.

A quick top level view of FreePBX operation:

  1. User enters data in a FreePBX GUI form and hits submit
  2. User data can be written internally to a number of locations, either the astdb, an asterisk MySQL table, or in rare cases a flat conf file, or a combination of these. Most modules write to mysql, follow-me is a good example of a module that writes to the astdb, and voicemail admin writes its config to voicemail.conf. When you create a new extension, all three get written to.
  3. When the user finally clicks “Apply Config”, FreePBX writes out all the Asterisk .conf files from the user values stored in MySQL, and does an Asterisk ‘core reload’ to apply the new config to the running asterisk.

So when you say:

Trivial for some perhaps. But such a scheme has to do more than replicate the MySQL asterisk tables, there is also the critical content in the astdb and the few conf files (and *-custom.conf files) to replicate as well. And we haven’t talked about the CDR database, custom system prompts, voicemail recordings, faxes, SMSs, and likely a bunch of things I am forgetting.

And in case you aren’t familiar with the warm spare setup in the wiki, the wheel has been invented:
http://wiki.freepbx.org/display/FPG/Warm+Spare+Setup

My question was apparently overly broad. I just meant the timegroups - nothing else.

Having built a couple of FreePBX modules (crappy as they are), I understand that pain.

Some things, without looking at the code so not sure if time groups is one, also edits astdb on save. So importing a database may make something show up in the GUI but then you find out it doesn’t actually work because an astdb entry is written on save and not “apply config”.

1 Like