Skip to content
May 21 15

How to Fix NTP Error Linux sntp: adj_systime: Invalid argument

by Jon

One of my clients AstLinux PBX’s was acting up a couple weeks ago by going into after hours mode in the middle of the day. Upon further investigation it turned out the PBX had lost power and rebooted so I realized the date/time was very wrong. The date command revealed the operating system believed it was 1999 so I figured the CR2032 battery on the board had gone bad. After replacing the battery I was expecting NTP to set the correct time for me, well that was a wrong assumption.

I restarted the NTP service many times only to continue getting an error of:

pbx ~ # service ntpd start
Starting ntpd...
sntp 4.2.8@1.3265-o Sat Feb  7 06:51:14 UTC 2015 (1)
2015-08-15 05:06:36.118274 (+0500) -8696498.478863 +/- 5797665.661695 s2
adj_systime: Invalid argument

I checked the logs which reported the same issue:

pbx ~ # date
Sat Jan 22 15:59:53 EST 2000
pbx ~ # cat /var/log/messages
Jan 22 16:07:48 pbx daemon.notice ntpd[517]: ntpd 4.2.8@1.3265-o Sat Feb  7 06:49:37 UTC 2015 (1): Starting
Jan 22 16:07:48 pbx ntpd[517]: Command line: ntpd ?
Jan 22 16:07:48 pbx ntpd[518]: proto: precision = 11.734 usec (-16)
Jan 22 16:07:48 pbx ntpd[518]: getconfig: Couldn't open 
Jan 22 16:07:48 pbx ntpd[518]: Listen and drop on 0 v4wildcard
Jan 22 16:07:48 pbx ntpd[518]: Listen normally on 1 lo
Jan 22 16:07:48 pbx ntpd[518]: Listen normally on 2 eth0
Jan 22 16:07:48 pbx ntpd[518]: Listening on routing socket on fd #19 for interface updates
Jan 22 16:09:03 pbx sntp[700]: sntp 4.2.8@1.3265-o Sat Feb  7 06:51:14 UTC 2015 (1)
Jan 22 16:09:03 pbx sntp[700]: 2000-01-22 16:09:03.294382 (+0500) +482356762.551 +/- 321571175.034339 s1
Jan 22 16:09:03 pbx user.err sntp[700]: adj_systime: Invalid argument

At this point I figured the date was so far off that the system could not calculate the correct time based on the Invalid argument log entry. So I went ahead and manually set the date/time using the date command.

pbx ~ # date -s 2015.05.17-13:28:00
Sun May  17 13:28:00 EDT 2015

Then I did a restart on the NTP service which restored NTP to working order.

pbx ~ # service ntpd restart

All was back to normal after that, just make sure to manually set the time to be as close as possible then restart the ntpd service.

Apr 7 15

How To: Add Gmail Account to Mail App on Apple iPhone or iPad IOS8

by Jon

If your like me and use an iPhone to do a lot of you’re emailing then it is imperative to have a gmail account connected to it. Below are the quick and easy steps to configure a Gmail account on your iPhone or iPad using the latest version of Apple IOS8.

1. Click on the settings app from your home screen

2. Then click on Mail, Contacts, Calendars

3. Now click the Add Account button

4. Next select the Google option

5. Sign in using your Gmail account username and password

6. Google will now ask you if you want to allow IOS to access your account, make sure to click accept.

7. The next screen will ask you what information you would like to use with your Gmail account, I prefer only using Mail but you can include all of these options by toggling the slider.

8. Once that has been updated you will get bounced out to the Mail, Contacts, Calendar menu where you will want to click on the newly created account for one last setting change.

9. Again select the account you are adding to the iPhone for the first time.

10. Finally here is where you want to enter in your name so when you send and reply to emails from your iPhone they are presented using your name. Make sure to save after entering your name.

Good luck and let me know if you have any questions or feedback.

Mar 23 15

How To: Build your Own Virtual Cloud Phone System Training 60% Off

by Jon

Do you want to build your own cloud phone system?
Do you want a get your own dedicated phone number?

How would you like to do all of this for less than the cost of a cup of coffee?

I recently finished another udemy training course where I walk you through step by step to building a cloud phone system and ordering a phone number. If you are looking to stop using your cell phone for all your work and personal phone calls this class is for you and for being a visitor of my blog get 60% off the original price.

Use this link to get the discount.


Feb 27 15

Share your iPhone or iPad screen on your Mac computer display for demos

by Jon

There are many times when I would like to present my iPhone on a projector or large computer screen to show others an app or something on my phone. This has been a challenge in the past using tools like airplay or some third-party apps. Well not anymore, with OS X Yosemite there is now a native tool to display your iPhone or iPad right on your computer screen. QuickTime player now has an easy to use option to make your phone the video source. See below for how to set up the screen sharing option.

1. Plug your iPhone or iPad into your Mac using the usb lightning cable.


2. Open iTunes and click Trust on your iPhone/iPad pop-up to allow your computer access to the device.


3. Open QuickTime Player from Applications menu.


4. From the QuickTime file menu select New Movie Recording.


5. By default the movie screen will open using the computers FaceTime camera. Click the down arrow next to the record button then select your iPhone/iPad.


6. Now your phone will appear in the QuickTime movie window which will allow you to display to others or start a recording.


Jan 31 15

How to: Linux and Asterisk Training Video’s

by Jon

I just posted my first Udemy course on learning Linux and Asterisk. If you are having problems getting started with Asterisk and Linux this is an easy step by step video series where I walk my students all the way through installing Linux and compiling Asterisk. I have included a link to the course below.


Dec 28 14

How To: Asterisk Voicemail to Email Using Gmail Account

by Jon

Updated 11-14-2015: Google made some changes to gmail account security so follow this link for an updated guide Asterisk Voicemail to Email Guide with Gmail

So my past post about using ssmtp to do voicemail to email with a Gmail account no longer works as some commenters pointed out. This sent me back to the drawing board to write an updated post to help all of you. This time I used postfix, included by default with CentOS installs making it easier.

Follow along below for your Asterisk voicemail to email with a Gmail account using the postfix application.

1. We do need to install a couple of extra packages even if postfix is already installed. I also am installing postfix just in case you didn’t have it installed.

yum -y install postfix mailx cyrus-sasl-plain

2. You need to create a new file with your Gmail account smtp server and credentials in the following format.

nano /etc/postfix/sasl_passwd

Paste in the below text and change the email address to your gmail email and enter in your password.

3. Once done doing that we want to hash your password file so it is not human readable.

 postmap hash:/etc/postfix/sasl_passwd

4. The next step is to configure postfix to use this new password file. Open the /etc/postfix/ file using a text editor then scroll down to the bottom and paste in the following code.

nano /etc/postfix/
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
# Secure channel TLS with exact nexthop name match.
smtp_tls_security_level = secure
smtp_tls_mandatory_protocols = TLSv1
smtp_tls_mandatory_ciphers = high
smtp_tls_secure_cert_match = nexthop
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
relayhost =


5. Restart the postfix service.

service postfix restart

6. Now you can send a test email using the mail command in the following format.

Subject: Hello World
. (followed by enter key to send and exit)


7. Once you send that check your email to see if you received the email and as long as that is the case you can go ahead and remove the text password file.

rm /etc/postfix/sasl_passwd

8. Now you are all set, by default Asterisk will use the default mailing program so my voicemail.conf file looks like so.

[root@localhost ~]# cat /etc/asterisk/voicemail.conf
format = wav
serveremail = asterisk
attach = yes
skipms = 3000
maxsilence = 10
maxmessage = 300
review = yes
silencethreshold = 128
maxlogins = 3
emaildateformat = %A, %B %d, %Y at %r
sendvoicemail = yes
exitcontext = vm-operator
operator = yes
fromstring = PBX Voicemail

Hope you find this helpful and it works for you. Please let me know if there are any issues so I can correct my tutorial. I like my visitors to get their questions answered with a single visit, not having to bounce around from website to website trying to solve a problem.

Happy New Year! Onto 2015!

Nov 30 14

Anran AR-24NW PoE IP Surveillance Camera ONVIF NVR

by Jon

I am in the process of adding surveillance cameras to the exterior of my home so I started looking at ONVIF cameras. The ONVIF cameras are great since a lot of network video recorders compatible with the ONVIF standard. My camera search started on Ebay trying to find affordable cameras, sub $125, and what I ended up with was an Anran AR-24NW-POE. The camera specs make it look really good and being ONVIF 2.0 compatible.



It is a 1.3 Megapixel HD camera with a 3.6mm lens supporting 960p. It supports the 802.3af PoE standard and powers up the first time it’s plugged in. Documentation suggests it will work with Synology, QNAP, iSpy, and Blue Iris NVR’s. I can’t confirm or deny that statement but I wouldn’t go out and buy a lot of these without testing one first. I started by testing it with the open source ONVIF configuration tool. It didn’t work as easy as I expected and after wasting a lot of time an email from the seller helped me get it working since the ONVIF interface runs on port 8899 instead of the default http port 80. After making that change it worked right away, although not 100% of the menus were working. The url for the ONVIF tool is in the following format:


So based on this I don’t believe the camera is ONVIF 2.0 compatible. While the infrared vision and picture quality is amazing for the price something else had to suffer. I was able to stream the video stream easily to VLC using the following url: rtsp://


Oct 21 14

Asterisk and AstLinux Wake Up Call AGI Script

by Jon

I recently added a wake up call to my AstLinux system at home so I could use it as an alarm clock I wouldn’t ignore. I downloaded a script written by Jonas ( and made some improvements to. I have tested it pretty well but there could still be some issues.

AstLinux & Asterisk Wake Up Call

First download the script to the /var/lib/asterisk/agi-bin/ directory, change the filename and make it an executable.

cd /var/lib/asterisk/agi-bin/
mv wake_up_call.agi.txt wake_up_call.agi
chmod +x wake_up_call.agi

Then your extensions need to dial the script by putting the following code in the default context of the extensions.

exten => 999,1,Answer
exten => 999,n,NoOp(wakeup-call-dialed)
exten => 999,n,AGI(wake_up_call.agi)
exten => 999,n,Hangup

Finally dial 999 or whatever you made the context from an extension and it will walk you through a series of prompts. Press 1 to create a new wake up call, then enter the time you would like such as 0630. You will then be asked if this is AM or PM and it will create the wake up call.

Sep 11 14

How To: Reset Lost Password on Polycom VVX IP Phone

by Jon

I ordered a few used Polycom VVX 500 phones from ebay and not to my surprise the default admin passwords was changed. I consulted with the seller and they did not have the passwords so I was left with the task of figuring out how to factory reset the phones. After reading many, many tutorials none of which helped I was ready to throw in the towel when I decided to try a last-ditch effort to use a TFTP server with a DHCP option to over ride the existing config. Luckily that fixed it without much effort. Below is how to do a quick step by step using an AstLinux PBX, but that could be done with any FTP/TFTP server.

1. First you need to create a config file with the filename using the MAC address of the phone, so such as one of my files was 0004f283345b.cfg. This file should contain the following text as seen below. You will need a file for each phone you need to reset.

0004f283345b.cfg contents below:

<?xml version="1.0" standalone="yes"?>

2. The second file needed is what will actually overwrite the admin password. This file is referenced in the above file as, CONFIG_FILES=”reset-password.cfg” so make sure you have the same file name for this config. There are extra settings but the key is the device.auth settings for the admin password, make sure those are kept intact.

reset-password.cfg contents below:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

3. These files now need to be put in an FTP or TFTP directory and published by a server, I choose to use the AstLinux FTP server so I stored the files in the /root directory. You can use your own knowledge of FTP servers to configure this on your own.

4. The last step is to configure your DHCP server for option 66 to force the phone to download the config files. I use Cisco/Meraki equipment and so I have attached a screenshot of how to do that with a Meraki MX 60 but the settings apply to any other type of DHCP server. The string I am using is how the phone will login to the FTP server, the format is as follows ftp://username:password@ip-address of server.


Once that is all setup reboot your phone and watch the logs on your FTP/TFTP server to make sure it downloads the files. It really is very easy and I was able to reset a handful of phones in less than 10 minutes. Once you can login to the web interface with the new default password just go to the menu option to do a factory reset on the phone.

Aug 4 14

AstLinux Record Phone Calls to External USB Flash Drive Part 3

by Jon

In my last post I gave you examples of how to record phone calls using the Asterisk dialplan. This post will make sure those recordings get stored on the external USB drive we formatted.

By default Asterisk will store call recordings to /var/spool/asterisk/monitor which is fine but the directory is on the compact flash card running AstLinux so we don’t want to do that. To redirect the call recordings and mount the USB drive I created a script I run via a cron job in case the system gets restarted.

1. The script will check for the existence of a file stored on the usb drive and if it does not exist then mount the drive. I stored the script on the keydisk at /mnt/kd/


if [ ! -f /mnt/usb/mount.txt ]; then
rm -f /var/spool/asterisk/monitor/*.wav
e2fsck -y /dev/sdb1
mount -t ext2 /dev/sdb1 /mnt/usb/
rm /var/spool/asterisk/monitor
ln -s /mnt/usb/callrecordings /var/spool/asterisk/monitor
date >> /mnt/usb/mount.txt

2. Next is to schedule the script as a cron job, of course make sure to make the script executable with the chmod +x command. Editing the crontab’s file on Astlinux is done through the web admin. I setup the script to run every 10 minutes since when I tried using the cron @reboot option it did not do anything, so worst case it might take up to 9 minutes and 59 seconds to mount the drive after a reboot For my home system this is an acceptable margin of error.

*/10 * * * * /mnt/kd/


3. Once the script as run it is very easy to listen to recordings using the Astlinux web admin. Just click on the Monitor tab which will display all the recorded phone calls.


Make sure to go back and read each part to do call recording on your AstLinux system.

AstLinux Record Phone Calls to External USB Flash Drive Part 1

AstLinux Record Phone Calls to External USB Flash Drive Part 2