Skip to content
Jan 31 16

How To: Compile and Install Asterisk on Rackspace Cloud Ubuntu Server

by Jon

Here is an easy to follow video tutorial on how to install Asterisk on a Rackspace Ubuntu cloud server. I am using the following commands to complete the install below.

apt-get update
apt-get upgrade -y && reboot
apt-get install linux-headers-$(uname -r)
apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev  libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev
cd /usr/src/
tar zxvf dahdi-linux-complete*
tar zxvf libpri*
tar zxvf asterisk*
cd /usr/src/dahdi-linux-complete*
make && make install && make config
cd /usr/src/libpri*
make && make install
cd /usr/src/asterisk*
./configure && make menuselect && make && make install && make config && make samples
/etc/init.d/dahdi start
/etc/init.d/asterisk start
asterisk -rvvv
Dec 29 15

How To: Asterisk Robo Call Screening with DTMF Digit Press

by Jon

If you are looking for a way of screening inbound robo calls I have a great script for you. Using a quick little app you can require inbound callers to press 1 or any digit in order for the call to ring through to your phone. Otherwise the caller gets hung up on. All the audio recordings I used are standard files included with Asterisk core or extra audio files.

See below for the context.

exten => 6175551212,1,Goto(call-screening,s,1)

exten => s,1,Answer(1000)
 same => n,Set(NUMINVALID=1)
 same => n,Set(TIMEOUT(digit)=3)
 same => n,Set(TIMEOUT(response)=3)
 same => n,Ringing
 same => n,Wait(3)

 same => n(catch-all),NoOp(catch-all-inbound-calls)
 same => n,Read(digit,privacy-unident&vm-onefor&vm-theperson,1,,2,4)
 same => n,GotoIf($["${digit}" != "1"]?i,1) ; change the 1 in quotes to the digit you want callers to press.
 same => n,Playback(one-moment-please)

 same => n,Dial(SIP/102,45,m)

 same => n(endcall),Playback(not-taking-your-call)
 same => n,Playback(vm-goodbye)
 same => n,Hangup

 same => n,Wait(1)
 same => n,Hangup()

exten => i,1,NoOp(invalid-option)
exten => i,n,Gotoif($["${NUMINVALID}" < "3"]?:call-screening,s,endcall) exten => i,n,Set(NUMINVALID=$[${NUMINVALID}+1]})
exten => i,n,Playback(option-is-invalid)
exten => i,n,Goto(call-screening,s,catch-all)
Nov 14 15

Using Gmail Email Accounts to Send Automated Emails or Voicemail to Email Asterisk

by Jon

Recently Google updated some of its security settings so the tutorial I created around doing Asterisk Voicemail to Email is broken when a new setting is enabled. Lucky for everyone looking to use a Gmail account I have created this new post to help you.

If you would like to read about this new setting here is a link:

The first thing you will want to do is login to the gmail account you plan on using for voicemail to email. Once you have done that follow the directions below.

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

1. Visit the following URL to enable less secure apps:

You should see a screen with on or off, make sure to select on as seen in the screenshot.

2. 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

3. 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.

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

 postmap hash:/etc/postfix/sasl_passwd

5. 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 =


6. Restart the postfix service.

service postfix restart

7. 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)


8. 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

9. 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.

Oct 10 15

Solution to Asterisk CLI Error: No such command ‘originate’

by Jon

Have you tried to use the originate command from the Asterisk CLI only to get the following error?

asterisk*CLI> originate
No such command 'originate' (type 'core show help originate' for other possible commands)

Well I just got this for the first time recently and it took me far too long to figure out the problem so I wanted to share with everyone.

Turns out the syntax of the command has changed recently and the CLI now requires users to put channel in front of originate.

Here is an example of how it works:

asterisk*CLI> channel originate SIP/102 extension *97@internal


Sep 30 15

How To: Install Asterisk on Centos Rackspace Cloud Server with Dahdi Video

by Jon

Learn how to install Asterisk on a Rackspace cloud server. This is an easy to follow step by step guide with all the commands you need to compile and install Asterisk with Dahdi.

Aug 20 15

How To: Install and Compile Asterisk Certified 11 on Rackspace Cloud Centos 5

by Jon

I use Rackspace for most of my cloud servers since their support is second to none. They are always very helpful in getting me answers or even going above and beyond what they technically support. So because of this I often build Asterisk servers up there to test with or even for production use. Here is an easy to follow guide on how to build an Asterisk 11 server using Centos 5 image. You can just copy and paste the commands one by one or add them to a text file and run as a script.

Note: This step by step guide is for 64bit operating systems, if you use a 32bit Centos 5 server it will fail.

yum -y update
sed -i s/SELINUX=permissive/SELINUX=disabled/g /etc/selinux/config

Then we need to install some packages:

yum -y install bind-utils curl-devel doxygen gcc gcc-c++ gtk+ gtk+-devel gnutls-devel httpd kernel-xen kernel-xen-devel kernel kernel-devel kernel-smp-devel kernel-smp libxml2-devel libtermcap-devel libtool-ltdl libtool-ltdl-devel make mysql mysql-server mysql-devel mysql-server-devel mysql-connector-odbc net-snmp-devel neon-devel newt-devel ncurses-devel ntp openssl-devel openssl perl-suidperl php-mysql system-config-securitylevel screen texinfo unixODBC unixODBC-devel wget

Now we can do the heavy lifting of installing Asterisk, Dahdi and LibPRI.

cd /usr/src
tar zxf certified-asterisk-11.6-current.tar.gz 
tar zxf dahdi-linux-complete-current.tar.gz 
tar zxf libpri-1.4-current.tar.gz
cd /usr/src/dahdi-linux-complete-*
make && make install && make config
cd /usr/src/libpri-1.4*
make && make install
cd /usr/src/certified-asterisk-11.6-*
./configure --libdir=/usr/lib64 && make menuselect && make && make install
make samples
make config
service dahdi start
service asterisk start

All done! It really is that easy 😉

Jul 2 15

Asterisk Click to Call from Webpage using the AMI Commands

by Jon

Are you trying to figure out how to set up click to call from a webpage using the Asterisk AMI? Well look no further, this is an easy to follow guide on exactly how to do it.

So before we start a couple of things you have to know about my environment. First I am hosting the webpage on the Asterisk server for the click to call so I have Apache installed and running, second I have port 80 open on the Asterisk server firewall so I can allow external requests.

So first thing you need to do is configure your Asterisk manager config file with a username who can originate the call.


displaysystemname = yes
enabled = yes
webenabled = yes
port = 5038

; Authorization for various classes
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config

Once you create a user and password, in this case I have the username “clickadmin” then you can start writing the php code.


$extension = $_REQUEST['internalnum'];
$dialphonenumber = $_REQUEST['outboundnum'];

$timeout = 10;
$asterisk_ip = "";

$socket = fsockopen($asterisk_ip,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: clickadmin\r\n");
fputs($socket, "Secret: asdf1234S3\r\n\r\n");


echo $wrets;

fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/$extension\r\n" );
fputs($socket, "Exten: $dialphonenumber\r\n" );
fputs($socket, "Context: dial-outbound\r\n" ); // very important to change to your outbound context
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );

echo $wrets;

So that webpage will respond to url post of http://[ip address]/clickcall/index.php?internalnum=101&outboundnum=4075551234

It will first place a phone call to the extension number, in the example case would be 101. Once extension 101 answers that call it will then place the outbound leg of the call to phone number 4075551234.

Jun 19 15

Udemy Asterisk Training Course Survey

by Jon

I love to hear from my students so today I am posting a survey for you to fill me in on what you want more of. Tell me what you like and what you don’t like, or what you want to see more of. Say whatever you want, I am here to listen to you.

Jun 15 15

How to Install and Compile Asterisk 13 on CentOS 7

by Jon

I just created a video of how to install Asterisk 13 on CentOS 7 64bit so anyone can follow along. I take this step by step to make it very easy to install the latest version of Asterisk. See the commands below the video.

Udemy Asterisk Training Course for 95% Off

yum install automake bluez-libs-devel bzip2  corosynclib-devel gcc  gcc-c++ git gsm-devel jansson-devel libcurl-devel libedit-devel libical-devel libogg-devel libsrtp-devel libtool-ltdl-devel libuuid-devel libvorbis-devel libxml2-devel libxslt-devel lua-devel mariadb-devel nano ncurses-devel neon-devel net-snmp-devel newt-devel openldap-devel openssl-devel perl popt-devel postgresql-devel speex-devel sqlite-devel subversion unixODBC-devel uuid-devel wget

cd /usr/src/



bzip2 -d pjproject-2.4.tar.bz2

tar xvf pjproject-2.4.tar

cd pjproject-2.4

./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr

make dep


make install


cd /usr/src

tar zxfv certified-asterisk-13.1-current.tar.gz 

cd certified-asterisk-13.1-cert2/


./configure --libdir=/usr/lib64

make menuselect


make install

make samples

make config

service asterisk start

asterisk -rvvv
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.