Difference between revisions of "Asterisk from source"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
m (Reverted edits by StevenCook (talk) to last revision by Kir)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
==General==
 
==General==
Asterisk is free and open source code to create software PBX server. See [http://www.asterisk.org] for details. This package perfectly runs inside OpenVZ container. Some users run up to 60 containers with Asterisk deployed for production per single hardware node. Although the easiest way to install Asterisk into container is to use pre-build package from Linux distribution, occasionally one may need to have a possibility to build it from source tarball available on developer's site.
+
Asterisk is free and open source code to create software PBX server. See http://www.asterisk.org/ for details. The package runs perfectly inside an OpenVZ [[container]]. Some users run up to 60 containers with Asterisk deployed for production per single [[hardware node]]. Although the easiest way to install Asterisk into a container is to use pre-build package from Linux distribution, occasionally one may need to have a possibility to build it from source tarball available on developer's site.
  
In order to do it the following remarks are worth reading:
+
In order to do so the following remarks are worth reading.
 
 
==Building Asterisk in CT==
 
Asterisk PBX server itself is compiled out of the shelf in CT provided that develop application template is installed on this CT. The functionality of the resulting executable is enough to support simple VoIP telephony.
 
  
 +
== Building Asterisk in a [[CT]] ==
 +
Asterisk PBX server itself is compiled out of the shelf in a [[container]] provided that development tools are installed. The functionality of the resulting executable is enough to support simple VoIP telephony.
 +
=== Debian Dependencies ===
 +
<pre>apt-get install build-essential libncurses-dev</pre>
 +
=== Compiling ===
 
<pre>
 
<pre>
 
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-x.x.xx.tar.gz
 
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-x.x.xx.tar.gz
 
tar xzf asterisk-x.x.xx.tar.gz
 
tar xzf asterisk-x.x.xx.tar.gz
cd asterisk-x.x.xx.tar.gz
+
cd asterisk-x.x.xx
 
./configure
 
./configure
 
make
 
make
Line 18: Line 20:
  
 
The last command is not needed in case you have your own configuration as it installs some sample configuration files.
 
The last command is not needed in case you have your own configuration as it installs some sample configuration files.
To configure Asterisk itself see for example [http://www.digium.com/elqNow/elqRedir.htm?ref=http://downloads.oreilly.com/books/9780596510480.pdf].
+
To configure Asterisk itself see, for example, http://downloads.oreilly.com/books/9780596510480.pdf.
  
==MeetMe problem==
+
=== MeetMe problem ===
Unfortunately, one particular module called MeetMe (conferencing tool) will be switched off from compilation. This happens due to external dependency on 'zaptel' package. Zaptel provides support for some hardware cards for FXO/FXS analog telephony marketed by Digium (the company behind Asterisk), and on top of that supplies so called ztdummy kernel module. Ztdummy works like a simple metronome which is required to synchronize multiple sound streams in case of conference call.  
+
Unfortunately, one particular module called MeetMe (conferencing tool) will be switched off from compilation. This happens due to external dependency on 'zaptel' package. Zaptel provides support for some hardware cards for FXO/FXS analog telephony marketed by Digium (the company behind Asterisk), and on top of that supplies so called <code>ztdummy</code> kernel module. Ztdummy works like a simple metronome which is required to synchronize multiple sound streams in case of conference call.  
  
 
If you do not plan to use analog telephone lines, hence don't like in install the hardware, nothing is lost provided you run your HN with 2.6.XX kernel. You just need to play a little trick with Asterisk make system: download zaptel tarball from the same location as Asterisk itself, and copy it's header zaptel.h to location /usr/include/zaptel/zaptel.h in CT where you plan to build Asterisk. This tweaks MeetMe for installation.
 
If you do not plan to use analog telephone lines, hence don't like in install the hardware, nothing is lost provided you run your HN with 2.6.XX kernel. You just need to play a little trick with Asterisk make system: download zaptel tarball from the same location as Asterisk itself, and copy it's header zaptel.h to location /usr/include/zaptel/zaptel.h in CT where you plan to build Asterisk. This tweaks MeetMe for installation.
  
==HN configuration==
+
Since Digium is retiring Zaptel with the use of Dahdi, the header you will use to build meetme module to work with Dahdi is called user.h. Just copy this file to /usr/include/dahdi/user.h in CT then build your Asterisk , you should get the MeetMe working.
Finally you need to make sure that on HN ztdummy kernel module is loaded and the access to /dev/zap/pseudo device file is granted to
+
 
CT:
+
===TTY Problem===
 +
 
 +
After I have installed asterisk, the service wouldn't start and give me the following error:
 +
 
 +
Starting asterisk: Cannot find your TTY
 +
 
 +
The solution is to edit /usr/sbin/safe_asterisk , comment out the TTY=  line. I found my at the very top of the file, about the 5th line. Now I am able to start, stop, restart the asterisk service all I want.
 +
 
 +
== HN configuration ==
 +
Finally you need to make sure that on [[HN]] ztdummy kernel module is loaded and the access to <code>/dev/zap/pseudo</code> device file is granted to the container:
 
<pre>
 
<pre>
 
modprobe ztdummy
 
modprobe ztdummy
 
vzctl set 240 --devnodes zap/pseudo:rw --save
 
vzctl set 240 --devnodes zap/pseudo:rw --save
 +
</pre>
 +
 +
This will create /dev/zap/pseudo and /lib/udev/devices/zap/pseudo in your container.  The group/owner will be root/root and the permissions will be 644.  If you're running Asterisk under the asterisk user in your container, you will need to set the proper ownership for these devices in your VE.  The /dev/zap devices are recreated whenever the container is restarted.  The /lib/udev/devices/zap files are persistent.  The key to only doing this once is to make sure you change the ownership in the VE of the /lib/udev/devices/zap files in addition to the /dev/zap files.
 +
 +
To set the necessary ownership in the VE:
 +
<pre>
 +
vzctl exec 240 chown -R asterisk /dev/zap /lib/udev/devices/zap
 +
vzctl exec 240 chgrp -R asterisk /dev/zap /lib/udev/devices/zap
 
</pre>
 
</pre>
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]

Latest revision as of 20:46, 4 August 2012

General[edit]

Asterisk is free and open source code to create software PBX server. See http://www.asterisk.org/ for details. The package runs perfectly inside an OpenVZ container. Some users run up to 60 containers with Asterisk deployed for production per single hardware node. Although the easiest way to install Asterisk into a container is to use pre-build package from Linux distribution, occasionally one may need to have a possibility to build it from source tarball available on developer's site.

In order to do so the following remarks are worth reading.

Building Asterisk in a CT[edit]

Asterisk PBX server itself is compiled out of the shelf in a container provided that development tools are installed. The functionality of the resulting executable is enough to support simple VoIP telephony.

Debian Dependencies[edit]

apt-get install build-essential libncurses-dev

Compiling[edit]

wget http://downloads.digium.com/pub/asterisk/releases/asterisk-x.x.xx.tar.gz
tar xzf asterisk-x.x.xx.tar.gz
cd asterisk-x.x.xx
./configure
make
make install
make samples

The last command is not needed in case you have your own configuration as it installs some sample configuration files. To configure Asterisk itself see, for example, http://downloads.oreilly.com/books/9780596510480.pdf.

MeetMe problem[edit]

Unfortunately, one particular module called MeetMe (conferencing tool) will be switched off from compilation. This happens due to external dependency on 'zaptel' package. Zaptel provides support for some hardware cards for FXO/FXS analog telephony marketed by Digium (the company behind Asterisk), and on top of that supplies so called ztdummy kernel module. Ztdummy works like a simple metronome which is required to synchronize multiple sound streams in case of conference call.

If you do not plan to use analog telephone lines, hence don't like in install the hardware, nothing is lost provided you run your HN with 2.6.XX kernel. You just need to play a little trick with Asterisk make system: download zaptel tarball from the same location as Asterisk itself, and copy it's header zaptel.h to location /usr/include/zaptel/zaptel.h in CT where you plan to build Asterisk. This tweaks MeetMe for installation.

Since Digium is retiring Zaptel with the use of Dahdi, the header you will use to build meetme module to work with Dahdi is called user.h. Just copy this file to /usr/include/dahdi/user.h in CT then build your Asterisk , you should get the MeetMe working.

TTY Problem[edit]

After I have installed asterisk, the service wouldn't start and give me the following error:

Starting asterisk: Cannot find your TTY

The solution is to edit /usr/sbin/safe_asterisk , comment out the TTY= line. I found my at the very top of the file, about the 5th line. Now I am able to start, stop, restart the asterisk service all I want.

HN configuration[edit]

Finally you need to make sure that on HN ztdummy kernel module is loaded and the access to /dev/zap/pseudo device file is granted to the container:

modprobe ztdummy
vzctl set 240 --devnodes zap/pseudo:rw --save

This will create /dev/zap/pseudo and /lib/udev/devices/zap/pseudo in your container. The group/owner will be root/root and the permissions will be 644. If you're running Asterisk under the asterisk user in your container, you will need to set the proper ownership for these devices in your VE. The /dev/zap devices are recreated whenever the container is restarted. The /lib/udev/devices/zap files are persistent. The key to only doing this once is to make sure you change the ownership in the VE of the /lib/udev/devices/zap files in addition to the /dev/zap files.

To set the necessary ownership in the VE:

vzctl exec 240 chown -R asterisk /dev/zap /lib/udev/devices/zap
vzctl exec 240 chgrp -R asterisk /dev/zap /lib/udev/devices/zap