libmfcr2 - a library for MFC/R2 signaling on E1 lines

This library is designed to support MFC/R2 signalling in the ZapTel environment,
but should be easily adaptable to other dumb E1 cards that allow channelised
CAS signaled operation.

It is intended that the library eventually support most national variants of the
MFC/R2 protocol. The application specifies the national variant when opening a
channel.

It can make and receive calls successfully when connected to a Dialogic E1
card running their GlobalCall package, in China and Argentina modes. 

Steve Underwood <steveu@coppice.org>
Sep 2004


The protocol variant for MFC/R2 is specified as a string with the following format:

<varient>,<maximum ANI digits>,<maximum DNIS digits>,<options>

The <variant> field is a two letter UN country code, or "itu" for the unmodified
ITU version of MFC/R2. Slightly longer codes are used for countries with more than
one variant of MFC/R2.

The fourth parameter is composed of bits, which must be OR'ed together, as follows:

    1:  Play progress tones. These are usually handled by the far end switch, but
        may need to be sent as audio through the channel on some systems.
    2:  Play disconnect tone. The disconnect tone is usually handled by the far end
        switch, but may need to be sent as audio through the channel on some systems.
    4:  Play ringback tone. The ringback tone is usually generated by something
         downstream of the MFC/R2 software, but may need to be generated here on some
        systems.
    8:  Get ANI after DNIS. The usual behaviour for incoming calls is to get the
        calling party category and the ANI as soon as possible, and to get the DNIS
        afterwards. This doesn't work on all systems, so the option to reverse the
        behaviour is provided.
    16: Use immediate accept. Most variants of MFC/R2 offer a way to go directly to
        the call accepted state, bypassing the use of group B and II tones. This option
        enables the use of that feature for incoming calls.

E.g. cn,20,7,24 means China variant, up to 20 ANI digits, up to 7 DNIS digits, get ANI after
DNIS, and use the immediate call accept option.
