Asterisk Hacking with trixbox 2.6

Older version for trixbox 2.2

Goals

My house is awash in 2.4GHz radio waves. In order to get good wireless LAN and wireless phone coverage at the exterme ends of my house and in the basement, I ended up with 4 2.4GHz base stations, 2 802.11g ones for computers and 2 Siemens ones for voice. I also can occasionally see additional wireless access points of my neigbors houses.

Unfortunately, having 4 of these devices in close proximity, especially the phones ones that do not provide any channel or power configuration, is not practical. There are only 11 channels in the 2.4GHz range and you are supposed to space devices at least 5 channels apart to minimize interference. I set one access point to channel 1, the other to channel 11, and hope the phones would somehow just work out some way to live happily in between. This did not work out and the voice side of things suffered, often resulting in a stuttering audio for the local listener, and incomprhensible sound for the remote listener. Note that the Siemens system worked great when I got it in early 2000, even when I had my original 2mb 802.11 setup.

A friend of mine had done some experimentation with Asterisk. When I found out there wireless phones that would work over WiFi, I decided to stop trying to have two 2.4GHz networks fighting with each other and have a single shared network for both voice and data.

Hardware selection

Initially I got a Wildcard X100P card on ebay because my friend had good luck with this. The first one that came didn't work. The seller sent another but Caller ID did not work. After trying my friends, we found that Caller ID didn't work on his either. As a side effect of debugging the Caller ID problem, I did discover crosstalk between my main phone line and my fax line in the office were I was installing

I continued my initial proof of concept test with the X100P card and a Linksys EIP300 WiFi VoiP phone in order to get the go ahead from my wife Jennifer before investing in some higher quality hardware. She wasn't happy that the EIP300 didn't have a charging stand, but the voice quality was great throughout the house. I decided to get the Digium Wildcard TDM400P for my real installation. Specifically I got a TDM422P thatallows me to have both my voice and my fax line potentially integrated with Asterisk, as well as two POTS analog lines hooked up.

Installing trixbox

trixbox is a CentOS based distribution that will automatically install Asterisk, FreePBX, autodetect common digital telephone hardware, etc. So painless its almost embarassing to admit I used it. The community edution known as trixbox CE is completely free.

  1. Installed Digium Wildcard TDM400P card in old 450MHz Dell Dimension box with 384mb of RAM and a 120gb Western Digial harddrive.
  2. Downloaded trixbox CE 2.6 ISO image from http://internap.dl.sourceforge.net/sourceforge/asteriskathome/trixbox-2.6.0.0-i386-DVD.iso
  3. Burned ISO image onto CD Windows XP SP2 box with ISO Recorder http://isorecorder.alexfeinman.com/v2.htm
  4. Inserted CD into Dell. Booted and hit enter to install trixbox.
    WARNING: This will automatically format the disk in the machine.
    NOTE: you need to install any telephone cards in the box first if you want them autodetected.
  5. Hit enter for "English".
  6. Hit enter for "us".
  7. Selected timezone.
  8. Setup root password.
  9. Package installation took about 15 minutes at which time I removed the CD for the first reboot.
  10. Logged in as root and did a "yum -y update" to get latest fixes. Note if this includes a new kernel, you should reboot again. Note if you don't have a DHCP setup on your local network, you'll have to manually configure the network with something like system-config-network or the trixbox web GUI before using yum. I also did a "yum -y install emacs" to get my favorite text editor.

Initial configuration of trixbox

  1. login as root. The motd (message of the day) should say the URL to use for the trixbox web GUI. Remember this URL!
  2. BUG: chmod +x /usr/local/sbin/passwd-maint
  3. run "passwd-maint" to setup the "maint" password for the trixbox web GUI, which is seperate from the root account password.
  4. Now go to trixbox web GUI URL. Click the "switch" link in the upper right to switch from "User Mode" to "Admin Mode" and login as the maint user with your new password.

Everything should hopefully be green on the status page, with the exception of the HUD Server which is not installed.

You can used the Packages page to install additional software on your trixbox. The packages are really just managed with yum underneath, so you can use that if you prefer. On my old machine, I received a timeout after 30 seconds trying to access the Packages page. To fix this, I had to change /etc/php.ini to increase the "max_execution_time" from "30" to "180", higher then I did in the older trixbox 2.4 version.

If you want to be able to receive email notices from your trixbox, you need to setup the postfix mail software.

  1. From a root user prompt, enable and start the postfix server with "chkconfig postfix on; service start postfix; ".
  2. In the web GUI, switch from "User Mode" to "Admin mode".
  3. Select "Settings | General Settings" from the menu.
  4. Fill out the mail settings and click submit.
  5. You now have postfix configuration files such as/etc/postfix/main.cf and /etc/postfix/saslpasswd.
  6. I needed to specific an email password, you need to manually generate the /etc/postfix/saslpasswd.db and restart postfix with "postmap /etc/postfix/saslpasswd; postfix reload; ".
  7. Generate /etc/aliases.db from /etc/aliases.db with "newaliases".

Configuring trixbox 2.6 using a trixbox 2.2 backup

I wrote this section since I was upgrading this time with trixbox 2.6 instead of doing a fresh like I did with trixbox 2.2. However, if you are doing a fresh install, just skip to the next section to proceed with your own setup from scratch.

This migration document assumes you are migrating from one machine to another. I did this because I couldn't have the phones offline for an extended period of time. Of course, with some care, you can install 2.6 on the old machine, but you need to make sure you have done things such as migrate the FreePBX configuration.

FreePBX migration

FreePBX can only backup and restore from the same FreePBX version. So migrating from trixbox 2.2 to 2.6 is a two step process. First we need to upgrade the trixbox 2.2 FreePBX to version 2.4 and then restore the a newly created backup to trixbox 2.6 system.

On the trixbox 2.2 system:

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Click "Check for updates online".
  5. Click "2.4 Upgrade Tool", select "Download and install", then scroll to the bottom and click "Process".
  6. Click "Confirm".
  7. Click "Return".
  8. Click the orange "Apply Configuration Changes" in the upper left.
  9. Click the newly added "2.4 Upgrade Tool". Follow the instructions to:
    1. Migrated data
    2. Upgrade the FreePBX Framework module to 2.4
    3. Upgrade the rest of the FreePBX modules to 2.4
    4. Click the orange "Apply Configuration Changes" in the upper left.
  10. Click "Module Admin".
  11. Click "2.5 Upgrade Tool", select "Uninstall", then scroll to the bottom and click "Process".
  12. Click "Confirm".
  13. Click "Return".
  14. Leave the "Module Administration" page open for comparison with the 2.6 system

On the trixbox 2.6 system:

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Confirm that all of your trixbox 2.2 modules are installed on 2.6. If not, install them. Also check that the versions are at least close to the same.

On the trixbox 2.2 system:

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools" at the top, not "Setup" like other modules.
  3. Click "Backup & Restore".
  4. Click "Add Backup Schedule"
  5. Under "System Backup", fill out the form with something like this:
    Schedule Name: Now
    VoiceMail: yes
    System Recordings: yes
    System Configuration: yes
    CDR: yes
    Operator Panel: yes
  6. Under "Run schedule", set "Run Backup" to "Now".

On the trixbox 2.6 system:

  1. Setup "Backup & Restore" module as described below
  2. Copy a backup file from the /var/lib/asterisks/backups/Now directory on the old machine to the backup directory for your newly created schedule on the new machine.
  3. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  4. Click "Tools", not "Setup".
  5. Click "Backup & Restore".
  6. Click "Restore from Backup".
  7. Under "System Backup", click "Daily", then click the backup file you just copyed to the system.
  8. Click "Restore Entire Backup Set".

After restoring, things for me were a little strange. I had to leave FreePBX and return to "Apply Configuration Changes". Under "System Status" that some "backup" module was broken and the "framework" module was disabled. I had to "upgrade" the "framework" module from 2.4.1.2 to the older 2.4.1.0. Fortunately this was possible under "Module Admin" but just updating modules the usual way. After another round of "Apply Configuration Changes", I was able to upgrade the "framework" module back to the 2.4.1.2 version. I simply deleted the redundant "backup" module to deal with the other issue. It claimed it was unable to run the uninstall scripts, but after returning it was missing from the list of isses on the "Module Admin" page. Another round of updating removed one last spurious message about available updates.

I later notice there has no longer any hold music after the upgrade. I needed to change the "directory" option in "/etc/asterisk/musiconhold_additional.conf" from "/var/lib/asterisk/mohmp3/" to "/var/lib/asterisk/moh/".

Even later I noticed that ntp was not working. I had to replace my /etc/ntpd.conf with /etc/ntpd.conf.rpmnew and "service ntpd restart"

DHCP and name server migration

  1. Use "system-config-network" on the old box to change the static IP from 192.168.0.168 to 192.168.0.167
  2. Use "service network restart" on the old box to make the IP address change effective
  3. Use "system-config-network" on the new box to change to a static IP of 192.168.0.168
  4. Use "service network restart" on the new box to make the IP address change effective
  5. Disable and stop the dhcp and name servers on the old box with "chkconfig dhcpd off; service stop dhcpd; chkconfig named off; service stop named; ".
  6. Run "setup-dhcp" on the new box
  7. scp 192.168.0.167:/etc/dhcpd.conf 192.168.0.168:/etc/dhcpd.conf
  8. scp 192.168.0.167:/etc/named.conf 192.168.0.168:/etc/named.conf
  9. scp 192.168.0.167:/var/named/data/db-home 192.168.0.168:/var/named/data/db-home
  10. scp 192.168.0.167:/var/named/data/db-home_rev 192.168.0.168:/var/named/data/db-home_rev
  11. scp 192.168.0.167:/etc/resolve.conf 192.168.0.168:/etc/resolve.conf
  12. ssh 192.168.0.168 chown named:named /var/named/data/db-home
  13. ssh 192.168.0.168 chown named:named /var/named/data/db-home_rev
  14. Enable and start the dhcp and name servers on the new box with "chkconfig dhcpd on; service restart dhcpd; chkconfig named on; service start named; ".

tftp server and Cisco settings migration

  1. Run "setup-cisco" to create /tftpboot/SIPDefault.cnf
  2. scp 192.168.0.167:/tftpboot/SIPDefault.cnf 192.168.0.168:/tftpboot/SIPDefault.cnf
  3. scp 192.168.0.167:/var/www/html/cisco/bmp/carlstrom.bmp 192.168.0.168:/var/www/html/cisco/bmp/carlstrom.bmp
  4. scp 192.168.0.167:P0S3-07-4-00.zip 192.168.0.168:P0S3-07-4-00.zip
  5. ssh 192.168.0.168 unzip -d /tftpboot P0S3-07-4-00.zip
  6. ssh 192.168.0.168 ln -s /tftpboot/cisco_util/XMLDefault.cnf.xml /tftpboot/XMLDefault.cnf.xml
  7. scp 192.168.0.167:/tftpboot/SIP.cnf 192.168.0.168:/tftpboot/SIP.cnf

Moving the Digium Wildcard TDM400P

  1. Power off the old and new boxes
  2. Move card from old machine to new, noting cabling of external lines
  3. Run "genzaptelconf"
  4. Run "service asterisk restart"

Final hacks

After much frustration, I found I had to manually fix up some things before my migrated setup worked correctly. It might have been faster to setup from scratch given these issues.

I found that many of my extensions were not working until I enabled call waiting for each of them with FreePBX.

I found that the main voicemail box on extension was not working until I disabled and reenabled voicemail on the extension. This did not lose my old messages.

Adding an X-Lite VoIP client

For testing, its convenient to setup a software VoIP client. X-Lite is a free Windows client that you can use for this. To setup a Windows box as extension 100:

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Setup".
  3. Click "Extensions".
  4. Select "Generic SIP Device" and click "Submit".
  5. Fill out the form with something like this:
    User Extension: 100
    Display name: X-Lite
    secret: yet-another-password
    Click "submit".
  6. Click the orange "Apply Configuration Changes" in the upper left.
  7. Install X-Lite on some desktop machine. Enter the extension information matching your newly added extension on the "Account" tab of the "SIP Accounts" configuration screen:
    Display name: X-Lite
    User name: 100
    Password: yet-another-password
    Authorization user name: 100
    Domain: host information from your trixbox web GUI
    You can also setup the voicemail button by going to the "Voicemail" tab of the "SIP Accounts" configuration screen:
    Number to dial for checking voicemail: *97
  8. You should now be able to place a call to yourself at extension 100

Setting up Digium Wildcard TDM400P

Setting up a TDM400P is pretty easy. Generally if the card is installed in the machine before you install trixbox, it should be automatically configured. If not, you can get asterisk to automatically configure it after the fact simply by running "genzaptelconf". This is shown in the the Digium "TDM400P User's Manual" that comes with the TDM400P card and is also available online at http://www.digium.com/en/supportcenter/documentation/viewdocs/TDM400P.

Adding an analog line to the TDM400P

For testing, I wanted to add my old analog office speaker phone as an analog extension on one of the of the FXO ports on the TDM400P.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Setup".
  3. Click "Extensions".
  4. Select "Generic ZAP Device" and click "Submit".
  5. Fill out the form with something like this:
    User Extension: 101
    Display name: Office Speakerphone
    This device uses zap technology. channel: 1
    Click "submit".
  6. Click the orange "Apply Configuration Changes" in the upper left.

I can now call between X-Lite extension 100 and the analog phone extension 101.

Setting up outbound calling

Now that we can call between extensions, lets set things up so we can dial out To do this I need to setup a trunk and outbound route with FreePBX. This is pretty easy, the instructions are a little longer than necessary just because I want to remove the ZAP/g0 Trunk that is meant for a digital phone interface, in contrast with my analog TDM400P card.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Setup".
  3. Click "Trunks".
  4. Click "Add ZAP Trunk".
  5. Under "Generic Settings", set "Maximum Channels" to "1" since we just once to use one of the two FXS ports on the TDM400P.
    Under "Outbound Dial Rules", set "Outbound Dial Prefix" to "w" since we want to wait for a dialtone.
    Under "Outgoing Settings", set "Zap Identifer (trunk name)" to "3" since I am using the FXS on port 3 of my TDM400P.
    Click "Submit".
  6. Click on the left to Switch to "Outbound Routes".
  7. Click "0 9_outside".
  8. Change the "Trunk Sequence" from "Trunk ZAP/g0" to "Trunk ZAP/3" and click "Submit Changes".
  9. Click on the left to Switch to "Trunks".
  10. Click "Trunk ZAP/g0".
  11. Click "Delete ZAP/g0", which is should warn is not used by any routes.
  12. Click the orange "Apply Configuration Changes" in the upper left.

Now I can go to either extension 100 or 101 and dial out to my cell phone to test the sound quality.

Setting up inbound calling

Now that we can call out, lets setup inbound calling.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Setup".
  3. Click "Inbound Routes".
  4. Under "Add Incoming Route", set "Zaptel Channel Channels" to "3" to specify our FXS ports on the TDM400P.
    Under "Destination", select "Core" and then pick extension 100.
    Click "Submit".
  5. Click the orange "Apply Configuration Changes" in the upper left.

Now incoming phone calls will ring on extension 100. However, this is not really what I want in a home environment. I don't want to just ring one phone but all the phones. Fortunately, ring groups can provide what we want

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Click "Check for updates online".
  5. Click "Ring Groups", select "Download and install", then scroll to the bottom and click "Process".
  6. Click "Confirm".
  7. Click "Return".
  8. Click "Setup" at the top like before.
  9. Click "Ring Groups", which was just added on the left hand side.
  10. Under "Add Ring Group", set "Description" to "All Extensions Ring Group".
    Also set "Extension List" to 100 and 101.
    Under "Destination if no answer", select "Core" and then pick "Hangup".
    Click "Submit Changes".
  11. Click "Inbound Routes".
  12. Click the existing "any DID / any CID" incoming route.
  13. Under "Destination", change from "Core" extension 100 to "Ring Group" 600.
    Click "Submit".
  14. Click the orange "Apply Configuration Changes" in the upper left.

Now when I call in, both of my extensions ring. One minor issue with this is that I have to remember to update my ring group whenever I add new extensions. A more major issue is that if none of the extensions answers, we just hang up on on the caller. The next step is to setup voicemail so we can direct unanswered calls there. One minor issue is that FreePBX 2.2 seems to only allow creating a voicemail box as part of a specific extension, as opposed to creating a shared mailbox directly which is apparently possible in trixbox 2.3. So as part of setting up voicemail, we'll have to use an extension to create the voicemail box to use for the ring group. We also need to point other extensions such as 101 to use a mailbox of 100@device so that voicemail notification such as stutter dialtone and message waiting indicator (MWI) lights will work.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Click "Check for updates online".
  5. Click "Voicemail", select "Download and install", then scroll to the bottom and click "Process".
  6. Click "Confirm".
  7. Click "Return".
  8. Click "Setup" at the top like before.
  9. Click "Extension".
  10. Click extension 100
  11. Under "Voicemail & Directory", set "Status" to "Enabled" and set a voicemail password.
    Click "Submit".
  12. Click extension 101
  13. Under "Device Options", set "mailbox" to "100@device"
    Click "Submit".
  14. Click "Ring Groups".
  15. Click ring group 600.
  16. Under "Destination if no answer", change from "Core" "hangup" to "Core" "voicemail box 100".
    Click "Submit".
  17. Click the orange "Apply Configuration Changes" in the upper left.

Now would be a good time to dial in and play with voicemail. You can access voicemail in several ways. From an extension you can use "*97" to directly access this extensions voicemail or "*98" to be prompted for any mailbox. When leaving a message for a mailbox, including from an outside line, you can also press "*" to be prompted to login to the mailbox. Don't forget to record your voicemail greetings and name by pressing "0" from the voicemail box menu.

If you dial in to check voicemail with *97 on an extension other than 100, FreePBX will prompt you for the mailbox number. This is because the FreePBX definition for *97 app-vmmain assumes that the mailbox number is the extension number without consulting the mailbox property of extension we set above, prompting users to enter a mailbox number. The solution is to add our own custom definition for *97 and use the "Feature Code Admin" module to disable the built in FreePBX definition.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Click "Check for updates online".
  5. Click "Feature Code Admin", select "Download and install", then scroll to the bottom and click "Process".
  6. Click "Confirm".
  7. Click "Return".
  8. Click the orange "Apply Configuration Changes" in the upper left.
  9. Click "Setup" at the top like before.
  10. Click "Feature Codes", which was just added on the left hand side.
  11. Now we'll actually edit the Asterisk dialplan
    Addtion to /etc/asterisk/extensions_custom.conf
    ; my own version of app-vmmain that always goes to mailbox 100               
    [from-internal-additional-custom]
    exten => *97,1,Answer
    exten => *97,n,Wait(1)
    exten => *97,n,VoiceMailMain(100@default)
    exten => *97,n,Macro(hangupcall,)
    

A cool feature of FreePBX is the Privacy Manager which will direct all inbound calls without Caller ID information to a voice prompt. While calls with Caller ID pass through as before, calls without receive this message:

The party you are trying to reach does not accept unidentified calls. Please enter your phone number starting with the area code.
  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Inbound Routes".
  3. Click the existing "any DID / any CID" incoming route.
  4. Under "Privacy", change from "Privacy Manager" from "No" to "Yes".
    Click "Submit".
  5. Click the orange "Apply Configuration Changes" in the upper left.

Setting up a Cisco 7960 IP Phone

Cisco IP phones seem to be everywhere. I had one at Ariba, I had one at Stanford, and apparently every TV show from Fox's 24 to NBC's the West Wing uses them as well. So setting up my very own Cisco at home seemed like a cool hack, if nothing else.

Unfortunately, compared to most generic IP phones, Cisco phones are a pain to setup. The first reason is that by default Cisco uses their own SCCP (aka Skinny) protocol, as opposed to the standard SIP protocol. Although Asterisk has a few options to support SCCP, they are not as well documented or integrated with tools such as FreePBX or trixbox. The second reasons is that the phones want to talk to a TFTP server when the boot up to configure themselves. The TFTP server needs to be specified by the DHCP server, and probably no home routers built in DHCP server do not allow a TFTP server option to be specified. So now I need to make my trixbox server a DHCP box so I can tell DHCP clients such as Cisco phones that the TFTP server is also on my trixbox.

Enabling DHCP server on trixbox

  1. login as root and run "system-config-network". Changed to a fixed IP address instead of using dynamic IP configuration since this box is going to be the dhcp server.
  2. Again as root, run "setup-dhcp" to setup basic dhcpd configuration.
  3. Edit /etc/dhcpd.conf to set correct subnet for your network. The default 192.168.1.* seems to match the linksys defaults, not the netgear default of 192.168.0.*. I ended up with somthing like the below. Note the ddns-* options are to allow dynamic DNS integration with a nameserver for a domain called "home", matching configuration to follow below. Also note that I used fixed addresses for phones with names and IP address matching my extension numbers just to make everything a little less confusing. Most importantly, note the tftp-server-name which will tell the Cisco phones were to get their updates and configurations.
    Example of /etc/dhcpd.conf
    authoritative;
    ddns-domainname "home";
    ddns-update-style interim;
    ignore client-updates;
    
    # If you have fixed-address entries you want to use dynamic dns
    update-static-leases on;
    
    include "/etc/rndc.key";
    
    subnet 192.168.0.0 netmask 255.255.255.0 {
    
      option routers                  192.168.0.1;
      option subnet-mask              255.255.255.0;
      option nis-domain               "home";
      option domain-name              "home";
      option domain-name-servers      192.168.0.168;
    # option time-offset              -18000; # Eastern Standard Time 
      option time-offset              -28800; # Pacific Standard Time
      option ntp-servers              192.168.0.168;
      option tftp-server-name         "192.168.0.168";
    
      range dynamic-bootp 192.168.0.200 192.168.0.254;
      default-lease-time 43200;
      max-lease-time 86400;
    }
    
    # home zone
    zone home. {
      primary 192.168.0.168;
      key "rndckey";
    }
    
    # reverse DNS for home zone
    zone 0.168.192.in-addr.arpa {
      primary 192.168.0.168;
      key "rndckey";
    }
    
    group {
     use-host-decl-names on;
     ddns-domainname "home";
    
      host phone123 {
        ddns-hostname "phone123";
        hardware ethernet 00:FF:00:FF:00:FF;
        fixed-address 192.168.0.123;
      }
    [...]
    }
    
  4. Edit /etc/named.conf to setup a DNS name server. This contains a "home" zone that maps from names like phone123.home to IP addresses and a zone that maps from 192.168.0.* addresses to DNS names. The actually details will be in db-home and db-home_rev shown below. Note the shared rndckey from /etc/rndc.key that was also mentioned in dhcpd.conf is what allows dhcpd to push its dynamically assigned names to named.
    Example of /etc/named.conf
    // Default named.conf generated by install of bind-9.2.4-24.EL4
    options {
            directory "/var/named";
            dump-file "/var/named/data/cache_dump.db";
            statistics-file "/var/named/data/named_stats.txt";
            forwarders { 
                    8.8.8.8; // google-public-dns-1.google.com
                    8.8.4.4; // google-public-dns-b.google.com
    //              192.168.0.1; // local gateway router
            };
    };
    include "/etc/rndc.key";
    
    zone "home" {
      type master;
      file "/var/named/data/db-home";
      allow-update { key rndckey; };
    };
    
    zone "0.168.192.in-addr.arpa" {
      type master;
      file "/var/named/data/db-home_rev";
      allow-update { key rndckey; };
    };
    
  5. Edit /var/named/data/db-home to contain the mapping from names to IP addresses. Note that I have defined phone.home as the static IP 192.168.0.168 which as a CNAME (aka alias) of ns.home, where ns is an abbreviation for name server. Note that after dhcpd starts assigning addresses they will be added to this file.
    Example of /var/named/data/db-home
    [root@asterisk1 ~]# cat /var/named/data/db-home
    $ORIGIN .
    $TTL 38400      ; 10 hours 40 minutes
    home                    IN SOA  phone.home. root.home. (
                                    2007090249 ; serial
                                    10800      ; refresh (3 hours)
                                    3600       ; retry (1 hour)
                                    604800     ; expire (1 week)
                                    38400      ; minimum (10 hours 40 minutes)
                                    )
                            NS      phone.home.
    $ORIGIN home.
    $TTL 38400      ; 10 hours 40 minutes
    ns                      CNAME   phone
    phone                   A       192.168.0.168
    
  6. Edit /var/named/data/db-home_rv to contain the mapping from IP addresses to names. Note again that I have defined phone.home as the static IP 192.168.0.168. Note again that after dhcpd starts assigning addresses they will be added to this file.
    Example of /var/named/data/db-home_rev
    $ORIGIN .
    $TTL 38400      ; 10 hours 40 minutes
    0.168.192.in-addr.arpa  IN SOA  phone.home.mhm. home.mhm. (
                                    2006021866 ; serial
                                    10800      ; refresh (3 hours)
                                    3600       ; retry (1 hour)
                                    604800     ; expire (1 week)
                                    38400      ; minimum (10 hours 40 minutes)
                                    )
                            NS      phone.home.
    $ORIGIN 0.168.192.in-addr.arpa.
    $TTL 38400      ; 10 hours 40 minutes
    168                     PTR     phone.home.
    
  7. Edit /etc/resolve.conf to point the local machine to itself as the name server as well as making the "home" domain the default suffix for names that don't resolve. This allows use to just use a hostname of phone123 instead of having to type phone123.home.
    Example of /etc/resolve.conf
    nameserver 192.168.0.168
    search home
    
  8. Make sure the DHCP server will start when the server reboots:
    chkconfig dhcpd on
    
  9. Make sure the BIND name server will start when the server reboots:
    chkconfig named on
    
  10. Start the DHCP server now:
    service dhcpd start
    
  11. Start the BIND name server now:
    service named start
    
  12. If you had an old DHCP server such as a Netgear or Linksys home firewall box, you'll want to make sure that is now disabled...

For reference on all the dhcpd and named configuration I used a combination of two sources:

  1. http://www.semicomplete.com/articles/dynamic-dns-with-dhcp/
  2. http://idahopcug.apcug.org/Linux/dnshowto.pdf

Setting up TFTP server on trixbox to upgrade Cisco firmware

Now when we boot a Cisco phone on the network with the trixbox server, it should see the new DHCP server and then try and contact the trixbox's tftp server. However, we still need to configure that to support the Cisco phones.

  1. login as root and run "setup-cisco" to create /tftpboot/SIPDefault.cnf
  2. edit SIPDefault.cnf to change 'image_version: "P0S3-07-5-00"' to image_version: "P0S3-07-4-00".
  3. edit SIPDefault.cnf to change 'directory_url' from PhoneDirectory.php to LocalDirectory.php so that the "Directory" button on the phone will do something useful, showing a list of extensions. Instructions for getting PhoneDirectory.php to work will be discussed below.
  4. edit SIPDefault.cnf to change 'timezone' from EST to PST so that the time will be display correctly in California.
  5. edit SIPDefault.cnf to change 'logo_url' from "http://192.168.0.168/cisco/bmp/trixbox.bmp" to "http://192.168.0.168/cisco/bmp/carlstrom.bmp" for custom phone bitmap.
  6. Grab a 7.4 SIP firmware image from http://www.xs4all.nl/~graver1/cisco/SIP-7960/P0S3-07-4-00.zip
    Note that 7.5 and 8.x version are reported to have problems, and you can't downgrade between major release versions. Sigh.
  7. Unzip the contents of P0S3-07-4-00.zip in /tftpboot, overwriting the old OS79XX.txt which refers to version 7.1, not 7.4
  8. I needed to make the XMLDefault.cnf.xml file available for my SCCP phone to find and load the SIP firmware. Some sites suggest removing this once your phones are upgraded but I have left mine.
    ln -s /tftpboot/cisco_util/XMLDefault.cnf.xml /tftpboot/XMLDefault.cnf.xml
    

I used a Cisco document as reference, but it really as useful as the voip-info.org pages:

  1. http://www.cisco.com/en/US/products/hw/phones/ps379/products_tech_note09186a0080094584.shtml.

Setting up Cisco extensions using FreePBX and Endpoint Manager

By now you hopefully have a Cisco phone on your network booting a SIP firmware image obtained from your TFTP server. The final step is to create a SIP extension and use Endpoint Manager to update the proper /tftpboot/SIP*.cnf file. Just make sure to set nat to false in the SIP extension setup or things won't work.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Setup".
  3. Click "Extensions".
  4. Select "Generic SIP device" and click "Submit".
  5. Fill out the form with something like this:
    User Extension: 102
    Display name: Office Cisco
    secret: yet-another-password
    Click "submit".
  6. Now click the newly added extension and change two more parameters which were not availble on the add extension screen:
    nat: no
    mailbox: 100@device
  7. Click the orange "Apply Configuration Changes" in the upper left.
  8. Select "PBX | Endpoint Manager" from the menu.
  9. Click "Cisco phones"
  10. Click "Add phone"
  11. Enter MAC address and click submit. This will create /tftpboot/SIP<mac>.cnf

Setting up the Cisco Phone Directory and other XML services

Cisco phones have a services button that can be used to provide simple information services via an XML protocol. trixbox comes with some default services menu that includes:

  1. Phone Directory
  2. Search by Name
  3. Local Directory
  4. Help
  5. RSS Feeds

This menu is driven by /var/www/html/xmlservices/index.php. The services are driven with a templating system that can render HTML as well as various other formats to support phones from Aastra, Cisco, Grandstream, and Polycom. You can view the HTML version of the services in your browser at http://192.168.0.168/xmlservices

The "Phone Directory" is setup to pull from SugarCRM contacts. Unfortunately, although SugarCRM was bundled in earlier versions of trixbox, it is no longer included in 2.6. Rather than setup all of SugarCRM to get the "Phone Directory" working, I instead decided to just create a fake sugarcrm database and contacts table it and populate it with contacts exported from another system.

To give the basic idea, here is a SQL script that can be used to create and populate a minimal SugarCRM contacts database:

Example of SugarCRMContacts.sql
/* Run to import: mysql --password=passw0rd < SugarCRMContacts.sql */
drop database if exists sugarcrm;
create database sugarcrm;
use sugarcrm;
create table contacts (
id char(36) not null,
deleted bool default '0' null,
first_name varchar(100) null,
last_name varchar(100) null,
phone_home varchar(25) null,
phone_work varchar(25) null,
phone_mobile varchar(25) null,
phone_other varchar(25) null,
primary key (id)
);

insert into contacts set
id='1,
first_name='Fred',
last_name='Flintstone',
phone_home='(555) 123-1234',
phone_work='',
phone_mobile='(555) 123-3214',
phone_other='(555) 123-2314'
;

insert into contacts set
id='2,
first_name='Barney',
last_name='Rubble,
phone_home='',
phone_work='(555) 321-4321,
phone_mobile='',
phone_other=''
;

With the populated sugarcrm contacts table, not only does the "Phone Directory" work but also the "Search by Name" service.

The "Local Directory" service provides a directory of local extensions, also provided as the external directory option under the directories button on the Cisco. If you prefer, you can change the external directory to use the newly working "Phone Directory" by reverting the directory_url change to SIPDefault.cnf and rebooting your phone.

The "Help" service provides a Asterisk command reference.

The "RSS Feeds" service by default tries to provide the Wall Street Journal "What's News" feed. Unfortunately, it is broken out of the box in trixbox 2.6. I downloaded the original code for xmlrssparse and found that the trixbox had a broken xmlrssparse.html file which stripped out the HTML comments which actually were being used as markers in the template.

Replacement /var/www/html/xmlservices/rss/xmlrssparse.html
<!-- BEGIN: main -->
<CiscoIPPhoneText>
<Title>{main_title}</Title>
<Prompt>RSS Feed</Prompt>
<Text><!-- BEGIN: feed -->{title} - {description} {date} {newline} <!-- END: feed --></Text>
</CiscoIPPhoneText>
<!-- END: main -->

By replacing the xmlrssparse.html file with the original, the "RSS Feeds" service will be working. The xmlrssparse web site has a list of RSS feeds they have tested. You can add more to the "RSS Feeds" service menu by editing /var/www/html/xmlservices/rssfeeds.php

Cisco SIP telnet server

The Cisco SIP image has a telnet server which can also be used for configuration and debugging. How 90's! The default password is cisco. There is some command documentation here: http://www.cisco.com/en/US/products/sw/voicesw/ps2156/products_administration_guide_chapter09186a008016107b.html. Something simple to try is "show config"

Setting up an Hitachi Cable Wireless IP 3000 Phones

NOTE: Hitachi no longer makes VoIP phones. They recommend the UniData WPU-7700 as a similar product. Fortunately there seem to be many WiFi VoIP handsets with charging stands available now.

After setting up the Cisco phones, anything is easy. Most SIP phones just need to have a basic SIP extension like I did for X-Lite. I picked the Hitachi Cable Wireless IP 3000 phone as the main handset for around the house because it was the only one that passed the wife test of having a simple charging cradle base.

Although annoying to configure WEP keys and the like using a phone handset, once done the SIP configuration and other options could be set via a web server running on port 8080 on the phone itself (username admin and default password 000000)

Some things I have configured via the phone's web server:

  • Under "Configuration | Time", change the following form values:
    Date Format: DD Jan,YY (Sun) Time Format: 12 hour format hours Time Zone: GMT-08:00 Enable Daylight Savings Time: On
  • Under "Configuration | SMS", change the following form values:
    Use SMS: Off
  • Under "Configuration | Presence", change the following form values:
    Use Presence: Off
  • Under "Configuration | DTFM", change the following form values:
    Mode: In-Audio+SIP-INFO

The Hitachi will display a notification for new messages. When you hit talk to dial in to respond to the notification, it displace "asterisk Unavailable". asterisk -r "sip debug" showed that the SIP NOTIFY message sent to the Hitachi actually did tell the phone to responed to the "asterisk" extension. Based on the thread here I added the following likes to the "[from-internal-additional-custom]" described above to allow one button access to the voicemail box.
Addtion to /etc/asterisk/extensions_custom.conf

; Hitachi phones are told to connect to "Message-Account: sip:[email protected]"
exten => asterisk,1,Answer   
exten => asterisk,n,Wait(1)   
exten => asterisk,n,VoiceMailMain(100@default)   
exten => asterisk,n,Macro(hangupcall,)   

There is a Windows tool called USB Manager that is largely used to import and export the devices phone book, which is not something you can do via the web server. The latest version of the software I could find was 2.3. Technically the software was only supposed to be available to registered partners who had received training but many resellers had posted it online. If the 2.3 link stops working, I suggest searching for v2_3x_0608_eng.zip, v2_2x_eng.zip, USBManager2_1_8.zip, USBManager2_1_7.zip, or USBManager.zip

I tried out USBManager2_1_8.zip. It talks to the phone via a mini-USB cable to manage the import and export the device's phone book as a CSV file. It also has an admin tool to save and restore phone settings by hitting "Alt-S".

If you want to import a phone book into a Hitachi, here is an example of the CSV file format:

Group,Name ,,,,
0,Group,,,,

Index,Name ,RdNm ,Tel  ,Group
1,Fred Flintstone home,,5551231234,0
2,Fred Flintstone mobile,,5551233214,0
3,Fred Flintstone other,,5551232314,0
4,Barney Rubble work,5553214321,0

The first section defines groups, which can then be used on the phone for searching. For example, you could define a Friends group and a Family group. By default, the phone has a group named Group, which I use in below example. The second section defines the actual directory entries. The first column is a unique index which can be used as a speed dial. The second column is a name and the third is a nick name, which I leave blank in the example below. The fourth column is the actual phone number. The fifth and final column is the group identifier, which is a reference the the group id in the first section.

Setting up an Android phone with sipdroid

I was excited to finally ditch my iPhone for a Google Nexus One. Soon after my wife got a myTouch 3G. It only took a few minutes to add each to trixbox using sipdroid. Just add a basic SIP extension like for X-Lite or the Hitachi Cable Wireless IP 3000 Phones. In "Sipdroid | Settings | SIP Account Settings", just set the "Authorization Username" to your extension number, "Password" to your secret, "Server" to your trixbox server address like 192.168.0.168. I also set "Sipdroid | Settings | Call Options | Preferred Call Type" to "Phone" instead of "Sipdroid, when available" because I just wanted to receive incoming calls with sipdroid by default.

Backing up your trixbox

At this point I had a production PBX system at home. I put away most of my old phones so if my trixbox had a hard drive crash, I would need to get the system back online as quickly as possible.

My first step was a simple rsync backup script. It runs on another box at home as a daily cron job focusing on backing up the /etc, /var, /root and /tftpboot directories. The /etc directory, particularlly /etc/asterisk/ contains most of the vital configuration files for the sytem. The /var/ directory has important runtime files such as in the /var/named. The /root directory is just the home directory for the super user on the asterisk box and I often keep downloaded working files here so I want it backed up as well. The /tftpboot directory has the files for Cisco phones.

Example of backup-phone
#!/bin/sh
date
phone=phone
mkdir -p /home/Backup/phone
rsync \
	--rsh=ssh \
	--archive \
	--compress \
	--partial \
	--delete --delete-excluded --cvs-exclude \
	--exclude X11/gdm/Init/:0 \
	--exclude cups/certs/0 \
	--ignore-errors --timeout=600 \
	--verbose --stats \
	root@$phone:/etc/ \
	/home/Backup/phone/etc/ \
	| tee /var/log/backup-phone-etc.log | grep -v '/$'
rsync \
	--rsh=ssh \
	--archive \
	--compress \
	--partial \
	--delete --delete-excluded --cvs-exclude \
	--exclude backups/dpkg.status.* \
	--exclude cache/ \
	--exclude empty/ \
	--exclude gdm/ \
	--exclude lib/apt/ \
	--exclude lib/defoma/fontconfig.d \
	--exclude lib/dhcp/dhclient-eth0.leases \
	--exclude lib/dhcp3/dhclient.eth0.leases \
	--exclude lib/dpkg/ \
	--exclude lib/logrotate.status \
	--exclude lib/logrotate/status \
	--exclude lib/tomcat5/ \
	--exclude lib/ntp/drift \
	--exclude lib/update-notifier/dpkg-run-stamp \
	--exclude lock/subsys/cups \
	--exclude log/ \
	--exclude named/chroot/ \
	--exclude run/ \
	--exclude slocate/slocate.db \
	--exclude spool/anacron/cron.daily \
	--exclude spool/anacron/cron.weekly \
	--exclude spool/slrnpull/ \
	--ignore-errors --timeout=600 \
	--verbose --stats \
	root@$phone:/var/ \
	/home/Backup/phone/var/ \
	| tee /var/log/backup-phone-var.log | grep -v '/$'
rsync \
	--rsh=ssh \
	--archive \
	--compress \
	--partial \
	--delete --delete-excluded --cvs-exclude \
	--exclude .cache \
	--exclude .gkrellm2 \
	--exclude .mcop/trader-cache \
	--exclude .mozilla/firefox/*/Cache/ \
	--exclude .nautilus/metafiles \
	--exclude .vnc \
	--exclude .xine/session.0 \
	--ignore-errors --timeout=600 \
	--verbose --stats \
	root@$phone:/root/ \
	/home/Backup/phone/root/ \
	| tee /var/log/backup-phone-root.log | grep -v '/$'
rsync \
	--rsh=ssh \
	--archive \
	--compress \
	--partial \
	--delete --delete-excluded --cvs-exclude \
	--ignore-errors --timeout=600 \
	--verbose --stats \
	root@$phone:/tftpboot/ \
	/home/Backup/phone/tftpboot/ \
	| tee /var/log/backup-phone-tftpboot.log | grep -v '/$'
df -h /home/Backup

date

Although I always setup rsync scripts to backup all my Unix and Windows boxes, FreePBX provides some additional backup functionality that it seems worth taking advantage of.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Click "Check for updates online".
  5. Click "Backup & Restore", select "Download and install", then scroll to the bottom and click "Process".
  6. Click "Confirm".
  7. Click "Return".
  8. Click "Tools" at the top, not "Setup" like other modules.
  9. Click "Backup & Restore".
  10. Click "Add Backup Schedule"
  11. Under "System Backup", fill out the form with something like this:
    Schedule Name: Daily
    VoiceMail: yes
    System Recordings: yes
    System Configuration: yes
    CDR: yes
    Operator Panel: yes
  12. Under "Run schedule", set "Run Backup" to "Daily (at midnight)".

The backups are tar files stored in /var/lib/asterisk/backups. I run backup-phone cron job at noon daily so it will always move the previous FreePBX backups off the machine on a daily basis. You can use a "Run schedule" of "Now" to force an instantaneous backup.

Eliminating the "dial 9" requirement

Although at this point I have a functional Asterisk system for the home, my wife does not like the requirement to dial 9. She is especially concerned about out-of-town guests and other visitors being able to use the phone, especially if they needed to place a call in an emergency. It is particularlly frustrating where we live since our local 7-digit numbers start with 9. I was dreading this as one of things that would be possible in an arbitrary Asterisk configuration but perhaps impossible using the FreePBX interface but I couldn't have been father from the truth.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Setup".
  3. Click "Outbound Routes".
  4. Click "Add Route".
  5. Set the "Route Name" to "Family_Friendly"
  6. Set the "Dial Patterns" to:
    311
    411
    511
    611
    911
    011.
    1800NXXXXXX
    1866NXXXXXX
    1877NXXXXXX
    1888NXXXXXX
    1NXXNXXXXXX
    NXXNXXXXXX
    NXXXXXX
    
    I used the dial pattern wizard to construct most of these.
  7. Set the "Trunk Sequence" to "ZAP/3"
  8. click "Submit Changes".
  9. Click the up arrow on the list of routes on the right to give the new "Family_Friendly" route priority over the old "9_outside" route. This means that if the number does not match
  10. Click the orange "Apply Configuration Changes" in the upper left.

Returning calls to 10-digit CallerID numbers

Another issue that came up within the first day of active use was wanting to return calls based on the Caller ID information from the call log. The outbound route I had setup already matched numbers of the form NXXNXXXXXX but the phone company kindly informed me I needed to dial a 1 before that type of number. Fortunately there was a very simple solution to this issue:

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Setup".
  3. Click "Trunks".
  4. Click "Add ZAP Trunk".
  5. Under "Outgoing Dial Rules", set "Dial Rules" to the single line of "1+NXXNXXXXXX". This simply means to add the digits before the "+" when the number matches the pattern after the plus.
    Click "Submit".
  6. Click the orange "Apply Configuration Changes" in the upper left.

I think at one company I worked at they never managed to get this working, meaning you could return calls to internal extensions from the call log but not external calls. I'll leave you to draw your own conclusions from this...

Fixing 611 to dial the phone company repair line instead of weather

In my "Family_Friendly" outbound route I made sure to include 611 as a dial pattern to go to the ZAP/3 trunk. However, 611 is hardwired to go to nv-weather.php in /etc/asterisk/extensions_trixbox.conf. I googled about 611 and found some references to setting it up using the "Misc Destinations" module. I figured I should install that to see if it would let me remap 611 to some other number.

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Click "Check for updates online".
  5. Click "Misc Destinations", select "Download and install", then scroll to the bottom and click "Process".
  6. Click "Confirm".
  7. Click "Return".
  8. Click the orange "Apply Configuration Changes" in the upper left.
  9. Click "Setup" at the top like before.
  10. Click "Misc Destinations", which was just added on the left hand side.

Unforunately it is not managable through the "Misc Destinations" module like it probably should and could be... The simple solution to get real 611 working is do replace the string 611 with something else like 612 in extensions_trixbox.conf file followed by a "service asterisk restart".

Having done this, I found that weather, now on 612, didn't actually work anyway. Seems like the provided script depended on pdaweather.org which changed its website. A newer version using NOAA data seems to be available from: http://bestof.nerdvittles.com/applications/weather-airport/ I just commented out the 612 extension in extensions_trixbox.conf.

While I was in extensions_trixbox.conf, I noticed *61 as an alternative weather script, but it also was not functionally so I disabled it as well. I did also find the *62 wakeup call application which seemed to work...

Supporting call waiting on the POTS zaptel trunk

Call waiting was been the most difficult feature to get working, probably second only to all the work to get the Cisco phones going.

I had something sort of working for trixbox 2.2 based on the *3/*4 approach found in http://lists.digium.com/pipermail/asterisk-users/2006-February/140818.html although I had changed it to be *0 for both the callee and caller case, since only one of the two DYNAMIC_FEATUREs would be enabled at a time. However, it was flakey enough that my wife gave up on using it.

When I moved to trixbox 2.6 I want to make sure I had a solid solution that worked. I first updated my 2.2 code for 2.6, setting outflash in macro-dialout-trunk-predial-hook and inflash in macro-from-zaptel-3. After much debugging, I found that for the inflash case I needed to use _DYNAMIC_FEATURES (note the underscore) to indicate that I wanted the DYNAMIC_FEATURE variable copied from the zap channel to the sip channel.

Addtion to /etc/asterisk/extensions_custom.conf

[macro-from-zaptel-3]
exten => s,1,NoOp(macro-from-zaptel-3 before set: DYNAMIC_FEATURES: ${DYNAMIC_FEATURES})
exten => s,n,Set(_DYNAMIC_FEATURES=inflash)
exten => s,n,NoOp(macro-from-zaptel-3 after set: DYNAMIC_FEATURES: ${DYNAMIC_FEATURES})
; end of [macro-from-zaptel-3]

[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(macro-dialout-trunk-predial-hook before set: DYNAMIC_FEATURES: ${DYNAMIC_FEATURES})
exten => s,n,Set(DYNAMIC_FEATURES=outflash)
exten => s,n,NoOp(macro-dialout-trunk-predial-hook after set: DYNAMIC_FEATURES: ${DYNAMIC_FEATURES})
; end of [macro-dialout-trunk-predial-hook]
Addtion to /etc/asterisk/features_applicationmap_custom.conf
inflash => *0,caller,Flash,()
outflash => *0,callee,Flash,()

However, with this configuration, with the inbound case I was getting an app_flash.c error complaining that the sip channel "is not a Zap channel". After changing caller to callee in the features_applicationmap_custom.conf, things finally worked. However, then there was no point to setting different features for the inbound and outbound case! So I changed to a much simpler two line configuration shown here:

Addtion to /etc/asterisk/extensions_custom.conf
DYNAMIC_FEATURES=>cwflash
Addtion to /etc/asterisk/features_applicationmap_custom.conf
cwflash => *0,callee,Flash,()

This configuration is a little over simplified because if you technically do not want *0 enabled when there is a not a zap channel involved, since hitting *0 when on an internal house SIP-to-SIP call will cause a hangup, but this is a rare situation in my house so I decided to make things as simple as possible since depending on things like macro-from-zaptel-3 and macro-dialout-trunk-predial-hook seems fragile when upgrading.

A final note from by debugging is that it is important to hit the two key *0 combination in quick succession. I learned from the debug output that there can only be 500ms between the keys. Ironically part of my wife's problem was that when things were not working she slowed down entering the keys which made things even worse! Of course, we've all be trained not to enter things too fast when dialing into analog systems so it is counterintuitive to try to do it as fast as possible.

Joining a conversation from another extension

The ChanSpy command, which is new to Asterisk 1.4 first available in trixbox 2.6, will finally allow us to implement the simple desire to pickup any extension and joing the conversation.

There is an example use of ChanSpy in extensions_additional.conf. However, it only allows you to listen on a channel, but we want to be able to talk as well so we need to make some changes.

  1. Copy [app-chanspy] from /etc/asterisk/extensions_additional.conf to /etc/asterisk/extensions_override_freepbx.conf
  2. Change the ChanSpy command in [app-chanspy] to specify our main trunk on the Zap/3 channel as well as "w" for whisper mode. Addtion to /etc/asterisk/extensions_override_freepbx.conf
    [app-chanspy]
    include => app-chanspy-custom
    exten => 555,1,Macro(user-callerid,)
    exten => 555,n,Answer
    exten => 555,n,Wait(1)
    exten => 555,n,ChanSpy(Zap/3|w)
    exten => 555,n,Hangup
    
    ; end of [app-chanspy]
    
  3. Restart asterisk with "service asterisk restart"
  4. Dialing "555" from an inactive extension should now join an existing call

Setting up hold music

Hold music is not really that important for a home system. However with our old system, there was nothing but silence on hold and that made callers nervous that they had been disconnected. Give how it easy it is to do better with FreePBX, I thought I would play around. It turns out there is some hold music already installed with FreePBX, but we can add our own. I grabbed the public domain classical music performed by Elena Kuschnerova and Lev Guelbard from: http://www.aussievoip.com.au/sounds/allsounds.tgz

  1. Select "PBX | PBX Settings" from the Web GUI Admin Mode menu.
  2. Click "Tools", not "Setup".
  3. Click "Module Admin".
  4. Click "Check for updates online".
  5. Click "Music on Hold", select "Download and install", then scroll to the bottom and click "Process".
  6. Click "Confirm".
  7. Click "Return".
  8. Click the orange "Apply Configuration Changes" in the upper left.

You can then use "Music on Hold" from FreePBX setup to add or remove music files from the hold rotation.

Create missing "text-to-speech" directory

I was receiving this email warning every day from cron:

/etc/cron.daily/asterisk_cleanup:

/usr/bin/find: /var/lib/asterisk/sounds/tts: No such file or directory

to fix this I simply created the missing directory, although I tried to create it with the ownership and permissions as indicated elsewhere on the web:

mkdir /var/lib/asterisk/sounds/tts
chown asterisk:asterisk /var/lib/asterisk/sounds/tts
chmod 777 /var/lib/asterisk/sounds/tts

Customizing logrotate emails

You can customize logrotate emails in the file /etc/logrotate.d/asterisk. By default it emails old logs before rotating them. You can disable this by commenting out the "mail" lines.

Webmin

The webmin tool lets you administer common linux settings from a web gui instead of directly from text files. In trixbox 2.4 webmin was installable via the Packages page or yum. However, in trixbox 2.6 you need to follow the instructions here:

http://trixbox.org/wiki/webmin

Once installed you can access webmin though port 10000 on your box via a URL like http://phone:10000/.

Enabling nightly yum updates

This will make sure we get the latest security updates automatically.

chkconfig yum on  # enable yum service on next reboot
service yum start # start yum service now

You can also set an "Update Email" addresses under FreePBX "General Settings" module to send notifications of available FreePBX updates.

Joining asterisk-announce

If you are really going to be running a production Asterisk server, it is probably a good idea to sign up to receive announcements about import update and security issues: http://lists.digium.com/mailman/listinfo/asterisk-announce


Brian D. Carlstrom [email protected]