Free Telephony Project
Open Telephony Hardware
Prototype IP04 minutes after birth

The IP04 is a 4 port IP-PBX that runs Asterisk and uClinux on a powerful embedded Blackfin processor. To build an Asterisk IP-PBX you normally need a x86 PC plus a PCI card for the analog ports. With the IP04 you get all of that functionality in a tiny, low cost, low power, silent box. Assembled and tested IP04s are available for around $450 from the Free Telephony Project Store.

Unlike many other embedded processors, the Blackfin has enough DSP horsepower to handle multiple channels of echo cancellation and speech compression. This means that the IP04 is a complete IP-PBX with 4 analog ports. No PC required!

The 4 analog ports can be configured any way you like, using single port FXS/FXO modules. The IP04 auto-detects the module type when it powers up and helpful LEDs indicate what flavour (FXS or FXO) each port is.

Using the IP04 is similar to any other Asterisk box. You can telnet in, modify config files, or even use the Asterisk-Now GUI. The IP04 comes pre-loaded with Asterisk and uClinux.

The IP04 is derived from the 4fx and BlackfinOne V2. You can read all about the development of the IP04 on my Building an Embedded Asterisk PBX series of blog posts. Part 3 and Part 4 deal with the IP04. Part 1 and Part 2 discuss the development of FXS/FXO hardware.

IP04 Versions

There are several versions of the IP04:

  1. The Prototype IP04 (picture at top of page), which was the original IP04 design. The design files for this version (PCB, schematic, CPLD source etc) are available from the SVN repository below. This is an IP04 that you can assemble yourself, some parts are available from the Store.

  2. The Atcom Production IP04, which has a different PCB layout (but very similar schematic) to the prototype IP04. This is the IP04 that Atcom and I are selling in fully assembled and tested form. The schematic and CPLD (but not PCB) files are available from IP04 SVN. You can buy an Atcom IP04 from the Free Telephony Project Store.

    Atcom IP04
  3. Due to the wonders of open hardware the IP04 also has an ever growing number of children.

Distribution

You can buy IP04s directly from the Free Telephony Store. By purchasing from this store you directly support the Free Telephony Project.

The production IP04s are being manufactured by the good people at Atcom. If you would like to distribute the IP04 in your country, please contact Edwin Chen, Technical Sales Manager at Atcom.

For Australian distribution and sales please contact David Rowe.

Prototype IP04 Specifications

(Please note, specs for the production IP04 are a little different)

  1. 2 layer PCB measuring 200mm by 100mm

  2. BF532 400MHz

  3. 64M SD-RAM running at 133MHz

  4. 256M NAND Flash for Asterisk Application, prompt and voicemail storage

  5. 0-4 FXS/FXO modules (fxsmod and fxomod designs)

  6. Optional stackable with 4fx cards to get 8 or even 12 analog ports

  7. Optional MMC card for removable flash storage

  8. High Performance echo cancellation using Oslec (Open source line echo canceller)

  9. Astfin Blackfin uClinux-Asterisk 1.4 software build

  10. Current consumption (2 FXS 2 FXO configuration) around 300mA @ 15VDC (4.5W).

Status

  1. The production IP04 was released in Mid 2007. Since then thousands of IP04s have been built and are in use all around the world. The hardware is very stable. The IP08, IP02, and IP01 are similar designs with different numbers of ports.

  2. The basic software load (uClinux, Asterisk & Zaptel) has proven to be very stable. A stable GUI has been slow to emerge but the recently released Asterisk Now 2.0 GUI is getting good reports. Many software packages have been ported to the IP04.

  3. The IP04 has been carefully tested. A series of automated stability and load tests have been performed, for example (i) 4 analog and 2 IAX calls for 4 days, about 32,000 calls and (ii) maximum anticipated load of 4 analog ports, 8 simultaneous calls (4 SIP-analog plus four SIP-IAX2 VOIP, running 8 GSM codecs). For more information please see the IP04 Test Plan.

    IP04 Maximum CPU Load Test
  4. These tests are repeated with every new production batch to ensure ongoing quality.

  5. The production IP04 has been tested to meet the following standards: FCC Part 68, FCC Part 15-B (USA); TBR-21, EN55022, EN60950 (Europe); S002, S003, CISPR 22, AS/NZS 60950.1:2003 (Australia).

  6. Here is a list of known IP0X bugs and their work arounds.

Capabilities

Many people have asked "how many calls can the IP04 handle and what codecs does it support?". The answer is "it depends" - for example the type of call (VOIP/analog), codec etc. Analog calls use the most MIPs due to the CPU load of echo canceller. IAX calls tend to use more CPU than SIP as there is more packing and unpacking of data. A-law and mulaw calls use less MIPs that GSM/g729.

Calls that use the IP04 to terminate or transcode RTP media (like playing an IVR or IAX2) use more MIPs than calls that just use the IP04 to handling call switching (e.g. a SIP extension to SIP extension call where RTP passes directly between the phones).

  1. The IP04 comes with ulaw/alaw/gsm/Speex codecs. All the usual Asterisk codecs are supported with the exception of iLibc which requires floating point (the Blackfin has no FPU). An optimised g729 library is available free from Analog Devices SVN, however there is at present no licensing scheme.

  2. The standard IP04 load test is 4 analog calls and 8 SIP calls (running GSM codecs). This simulates full load of the IP04 in a typical office environment of 4 outside FXO lines and 8 SIP phones.

  3. Kelvin Chua has tested up to 72 ulaw calls with an IP04 using SIPp. The IP04 was terminating RTP with an IVR prompt.

  4. With Asterisk running SIP calls (and no analog hardware), 34 ulaw, 16 g729, and 8 Speex (16 kbit/s mode) calls were possible at a 2.0 loadav. Care was taken to ensure that all calls were full duplex (when terminating a call with an IVR prompt the RTP traffic is usually one way).

Resources

  1. For IP0X configuration tips see the IP0X Howto below.

  2. If you have any questions, bug reports, or suggested improvements, please post to the Blackfin Asterisk forum or the Free Telephony Project Mailing List.

  3. IP04 and Asterisk training course, which covers basic dialplan configuration using command line and conf files on the IP04. The course was first delivered to classes during a visit to East Timor.

  4. BAPS is the build system for the IP04/IP08 based on the package paradigm (like apt-get or rpms). BAPS is being used for the production IP04s and IP08 prototype and allows users to easily upgrade software from the command line, avoiding the need to compile an entire uImage.

  5. Some bugs and common traps are described in the IP0X Bugs section.

  6. IP04 SVN for schematics, PCB design, BOM spreadsheet, test plan, errata and more.

  7. The previous build system was Astfin. Here are steps used to get a bootable uImage containing uClinux and Asterisk for the Blackfin using Astfin.

  8. NAND Flash and u-boot

  9. For low level boot loader and firmware set up see the IP04 Wiki. Please note that the Linux uImage discussed on the wiki is a very early version - pls use later BAPS or Astfin Linux uImage. The low level u-boot instructions are still relevant.

  10. NAND Flash and uClinux

  11. There are now quite a few Asterisk "Appliance" type products that have been announced. Here is a survey of Asterisk Appliance products.

Credits

I stand on the shoulders of giants. Thanks to all the people who have contributed and whose work I have built on. In no particular order: the Astfin & BlackfinOne teams, uClinux, Analog Devices Blackfin team, the Asterisk community, and the guys at Atcom. Sorry if I forgot anybody.

IP04 top view with no modules loaded

IP0X HOWTO

Production IP04 and modules

These notes apply to the Production (Atcom) IP0Xes (IP04, IP08, IP02, IP01) from the Free Telephony Project Store. If your IP0X came directly from Atcom or another manufacturer the configuration may be slightly different.

Blackfin Asterisk Package System (BAPS) Mini-How To

BAPS is a package based system for Blackfin Asterisk, like apt-get or rpm. It makes installing, updating and contributing software easy.

Here is a list of BAPS packages.

When each package is installed, documentation for the package is installed in /usr/doc on your IP04. You can also browse the BAPS Package Documentation online.

Essential BAPS commands are:

root~> ipkg update
root~> ipkg list
root~> ipkg list_installed
root~> ipkg install PackageName
root~> ipkg remove PackageName

Many BAPS packages install documentation on the IP0X in /usr/doc.

Please see the BAPS page for more information

Help and Support with your IP0X

If you have any questions, bug reports, or suggested improvements, please post to the Blackfin Asterisk forum or the Free Telephony Project Mailing List, so the IP0X community can share the answers.

For a gentle introduction the Asterisk on the IP0X there is an on-line IP04 and Asterisk training course, which covers basic dialplan configuration using command line and conf files on the IP04. The course was first delivered to classes during a visit to East Timor.

IP04 How To Notes

  1. uClinux and Asterisk are pre-installed. Just connect an Ethernet cable, apply power and in about 90 seconds the IP04 should be ready for use. If you have FXS modules installed, try connecting an analog phone to the ports until you hear dial tone. Try dialling 2008 to hear a prompt or 2020 to record and playback your own voice.

  2. On the IP04 & IP08 the Tel1-Tel8 LEDs on the front panel indicate what sort of modules (FXS or FXO) you have installed. Red = FXO, Green = FXS. For example the IP04 below has Tel1 & Tel2 set up as FXS and Tel3 and Tel4 as FXO.

    IP04 port config LEDs

    Please note that the IP01 TEL LED does not change colour - it is green for both FXO and FXS modules.

  3. The Tel1-Tel8 ports are configured as extensions 6001, 6002,….,6008. For example if you have Tel3 & Tel4 configured as FXS, dialling 6004 on Tel-3 will make Tel-4 ring. If Tel1 is a FXO port, dialling 6001 will take it off hook, you should then hear PSTN dial tone.

  4. When you boot the IP0X, the default IP will be 192.168.1.30. You can telnet to the IP0X:

    [david@bunny ~]$ telnet 192.168.1.30
    Trying 192.168.1.30...
    
    Connected to 192.168.1.30.
    Escape character is '^]'.
    
    
    BusyBox v1.4.1 (2007-06-01 01:29:28 CST) Built-in shell (msh)
    Enter 'help' for a list of built-in commands.
    
    root:~> asterisk -r
    Asterisk 1.4.2, Copyright (C) 1999 - 2006 Digium, Inc. and others.
    Created by Mark Spencer <markster@digium.com>
    Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
    This is free software, with components licensed under the GNU General Public
    License version 2 and other licenses; you are welcome to redistribute it under
    certain conditions. Type 'core show license' for details.
    =========================================================================
    Connected to Asterisk 1.4.2 currently running on af1 (pid = 71)
    No entry for terminal type "dumb";
    using dumb terminal settings.
    af1*CLI>
    
    Note In the default configuration no username or password is required for telnet. You can add a username/password prompt by installing the login ipkg. The default username/password is root/uClinux.
  5. To enable static IP (the default as shipped):

    root~> /etc/init.d/network disable
    root~> /etc/init.d/network-static enable
    root~> reboot
  6. To change the static IP settings edit /etc/init.d/network-static

  7. To enable dhcp:

    root~> /etc/init.d/network-static disable
    root~> /etc/init.d/network enable
    root~> reboot
  8. rcp is the easiest way to transfer files to and from the IP04:

    [david@bunny ~]$ rcp root@192.168.1.30:/etc/asterisk/extensions.conf .
  9. The IP04 also has a built in ftp server, the username/password is root/uClinux.

  10. wget also works well from the IP04 command line to grab files from a web server. tftp can also be used:

    root:~> tftp -g -r uImage_r2.ip08.bf533 bunny
  11. All the usual Asterisk config files are present in /etc/asterisk, edit using vi. If you hate vi try one of the other editors like ee or nano (ipkg install ee, ipkg install nano).

  12. There is plenty of NAND flash (256 MBytes) to store any custom prompts, programs or voicemail. Any changes to files are persistent, it appears that using the yaffs file system you don't even need to "shutdown" or "halt" when powering down - the changes are written to flash straight away.

  13. There is a small reset button next to the power connector. This is a hardware reset, it does not reset software defaults (see below for software defaults).

  14. To use the RS232 console remove the top cover from the IP04 and install the small RS232 daughter board on J8 as below. If present, remove the small shorting link first (shorting link not required on current IP04s). Use 115,000 baud, 8 data bits, no parity. Use a direct RS232 cable, as the IP04 swaps the RS232 tx/rx lines. A null-modem cable is not required. For RS232 work I use minicom on a Linux host machine, here is my minicom configuration file. When you are finished with the console be sure to replace the shorting link, otherwise the IP04 will not boot.

    RS232 daughter board A
  15. The GUI is not installed by default. See the GUI Installation instructions.

  16. The IP04's currently shipping from the Free Telephony Project Store don't support the MMC card. MMC card support requires a firmware (CPLD and uImage) upgrade which is still experimental. Alex Tao has written instructions for IP04 MMC support.

  17. To change the root password, on a x86 Linux box:

     perl -e 'print "crypt("yourpassword", "yoursalt")","\n"'

    to generate the password and copy/paste in /etc/passwd on your IP04. Thanks to Li for suggesting this in the Blackfin Asterisk Forum.

  18. To restore the default Asterisk configuration files on your IP04

    root:~> ipkg update
    root:~> ipkg remove asterisk
    root:~> ipkg install asterisk
    root:~> reboot
  19. Caller ID: You need asterisk-spandsp to pick up caller id. You can check if asterisk-spandsp is installed using:

    $ ipkg list_installed

    To install asterisk-spandsp:

    $ /etc/init.d/asterisk stop
    $ ipkg remove asterisk
    $ ipkg install asterisk-spandsp
    $ reboot
  20. Asterisk CDR Records: You need to have a CDR backend like cdr-csv.so. cdr-csv.so is installed as part of the asterisk ipkg. Use vi to add the following line to the end of /etc/asterisk/cdr.conf:

    [csv]
    usegmtime=no;

    Then create the file /var/log/asterisk/cdr-csv/Master.csv and restart Asterisk:

    $ mkdir -p /var/log/asterisk/cdr-csv
    $ touch /var/log/asterisk/cdr-csv/Master.csv
    $ /etc/init.d/asterisk stop
    $ /etc/init.d/asterisk start

    Make a few calls and check Master.csv:

    $ cat /var/log/asterisk/cdr-csv/Master.csv
  21. Dropbear SSH. When you install dropbear a public key will be generated and printed:

    root:~> ipkg install dropbear

    Paste the "Public key portion" into your ~/.ssh/authorized_keys2 file on your host machine. You should now be able to log into your host from the IP04 without a password:

    root:~> ssh -i /etc/dropbear/dropbear_rsa_host_key user@host

    To create a ssh tunnel, for example to maintain an IP04 that is behind a NAT:

    IP04 ---> Firewall/NAT -> Linux host

    On the IP04:

    root:/etc/dropbear> ssh -R 2048:localhost:22 user@host

    You need to keep this ssh session running. Now to ssh into the IP04 behind the NAT type this on the host:

    [host ]$ ssh root@localhost -p 2048
  22. Country specific Zaptel settings can be set by modifying /etc/init.d/zaptel:

    start) modprobe wcfxs;

    For example to set opermode for Australia:

    start) modprobe wcfxs opermode=AUSTRALIA;
  23. Transfers between Analog phones. The settings in zapata.conf are overridden by users.conf, so to enable analog transfers for say extension 6004, go to the [6004] section in /etc/asterisk/users.conf and set:

    threewaycalling=yes
    transfer=yes
  24. Atcom AT530 IP phone configuration for Asterisk on the IP04:

    • Insert this at the end of /etc/asterisk/sip.conf:

      [at530]
      type=friend
      context=default
      host=dynamic
      user=at530
      secret=sipguest
      canreinvite=no
      callerid=at530
      disallow=all
      allow=ulaw
    • Connect the WAN port of the AT530 to your LAN, it will boot and obtain an IP via dhcp.

    • Find the IP of the phone by pressing the Sysinfo button a few times.

    • With your web browser login to this IP using the username/password admin/admin.

    • Optional: set a static IP using the WAN menu (I like static IPs for SIP phones).

    • On the SIP Config menu set Register Server Address to your IP04 IP, Register Username to at530, Register Password to at530, and the Phone Number to at530.

    • Check the Enable Register box.

    • Then hit apply.

    • To check if registration is successful press SysInfo a few times on the phone.

    • You can also check registration on the IP04:

      ip04*CLI> sip show peers
      Name/username              Host            Dyn Nat ACL Port     Status
      at530/at530                192.168.1.179    D          5060     Unmonitored
    • Once you have dialled a number on the AT530 phone press Send to make the call (or just wait a few seconds).

    • To change the LCD logo go to Account Manage, Lcd Logo field, then reboot the phone.

  25. VLAN: There is some experimental support for VLANs. If anyone is interested is using VLANs in production systems please let me know and I will create an ipkg.

    • Start your IP04 and connect to the console using the RS232 daughter board.

    • rcp 8021q.ko and vconfig to your IP04.

    • Make sure network-static is being used (not dhcp)

      root:~> insmod 8021q.ko
      root:~> ifconfig eth0 0.0.0.0
      root:~> vconfig add eth0 2
      root:~> ifconfig eth0.2 10.1.1.2

      This sets up VLAN 2 with IP 10.1.1.2. I noticed that VLAN2 can't talk to regular LAN, it's like a separate physical network. So I couldn't talk to 10.1.1.0 network unless PC on other end was configured for VLAN2.

      Now configure a VLAN on your PC, On my Ubuntu PC "apt-get install vlan". Then same as above for IP04:

      # modprobe 8021q.ko
      # ifconfig eth0 0.0.0.0
      # vconfig add eth0 2
      # ifconfig eth0.2 10.1.1.1

      Then I can connect between PC and IP04 on 10.0.0.x VLAN2 network.

  26. Music on Hold. The IP04 doesn't play MP3 format out of the box, but it can play ulaw files. To install MOH files:

    cd /var/lib/asterisk/moh/
    wget http://mirror.astlinux.org/sounds/moh/default/fpm-calm-river.ulaw
    wget http://mirror.astlinux.org/sounds/moh/default/fpm-sunshine.ulaw
    wget http://mirror.astlinux.org/sounds/moh/default/fpm-world-mix.ulaw

    Thank you Erwin B for these instructions.

  27. IP08 USB Port. Please note that not all USB devices will work - some may require a new kernel to be built. To test plug in a memory stick, when you type dmesg you will see something like:

      <snip>
      sda: Write Protect is off
      sda: assuming drive cache: write through
       sda: sda1
      <snip>

    You can then mount the memory stick:

      root:~> mount /dev/sda1 /mnt/
      root:~> ls /mnt/
  28. Updating uImage from uClinux. This neat technique was developed by Oussema Harbi. You can update your kernel image without u-boot or messing about with serial cables and RS232.

root:~> cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00300000 00001000 "ROMfs"
mtd1: 00800000 00020000 "linux kernel"
mtd2: 0f800000 00020000 "file system"
root:~> tftp -g -r uImage_r2.ip08.bf533 bunny
root:~> dd if=uImage_r2.ip08.bf533 of=/dev/mtdblock1
4180+1 records in
4180+1 records out
root:~> reboot

The tftp step can be replaced by scp, rcp, wget, ftp from your host to the IP0X etc. Oussema has used this technique to update kernels using an ipkg. Nice work Oussema.

If you have any questions, bug reports, or suggested improvements, please post to the Blackfin Asterisk forum or the Free Telephony Project Mailing List, so the IP04 community can share the answers.

Astfin and BAPs

Until April 2008, most IP04s ran Astfin firmware. From April 2008 IP04s shipped from the Free Telephony Project Store run BAPS. Differences in configuring the Astfin firmware are described below:

  1. To change the default network parameters (plus a bunch of other config options), edit the file /etc/asterisk/rc.conf then reboot. If the network is not coming up you may need to use the RS232 console (see below).

  2. To switch on DHCP enable the DHCP variable in /etc/asterisk/rc.conf. For reliable DHCP client operation I suggest the following code in /etc/rc:

    <snip>
    # Check DHCPD is enabled
    if [ "$DHCPD" = "yes" ]
    then
    rm -f /var/run/dhcpcd*
    dhcpcd &
    sleep 5
    else
    <snip>
  3. To set a static ip, use vi to change these two lines in /etc/asterisk/rc.conf:

    DHCPD=no
    IPADDRESS="192.168.1.31"

    and this line in in /etc/rc:

    # Check DHCPD is enabled
    if [ "$DHCPD" = "yes" ]
  4. To restore the default Asterisk configuration files on your IP04

    root:~> rm -f /etc/asterisk/.unpacked

    then reboot your IP04. Thanks Mark T for this one.

IP0X Bugs

The IP0X hardware and software is very reliable. There are thousands of IP0X devices in the field and over 10,000 analog ports deployed. However there are a few issues with a small number of IP0X installations. As the software and hardware is very open, the IP0X community is working together to close out the few remaining issues below. You are welcome to contribute.

Outstanding Issues

  1. MMC card support is still experimental and not enabled on the IP04s shipped from the Free Telephony Project Store. However with 256 MByte of internal flash this is not a practical problem for most applications. See the getting started notes for more information.

  2. The IP08 USB port currently does not work. We are investigating this issue. Probably a CPLD firmware bug - USB worked fine on earlier IP08s.

  3. On a small number of IP04s there have been reports of FXO ports locking up after 1-14 days. In this state incoming calls and outgoing calls are not possible, and the IP04 needs to be rebooted or the wcfxs driver unloaded and loaded. We are investigating this bug. The work around is a cron job to unload/load the wcfxs module every day (see forum for scripts). The vast majority of IP04 installations do not experience this problem, which seems to be site related, perhaps due to noisey power or phone line noise. For more information please see the Blackfin Asterisk forum posts.

  4. There have been a few popped FXS modules reported. This seems to be linked with ringing multiple FXS ports simultaneously, and/or non-standard power supplies.

There are two known network issues that affect a small number of IP0X devices:

  1. Sometimes the DM9000 Ethernet chip will fail on the 10/100M auto-negotiation with certain switches. In this case the network link will not come up until you unplug/replug the RJ45 cable or reboot the device. Atcom have developed a fix based on an upgrade to the DM9000 driver. You can test this fix by installing the Atcom firmware.

  2. Keep alive issue: The IP0X will stop responding to the network, however if you send a ping from the IP0X (e.g. using the serial console), the network will come up again. This appears to be a uClinux issue, as it also occurs on Blackfin IP-PBX devices that do not use the DM9000 Ethernet chip.

    On some networks this problem can be induced by unplugging the Ethernet cable for 15 minutes, then reconnecting the cable.

    A reliable work around for this problem is to ping your gateway every few seconds. A ping command running in the background can be started using a line in your /etc/init.d network start-up script.

Gotchas

Some subtle problems that people have experienced in the field, and how to fix them:

  1. Your IP0X works fine for several months, then one day the network won't come up and no phone functions work. I have seen this problem caused twice due to the file system filling up. In the first case it was due to very verbose asterisk logging, in the second case a large audio file.

    Connect the RS232 serial cable and wait for the root prompt. Then check to see if the file system is full:

    root:~> df -h
    Filesystem                Size      Used Available Use% Mounted on
    /dev/mtdblock2          248.0M     20.4M    227.6M   8% /

    You can track down and delete the large files using "du -h"

  2. Your IP0X doesn't boot so you connect the RS232 serial cable and it boots OK. You disconnect the RS232 cable and it doesn't boot any more. Not sure why this one happens but in the three times I have seen it the fix is to reflash your IP0X with the firmware of your choice.

  3. When your IP0X boots you see messages like this in the dmesg boot log or serial console:

    <snip>
    block 791 is bad
    <snip>

    i.e. one of more bad blocks reported as the Yaffs file system is mounted. This is completely normal - the NAND flash chips often have a few bad blocks when they are manufactured and the file system works around them.

  4. Changing settings in /etc/asterisk/zapata.conf has no effect: Try changing the same setting in /etc/asterisk/user.conf - this overrides zapata.conf settings.