Note: This article was originally posted in August, 2011 and is very out-of-date.
This is just one of those things that I figured it might not hurt to put into a blog post so I can find it later if I ever need to. This is the procedure I use to upgrade Asterisk 1.8 when a new release appears that has a fix that I feel I need, or that closes a security hole. PBX in a Flash users should NOT do this, and FreePBX Distro users probably shouldn’t do this either, as you have your own respective upgrade mechanisms. This is for folks who have either built a system from scratch, or who (like me) started out with a distro but the decided to go your own way as far as upgrades are concerned. Note that I am only saying that this is how I do it. I am NOT telling you to do it this way, and if you do so you do it at your own risk.
There are the steps from the CentOS Linux command prompt. Some of them need further explanation and those have a footnote number next to them. Do NOT enter the footnote number from the command prompt! Also, in these examples I’m using Asterisk 1.8.5.0 (the current release version as I write this) as the version I’m installing, but you should go to http://downloads.asterisk.org/pub/telephony/asterisk/releases/ and find the current version and use that instead. If the lines overflow the width of the column, you should probably copy and paste the entire block into a text editor so that you can see the complete lines and know where the line breaks are supposed to be.
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.5.0.tar.gz ¹
tar xvfz asterisk-1.8.5.0.tar.gz ¹
cd /usr/src/asterisk-1.8.5.0 ¹
make clean
contrib/scripts/get_mp3_source.sh
./configure
make menuselect ²
/root/stopnoise ³
make
make install
After doing this I find it’s easiest to just reboot the system to nip any “weirdness” in the bud. Some Linux purists will hate that idea (it seems to be a badge of pride among some of them to see how many days they can run a system without rebooting), and if you don’t want to reboot, feel free not to — it’s your system. Many people will stop Asterisk before starting the upgrade procedure by doing amportal stop at the beginning, and amportal start at the end, but since I usually reboot anyway I’ve never found the need to do that (the upgrade seems to go just fine even if Asterisk is running at the time, so I’m not sure why so many people think they have to stop Asterisk first — probably a case of one person did it, so everyone else follows like lemmings to the sea). However, if you don’t plan on rebooting, then you must stop and restart Asterisk to get it to use the upgraded version. If I want to only restart Asterisk for some reason, I usually go into the Asterisk CLI and do “core restart when convenient” so that the system will restart as soon as there are no calls in progress.
I do NOT use the flite synthesized voices (I can’t stand them; they are far too mechanical for my taste) so you won’t find any instructions here pertaining to those.
Now the footnotes:
¹ Use the correct version number for the version of Asterisk you are installing in place of 1.8.5.0
² When you run “make menuselect” it will bring up a menu that lets you select various options. You will want to pay attention to what is selected and what is not. Typically I need to make these changes:
Under Add-ons, I select everything EXCEPT chan_ooh323 — most of the others are required for FreePBX to function properly. Under Applications, I use the defaults. Under Bridging Modules through PBX Modules, everything that is not X’ed out is selected. Under Resource Modules everything that is not X’ed out is selected except res_pktccops (NOTE: If res_srtp has XXX next to it and you would like to enable SRTP support, stop here and read the note at the bottom of this article). Under Test Modules NOTHING is selected. Under Compiler Flags, LOADABLE_MODULES is selected by default and in addition I select G711_NEW_ALGORITHM and G711_REDUCED_BRANCHING. Under Voicemail Build Options through Module Embedding I just accept the defaults. Under Core Sound Packages through Extras Sound Packages I accept the defaults and also add the sounds corresponding to the language and codecs I use on my system (in my case the *-EN-WAV and *-EN-ULAW packages, and if I had any wideband endpoints I’d also use the *-EN-G722 packages). So, the only screens on which I make changes (in other words, I don’t just accept the defaults) are the Add-ons, Compiler Flags, and the three sound-related screens. Note that the Compiler Flags are just a personal preference (I just think the new algorithm may make G.711 calls a bit clearer) and the sounds MAY not need to be reloaded on every upgrade, but I’d rather be safe and include them, just in case some of the sound files have been updated.
³ This is a bash script I have in my /root directory that contained the following three lines prior to Asterisk 1.8.12.0:
#!/bin/bash
sed -i 's/ast_verb(4, "ast_get_srv: SRV lookup for/ast_verb(11, "ast_get_srv: SRV lookup for/' main/srv.c
sed -i 's/ast_verb(4, "doing dnsmgr_lookup for/ast_verb(11, "doing dnsmgr_lookup for/' main/dnsmgr.c
Starting with Asterisk 1.8.12.0 it appears they changed the default value in the last line, so now I use this:
#!/bin/bash
sed -i 's/ast_verb(4, "ast_get_srv: SRV lookup for/ast_verb(11, "ast_get_srv: SRV lookup for/' main/srv.c
sed -i 's/ast_verb(6, "doing dnsmgr_lookup for/ast_verb(11, "doing dnsmgr_lookup for/' main/dnsmgr.c
If either or both of the phrases “doing dnsmgr_lookup for …” and/or “ast_get_srv: SRV lookup for …” are familiar (and annoying) to you, then you may want to use this script. Otherwise, you can just skip this instruction. For more information, see this thread in the PBX in a Flash forum.
NOTE REGARDING MISSING SRTP SUPPORT: It is possible to add this by following this procedure:
In your browser go to ftp://ftp.owlriver.com/pub/local/ORC/srtp/ (your browser must support the ftp protocol – try Firefox if yours doesn’t). You should see a file named srtp-1.4.4-1orc.src.rpm or perhaps a newer version. Download it and then move it to a directory (such as /tmp or /root) on your Asterisk server. Then do this, changing the version number if you got a different one:
cd (whatever directory you put the file into)
rpm -ivh srtp-1.44-1orc.src.rpm
cd /usr/src/redhat/SOURCES/srtp
(If the srtp directory does not exist then cd /usr/src/redhat/SOURCES/ and tar xvf srtp-1.4.4.tgz)
./configure
make
make install
Then go back and restart the upgrade procedure, starting at the second cd … command and make clean. When you get to make menuselect, res_srtp should now be enabled. Note that this is not the only thing you need to do to make SRTP functional; at a bare minimum you would beed to add the line encryption=yes to the extension’s configuration, and even that would not be sufficient for some devices due to a so far unpatched bug in Asterisk. But, that is beyond the scope of this article.
Thanks for this, it solved my google out issues. In the process I decided to apply the fixes for google inbound as referenced by you in the PBXinFlash forums but it did not work.
I did update to 1.8.6 and so far their seems to be no problems. Google inbound is now operational with no other changes required based on your setup for FreePBX 2.9 posted on your site. I do have the following warnings after installing 1.8.6 however they have not caused me any incompatabilities.
WARNING WARNING WARNING
Your Asterisk modules directory, located at
/usr/lib/asterisk/modules
contains modules that were not installed by this
version of Asterisk. Please ensure that these
modules are compatible with this version before
attempting to run Asterisk.
app_flite.so
chan_mobile.so
chan_ooh323.so
func_curl.so
func_speex.so
res_config_curl.so
res_curl.so
res_srtp.so
WARNING WARNING WARNING
Thanks again.
TheRogueBit, I’ve found that those warnings are USUALLY harmless as long as you aren’t upgrading to a new MAJOR version of Asterisk (such as 1.6 to 1.8). As long as your system is running fine, don’t worry about them. Keep in mind that as of today, 1.8.6 is a release candidate, therefore you’re actually beta testing that version. I usually don’t like running RC versions of Asterisk unless they contain some fix I desperately need, but if you’re willing to be the Guinea Pig, have at it!
(Why do we still use the expression “Guinea Pig” when most laboratories now use lab mice in experiments?)
If the changelog is somewhat small, I recommend downloading the released .patch.gz file. Just gunzip it into your existing source directory, run patch < whatever.patch, make, make install. Typically no need to re-./configure or make clean with this method, and it preserves your menuselect choices.
Thank you very much for this post. This worked perfectly for me. I am running my Asterisk server on 64-bit Ubuntu 10.04.3 LTS. I followed your post with 2 changes. I chose to go with Asterisk 1.8.6.0-rc1 and I did not use your stopnoise bash script. I did issue amportal stop before I started. I have no valid reason for it, but we were not using our phones anyway. When it was all done, I just issued amportal start and everything is working again. I have 3 paid SIP trunks and 3 Google Voice trunks. I was updating from an earlier 1.8.x version and I am running Freepbx 2.9.0.7. All of my config files worked as-is, and I can once again place outbound calls on my Google Voice trunks. All inbound and outbound are working again. Thank you very much for your post.
For anyone using the /root/stopnoise script mentioned in the article, note that it appears they changed a default value in Asterisk 1.8.12.0, so in the last line of the script I had to change the value “4” to “6” to get it to work (and I added the change to the main article). If you have already installed Asterisk 1.8.12.0, just make the above change, then go back into the source directory and run the last three commands, for example:
cd /usr/src/asterisk-1.8.12.0
/root/stopnoise
make
make install
Then restart Asterisk (do core restart when convenient from the CLI) and you should be good to go.
NOTICE: All comments above this one were imported from the original Michigan Telephone Blog and may or may not be relevant to the edited article above.