?
Solved

2 Instances of Asterisk

Posted on 2009-07-07
5
Medium Priority
?
557 Views
Last Modified: 2013-11-12
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?
0
Comment
Question by:cipher7836
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Assisted Solution

by:three7six
three7six earned 160 total points
ID: 24796249
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
 

Author Comment

by:cipher7836
ID: 24798649
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
 
LVL 3

Assisted Solution

by:three7six
three7six earned 160 total points
ID: 24798746
Great job then,  seems like a lot of to do for an otherwise simple task!
0
 

Author Comment

by:cipher7836
ID: 24803255
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
 

Accepted Solution

by:
cipher7836 earned 0 total points
ID: 24871062
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Implementing Avaya's One-X portal is pretty painless, until you want to deploy this to the Android and iPhone clients when these clients are outside of your network. The clients will also work within your local network. Here is our experience and so…
As companies replace their old PBX phone systems with Unified IP Communications, many are finding out that legacy applications such as fax do not work well with VoIP. Fortunately, Cloud Faxing provides a cost-effective alternative that works over an…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question