IP0X How To

Introduction

QuickStart: Point your web browser at 192.168.1.30 to access the Mini Asterisk GUI. This is the easiest way to get started with the IP0X. Hover your mouse over the GUI screens and read the FAQ.

This HOWTO applies to IP0Xes (IP04, IP08, IP02, IP01) supplied by Rowetel. If your IP0X came directly from Atcom or another manufacturer the configuration may be different.

For more information there is a list of IP0X Resources.

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 to 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.

IP0X How To

  1. Asterisk security is becoming a big issue. Use Google to find many links on the topic and what you can do, for example this document. It is strongly recommended that your IP0X be placed behind a firewall. Tools like sipvcious can be used to test Asterisk security. Here is the story of how my Asterisk box was hacked, even though it was behind a firewall.
  2. 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.
  3. 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.
  4. IP04 port config LEDs

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

  5. 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.
  6. Point your web browser at 192.168.1.30 to access the Mini Asterisk GUI. This is the easiest way to get started with the IP0X.
  7. When you boot the IP0X, the default IP will be 192.168.1.30. You can telnet to the IP0X (default user/password is root/uClinux):
    [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.

  8. To enable static IP (the default as shipped):
    root~> /etc/init.d/network disable
    root~> /etc/init.d/network-static enable
    root~> reboot
  9. To change the static IP settings edit /etc/init.d/network-static
  10. To enable dhcp:
    root~> /etc/init.d/network-static disable
    root~> /etc/init.d/network enable
    root~> reboot
  11. 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 .
  12. The IP04 also has a built in ftp server, the username/password is root/uClinux.
  13. 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_r3.ip08.bf533 bunny
  14. 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).
  15. 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.
  16. 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).
  17. To use the RS232 console remove the top cover from the IP04 and install the small RS232 daughter board on J5 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

  18. The Mini Asterisk GUI is installed by default. See here for more information on available GUIs and here for Asterisk Now 2.0 GUI instructions.
  19. 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.
  20. 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.

  21. To restore the default Asterisk configuration files on your IP04:
    root:~> ipkg update
    root:~> ipkg remove asterisk
    root:~> ipkg install asterisk
    root:~> reboot
  22. 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 (note this procedure will overwrite your conf files) :
    $ /etc/init.d/asterisk stop
    $ ipkg remove asterisk
    $ ipkg install asterisk-spandsp
    $ reboot

    If you are using the mini-asterisk-gui, re-install to recover the mini-asterisk-gui conf files:
    $ ipkg remove mini-asterisk-gui
    $ ipkg install mini-asterisk-gui

  23. 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

  24. 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 login from your host to your IP04 without a password, first generate a key on your host using ssh-keygen. In ~/.ssh this will generate id_rsa (private key) and id_rsa.pub (public key). Copy id_rsa.pub to your IP04, the easiest way is with scp:
    root:~> mkdir /.ssh
    root:~> scp user@host:.ssh/id_rsa.pub /.ssh/authorized_keys

    You should now be able to login to your IP04 using ssh without a password:
    [host]$ ssh root@ip04

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

    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

  25. 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;

  26. 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
  27. 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.

  28. 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.

  29. 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.

  30. 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/

  31. 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_r3.ip08.bf533 bunny
    root:~> dd if=uImage_r3.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.

  32. Asterisk Jitter Buffer: Mike O’Conner reports that to enable the jitter buffer on a SIP to Zaptel call the option ‘jbenable=yes’ needs to be added to the /etc/asterisk/zapata.conf under [channels], as well as enabling the jitter buffer in sip.conf. Thanks Mike.

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.