Search

Thursday, August 25, 2011

Asterisk log files can grow very large unawared, eventually leading to disk space problems.

We can take a few measures to maintain log history and housekeep old ones automatically.

1. Review the /etc/asterisk/logger.conf

This file specifies the logging level of asterisk. In a production system, it is sufficient to turn on message log only while keeping the others disabled.

;debug => debug

console => notice,warning,error,debug

messages => notice,warning,error

;full => notice,warning,error,debug,verbose

The modified logging level is made effective by:

asterisk –rx 'logger reload'

2. Use logrotate to rotate and remove historical files

This utility is helpful in housekeeping outdated log files. The logrotate is usually invoked from /etc/cron.daily and it looks for how and what to process in the /etc/logrotate.conf.

As illustrated in the logrotate.conf below, we rotate log files on weekly basis and keep 4 weeks. Rotated log would have a timestamp as suffix. Older files would be deleted automatically. Note that we can compress rotated files to further reduce disk usage. Individual rotation information are put in /etc/logrotate.d.

logrotate.conf

# see "man logrotate" for details

# rotate log files weekly

weekly

# keep 4 weeks worth of backlogs

rotate 4

# create new (empty) log files after rotating old ones

create

# use date as a suffix of the rotated file

dateext

# uncomment this if you want your log files compressed

compress

# RPM packages drop log rotation information into this directory

include /etc/logrotate.d

In /etc/logrotate.d/, we can create a file (eg, named as 'asterisk') to specify which asterisk log files we want to housekeep. We need to run 'logger reload'. Otherwise, Asterisk still writes to the old file.

Thursday, August 18, 2011

Dial creates an outbound PBX channel and asks one of the channel drivers to create a call

When the call is answered, Asterisk bridges the media streams so the caller on the first channel can speak with the callee on the second, outbound channel

In some cases where we have the same technology on bothchannelsand compatible codecs, a native bridge is used. In a native bridge, the channel driver handles forwarding of incoming audio to the outbound stream internally, without sending audio frames through the PBX.

In SIP, theres an "external native bridge" where Asterisk redirects the endpoint, so audio flows directly between the caller's phone and the callee's phone. Signalling stays in Asterisk in order to be able to provide a proper CDR record for the call.