2 Instances of Asterisk

Currently: Asterisk 1.4
Goal: Asterisk 1.6


BACKGROUND:
This scenario is more of a learning experience for me since I'm a junior Linux admin. We can't use virtual machines. Only 1 physical test machine. Why? They didn't really say....
 
Anyway, it seems that Asterisk version 1.4 has some kind of memory leak quirk which causes us to have to restart the Asterisk service every day on the production machine. If we don't restart it then eventually calls stop. The powers that be came up with a solution to migrate to Asterisk 1.6 because it seems that the problem was corrected in that version. They decided it would be best to do the following:

Run Asterisk 1.4 AND 1.6 on a test server. Import the production server's configs into both installs. Test that both installs work. Run the 1.6 version for a bit to make sure there are no issues. Then migrate to version 1.6 on the production server. In order to get the test system up and running on version 1.4 the following was done:


1. Setup a test box with Cent O/S.
2. Install Asterisk 1.4
3. Make a backup copy of /etc/asterisk called /etc/asterisk.orig
4. Copy all files from /etc/asterisk on production server into test server into /etc/asterisk directory
5. On test server make a backup copy of /var/lib/asterisk called /var/lib/asterisk.orig
6. Copy all files from /var/lib/asterisk on production server into /var/lib/asterisk
7. Import a copy of the production server's MySQL database


All the above went correctly, and Asterisk 1.4 is running fine. I'm at the point where I want to install version 1.6 but I don't want to install it in the same directory as 1.4 and overwrite it.

Questions:

1. How can I control where it will install Asterisk 1.6?
2. Could I "toggle" between 1.4 and 1.6?
And more importantly...
3. Is it even possible to run both versions on the same box?
cipher7836Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

three7sixCommented:
I think you'll have some difficulty with running two separate instances of Asterisk.. config files, the service itself and dependencies.   I know you cant use a VM, but this is precisely the type of test work that VM's are perfect for.  Not using the free tools available to you in the end will just cost you money in labor.  

That being said, maybe a second drive in a dual boot configuration would handle this scenario if VM's just cannot be used.  Far from efficient but its an idea.
0
cipher7836Author Commented:
Believe it or not I'm actually at the point where I can toggle between versions 1.4 and 1.6. It's taken A LOT of tweaking including messing with the Makefile in the 1.6 install so I can force it to install where I want. Now I just need to import the settings from the 1.4 production system, and see what happens.
0
three7sixCommented:
Great job then,  seems like a lot of to do for an otherwise simple task!
0
cipher7836Author Commented:
Yeah, I think the point was more to get me thinking than anything else. I suspect it could be done a whole lot easier!
0
cipher7836Author Commented:
There is probably a more efficient way of doing this. However, I'm a Linux/Asterisk newbie so this was what I came up with. It does actually work which surprised the heck out of me. In our scenario I had to get the Asterisk information from our A2Billing server. That's why you see references to it in the steps below.

Two Installations of Asterisk Running on the Same Machine: 1.4 and 1.6
Step 1: INSTALL ASTERISK 1.4 USING THIS LINK:
http://www.voip-info.org/wiki/view/CentOS+5+and+Asterisk+1.4.x+installation

Step 2: ASTERISK 1.4 WITH A2BILLING FILES:

1. Stop Asterisk daemon
2. On 192.168.1.201 (the Asterisk test server for dual installation) make a backup copy of /etc/asterisk called  /etc/asterisk.orig
3. Copy all files from /etc/asterisk on 67.X.X.X into your new server into /etc/asterisk directory (overwrite files if  necessary)
4. On 192.168.1.201 make a backup copy of /var/lib/asterisk called /var/lib/asterisk.orig
5. Copy all files from /var/lib/asterisk on 67.X.X.X into your new server into /var/lib/asterisk
6. Under /usr/local/src/A2BILL there should be a directory named databases.  
7. Export the A2Billing database and import it into the new server. Do not use mysqlimport. It wouldn't work for me. I can't remember the specific error but I used the following:
On A2Billing:

mysqldump a2billing > a2billing.sql
then....
gzip -v a2billing.sql
type "mysql"
type "create database a2billing;"
Exit mysql
Then on the remote server perform...
mysql a2billing < a2billing.sql
Exit mysql
Step 3: STOP THE ASTERISK DAEMON
Step 4: ASTERISK VERSION 1.6
1. Install according to the version 1.4 guide, but instead of Zaptel drivers you will build DAHDI drivers. (Zaptel is no longer supported)
2. EDIT THE MAKEFILE
3. Follow the information below:

****THIS IS ACTUALLY A SNIPPET OF CODE FROM THE MAKE FILE...my comments are in []


# DESTDIR is the staging (or final) directory where files are copied
# during the install process. Define it before 'export', otherwise
# export will set it to the empty string making ?= fail.
# WARNING: do not put spaces or comments after the value.
DESTDIR?=/opt/asterisk1.6 [CHANGED FROM A VARIABLE]
export DESTDIR

[THIS AREA ALSO CHANGED]

# Define standard directories for various platforms
# These apply if they are not redefined in asterisk.conf
ifeq ($(OSARCH),SunOS) [DOES NOT APPLY TO US]
  ASTETCDIR=/var/etc/asterisk
  ASTLIBDIR=/opt/asterisk/lib
  ASTVARLIBDIR=/var/opt/asterisk
  ASTDBDIR=$(ASTVARLIBDIR)
  ASTKEYDIR=$(ASTVARLIBDIR)
  ASTSPOOLDIR=/var/spool/asterisk
  ASTLOGDIR=/var/log/asterisk
  ASTHEADERDIR=/opt/asterisk/include
  ASTBINDIR=/opt/asterisk/bin
  ASTSBINDIR=/opt/asterisk/sbin
  ASTVARRUNDIR=/var/run/asterisk
  ASTMANDIR=/opt/asterisk/man

else [THIS APPLIED TO US. YOU CAN TEST IT BY PUTTING IN NONSENSE AND THE MAKEFILE WILL GENERATE AN ERROR]
  ASTETCDIR=/etc/asterisk1.6
  ASTLIBDIR=/lib
  ASTHEADERDIR=/bin
  ASTBINDIR=/bin
  ASTSBINDIR=/sbin
  ASTSPOOLDIR=/spool/asterisk
  ASTLOGDIR=/log/asterisk
  ASTVARRUNDIR=/run
  ASTMANDIR=$(mandir)
5. START ASTERISK DAEMON
6. EDIT ASTERISK.CONF

-After installing edit the asterisk.conf in the ASTETCDIR which for us was /etc/asterisk1.6. Change the paths to what the Makefile has. (This assumes that after "make install" you ran "make samples". If you don't make samples the asterisk.conf never gets created. However, Asterisk still runs and can connect you to the console.
7. VERSION TOGGLING

-In order to toggle between versions you must do the following:

ps -elf |grep asterisk

Make sure no asterisk instances are running.

To start 1.4 perform /init.d/asterisk start

To start version 1.6 perform the following:
(Make sure there are no instances of Asterisk running
/opt/asterisk1.6/sbin/./asterisk -rvvvvq


If you start Asterisk 1.6 and then issue the command "asterisk -rvvvq" without doing so in the Asterisk 1.6 sbin folder like

so "./asterisk -rvvvvvq" then you will end up trying to start asterisk 1.4.














0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IP Telephony

From novice to tech pro — start learning today.