OPT_Asterisk 1.6.2 for Fli4L

What's this?

Asterisk is a major software telecommunication PBX with incredible features you would not find packed into any single traditional PBX.

Please, be aware, that this OPT is NEITHER SUITED FOR LARGE OFFICE PBX, NOR FOR PRODUCTION SYSTEMS! This is due to restrictions on the OS side, as well as on the OPT's side. Remember: Fli4L is a router, is a router, is a router ...

This OPT makes it as easy as possible to bring Asterisk to your Fli4L. It does not automatically set-up your system. Do not expect to get a up-and-running PBX within a few clicks!

About this Document

Please understand, that we cannot cope to explain the various concepts and configurations of Asterisk in this document. Contrary, we assume you know what Asterisk does and how it works. If for some reason you do not know how to configure Asterisk itself, please, bury yourself in literature like given in the reference chapter at the end of this cruft.

What You Need to Bring Along

System Requirements

Well, it's a kind of tricky to give out certain constrains for choosing hardware to run this OPT on, because if we'd state something like "You need a 500MHz CPU" someone will come along to say "I'm successfully running it on a 350MHz PC", while another says "My sound get's chunky or noisy even on a 1GHz system". Therefore the following should be considered something like guideline:

Above all that, mind Fli4L to be a router OS. It does not offer functionality expected from a communication server (e.g. mail support). This OPT is best suited for simple protocol routing of protocol based telephony with small amounts of protocol conversion needed.

Installing and Configuring this OPT

First, simple extract the OPT in your Fli4L folder. After that, you'll need to edit the file config/asterisk.txt and set the variables listed below to your needs.

Basic Set-up

These variables set the general behavior of Asterisk. Once set, you may get a 'first-try' Asterisk system running on your Fli4L.

Variable

Default

Description

Valid

Example

Optional

OPT_ASTERISK

'no'

Enable the entire OPT.

'yes' or 'no'

'yes'

no

ASTERISK_SYSTEMNAME

'asterisk'

The name your Asterisk system is identified within your network. Make sure it does not collide with any other domain name in your subnet.

A-Z, a-z, 0-9, '-' and '.'

'voip.mynet'

no

ASTERISK_LANGUAGE

'en'

Select the language for your voice menu files. This does not set the language for the GUI, just for the voice files.

'en', 'de' or 'fr' at this stage

'de'

no

ASTERISK_GUI

'yes'

If you want to enable the GUI implemented in httpd of Fli4L, state 'yes'.

'yes' or 'no'

'yes'

yes

ASTERISK_AUTOLOAD

'yes'

If your system has enough RAM, so you don't have to care about a byte more or less, turn AUTOLOAD on and any module found in /usr/lib/asterisk/modules will be automatically loaded with Asterisk. Otherwise use ASTERISK_LOAD and ASTERISK_NOLOAD to specify which modules you want to use.

'yes' or 'no'

'no'

no

ASTERISK_CAPI

'no'

Enable CAPI support for ISDN.

'yes' or 'no'

'yes'

yes

Configuring Asterisk

There are two ways to edit the *.conf files for your system. You can ...

  1. edit them directly on your router, if they are stored on a non-volatile disk space.

  2. take the long way and edit them in you Fli4L build directory.

Let's look at the procedure, that takes place during a router update: Once you've made your changes to the configuration, you call the mkfli4l batch or script, which parses the configuration files and puts everything together in a few mostly compressed files. Those files are put on your router (e.g. remote update) and will be decompressed during boot time, either to disk or to volatile RAMdisk.

Editing the Configuration Directly on Your Router

So, if you choose to edit your *.conf files directly on your router (e.g. using the GUI), you have to make sure, that your changes are neither lost during reboot, nor during update. Make use of the ASTERISK_DIR_CONF variable described in the next chapter to put your *.conf files in the right place on your router. Set it to any non-volatile disk space available, which is not overwritten by Fli4L in any case. This, for instance, can be a /data partition or a /boot/asterisk sub-folder.

If you have activated the httpd GUI of this OPT, you can use the Configuration tab to edit any of the files in your ASTERISK_DIR_CONF folder.

Editing the Configuration on Your Desktop PC

You can edit the *.conf files in the opt/etc/asterisk directory of your desktop PC, as well, and remotely update them to your router. Just, you may find it takes a rather annoying long time to build Fli4L with Asterisk installed and to transfer the files to your router. Anyway, if you choose this variant, you have to state which configuration files to include in the build of Fli4L.

Variable

Default

Description

Valid

Example

Optional

ASTERISK_CONFFILE_N

'0'

Number of configuration files to copy.

any number

'5'

no

ASTERISK_CONFFILE_%

''

Name of the configuration file with arbitrary extension (including .ael and .adsi)

any file name in 'opt/files/etc/asterisk'

'extensions.conf'

no

Running Asterisk from RAMdisk (Fli4L Type 'A' Disk Installation)

Most people are running a type 'A' installation on their Fli4L system, which means, that the root system is decompressed not to hard disk, but to a temporary RAMdisk (tmpfs). It's the nature of such a ramdisk to loose any content once the system is shut down. So, in case your Fli4L is that sort of type 'A' installed, you should consider to save your data during power off and restore it on reboot.

One problem may be, if you use AstDB to store configuration data (e.g. blacklisted CIDs), you want that configuration to be available after a reboot as well. To backup AstDB during shut down, just set ASTERISK_ASTDB_BACKUP to a absolute path directly on your hard disk or CF card, where the AstDB file is copied to.
Also, the log and spool folders of Asterisk may hold information you do not want to loose (e.g. call details, voice messages). Use the ASTERISK_DIR_* variables to redirect those files (paths) to non-volatile disk space.

Furthermore, if your system does not have a traditional hard drive, but a CF or similar FLASH card as system storage device, you may want to reduce write cycles to disk in order to extend the FLASH card's lifetime. Yeah, we do know, that nowadays CF cards are not that sensitive to write access anymore, but we wouldn't want to test that in system like a PBX with expected 99.5% availability. ;-)
One attempt to spare some writes is, to tell Asterisk with the variable ASTERISK_DIR_RECORDCACHE not to write audio recordings (e.g. voice message, call monitoring) directly to disk, but to the given folder on the RAMdisk first. Once the recording is completed, the file is moved to disk in one go.

Buy the way: Those *.conf files, which are automatically created during start up, are always written to RAMdisk in order not to waste boot time and FLASH write cycles. To tell Asterisk where to find those files, symbolic links in the folder set with ASTERISK_DIR_CONF are created. Therefore a minimum of write cycles is archived.

Variable

Default

Description

Valid

Example

Optional

ASTERISK_OPTIONS

''

If you want to state additional parameters for the start-up of Asterisk, you can do that here. Do NOT use the parameters '-t', '-V', '-h', '-r', '-R', '-F' and '-c', because the contradict internal settings and probably render the system unusable.

any start parameter as given by Asterisk -h

'-n'

yes

ASTERISK_ASTDB_BACKUP

''

If you want the AstDB to be saved to another location during system shutdown, state the path to save it to here. Your AstDB is automatically restored during the next boot.

any absolute path

'/data/asterisk'

yes

ASTERISK_DIR_LOG

'/var/log/asterisk'

Redirect the logging to a different folder. Mind that logging in that context also includes the Call Detail Recording (CDR).

any absolute path

'/data/asterisk/log'

yes

ASTERISK_DIR_RUN

'/var/run'

That's just where Asterisk's PID is stored.

any absolute path

'/data/asterisk/run'

yes

ASTERISK_DIR_CONF

'/etc/asterisk'

If you choose to modify conf files directly on the system, all changes are lost after the next reboot. Therefore, you may want to use a folder on a non-volatile disk space to hold your conf files. Only the automatically generated files are always stored in /etc/asterisk to reduce write cycles to your FLASH drive. The boot script generates symbolic links in your chosen conf files folder to link to those files in /etc/asterisk.

any absolute path

'/data/asterisk/etc'

yes

ASTERISK_DIR_SPOOL

'/var/spool/asterisk'

The spool folder holds all monitored calls and all voice box messages. Therefore, its a good idea to redirect it to a non-volatile disk space.

any absolute path

'/data/asterisk/spool'

yes

ASTERISK_DIR_RECORDCACHE

''

Write audio recordings to the given temporary folder first, before moving it to disk in one go. Saves time and disk write cycles.

any absolute path

'/tmp'

yes

Adding Lines to asterisk.conf and modules.conf

Some may ask: "Why all the fuss about automatically creating some *.conf files? Why not editing them by hand as the other *.conf files?"

Well, the Fli4L development specification states, that users are not to bound to change anything but the config/*.txt files in order to use an OPT. On the other hand, Fli4L requires the *.conf files to be put in opt/etc/asterisk which many users may find hard to locate. Because of that, we chose to move the content of the Asterisk main configuration file (asterisk.conf) into the config/asterisk.txt file. In other words, we tried to make it an "Edit one file and get started" OPT. The downside is a rather complex configuration in config/asterisk.txt.

Variable

Default

Description

Valid

Example

Optional

ASTERISK_CONF_N

'0'

Number of lines to add to the asterisk.conf file.

any number

'9'

no

ASTERISK_CONF_%

''

State the additional lines to write to [options] section of the asterisk.conf file. Mind that the entire [directories] section and systemname in the [options] section are automatically generated. You can add new sections, as well.

anything

'internal_timing = no'

no

ASTERISK_LOAD_N

'0'

Number of modules to load.

any number

'37'

no

ASTERISK_LOAD_%

''

Specify a module by its name to be loaded.

any module file name ending with '.so'

'app_dial.so'

no

ASTERISK_NOLOAD_N

'0'

Number of modules to be left out when starting Asterisk.

any number

'21'

no

ASTERISK_NOLOAD_%

''

Specify a module by its name NOT to be loaded. Mind that NOLOAD is overriding any LOAD of the same module.

any module file name ending with '.so'

'codec_lpc10.so'

no

Adding Sound Files

You may want to record your own sound files for voice menues or announcements. To include those sound files in the compressed Fli4L build, put the files in the following directory.

Furthermore, you can configure audio files for the Music on Hold feature. A few sample files are included in this OPT.

Language

Directory in Your Fli4L Build

English

opt/files/var/lib/asterisk/sounds/en

German

opt/files/var/lib/asterisk/sounds/de

French

opt/files/var/lib/asterisk/sounds/fr

Music on Hold

opt/files/var/lib/asterisk/moh


Furthermore, you have to tell Fli4L which additional sound files to include in the build process.

Variable

Default

Description

Valid

Example

Optional

ASTERISK_SOUNDFILE_N

'0'

Number of sound files to add.

any number

'8'

yes

ASTERISK_SOUNDFILE_%

''

Relative path and name of the sound file. 'opt/files/var/lib/asterisk/sounds' is assumed as base directory and should be omitted.

any filename with relative path

'de/usr-intro.gsm'

yes

ASTERISK_MOHFILE_N

'0'

Number of MOH sound files to add.

any number

'3'

yes

ASTERISK_MOHFILE_%

''

Relative path and name of the sound file. 'opt/files/var/lib/asterisk/moh' is assumed as base directory and should be omitted.

any filename with relative path

'sample.mp3'

yes


All sound files for you language delivered with this OPT are included anyway and do not have to be added separately.

Various Other Options

Unfortunately, we have discovered, that Asterisk tends to crash occasionally, if it stumbles across a bug in the dialplan or if a module is missing an external file (e.g. voice file). While Asterisk is broken down, your phone system is dead, you cannot call outside and your phone numbers are unavailable. To immediately get going again (well, there is one or two seconds delay), you can enable ASTERISK_RESTART. That way Asterisk is at least running again, while the bug in the dialplan remains or the file is still missing.

There are also two utilities included in this OPT, which are not part of the genuine Asterisk distribution. Though, they will make your life easier. ;-)

Variable

Default

Description

Valid

Example

Optional

ASTERISK_RESTART

'yes'

If for any reason Asterisk crashes, it is automatically restarted. This is also a convenient way to reload Asterisk by you issuing "stop now" from the console.

'yes' or 'no'

'yes'

yes

ASTERISK_MPG123

'yes'

If you want to playback Mpeg Layer3 files on the phone system (e.g. music on hold), we would suggest to use mpg123, because it supports many more MP3 file formats than Asterisk by itself. Though, mpg123 is sometimes said not to be working very stable together with Asterisk, we can only encourage the use.

'yes' or 'no'

'no'

yes

ASTERISK_SOX

'yes'

To convert audio files from WAV or MP3 format to any Asterisk suitable format, you can use sox. Please, use the sox integrated help cruft or the WWW to get further information.

'yes' or 'no'

'no'

yes

ASTERISK_LICENSE_N

'0'

Number of licenses you purchased for CoDecs. You can state several licenses of the same type, if, for instance, you want to add more channels.

'yes' or 'no'

'5'

no

ASTERISK_LICENSE_%_FILE

''

Name of the license file in folder opt/files/usr/lib/asterisk/license. Omit any path, just state the file name.

any file name

'mylicense.lic'

no

ASTERISK_LICENSE_%_CODEC

''

Type of CoDec the license is valid for.

'skype', 'g723' or 'g729a'

'g729a'

no

Peculiarities of Asterisk on Fli4L

MeetMe

The MeetMe application requires DAHDI not only for timing, but also for mixing sound. Since DAHDI is not included in OPT_Asterisk, MeetMe cannot be used. Please, use the ConfBridge application instate.

Music on Hold

In order to use mpg123 as source the library wrapper script has to be circumvented and the binary file invoked directly, because the script cannot handle streaming. Therefore, consider using this line in your musiconhold.conf file:

application = /usr/sbin/asterisk-bin/mpg123 -q -r 8000 -f 8192 -b 2048 -m -s

The Fli4L GUI

Setting Fli4L User Rights for Asterisk GUI

Fli4L has it's own user right definition for the httpd web interface. It is set in the file config/httpd.txt by setting HTTPD_USER_%_USERNAME, HTTPD_USER_%_PASSWORD and HTTPD_USER_%_RIGHTS. To set rights for Asterisk just add a "asterisk:" section to the RIGHTS entry of the user and state one or more comma separated rights as the following are available:

User Right

Status

Registry

Peers

Active Channels

Call Details

Asterisk Database

Configuration

Command Line

asterisk:view

yes

yes

yes

yes

yes

no

no

no

asterisk:admin

yes

yes

yes

yes

yes

yes

yes

yes

asterisk:all

yes

yes

yes

yes

yes

yes

yes

yes

asterisk:

no

no

no

no

no

no

no

no


Just bear in mind, that users with admin rights not only get unlimited access to all configuration files showing passwords, but also to the Asterisk command line, which enables them to easily wreck your phone system and even execute shell commands with '!'.

GUI Configuration

The GUI does not need to much configuration, but you can alter it's appearance to your needs.

Variable

Default

Description

Valid

Example

Optional

ASTERISK_CLI_BTN_N

'0'

Number of command buttons to add to the command line interface.

any number

'5'

yes

ASTERISK_CLI_BTN_%

''

Asterisk command line instruction to be available simply by clicking the button in the CLI of the GUI. Three dashes (---) as command insert a separator line between buttons to group them visually.

any CLI command

'dialplan reload'

yes

Using the GUI

ASTERISK_GUI enables an independent GUI for the administration of Asterisk. The aim for developing this GUI was to get easy access to all background data Asterisk is continually producing and running with. It does not so much help setting up Asterisk, but administering it.

Status

Here you get a short overview of the system status. If you have administrator rights you can also reload all modules with a click on the button.

Registry

This table shows the provider account your system is currently registered to. Of course, this only works for protocols that require registration with a provider. So far, these are SIP, IAX and IAX. Each of the protocols is shown in a separate table section.

Peers

If you want to check, if peers (e.g. extensions of your phone system) are reachable, this is the place to look. Of course, this only works for protocols where the peer is required to register with Asterisk. So far, these are the protocols SIP, IAX and IAX. Each of the protocols is shown in a separate table section.

Active Channels

Here are all sorts of active channels to be seen. That's mainly calls going on, but also protocol communication. So if there are occasional entries popping up with a format of '0x00 (nothing)', don't worry. That's just your Asterisk checking your provider. Once again, the table is sectioned by protocol.

Call Details

If you have set up CDR (Call Detail Recording) in cdr.conf, a entry is written to csv format database for each call. Each call is listed with various details. You can sort on any of the fields shown, reverse the sort order and filter entries by certain fields. To filter data, enter the filter parameters into the input fields below the field names.

Filters for the calling date work with string compare. This means, if you enter a range from 2007-10-15 (first field) to 2007-10-20 (second field) only calls placed between October, 10th 2007 at 00:00:00 and October, 19th 2007 at 23:59:59 are shown. Mind, this does NOT include calls on the 20th! You can filter including time, too (e.g. 2007-10-20 12:35:00 to 2007-10-22 18:15:00).

The filters for caller and callee digest Perl style regular expressions. So you are not only able to filter specific numbers or names, but also using filter masks. Here some examples:

Filter

Description

.\{3\}

Only three digit numbers are shown.

.\{6,\}

Only shows numbers with six or more digits.

.\{9,11\}

Only shows numbers with nine to eleven digits.

145[0-9]*

Shows any number starting with 145

Ext_.*

Shows 'Ext_boss', as well as 'Ext_slave', or even 'Ext_'


But there are Limitations: '\(' and '\)' and ',' cannot be used in expressions!

Please note, this only works with a CDR database in csv format using only the standard fields optionally including the 'Userfield'!

The 'Userfield' is evaluated specially. Any expression in curly brackets at the end of the Userfield is shown as user-defined error in the column 'Disposition' of a call record. That way, you can state detailed causes for an error in the dialplan, even though the corresponding field 'DISPOSITION' is read-only.

Asterisk Database (only available to users with admin rights!)

Independent of the CDR database in csv format as described above, Asterisk includes a more sophisticated database. It does hold various internal records Asterisk needs for handling peers and calls, but can be used to store any other sort of information, too. Examples are blacklisted caller IDs or configuration settings used by the dialplan.

Each record is cut into four parts:    /family/subfamily/key:data

Part

Description

Optional

family

Family is another name for 'category' and can be freely chosen, as long as it does not collide with internal record families.

no

subfamily

A subfamily can be set, if you want to group keys to find them easier in a growing database.

yes

key

Names of the key itself.

no

data

Any sort of data. Can be left empty, as well.

yes


You can browse through the database by clicking the family or subfamily names. Notice the little plus symbol next to the name!
Keys are shown with a little key symbol next to them. If you click a key, you can edit the key's data. Just press enter or click the green tick next to the input field to submit your changes. To abort, just click any other family or tab. Erase keys from the database by clicking the red 'X' symbol in the right hand side column next to the data field.

To create new database entries fill in the input fields near the bottom of the table. The first field has to hold the family and optional subfamily separated by a '/' dash character, the second the name of the key and the third the data, if supplied. Then click the green tick.

Note: family, subfamily and key all together cannot be longer than 50 characters including delimiters!

Just be aware: Curiosity kills the database! It's a really good idea to read some stuff about AstDB before trying to use it.

Configuration (only available to users with admin rights!)

Here you can see all files in your ASTERISK_DIR_CONF folder. Edit or view any of the files by clicking on it or create new file with the input field and button at the bottom of the list.

Command Line (only available to users with admin rights!)

This is a budget version of a Asterisk Command Line Interface (CLI). It is not really a real-time interface, but enough to at least issue a few commands and see the results.

Be aware, that the command line gives total control of the Asterisk system to the user! Even shell commands can be issued. Therefore limit access to the command line to trusted users, only!
Recommended Literature

Literature

The official Asterisk User's Guide can be found here: doc/english/opt/asterisk.pdf.

There are several fantastic books available about Asterisk. The most prominent may be Asterisk: The Future of Telephony by Jim Van Meggelen, Leif Madsen and Jared Smith, which always is a good way to approach Asterisk.

If you are looking for a fast and complete (while not always up to date) reference on the web, go to http://www.voip-info.org/tiki-index.php?page=Asterisk
Or find your luck with http://www.asteriskguru.com/

There is an uncountable number of forums, chats and other resources available online. Just google it.

License, Copyright and Acknowledgements

Of course, we (the OPT_Asterisk Team) did NOT write Asterisk! We wouldn't be able to nor would we try. Asterisk is a fantastic team effort of hundreds, probably thousands of people contributing from around the world to the project, administered by Digium, Inc.

This OPT's Content

Available at: http://extern.fli4l.de/fli4l_opt-db3/search.pl?pid=539

copyright © 2006-2010 Tiger
This package is licensed by Free Software Foundation, Inc., General Public License Version 2, June 1991


The GPL2 is the only legal base this package is published on. We do NOT acknowledge any other national or international, implicated or explicit laws. If this or the GPL2 does not meet the local laws in your country, we strictly forbid this package to be used in your country.

Source Code

Available at: http://www.asterisk.org

copyright © Digium, Inc. (http://www.digium.com)
And innumerable other contributors (see Credit file supplied with source)

Compiled Binaries and in Parts this OPT

Integrated into the OPT.

copyright © 2006-2010 H. Hornung

English Language Voice Menu

Available at: http://downloads.digium.com/pub/telephony/sounds/

copyright © Allison Smith (http://www.theivrvoice.com)
Financial Contributions by: Digium, Inc. (http://www.digium.com)

German Language Voice Menu

Available at: http://www.amooma.de/

copyright © AMOOMA GmbH (http://www.amooma.de)
recorded by Gabi Becker (http://www.gabi-becker.de/)

French Language Voice Menu

Available at: http://public.indigen.com/asterisk-1.2-sounds-fr-armelle.tar.gz

Support

Please, understand we don't choose to give any end user support! Therefore, any mail sent to us with content like "The package does not work for me. Where is my mistake?" will stay unanswered. Please, ask your questions regarding the OPT_Asterisk and it's installation in the OPT newsgroup on www.fli4l.de. English language will be accepted. For questions about Asterisk itself please visit appropriate forums on the web.

If you somehow find a bug in our program or you would like to improve existing or develop new features, you are welcome to contact us by email for assistance. You will find our current mail addresses on the project website at www.opt-asterisk.bplaced.net.

Donations

If you think our work on this package is worth a small amount of money, please don't hesitate to donate to:

World Wide Fund for Nature - United Kingdom
Conservation Project "Tigers"
http://www.wwf.org.uk/

World Wide Fund for Nature - United States
Conservation Project "Tigers"
http://www.worldwildlife.org/

World Wide Fund for Nature - International
Conservation Project "Tigers"
http://www.panda.org/

To find a local site of the WWF in your country go to:
http://www.wwf.org/


The WWF is internationally doing fantastic work in preserving endangered big cat species. And those tigers need the money much more than we do. By the way: Big international companies (like Exxon/Esso) sponsor the WWF's administration. Money donated by private people therefore goes directly into the project work.