shell script - call detail records.

January 1st, 2010

This simple shell script is useful for checking call detail records from the command line.
cdr.sh

shell script - active channels

January 1st, 2010

This simple shell script is useful for checking active channels from the command line prompt.
channels.sh

Lookup Caller ID name from number via mysql

January 1st, 2010

The following are small scripts I used to create and manage a mysql data base for CID name lookups in my TrixBox.

cid.pl This is a cgi perl script that makes it easy to manage the lookup table, the setup script below will copy this to /var/www/cgi/
setup.sh This shell script will create the data base and lookup table. It will also create a blank tuple in the table, so that calls with a blank CID will return “unknown” instead of the first entry in the table.
backup.sh Shell script to backup cid lookup table, creates text file cid.sql
restore.sh Shell script to restore cid.sql text file back to the data base.

My trixbox CE system status version is 2.6.23


All scripts assume default passwords for mysql.


In the web page gui select: PBX > PBX settings

Select the CallerID Lookup Sources and Add Lookup Source

Source Description: local mysql
Source Type: MySQL

Host: localhost
database: cidlookup
query: SELECT name FROM callerid WHERE number LIKE ‘%[NUMBER]%’
username: root
password: passw0rd


Next, in the web page gui select: PBX > PBX settings
Then select the inbound routes that are to look up the name in mysql.
Change CID Lookup source to local mysql.

apache virtual hosts, user accounts with public html, webalizer reports

December 21st, 2008

Set up httpd.conf with a virtual host for each url.
/etc/httpd/conf/httpd.conf

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
ServerSignature off
DirectoryIndex index.php index.html index.htm index.shtml index.pl
LogLevel debug
HostNameLookups off
</VirtualHost>

<VirtualHost *:80>
ServerName www.labellepageantwear.com
ServerAlias *labellepageantwear.com
DocumentRoot /home/labelle/public_html/
DirectoryIndex index.php index.html index.htm index.shtml index.pl
ErrorLog /var/log/httpd/labellepageantwear.com-error_log
CustomLog /var/log/httpd/labellepageantwear.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerName www.missidahofalls.org
ServerAlias *missidahofalls.org
DocumentRoot /home/missif/public_html/
DirectoryIndex index.php index.html index.htm index.shtml index.pl
ErrorLog /var/log/httpd/missidahofalls.org-error_log
CustomLog /var/log/httpd/missidahofalls.org-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerName www.missrexburg.org
ServerAlias *missrexburg.org
DocumentRoot /home/missrex/public_html/
DirectoryIndex index.php index.html index.htm index.shtml index.pl
ErrorLog /var/log/httpd/missrexburg.org-error_log
CustomLog /var/log/httpd/missrexburg.org-access_log common
</VirtualHost>

# allow each user to have a public html folder
<Directory “/home/*/public_html”>
Options Indexes Includes FollowSymLinks
Order Deny,Allow
AllowOverride authConfig
Allow from all
Order allow,deny
</Directory>

# prevent index of labelle catalog
<Directory “/home/labelle/public_html/catalog”>
Options -Indexes
</Directory>

Restart apache for the configuration to take effect.
service httpd restart


create each access and error log file:
touch /var/log/httpd/missif.org-error_log
touch /var/log/httpd/missif.org-access_log
touch /var/log/httpd/missrexburg.org-error_log
touch /var/log/httpd/missrexburg.org-access_log


Setup webalizer for each virtual host.
mkdir /etc/webalizer
mv /etc/webalizer.conf /etc/webalizer/.
copy webalizer.conf to a unique file for each virtual host
cp /etc/webalizer/webalizer.conf /etc/webalizer/labellepageantwear.com.conf
cp /etc/webalizer/webalizer.conf /etc/webalizer/missidahofalls.org.conf
cp /etc/webalizer/webalizer.conf /etc/webalizer/missrexburg.org.conf

edit /etc/webalizer/webalizer.conf
leave LogFile /var/log/httpd/access_log
change OutputDir /var/www/usage/default
I changed the hostname to the static IP on the local LAN HostName 192.168.1.50
Every thing else stayed the same.

Now, update the following items for each virtual host in their conf file
LogFile /var/log/httpd/missrexburg.org-access_log
OutputDir /var/www/usage/missrex
HistoryName /var/lib/webalizer/missrex.webalizer.hist
IncrementalName /var/lib/webalizer/missrex.webalizer.current
HostName www.missrexburg.org


Setup a folder for each webalizer report:
mkdir /var/www/usage/default
mkdir /var/www/usage/labelle
mkdir /var/www/usage/missif
mkdir /var/www/usage/missrex

in each folder place a copy of msfree.png and webalizer.png
cp /var/www/usage/msfree.png /var/www/usage/labelle/.
cp /var/www/usage/webalizer.png /var/www/usage/labelle/.

I also created a folder for all the old data
mkdir /var/www/usage/old_data
and moved all the old webalizer stuff into the old_data folder
mv /var/www/usage/* /var/www/usage/old_data/.


Setup the webalizer cron script to run each conf file:
/etc/cron.daily/00webalizer
#! /bin/bash
# update access statistics for the web site

#if [ -s /var/log/httpd/access_log ] ; then
# /usr/bin/webalizer
#fi

for i in /etc/webalizer/*.conf; do /usr/bin/webalizer -c $i; done

exit 0


I also set up /etc/httpd/conf.d/webalizer.conf to allow an index of the usage folder and only allow browsers on the LAN to see webalizer reports.

#
# This configuration file maps the webalizer log analysis
# results (generated daily) into the URL space. By default
# these results are only accessible from the local host.
#
Alias /usage /var/www/usage

<Location /usage>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.1. # local subnet
Allow from ::1
Options +Indexes
</Location>

Restart apache for the configuration to take effect.
service httpd restart


Last of all, make sure each domain’s dns entry is pointing to your ip address. I found out the hard way that this doesn’t work if you are using forwarding….
Try ping or nslookup on one of your domains to make sure the ip address is correct.


Rush’s Kitchen Supply

December 16th, 2008

9 camera system at Rush’s Kitchen Supply in Idaho Falls, Idaho. I had to use several “lipstick” cameras since only part of the store has a ceiling where any thing could be mounted.

Cedric’s Family Restaurant

December 16th, 2008

Here are a few pictures of the system at Cedric’s.
There are 9 cameras connected to the Linux Server and a Video Quad Mux.
The Linux box records time-lapse video and streams to the internet. The Mux feeds a T.V. in the office.

E-mail Voicemail volume too low

December 10th, 2008

“Use gain when recording the voicemail message (optional) : [ ]”
found in; “setup > general settings”, doesn’t work.

I finally found a setting that does work in
/etc/asterisk/voicemail.conf

[general]
;1st listed format gets emailed
; format = wav49|wav
format = wav|wav
volgain=12.0
attach = yes
pbxskip = yes ; Don’t put [PBX]: in the subject line

Wake Up Call

October 30th, 2008

Add FreePBX module.

goto http://www.freepbx.org/trac/changeset/5065 and get the file wakeup-1.0.tgz
Load your gui up of freepbx
Click on the tools tab
select module admin
Select Upload Module and then browse for the file
Select the file and press upload
After it is uploaded, go to module admin again, under “provides a feature code” the wakeup module should be there.
Click on check for updates online at the top of the page.

Go back under “provides a feature code”, click on wakeup and select install.
Then click process at the bottom of the page.

apply your changes with a reload

in linux
mkdir /tmp/wakeup
chown asterisk /tmp/wakeup
chgrp asterisk /tmp/wakeup


another way…

After the initial install of TrixBox 2.6 there is a wake up script wakeup.php already in /var/lib/asterisk/agi-bin

So all I had to do was add the following in /etc/asterisk/extensions_custom.conf
exten => *62,1,Answer
exten => *62,n,AGI(wakeup.php)
exten => *62,n,Hangup

And restart with amportal restart.

This is quick and easy, but does not add the features in the FreePBX module.

my TrixBox CE release is 2.6.1.11

DD-WRT DNSMasq tftp to TrixBox

October 19th, 2008

In a DD-WRT router to have dhcp point to the TrixBox for tftp, set the following:
In the DD-WRT control panel select:
Administration > Services > scroll down to DNSMasq
DNSMasq = enable
Additional DNS Options:
dhcp-option=66,192.168.1.40

192.192.1.40 is my TrixBox.

Ring Back Solved

October 16th, 2008

I had trouble with TrixBox ringing after hanging up. After hanging up, a couple seconds latter all of the phones in the incoming ring group would ring, caller ID reporting “unknown”. Answering would result in listening to dial tone. It did not matter if I was terminating or originating.

I have a digium tdm410p wildcard with 2 FXO modules. Ring back was happening on both FXO ports.

I added options wctdm24xxp ringdebounce=1536 in /etc/modprobe.conf and restarted the system.

Looks like the voltage swing/change on disconnect was being interpreted as a ring cycle. Increasing the ring-de-bounce parameter took care of it.

Since this is a driver setting I don’t think any of the many, many, changes I made in my zapata.config made a difference.