Make Internet calls with a real ISDN phone

Last update: March, 3rd, 2006

What is the advantage?
I didn’t really like that I had to use a headset when I wanted to call someone via the internet. The volumes of the soundcard had to be adjusted to avoid over- or undermodulation. With the way described here, it is possible to use an ordinary ISDN telephone (at Germany’s Ebay you easily get one for 30 EUR) to make phone or internet calls with the help of a computer and a SIP provider. The audio quality is excellent with a DSL connection, there is no noticeable difference compared to a normal phone. The line should be clear however.

Additionally, you save the money for buying a SIP phone which costs about 100 EUR at this moment. Over the internet, you can call each other for free with a “real” phone. Calls to the Germany phone network cost 1.79 euro cent per minute with Sipgate.

This how-to is written especially for Sipgate accounts. However, you can easily adopt it for other SIP providers. You find links to other providers at the end of this document.

What do you need?
Firstly, you need a computer running Linux. The distribution is not important; I tried it with the Mandrake 10 Official Edition. Your computer doesn’t need to have a high-speed cpu, 350 MHz should be sufficient. In some boards even computers with 200 MHz were discussed.

Secondly, you need an ISDN card that supports the „NT“-mode. NT means network termination, normally, the cards a running in terminal equipment mode, TE-mode, like an ISDN phone. However, we basically have to simulate an ISDN network. That works only with cards having a HFC chipset (it works with some other cards as well, see Jollys website for more information). If you have a HFC card, you can see the tops of the Cologne Cathedral on the chip. You find a list of HFC cards at Jolly’s page. I am using a rather old card made by Typhoon. This card can still be purchased and is quite cheap.

Next to this, you need an NTBA, also called NT1. The NT1 is that thing that is normally connected to the two copper wires provided by the phone company. We need this NT1 only for the power supply and the wiring.

Finally, you should have an ISDN telephone and an Ethernet or ISDN cable (which are exactly the same).

Wiring
You cut the Ethernet cable in the middle and open the NT1. Depending on your NT1, you will find connectors called a1, b1, a2, b2. We now have to build a crossover connection (this time, this crossover cable differs from normal Ethernet crossover cables).

The pins at the RJ45 plug are numbered like this:
ISDN-Steckerbelegung

When the clip of the plug shows to the top, pin 1 is on the far left and pin 8 on the far right. Now you should locate the wires that connect to the pins using a simple measurement instrument. Pin 6 (or better the wire of pin 6) ist connected to a1 in the NT1, pin 5 to a2, pin 4 to b2 and pin 3 to b1.

Pin 3 => b1
Pin 4 => b2
Pin 5 => a2
Pin 6 => a1

When everything is connected, the most difficult part is over. The Ethernet cable wired to the NT1 gets now connected to the ISDN card in the computer with the other end. The ISDN phone has to be plugged in one of the available jacks of the NT1. The NT1 must also be connected to a power outlet.

Software
Now we can install the software we need. An already installed Linux distribution is required. Furthermore, the development packages should be installed, as well as the libraries libncurses5-dev and libssl-dev. The latest bristuff has to be downloaded from http://www.junghanns.net/asterisk. Extract this package into a directory and run the install.sh script by typing in as root “./install.sh”. Use “anoncvs” as password and hit return when asked. Bristuff now downloads and installs asterisk automatically. When everything is ready, change to “asterisk” in the bristuff directory and type “make samples”. This is compiles some sample configuration files which are then located in /etc/asterisk.

Everything is installed now and we can start the configuration.

First of all, zaphfc has to be configured which connects our ISDN telephone
The file zaptel.conf should be saved in /etc/zaptel.conf and contain the following

loadzone=nl
defaultzone=nl

span=1,1,3,ccs,ami
bchan=1-2
dchan=3

zapata.conf is in /etc/asterisk and looks like this:

[channels]
switchtype=euroisdn
signalling=bri_net_ptmp
pridialplan=local
echocancel=yes
immediate=no
overlapdial=yes
group=1
context=default
channel=>1-2

Sip.conf in /etc/asterisk configures the access to the SIP provider, in our case Sipgate.

[general]
port = 5060
bindaddr = 0.0.0.0
externip = xyz.dyndns.org
Localnet = 192.168.0.0/255.255.0.0
srvlookup = yes
context = default
disallow=all
allow=gsm
register => 8001234:passwort@sipgate.de/8001234
canreinvite=no
tos=0x18
insecure=very
nat=no
dtmfmode=info

[sipgate]
type=friend
username=8001234
secret=passwort
host=sipgate.de
fromuser=8001234
fromdomain=sipgate.de
context=default
canreinvite=no
qualify=yes
disallow=all
allow=gsm
insecure=very
nat=no
dtmfmode=info
tos=0x18

„Externip“ is the external IP of the router. It is possible to use a Dyndns.org host address here. “Localnet” describes the local network. “Register” is followed by the SIP-ID, a colon and the password. In the case of Sipgate, the password is different from the one used to log into the website. Therefore, in our example, the SIP-ID is 8001234 and the password is passwort. Depending on your internet connection setup, the variable nat must be yes or no. Yes if you are behind a NAT and firewall for instance. More about this at the end of this document. “Insecure” has to be set to very, otherwise, a registration at Sipgate is not possible.

The file extensions.conf located in /etc/asterisk defines –guess what- the extensions.

[general]

static=yes
writeprotect=no

[globals]
IAXINFO=guest

[default]
include => calls

[calls]
exten => 8001234,1,Dial(Zap/2/1234,60,tT)
exten => 8001234,2,Hangup

exten => _8.,1,Dial(SIP/${EXTEN:1}@sipgate,60,tT)
exten => _8.,2,Congestion
exten => _8.,3,Busy
exten => _8.,4,Hangup

In extensions.conf the behavior of Asterisk is set up. In this example, you call a public phone number via Sipgate by first dialing an “8” and the normal phone number afterwards. The imaginary phone number in Berlin 030-123456 has to be called by dialing 8030123456. An international number, e.g. 001 202 123456, would be 8001202123456.

The 800123 is again the Sipgate number, the 1234 after the Zap entry is the MSN of the ISDN phone. It has to be set up in the ISDN phone. In addition, I had to include an entry in /etc/hosts with the local IP and name of my the Asterisk server.

One advice: The configuration files here represent only a basic setup. They are not tested for security. You should also consider what to do with the emergency numbers 112 or 911. If you found a mistake in this setup, just drop me a mail.

Let’s start our phone network
First, we have to load the kernel modules for zaphfc. You go into the bristuff directory in …/bristuff…/zaphfc and do a “make loadNT”. Now the modules are compiled and installed. When everything is finished, you will see something like “3 channels configured”.
Now you can start Asterisk by typing „asterisk –vvvvc“. You will now see an Asterisk console and all the debug messages from Asterisk. If everything worked out, a “sip show registry” should return a “registered”.

Hints for Sipgate and NAT
If you are using your Asterisk server behind a Router or NAT, it has to be modified a bit. In my case, I am using Asterisk with a Fli4l-Router. Though there is the option nat=yes in the sip.conf, it did not work. I had to specify in the file /etc/asterisk/rtp.conf a portrange (the standard range here is too big, some 20 ports will do in most cases) that I forwarded to the Asterisk server. Additionally, the port 5060 udp is needed.

Help and further Links
The wiring of the phone can also be read here http://isdn.jolly.de. The official Asterisk homepage is here http://www.asterisk.org , a WIKI is http://www.voip-info.org/. Here you can lookup alls the commands and much much more. The „bristuff“ can be downloaded from http://www.junghanns.net/asterisk/. Mandrake Linux is available for free underhttp://www.mandrakelinux.com. SIP probiders can be found here http://www.voip-info.org/tiki-index.php?page=VOIP+Service+Providers .

If you find errors in this document (spelling mistakes excluded), just drop me a mail.

Addition February 12th, 2005
I rewrote the wiring section, I hope it is clearer now. For more help concerning possible compilation errors see the VOIP section of my blog.

Addition March, 3rd, 2006: mISDN Instead of Bristuff
Instead of using bristuff, you can also use the mISDN drivers from Beronet. They are said to be capable of supporting the NT mode for directly connecting an ISDN telephone to Asterisk as well. However, I haven’t tried these drivers yet… So feedback is welcome.

9 thoughts on “Make Internet calls with a real ISDN phone

  1. Pingback: Christopher's Blog » DTMF now regocnised properly

  2. Pingback: Christopher's Blog » Asterisk How-To updated

  3. Shane James

    I get errors when I run ‘make loadNT’

    In file included from zaphfc.c:28:
    zaphfc.h: At top level:
    zaphfc.h:258: syntax error before “spinlock_t”
    zaphfc.h:258: warning: no semicolon at end of struct or union
    zaphfc.h:259: conflicting types for `irq’
    /root/bristuff-0.2.0-RC8n/zaptel-1.0.9/zaptel.h:1215: previous declaration of `irq’
    zaphfc.h:278: syntax error before ‘}’ token
    zaphfc.h:278: warning: type defaults to `int’ in declaration of `hfc_card’
    zaphfc.h:278: warning: data definition has no type or storage class
    zaphfc.h:282: field `span’ has incomplete type
    zaphfc.h:283: field `chans’ has incomplete type
    make: *** [zaphfc.o] Error 1

    How can I fix this?

  4. Pingback: Christophers Blog » Blog Archive » Mit ISDN-Telefon und Sipgate kostenlos übers Internet telefonieren

  5. Pingback: Christopher’s Blog » Blog Archive » Asterisk: mISDN Drivers Instead of bristuff

  6. Rehan

    Some experiences using mISDN.

    The kernel must be compiled with profiling switched off otherwise you will get lockups and performance issues.

    You need at least kernel version 2.6.14 (2.6.16.20 is the latest stable)!

    Weird ISDN connectivity issues in the UK (although it apparently works in Germany ok).

    You can’t have any other HFC drivers installed before installing mISDN.

    Install script is very good and takes care of everything for you. Well integrated with asterisk.

    If u are using freePBX, create a custom trunk with the dial string ‘misdn/g:(context name)/$OUTNUM$/. You might need to put a /h at the end to get it dialing out.

    Rehan

  7. Pingback: Christopher’s Blog » Blog Archive » Asterisk, My Telephone And Operation “Busy”

Comments are closed.