...
Step-by-step guide
Download the script.
Shell wget -O time_interval.pl https://raw.githubusercontent.com/4psa/voipnowtoolbox/master/time_interval.pl
Install the needed Perl libraries.
Shell yum install perl-DBD-mysql perl-JSON
Run the script.
Shell perl time_interval.pl
The available options will be displayed:
Code Block Usage: Available options: Share a time interval with a different account perl time_interval.pl share <time_interval_id> <client_id> E.G.: perl time_interval.pl share 2 4 Dump a time interval to a file perl time_interval.pl dump <time_interval_id> <file_name or empty> E.G.: perl time_interval.pl dump 2 afterhours Restore a time interval from a file perl time_interval.pl restore <client_id> <file_name or empty> E.G.: perl time_interval.pl restore 2 afterhours.json
Cloning time intervals on a different account
To clone an existing time interval on a different account, you need to know the ID of the time interval and the client ID of the destination account.
Code Block |
---|
perl time_interval.pl share <time_interval_id> <client_id> |
Let's assume that the ID of the After Hours matching time interval created on the Admin level (Unified Communications >> Time Intervals) is 21, and let's copy the time interval on the Service Provider with ID 2.
Shell |
---|
#> perl time_interval.pl share 21 2 |
Saving time intervals to a file
Assuming we want to create the same time interval on a different server, we need to save it to a file and restore it where it is needed.
In our example, we will use the same time interval with ID 21, used for After Hours matching, and we will run the following command:
Shell |
---|
#> perl time_interval.pl dump 21 afterhours |
Code Block |
---|
{"mod_date":"2016-01-22 09:42:36","cr_date":"2015-11-10 12:11:09","client_id":"1","name":"AfterHours","data":[{"end_day":"31","time_interval_id":"21","month":"0","start_time":"00:00:00","end_time":"09:59:00","start_wkday":"2","end_wkday":"6","start_day":"1","td_id":"40"},{"end_day":"31","time_interval_id":"21","month":"0","start_time":"17:00:00","end_time":"23:59:00","start_wkday":"2","end_wkday":"6","start_day":"1","td_id":"41"},{"end_day":"31","time_interval_id":"21","month":"0","start_time":"00:00:00","end_time":"23:59:00","start_wkday":"7","end_wkday":"1","start_day":"1","td_id":"42"}],"timezone_id":"248","id":"21","type":"day"} |
Restoring time intervals from file to an existing account
Code Block |
---|
perl time_interval.pl restore <client_id> <file_name or empty> |
Let's restore the time interval saved earlier to an existing account with ID 2. We will use the following command:
Shell |
---|
#> perl time_interval.pl restore 2 afterhours.json |
Related articles
Content by Label | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
hidden | true |
---|
...
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.