Foniva Contact Center Software
Asterisk Experts Support

Quick packages install on CentOs 5 and Asterisk 1.4.X

Here is a quick trick on centos/redhat or any yum powered platform

to install all packages that you may need to install asterisk.

It will even install mysql for you as well as odbc connector.

yum -y install gcc gcc-c++ kernel-devel bison openssl-devel \
libtermcap-devel ncurses-devel doxygen curl-devel newt-devel \
mlocate lynx tar wget nmap bzip2 mod_ssl crontabs vixie-cron \
speex speex-devel unixODBC unixODBC-devel libtool-ltdl \
libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel \
mysql-server php-mysql php-mbstring php-mcrypt flex screen

asterisk/zaptel/dahdi/you do not appear to have the sources

When installing asterisk and the zaptel or dahdi module, you may reach the error:

You do not appear to have the sources for <your-kernel-version>

Here, I will explain exactly what asterisk is looking for and how you can fix it.

First, you may really need to install the kernel sources. The headers are needed to compile zaptel/dahdi.

If you use yum, you can install from repository.

yum -y install kernel-devel

If you run SMP kernel, use instead

yum -y install kernel-smp-devel

Here is what zaptel/dahdi will do to determine if you have the kernel source or not :

- find your kernel version by running uname -r and stock it into $(KVERS)

- set variable $(KSRC) to one of the following /lib/modules/$(KVERS)/build or /usr/src/linux or /usr/src/linux-2.4. The Makefile will then check if one of those directories exist.

- The $(KSRC) directory should contain the .config file.

If you installed the kernel sources, you should have the .config file somewhere in /usr/src/kernels/(somedir)

You just then have to create a symbolic link from /usr/src/linux or /lib/modules/$(KVERS)/build to that directory.

Reconfigure, recompile zaptel/dahdi and asterisk.

Hope it helps

Asterisk : Open big log file

When you enable asterisk logs, specifially full logs with DEBUG,

your log file could increase quickly. Open it with vi can use a lot of memory of your server

and prevent you to receive a lot of calls.

You can use split command line to split your file to smaller one

split full

Asterisk automatic dialing

Sometimes, you may need asterisk to call somebody and play any kind of application or run a dialplan extension.

Asterisk call files can be use here. You need to create a call file (which is a clear text file) and move it in /var/spool/asterisk/outgoing/ directory. A thread on the asterisk server will check for new files there and process them.

The file contains keys and values seperated by a ‘:’ character on each line. Here are the accepted parameters:

Example :

If you want to call the number 5140000000 through channel Zap/g1 and play welcome prompt when answered, your call file will look like :

Channel: Zap/g1/5140000000

CallerID: Ruddy Micnes  <5143161470>

WaitTime: 30

Application: Playback

Data: welcome

Tip : Restrict call by matching caller id

This quick tip will show you how, in asterisk dialplan, you can restrict calls to a specific match of caller id.

Usually, in a dialplan, extensions will match the called number. Like in the following example :


exten => _514XXXXXXX,1,Noop( CALLS TO NUMBER ${EXTEN} FROM ${CALLERID(all)} )

exten => _514XXXXXXX,n,Dial(Zap/g1/${EXTEN})

This means that anyone that reach an extension starting with 514 and followed by 10 digits will be send to Zap/g1

If you want this extension to be restrict to a specific caller id or match also a caller id pattern (eg: starting with 418 and followed by 10 digits, your dialplan should be like



exten => _514XXXXXXX/_418XXXXXXX,n,Dial(Zap/g1/${EXTEN})

Asterisk CDR log all calls

You may have notice that some calls that you are sure that you placed are missing in the CDR file or table.

Those calls may be those that wasn’t answered.

For example, if you place, from one channel, multiple simulatanous or successive calls to differents destinations, you will see only one record : the origination channel tring to reach the destination that answered.

To change this and log all channels even to answered, you need to edit cdr.conf file and add unanswered option .

vi /etc/asterisk/cdr.conf



Unload asterisk server - Batch save cdr

Hi All,

This chronicle will be use to give you tips where you can unload your asterisk server and make him do what he  is suppose to do : Take calls.

One departement were you can save processing is CDR logging and database writing.

By default, asterisk will write or post your call detail record (CDR) at the end of every calls. This help keeping track of all calls including bill seconds. But if you have too many calls, the load of your server writing CDR or inserting in the database can become enormous.

You can add some options in /etc/asterisk/cdr.conf. For example, asterisk can just collect the cdr and after 10 calls ou 5 minutes, write the call details in a file or insert them in the database.

Here are options that will help you doing so:

vi /etc/asterisk/cdr.conf








You need to know exactly what every parameter means here and need to tune in those parameters to fit your environment or type of business.

- batch = yes. This means that asterisk will keep CDRs for x seconds (see parameter size and time) and post them all at once. This also means that if your asterisk server crash, or if you manually kills it (kill -9 asterisk) you will loose every CDR in memory. So, if CDRs are very critical for your business and your asterisk server trends to crash sometime, you may consider not enabling this feature. But, if you want to easy loads on asterisk and databases, you can do it. However, you can reduce how many CDR you may lost in case of crash but using ’size’ and ‘time’ parameters.

- size = 100. This means that, at any time, if the number of CDR kept in memory reach 100, they will be post or send in the database.

- time = 300. This means that, every single 300 seconds (5 minutes), the CDR will be post whatever the size is.

- scheduleronly=no. Asterisk has one thread (a kind of separate internal process) whose only job will be to post CDR when comes the time to do so or when the size is reach. If set to ‘no’, everytime the size will be reach, asterisk will start a new thread to post your CDR. If set to ‘yes’, only one still active thread will do the job again and again. Why is this important ? If you set it to ‘yes’ and the same thread is responsible of doing the same job, if you have any kind of delay while posting CDR, the following CDR will be block until the previous are done. That’s why I recommand one separate thread every time specially if your size is big.

-safeshutdown=yes. When you run ‘asterisk> stop now’ in asterisk cli, if this option is set to ‘yes’, asterisk will issue the last CDR post before shutting down, if not, your still-in-memory-CDR may be lost. So, keep this to yes unless CDRs are not very relevant in your business.

Asterisk 1.4.22 and 1.6.0 released

Great news today for the release of those two version that fix many bugs out there.

Please visit

Our sponsors

Asterisk Experts Support