How to solve time synchronization problem on Vicidial
When timezone is set differently in Server, Vicidial database, and in PHP you will receive the following error.
There is a time synchronization problem with your system, please tell your system administrator
To resolve this you need to set the same timezone for the Server, Vicidial database, and in PHP.
To check Server timezone.
timedatectl
Output:
vicibox9:~ # timedatectl
Local time: Tue 2021-06-08 14:02:11 UTC
Universal time: Tue 2021-06-08 14:02:11 UTC
RTC time: Tue 2021-06-08 14:02:11
Time zone: UTC (UTC, +0000)
And also check in /etc/php7/apache2/php.ini
.
Output:
vicibox9:~ # cat /etc/php7/apache2/php.ini | grep timezone
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone =
vicibox9:~ #
Note: For the above timezone make changes if needed and make sure both are in the same timezone!!
If the issue persists after the above changes are made, use the following command check and compare the timezone values in the Server, PHP, and Vicidial database.
echo "SELECT server_ip, UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater" | mysql -uroot asterisk && php -r "date_default_timezone_set('America/New_York'); echo 'php time: '.date('U');" && echo ""
Output:
vicibox9:~ # echo "SELECT server_ip, UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater" | mysql -uroot asterisk && php -r "date_default_timezone_set('America/New_York'); echo 'php time: '.date('U');" && echo ""
server_ip UNIX_TIMESTAMP(last_update) UNIX_TIMESTAMP(db_time)
193.29.57.151 1623161611 1623161611
php time: 1623161612
To resolve this issue run the following script.
/usr/share/astguiclient/AST_update.pl
Output:
vicibox9:~ # /usr/share/astguiclient/AST_update.pl
SHOW CHANNELS format: 1
LOOKING FOR Zap/DAHDI clients assigned to this server:
LOOKING FOR IAX2 clients assigned to this server:
LOOKING FOR SIP clients assigned to this server:
gs102
Zap Clients: |
IAX2 Clients: |
SIP Clients: |gs102|gs102@gs102|
pattern match timed-out at /usr/share/astguiclient/AST_update.pl line 470
Note: In the above output we can see the error
pattern match timed-out at /usr/share/astguiclient/AST_update.pl line 470
,
- This error occurs due to the Asterisk server response doesn’t match the regex pattern.
To resolve this issue open the following files and find the line $t->waitfor('/[0123]\n$/');
- /usr/share/astguiclient/AST_update.pl
- /usr/share/astguiclient/AST_update.pl
- /usr/share/astguiclient/AST_update.pl
And replace it with,
$t->waitfor('/[0123456789]\n$/');
or
$t-waitfor('/Asterisk Call Manager.+\n$/');
After the changes are made re-run the script /usr/share/astguiclient/AST_update.pl
And confirm the changes by running the following command.
echo "SELECT server_ip, UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater" | mysql -uroot asterisk && php -r "date_default_timezone_set('America/New_York'); echo 'php time: '.date('U');" && echo ""
Output:
vicibox9:~ # echo "SELECT server_ip, UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater" | mysql -uroot asterisk && php -r "date_default_timezone_set('America/New_York'); echo 'php time: '.date('U');" && echo ""
server_ip UNIX_TIMESTAMP(last_update) UNIX_TIMESTAMP(db_time)
193.29.57.151 1623164839 1623164839
php time: 1623164839
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS