Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng

Quản trị net diễn đàn chia sẻ thông tin các thủ thuật mạng, internet bảo mật thông tin dành cho giới IT VIệt hy vọng là nơi bổ ích cho cộng đồng (http://quantrinet.com/forum/index.php)
-   Trixbox, Elastix (http://quantrinet.com/forum/forumdisplay.php?f=319)
-   -   Install & Configure Trixbox 2.6 with Digium Wildcard TDM400P (http://quantrinet.com/forum/showthread.php?t=4208)

hoctinhoc 13-11-2009 11:58 AM

Install & Configure Trixbox 2.6 with Digium Wildcard TDM400P
 

Install & Configure Trixbox 2.6 with
Digium Wildcard TDM400P


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/s...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 netconfig 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 Asterisk with FreePBX with an X-Lite VoIP client
  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 login as the maint user, with your new password. Complete the registration page if you like or you can disable it under "Settings | Registration" by clicking "Don't ask me to register again". Otherwise, everything should hopefully be green on the status page, with the exception of the HUD Server which is not installed.
    If you want to use the Packages page, ogin in the upper right using a trixbox.org account. The packages are really just managed with yum underneath, so you can use that if you prefer
  5. Select "Asterisk | FreePBX" from the menu.
  6. Click "Setup".
  7. Click "Extensions".
  8. Select "Generic SIP Device" and click "Submit".
  9. Fill out the form with something like this:
    User Extension: 100
    Display name: X-Lite
    secret: yet-another-password
    Click "submit".
  10. Click the orange "Apply Configuration Changes" in the upper left.
  11. 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
  12. 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 eazy, even though its a little harder in trixbox 2.2.4 because of a install bug. Basically, trixbox installed zaptel-modules-2.6.9-34.0.2.ELsmp, even though I need zaptel-modules-2.6.9-34.0.2.EL (for the non-smp kernel it installed). Having resolved that issue, it was smooth saling
  1. "yum install zaptel-modules-2.6.9-34.0.2.EL" to get the proper zaptel modules for my kernel
  2. "genzaptelconf" to setup the zaptel modules
  3. re run "genzaptelconf" to generate the correct /etc/zaptel.conf as show 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/supportcent...ewdocs/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. Return to FreePBX in the trixbox Web GUI.
  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. Return to FreePBX in the trixbox Web GUI.
  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. Return to FreePBX in the trixbox Web GUI.
  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. Return to FreePBX in the trixbox Web GUI.
  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. Return to FreePBX in the trixbox Web GUI.
  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. Return to FreePBX in the trixbox Web GUI.
  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,)
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 this, 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 make my trixbox server my 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 "netconfig". 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 this. Note the ddns 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

    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 {
    192.168.0.1;
    };
    };
    include "/etc/rndc.key";

    zone "home" {
    type master;
    file "/var/named/db-home";
    allow-update { key rndckey; };
    };

    zone "0.168.192.in-addr.arpa" {
    type master;
    file "/var/named/db-home_rev";
    allow-update { key rndckey; };
    };
  5. Edit /var/named/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/db-home
    [root@asterisk1 ~]# cat /var/named/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/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/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...dns-with-dhcp/
  2. http://idahopcug.apcug.org/Linux/dnshowto.pdf
continue



Install & Configure Trixbox 2.6

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.
  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/...80094584.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. Return to FreePBX in the trixbox Web GUI.
  2. Click "Setup".
  3. Click "Extensions".
  4. Select "Genric 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 "Asterisk | 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.cnf
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/...08016107b.html. Something simple to try is "show config"

Setting up an Hitachi Cable Wireless IP 3000 Phones


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.
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
There is a Windows tool called USB Manager. I tried out USBManager2_1_8.zip. It can be used to talk to the phone as a USB device allows you to manage the import and export the device's phone book as a CSV file. Useful if you want to upload the same phone book to a number of phones, but not much else. It also has an admin tool to save and restore phone settings by hitting "Alt-S".
The Hitachi's display a notification for new message. 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: http://forums.digium.com/viewtopic.p...564470296147e5 I added the following likes to the "[from-internal-additional-custom]" described above.

Addtion to /etc/asterisk/extensions_custom.conf
; Hitachi phones are told to connect to "Message-Account: sip:asterisk@192.168.0.168"
exten => asterisk,1,Answer
exten => asterisk,n,Wait(1)
exten => asterisk,n,VoiceMailMain(100@default)
exten => asterisk,n,Macro(hangupcall,)

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. Return to FreePBX in the trixbox Web GUI.
  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, making sure to disable NAT:
    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. Return to FreePBX in the trixbox Web GUI.
  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. Return to FreePBX in the trixbox Web GUI.
  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. Return to FreePBX in the trixbox Web GUI.
  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/applic...ather-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

TBD Perhaps http://lists.digium.com/pipermail/as...ry/140818.html

Joining a conversation from another extension

TBD Perhaps http://www.voip-info.org/wiki/view/A...way+call+HOWTO
Cisco phone conference functionality works fine. Perhaps just need feature code for wireless phones.

Setting up hold music

Hold music is not really that important for a hold system. However with out 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. Return to FreePBX in the trixbox Web GUI.
  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.

Webmin


The webmin tool lets you administer common linux settings from a web gui instead of directly from text files. As mentioned before, you can install such packages through the trixbox Packages page or via yum. 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/list...erisk-announce

Source from http://carlstrom.com/trixbox-2.6.html


:battay:


Bây giờ là 03:45 PM. Giờ GMT +7

Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.