7. Description of the IsdnLib

A few month ago, as we were looking for a topic for our thesis, we start thinking about Internet telephony. The question was to which extent it will be possible to make an ordinary telephone call via an ISDN using a connected computer.


7.1. 7.1 ISDN and SUN

For this purpose an ISDN card for a SUN machine was acquired as well as the ISDN software SUN ISDN 1.0.2 which should make it possible to use the card. Recently after installation we found out that it was just a PPP network for ISDN and with this software the card could not be used for any other purpose. In particular, no programming interface was provided.

We disassembled two test programs that were applied (for sending and receiving of an audio file) in order to find a way to work with the ISDN card. So we found out that the programs communicate with the software by use of a 'named pipe', and we were able to initialize a call. Nevertheless, there was no information how signalling is done.

Of course, we raised a question to SUN. The answer was, the software has been explicitly developed for PPP. The test programs were applied for historical reasons only. We were advised not to use the 'named pipe', since the interface may change from one version to next.

The SUN people referred to another product, namely the SunXTL 1.2, which should enable the use of the ISDN card for our purposes. The product was acquired and installed.

7.1.1 SunXTL 1.2

Together with the ISDN card SUN Microsystem offered an interesting programming environment, called SunXTL 1.2 [Sun9412:xtlArch][Sun9412:xtlAdmin][Sun9412:xtlApi][sun9412:xtlMpi]. With this environment it should be possible to develop telephony applications not only restricted to ISDN, but suitable as well to ATM, Ethernet, and modem connections. Picture 7.1.1 (from [Sun9412:xtlAdmin] ) gives a short overview about the architecture.

The architecture offers a distributed telephony environment. But when we were looking for a MPI[ The MPI connects one type of a physical device (like an ISDN card) with the XTL teleservices. It transforms the internal functions of the XTL in actions running on the device (e.g. initiating a call) and, vice versa, incoming events (e.g. incoming call) to internal messages, Without the MPI it is not possible to use the underlying hardware.] for the ISDN card, it turns out that no one exists. Asking the SUN people again, they told use to get such MPI from another manufacturer. The software offered no way to use the ISDN card.

After this discouraging experience we asked at GMD for an usable implementation. There, the response regarding the XTL architecture was somewhat restrained and we were recommended to wait for another while. At that time an ISDN card was under development at GMD. Better reliability and support was promised.

7.1.2 Requesting via Internet

We asked in the Internet whether someone knew something particular about a MPI for XTL. There were only few, but negative responses. It was expected that SUN would retire the product from the market quite soon. Several people remarked the poor service provided by SUN for this product. It was confirmed, as well, that there was no software in the XTL package permitting the use of the ISDN card.

7.1.3 SunShine

After these discouraging experiences we came in contact with a project at the Helsinki University in Finland called SunShine. Something should have been developed there to use the ISDN card. We were immediately provided with the source code and were able to use it. There were two test programs enabling the sending of files via ISDN.

We were still not satisfied with the results, since

Furthermore, the semester vacation just started in Helsinki and further development could be expected only in a few month.

But the SunShine project was the only reference we could find for the support of programming the ISDN card. Thus, we decided to collaborate. One part of the development was still done by Bengt Olof Shalin, the other one by us.


7.2 A Short Overview about ISDN

To understand which part of the SunShine project we have undertaken we will give a short overview about ISDN.

ISDN was standardized by the International Telecommunication Union (ITU). Recommendation I.120 [itu9303:I.120] gives an overview about the framework of ISDN recommendations (ref. picture 7.2).

For further understanding particular ISDN layers will be roughly presented in the following.

The physical layer (Physical Layer) in ISDN is specified by the ITU rec. I.430 [itu9303:I.430] for the basic access [ There are three kinds of access: the basic access, the *primary multiplex access*, and Broadband-ISDN. Basically they differ in the exchange rate and in physical properties. In the following, we will consider the basic access only.] The ISDN card provides an interface to this physical layer. Since this already works well, we will not tackle it any more in the following.] The second layer (Link Layer) provides data exchange based on the physical layer. The addressing of sender and receiver is located here as well as reliable date exchange by error recognition and recovery. Multiplexing of several access points is done as well. The layer is specified by Q.920 [itu9303:Q.920] (same as I.440 [itu9303:I.440]) and Q.921 [itu9303:Q.921] (corresponds to I.441 [itu9303:I.441]).

The third layer (Network Layer) provides communication among two or more parties. In the context of ISDN this may be, for example, a telephone call between two parties using ISDN. The layer is specified by Q.930 [itu9303:Q.930] (I.450 [itu9303:I.450]) and Q.931 [itu9303:Q.931] (I.451 [itu9303:I.451]).

The other layers are not relevant for our work and will not be considered in the folllowing.


7.3. Allocation of responsibilities

As already mentioned, we needed a software that allows access to the ISDN card. Exactly, we need a software dealing with layer 2 and 3 and providing a programming interface to the user. Without an implementation of the both layer according to the ITU recommendations mentioned above it will not be possible to use the ISDN card in a real environment, that means the public ISDN network of the Telekom.

In the SunShine project the layer 2 and 3 has been implemented. Thus, we were able to access the "ordinary" ISDN. As already mentioned, there were a lot of errors in the implementation. Furthermore, it was not designed for use in a real environment, but for test purposes. No programming interface was provided.

The project came up with the decision to develop one part completely from the scratch. Fortunately, the implementations of the two layers were completely separated. Layer 2, exactly Q.921 LAP-D protocol, was implemented as an autonomous streams extension for the SUN kernel. The Q.931 protocol implementation was linked to the application.

We decided to implement the Q.931 modul. Additionally, a programming interface should be provided. Beng Olof Shalins decision was to revise the Q.921 modul.


7.4 Description Of The Implementation

In the following, we will describe what we have implemented. Picture 7 gives an overview about the modules involved.

7.4.1 The DLPI Interface

The DLPI (Data Link Provider Interface) Interface Modul provides relative simple access to the Q.921 modul. The Q.921 modul is a STREAMS extension and integrated in the SUN kernel. Only a DLPI interface is provided to the environment. Data exchange is somewhat awkward, since there are several different types of messages differing in structure according to the particular type. The interface offers much more features as we required for the ISDN access. Though, we implemented some routines that significantly simplified the data exchange.

7.4.2 Msg Encode/Decode

This modul is used by the scheduler as a callback routine for incoming messages from the Q.921 module. The MSG Encode/Decode module makes use of the DLPI Interface Module to receive messages from the DLPI connection. After receiving the message will be processed according to the message type. The data messages which are the majority of the messages will be decoded in the first step.

All incoming messages according to Q.931 have the same structure (see picture 7.4.2). After the message is identified according to the Protocol Discriminator field as a Q.931 message, the Call Reference Value (CRF) part of the message is decoded as well as the Message Type (MT). As the next part, a list with Information Elements (IE) may follow. If existent, the elements will decoded one after the other and stored in an internal data structure. As described in Q.931 unknown IEs are ignored without producing an error.

After the general message structure is checked the Call Reference Value (CRV) is examined which identifies a logical connection between the ISDN card and the ISDN0NT. The CRV determines the related context. If no one exists, a new one is created independently from message type. According to the MT the decoded message is passed to a related function to handle this message. The modul, as well, is responsible for the sending of complete messages to the DLPI modul.

7.4.3 Msg Handling, Indication Handling, Q.931 State Machine

This modul is the core of the Q.931 implementation. First, it contains all the functions to handle a particular MT. These are

All the functions required for the handling of a particular message type are collected in one source file. At the time being, the following Q.931 Message Types are evaluated (compare Q.931 [itu9303:Q.931], paragraph 3.1):

The following types are missing with respect to Q.931:

Until now, this has been enough for the usage of the implementation. Message of the missing types were never received. Nevertheless, for a Q.931 conformance they should be handled.

For each message sent and received the Q.931 Finite State Machine of the related context is executed. Additionally, all the timers defined in Q.931 are handled according to the SDL [Int93b] diagrams. The timers are realized by the Schedule modul.

Some outgoing messages, and some incoming as well, require an indication made to the application. In these cases an IsdnLib Indication is generated in the particular functions, and the Callback Function of the application that was registered before is called.

7.4.4. IE Handling

Beside the handling of the MT, the Information Elements must be encoded and decoded. A closer look to the structure of particular IEs shows that this is a quite complex task. The reason is the change of the structure of some IEs due to many optional fields.

Therefore, and for better overview these encoding and decoding functions are located in an own modul. For each IE two functions exist implemented as one particular source file. One function realizes the encoding, the other one decoding. For test purposes most IEs have a further function for formatted output of the content.

In the actual implementation the following IEs are supported (alphabetical order):

The IEs marked are not completely implemented yet.

7.4.5. Scheduler

The scheduler deals with asynchronous events. A main-loop waits for events. A small programming interface is provided to register a routine for handling a particular event. The events may be

The Scheduler is used, for example, by the Q.931 Finite State Machine module for the realization of the timers.

7.4.6. IsdnLib

The IsdnLib provides the real programming interface to the environment. the library provides a set of functions which help an application to use ISDN quite easy.

The ISDNLib bases mainly on the modules described before such as the Scheduler modul. When the IsdnLib was developed one consideration was to bind it into tcl/tk[ tcl/tk ist eine Scriptsprache, die von John K. Ousterhout entwickelt wurde.] later. Therefore, it must be possible to use the tcl scheduling functions. For this purpose the implementation expects some "shell" functions with the name of schedule modul functions and calling the tcl implementation functions. This is not yet tested!


7.5. 7.5 Why A New Library

We already described the structure of our implementation. Now, we want to recall roughly the reasons to realize the library in the way it exists yet.

At the beginning of the project, we were thinking about the most simple interface to support ISDN. The following varieties were considered:

  1. Realization as autonomous process with a socket like interface.
  2. Implementation as CAPI 2.0 interface.
  3. Definition of a library to be linked to the application.

7.5.1. Socket Interface

At the beginning, the first version looks very simple with the advantage that ISDN could eventually be used via the network. But when we continued, problems arised that made further realization and usage more difficult. Furthermore, a higher scheduling was expected.

The realization of asynchronous signalling appears to be quite difficult. In ISDN at every time messages may come in for connections already established or to be established. to relate the messages to the particular connections, we needed something like the Call Reference Value of the Q.931 messages. A new protocol would be required defining different message structures by its own.

The new protocol would become as complex as the Q.931 protocol itself. So, there was no advantage doing things this way.

7.5.2. CAPI 2.0

It seams to us more meaningful to use an already defined and well known interface, namely CAPI 2.0. Though, we analysed the CAPI specification in order to find out to which extend it was possible to us to implement the interface. But the specification was quite complex and would require another STREAMS kernel extension. The usage of CAPI seemed to be complicated. We were not willing to spent to much work, so we refused the idea.

7.5.3. 7.5.3 Implementation As Library

The only way left was to implement an autonomous library to be linked to the application. This seemed very meaningful to us, since we could immediately start and run tests. No new protocol was to be defined and no kernel extension required. Extensions seemed to be no problem. With a new service just a new function has to be implemented. When a new data field will come with a message, just a structure would change. The change would be transparent for the application.

There was one small disadvantage with this choice. Since the library is a part of the process a blocking of the program would affect the ISDN interface. Incoming Q:931 messages could not be handled Q.931 conform any more.

Nevertheless, we preferred this last variant. We called the new library IsdnLib.


7.6. Description Of The IsdnLib

An internal event loop is the core of the library. It is similar to the one in tcl. For this reason the IsdnLib can be used in a way very similar like applications linking tcl.

The particular functions of the ISdnLib are explained in the addendum D in form of manual pages. The implementation of the IsdnLib is part of addendum E.