Difference between revisions of "Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a VOIP Server"

From bering-uClibc
Jump to: navigation, search
(Started to populate Asterisk section in parallel with software development)
(Asterisk: Added Hints and Tips section with some initial content (to be expanded later))
 
(10 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
! colspan="3" align="center" | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a VOIP Server|Advanced Topics - Setting Up a VOIP Server]]
 
! colspan="3" align="center" | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a VOIP Server|Advanced Topics - Setting Up a VOIP Server]]
 
|-
 
|-
| width="20%" align="left"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a Routing Daemon|Prev]]
+
| width="20%" align="left"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a Print Server|Prev]]
 
! width="60%" align="center" | [[Bering-uClibc 4.x - User Guide]]
 
! width="60%" align="center" | [[Bering-uClibc 4.x - User Guide]]
 
| width="20%" align="right"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a File Server|Next]]
 
| width="20%" align="right"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a File Server|Next]]
Line 10: Line 10:
  
 
==Yate==
 
==Yate==
'''This material copied directly from http://leaf.sourceforge.net/doc/bucu-voip.html - needs to be checked/updated for Bering-uClibc 4.x!'''<br>[[User:Davidmbrooke|Davidmbrooke]] 20:46, 16 November 2010 (UTC)
 
  
 
===Introduction===
 
===Introduction===
 
This Howto describes a Voice-over-IP (VoIP) solution based on [http://yate.null.ro/pmwiki Yate]. Yate is a small but powerful IP telephony engine.
 
This Howto describes a Voice-over-IP (VoIP) solution based on [http://yate.null.ro/pmwiki Yate]. Yate is a small but powerful IP telephony engine.
 +
 +
The <code class="filename">yate.lrp</code> Package in [[Bering-uClibc 4.x]] is based on Yate version 3.
 +
This is much more advanced than Yate version 1 which was used for [[Bering-uClibc 3.x]] and includes many more Yate modules, each with their own configuration file.
 +
Since many of these Yate modules will only be of interest to advanced users, the [[Bering-uClibc 4.x]] <code class="filename">yate.lrp</code> Package includes a large number of Yate modules (and their configuration files) but only loads a small number of Yate modules by default (the same ones as were available for Yate version 1 on [[Bering-uClibc 3.x]]) and only lists the configuration files for these default Yate modules in the <tt>lrcfg</tt> menu.
  
 
===Requirements===
 
===Requirements===
To install Yate on Bering-uClibc based system the following packages are required:
+
To install Yate on a Bering-uClibc based system the following Packages are required:
 +
* <code class="filename">yate.lrp</code>
 +
* <code class="filename">libcxx.lrp</code>
 +
* <code class="filename">libm.lrp</code>
 +
* <code class="filename">lpthread.lrp</code>
  
{| class="simplelist" summary="Simple list"
+
===Yate Basics===
| yate.lrp
+
====Startup and Shutdown====
|-
+
The Yate processes are stopped and started via init script <code class="filename">/etc/init.d/yate</code>. This is executed automatically at boot time, or the Yate processes can be started manually with the following command:
| libcxx.lrp
+
svi yate start
|-
+
 
| libm.lrp
+
====Logging====
|-
+
Log output is sent to <code class="filename">/var/log/yate.log</code>
| lpthread.lrp
+
By default the logging is fairly minimal.
|}
+
Extra log output can be configured by adjusting the <tt>[debug]</tt> settings in <code class="filename">/etc/yate/yate.conf</code> or by using the Remote Manager.
 +
 
 +
====Test Numbers====
 +
Yate comes pre-configured with some test numbers, which are specified at the end of <code class="filename">/etc/yate/regexroute.conf</code>:
 +
; The following are for testing purposes                                       
 +
^99991001$=tone/dial                                                           
 +
^99991002$=tone/busy                                                           
 +
^99991003$=tone/ring                                                           
 +
^99991004$=tone/specdial                                                       
 +
^99991005$=tone/congestion                                                     
 +
^99991006$=tone/outoforder                                                     
 +
^99991007$=tone/milliwatt
 +
For example, after dialling <tt>99991003@192.168.1.254</tt> (assuming that is the IPv4 address of your Yate server) you should hear a (US) ring tone.
 +
 
 +
===Configuration Recipes===
 +
Yate has a number of configuration files in directory <code class="filename">/etc/yate/</code>. Only some of those are listed in the Yate section of the LEAF configuration menu.
  
===Configuration===
+
====SIP Client Registration====
To allow SIP clients to register set ''<code>registrar=yes</code>'' in <code class="filename">ysipchan.conf</code>. You have to set the username and passwords for those clients in <code class="filename">regfile.conf</code> like this:
+
To allow SIP clients to register edit file <code class="filename">ysipchan.conf</code> and un-comment the <tt>registrar</tt> entry.
 +
; registrar: bool: Allow the SIP module to receive registration requests       
 +
registrar=enable
  
  [someusername]
+
You have to set the username and passwords for those clients in <code class="filename">regfile.conf</code> like this:
  password=something
+
  [''someusername'']
 +
  password=''something''
  
 +
====Call Routing Configuration====
 
The regexroute module provides a simple way of routing telephony calls inside Yate. This module describes the routes using a configuration file in which each number is matched using regular expressions. The config file is named <code class="filename">regexroute.conf</code> and contains numerous examples.
 
The regexroute module provides a simple way of routing telephony calls inside Yate. This module describes the routes using a configuration file in which each number is matched using regular expressions. The config file is named <code class="filename">regexroute.conf</code> and contains numerous examples.
  
 +
====Accounts====
 
The accfile module allows Yate to act as a SIP or AIX client, this can be used to connect Yate to an other VOIP server or provider.
 
The accfile module allows Yate to act as a SIP or AIX client, this can be used to connect Yate to an other VOIP server or provider.
  
Line 62: Line 89:
 
==Asterisk==
 
==Asterisk==
 
===Status===
 
===Status===
As of February 2011 Asterisk version 1.8.2.3 (the latest upstream version) is in the process of being ported to [[Bering-uClibc 4.x]].
+
In October 2011 Asterisk version 1.8.7.1 (the latest upstream version) was ported to [[Bering-uClibc 4.x]] and will be released as part of Bering-uClibc 4.1.1. See also [http://sourceforge.net/apps/trac/leaf/ticket/5 LEAF Trac ticket #5].
This is currently at "Alpha Test" status and is '''NOT''' included in any of the Bering-uClibc 4.0 Beta releases.
+
  
Experimental versions of the various Asterisk Packages can be downloaded from [http://leaf.cvs.sourceforge.net/viewvc/leaf/devel/davidmbrooke/bin/packages/uclib-0.9/30/ davidMbrooke's "devel" directory] in SourceForge CVS.
+
'''Important:''' The asterisk executable seems to segfault early in the startup process unless the "-p" command-line argument is specified (or "<tt>highpriority = yes</tt>" is specified in <code class="filename">/etc/asterisk/asterisk.conf</code>).
 
+
Status as of 2011-02-19: code is compiled but segfaults at runtime (pthread related) so actually '''NOT''' uploaded to CVS yet.
+
 
+
See also [http://sourceforge.net/apps/trac/leaf/ticket/5 LEAF Trac ticket #5].
+
  
 
===Packages===
 
===Packages===
The Asterisk distribution is divided into several <code class="filename">.lrp</code> Packages, based on the structure adopted for Asterisk 1.2 on [[Bering-uClibc 3.x]] but somewhat extended.
+
The Asterisk distribution is divided into four <code class="filename">.lrp</code> Packages, based on the structure adopted for Asterisk 1.2 on [[Bering-uClibc 3.x]] but somewhat extended.
 
The Packages are:
 
The Packages are:
 
; <code class="filename">asterisk.lrp</code> : The main Package, with the Asterisk executables installed into directory <code class="filename">/usr/sbin/</code> and also all of the Asterisk modules installed into directory <code class="filename">/usr/lib/asterisk/modules/</code>
 
; <code class="filename">asterisk.lrp</code> : The main Package, with the Asterisk executables installed into directory <code class="filename">/usr/sbin/</code> and also all of the Asterisk modules installed into directory <code class="filename">/usr/lib/asterisk/modules/</code>
; <code class="filename">astsmpls.lrp</code> : The sample configuration files which are installed into directory <code class="filename">/etc/asterisk/</code>
+
:'''Note''': There are '''no''' configuration files included in <code class="filename">asterisk.lrp</code> - see the [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a VOIP Server#Installation|Installation]] section for more details
 +
; <code class="filename">astsmpls.lrp</code> : The sample configuration files which are installed into directory <code class="filename">/etc/asterisk/samples/</code>
 
; <code class="filename">astsnds.lrp</code> : The sound files which are installed into directory <code class="filename">/var/lib/asterisk/sounds/</code>
 
; <code class="filename">astsnds.lrp</code> : The sound files which are installed into directory <code class="filename">/var/lib/asterisk/sounds/</code>
 +
: This file is big - 1.7MB - and once installed the files occupy over 2.25MB of disk space
 
; <code class="filename">astmoh.lrp</code> : The music-on-hold files which are installed into directory <code class="filename">/var/lib/asterisk/moh/</code>
 
; <code class="filename">astmoh.lrp</code> : The music-on-hold files which are installed into directory <code class="filename">/var/lib/asterisk/moh/</code>
 +
: This file is ''very'' big - 14.6MB - and once installed the files occupy over 17MB of disk space
  
The following Packages are pre-requisites:
+
The following Packages are pre-requisites for <code class="filename">asterisk.lrp</code>:
 
* <code class="filename">libm.lrp</code>
 
* <code class="filename">libm.lrp</code>
 
* <code class="filename">libssl.lrp</code>
 
* <code class="filename">libssl.lrp</code>
Line 85: Line 110:
 
* <code class="filename">lpthread.lrp</code>
 
* <code class="filename">lpthread.lrp</code>
 
* <code class="filename">ncurses.lrp</code>
 
* <code class="filename">ncurses.lrp</code>
 +
 +
===Installation===
 +
There are no configuration files included in the <code class="filename">asterisk.lrp</code> Package. Sample configuration files are available in the <code class="filename">astsmpls.lrp</code> Package and - once present - these are saved (and restored) as part of the basic <code class="filename">asterisk.lrp</code> Package.
 +
The recommended procedure is therefore to load the <code class="filename">astsmpls.lrp</code> Package manually.
 +
This only needs to be done once.
 +
This can be achieved with the following command (assuming the <code class="filename">.lrp</code> files are available in the <code class="filename">/mnt/</code> directory):
 +
apkg -i /mnt/astsmpls.lrp
 +
Note that the sample configuration files are loaded into directory <code class="filename">/etc/asterisk/'''samples'''/</code>.
 +
Those files which you require for your configuration will need to be moved or copied into <code class="filename">/etc/asterisk/</code> before they will be processed by Asterisk.
 +
 +
===A Simple Test Configuration===
 +
Asterisk is a large and complex application and this page is not intended to be an Asterisk tutorial or reference manual.
 +
However, a very simple but working configuration can be achieved with the following steps:
 +
# Install the <code class="filename">asterisk.lrp</code>, <code class="filename">astsmpls.lrp</code> and  <code class="filename">astsnds.lrp</code> Packages along with any missing pre-requisites.
 +
# Copy <code class="filename">/etc/asterisk/samples/*.conf</code> to <code class="filename">/etc/asterisk/</code>
 +
# Edit <code class="filename">/etc/asterisk/asterisk.conf</code> and:
 +
#* Remove the comment character at the start of the line for <code>highpriority = yes</code>
 +
# Edit <code class="filename">/etc/asterisk/sip.conf</code> and:
 +
#* Remove the comment character at the start of the line for <code>match_auth_username=yes</code>
 +
#* Remove the comment character at the start of the line for <code>allowguest=no</code>
 +
#* Add an entry for a SIP phone at the end of the file - something like the following:<pre>[host-mac_address_without_colons]&#10;type=friend&#10;secret=<your-password-here>&#10;deny=0.0.0.0/0&#10;permit=192.168.1.0/24&#10;qualify=100&#10;nat=no&#10;host=dynamic&#10;directmedia=yes</pre>
 +
# Configure the SIP phone device to Register with the Asterisk server, using the ''host-mac_address_without_colons'' string as Username and ''<your-password-here>'' as the Password
 +
# Ensure that any firewall running on the VOIP server is configured to permit incoming UDP connections on port 5060
 +
# Start the asterisk process in verbose mode in the foreground by running the following command: <pre>asterisk -vvvc</pre>
 +
# Restart the SIP phone device and check that it registers with Asterisk
 +
#* Should be a message in the window where Asterisk was started
 +
'''Incomplete''' but to be continued... [[User:Davidmbrooke|Davidmbrooke]] 20:09, 22 October 2011 (UTC)
 +
 +
===Hints and Tips===
 +
====Asterisk CLI====
 +
The Asterisk server software has a Command-Line Interface (CLI) which is very useful for interactive use (e.g. checking the status of the system) or for issuing commands from an external shell script.
 +
To run the CLI in interactive mode:
 +
asterisk -r
 +
To run a single command in non-interactive mode:
 +
asterisk -rx "''command''"
 +
This is how <code class="filename>/etc/init.d/asterisk</code> shuts down Asterisk, for example (it executes <tt>asterisk -rx "core stop now"</tt>).
 +
 +
====CLI Commands====
 +
Some of the CLI command syntax can be a bit cryptic and it must have changed fairly recently since a lot of the online resources are incorrect.
 +
The following seem to work OK for version 1.8.
 +
; <tt>module show</tt> : lists the Asterisk modules which are currently loaded
 +
; <tt>sip show peers</tt> : shows the registration state of the SIP "peers"
 +
; <tt>sip show registry</tt> : shows the state of upstream SIP providers which Asterisk is registered with
 +
 +
===Further Reading===
 +
* The standard Asterisk version 1.8 documentation is located [http://wiki.asterisk.org/wiki/display/AST/Asterisk+1.8+Documentation here].
 +
* ''Asterisk: The Definitive Guide'', by Leif Madsen, Jim Van Meggelen, Russell Bryant. 3rd Edition. Copyright 2011 O'Reilly Media, Inc. ISBN 978-0-596-51734-2.
 +
  
  
 
----
 
----
 
{| summary="Navigation footer" width="100%"
 
{| summary="Navigation footer" width="100%"
| width="40%" align="left"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a Routing Daemon|Prev]]
+
| width="40%" align="left"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a Print Server|Prev]]
 
| width="20%" align="center" | [[Bering-uClibc 4.x - User Guide - Advanced Topics|Up]]
 
| width="20%" align="center" | [[Bering-uClibc 4.x - User Guide - Advanced Topics|Up]]
 
| width="40%" align="right"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a File Server|Next]]
 
| width="40%" align="right"  | [[Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a File Server|Next]]

Latest revision as of 20:30, 7 November 2011

Advanced Topics - Setting Up a VOIP Server
Prev Bering-uClibc 4.x - User Guide Next


Yate

Introduction

This Howto describes a Voice-over-IP (VoIP) solution based on Yate. Yate is a small but powerful IP telephony engine.

The yate.lrp Package in Bering-uClibc 4.x is based on Yate version 3. This is much more advanced than Yate version 1 which was used for Bering-uClibc 3.x and includes many more Yate modules, each with their own configuration file. Since many of these Yate modules will only be of interest to advanced users, the Bering-uClibc 4.x yate.lrp Package includes a large number of Yate modules (and their configuration files) but only loads a small number of Yate modules by default (the same ones as were available for Yate version 1 on Bering-uClibc 3.x) and only lists the configuration files for these default Yate modules in the lrcfg menu.

Requirements

To install Yate on a Bering-uClibc based system the following Packages are required:

  • yate.lrp
  • libcxx.lrp
  • libm.lrp
  • lpthread.lrp

Yate Basics

Startup and Shutdown

The Yate processes are stopped and started via init script /etc/init.d/yate. This is executed automatically at boot time, or the Yate processes can be started manually with the following command:

svi yate start

Logging

Log output is sent to /var/log/yate.log By default the logging is fairly minimal. Extra log output can be configured by adjusting the [debug] settings in /etc/yate/yate.conf or by using the Remote Manager.

Test Numbers

Yate comes pre-configured with some test numbers, which are specified at the end of /etc/yate/regexroute.conf:

; The following are for testing purposes                                        
^99991001$=tone/dial                                                            
^99991002$=tone/busy                                                            
^99991003$=tone/ring                                                            
^99991004$=tone/specdial                                                        
^99991005$=tone/congestion                                                      
^99991006$=tone/outoforder                                                      
^99991007$=tone/milliwatt 

For example, after dialling 99991003@192.168.1.254 (assuming that is the IPv4 address of your Yate server) you should hear a (US) ring tone.

Configuration Recipes

Yate has a number of configuration files in directory /etc/yate/. Only some of those are listed in the Yate section of the LEAF configuration menu.

SIP Client Registration

To allow SIP clients to register edit file ysipchan.conf and un-comment the registrar entry.

; registrar: bool: Allow the SIP module to receive registration requests        
registrar=enable 

You have to set the username and passwords for those clients in regfile.conf like this:

[someusername]
password=something

Call Routing Configuration

The regexroute module provides a simple way of routing telephony calls inside Yate. This module describes the routes using a configuration file in which each number is matched using regular expressions. The config file is named regexroute.conf and contains numerous examples.

Accounts

The accfile module allows Yate to act as a SIP or AIX client, this can be used to connect Yate to an other VOIP server or provider.

[test_sip]
 enabled=yes
 protocol=sip
 username=me
 description=Test SIP account
 ;interval=600
 formats=alaw,mulaw
 password=1234
 ;number=1234
 ;domain=somewhere.org
 registrar=10.0.0.1:5060
 ;outbound=10.0.0.1:5061
 ;localaddress=auto

An example on how to connect Yate to FWD (Free World Dialup) can be found in yate's wiki.

Firewall settings

In most situations you don't install a firewall VoIP server itself. If you install a VoIP server behind a firewall you need to open a SIP and a RTP range.

SIP uses udp port 5060, RTP (udp) ports are not hard defined but depends very much upon the application. In Yate the range of ports can be defined in yrtpchan.conf.


Asterisk

Status

In October 2011 Asterisk version 1.8.7.1 (the latest upstream version) was ported to Bering-uClibc 4.x and will be released as part of Bering-uClibc 4.1.1. See also LEAF Trac ticket #5.

Important: The asterisk executable seems to segfault early in the startup process unless the "-p" command-line argument is specified (or "highpriority = yes" is specified in /etc/asterisk/asterisk.conf).

Packages

The Asterisk distribution is divided into four .lrp Packages, based on the structure adopted for Asterisk 1.2 on Bering-uClibc 3.x but somewhat extended. The Packages are:

asterisk.lrp 
The main Package, with the Asterisk executables installed into directory /usr/sbin/ and also all of the Asterisk modules installed into directory /usr/lib/asterisk/modules/
Note: There are no configuration files included in asterisk.lrp - see the Installation section for more details
astsmpls.lrp 
The sample configuration files which are installed into directory /etc/asterisk/samples/
astsnds.lrp 
The sound files which are installed into directory /var/lib/asterisk/sounds/
This file is big - 1.7MB - and once installed the files occupy over 2.25MB of disk space
astmoh.lrp 
The music-on-hold files which are installed into directory /var/lib/asterisk/moh/
This file is very big - 14.6MB - and once installed the files occupy over 17MB of disk space

The following Packages are pre-requisites for asterisk.lrp:

  • libm.lrp
  • libssl.lrp
  • libcrpto.lrp
  • lpthread.lrp
  • ncurses.lrp

Installation

There are no configuration files included in the asterisk.lrp Package. Sample configuration files are available in the astsmpls.lrp Package and - once present - these are saved (and restored) as part of the basic asterisk.lrp Package. The recommended procedure is therefore to load the astsmpls.lrp Package manually. This only needs to be done once. This can be achieved with the following command (assuming the .lrp files are available in the /mnt/ directory):

apkg -i /mnt/astsmpls.lrp

Note that the sample configuration files are loaded into directory /etc/asterisk/samples/. Those files which you require for your configuration will need to be moved or copied into /etc/asterisk/ before they will be processed by Asterisk.

A Simple Test Configuration

Asterisk is a large and complex application and this page is not intended to be an Asterisk tutorial or reference manual. However, a very simple but working configuration can be achieved with the following steps:

  1. Install the asterisk.lrp, astsmpls.lrp and astsnds.lrp Packages along with any missing pre-requisites.
  2. Copy /etc/asterisk/samples/*.conf to /etc/asterisk/
  3. Edit /etc/asterisk/asterisk.conf and:
    • Remove the comment character at the start of the line for highpriority = yes
  4. Edit /etc/asterisk/sip.conf and:
    • Remove the comment character at the start of the line for match_auth_username=yes
    • Remove the comment character at the start of the line for allowguest=no
    • Add an entry for a SIP phone at the end of the file - something like the following:
      [host-mac_address_without_colons]
      type=friend
      secret=<your-password-here>
      deny=0.0.0.0/0
      permit=192.168.1.0/24
      qualify=100
      nat=no
      host=dynamic
      directmedia=yes
  5. Configure the SIP phone device to Register with the Asterisk server, using the host-mac_address_without_colons string as Username and <your-password-here> as the Password
  6. Ensure that any firewall running on the VOIP server is configured to permit incoming UDP connections on port 5060
  7. Start the asterisk process in verbose mode in the foreground by running the following command:
    asterisk -vvvc
  8. Restart the SIP phone device and check that it registers with Asterisk
    • Should be a message in the window where Asterisk was started

Incomplete but to be continued... Davidmbrooke 20:09, 22 October 2011 (UTC)

Hints and Tips

Asterisk CLI

The Asterisk server software has a Command-Line Interface (CLI) which is very useful for interactive use (e.g. checking the status of the system) or for issuing commands from an external shell script. To run the CLI in interactive mode:

asterisk -r

To run a single command in non-interactive mode:

asterisk -rx "command"

This is how /etc/init.d/asterisk shuts down Asterisk, for example (it executes asterisk -rx "core stop now").

CLI Commands

Some of the CLI command syntax can be a bit cryptic and it must have changed fairly recently since a lot of the online resources are incorrect. The following seem to work OK for version 1.8.

module show 
lists the Asterisk modules which are currently loaded
sip show peers 
shows the registration state of the SIP "peers"
sip show registry 
shows the state of upstream SIP providers which Asterisk is registered with

Further Reading

  • The standard Asterisk version 1.8 documentation is located here.
  • Asterisk: The Definitive Guide, by Leif Madsen, Jim Van Meggelen, Russell Bryant. 3rd Edition. Copyright 2011 O'Reilly Media, Inc. ISBN 978-0-596-51734-2.



Prev Up Next