# Asterisk Project : mISDN Configuration

Added by mdavenport , edited by mdavenport on Aug 31, 2010

First of all you must configure the mISDN drivers, please follow the instructions in the mISDN package to do that, the main config file and config script is:

    /etc/init.d/misdn-init and /etc/misdn-init.conf

Now you will want to configure the misdn.conf file which resides in the Asterisk config directory (normally /etc/asterisk).

##### misdn.conf: [general] subsection

The misdn.conf file contains a "general" subsection, and user subsections which contain misdn port settings and different Asterisk contexts.
In the general subsection you can set options that are not directly port related. There is for example the very important debug variable which you can set from the Asterisk cli (command line interface) or in this configuration file, bigger numbers will lead to more debug output. There's also a trace file option, which takes a path+filename where debug output is written to.

##### misdn.conf: [default] subsection

The default subsection is another special subsection which can contain all the options available in the user/port subsections. The user/port subsections inherit their parameters from the default subsection.

##### misdn.conf: user/port subsections

The user subsections have names which are unequal to "general". Those subsections contain the ports variable which mean the mISDN Ports. Here you can add multiple ports, comma separated.

Especially for TE-Mode Ports there is a msns option. This option tells the chan_misdn driver to listen for incoming calls with the given msns, you can insert a '' as single msn, which leads to getting every incoming call. If you want to share on PMP TE S0 with Asterisk and a phone or ISDN card you should insert here the msns which you assign to Asterisk. Finally a context variable resides in the user subsections, which tells chan_misdn where to send incoming calls to in the Asterisk dial plan (extension.conf).*

##### Dial and Options String

The dial string of chan_misdn got more complex, because we added more features, so the generic dial string looks like:

    mISDN/<port>[:bchannel]|g:<group>/<extension>[/<OPTIONSSTRING>]

The Optionsstring looks Like:

     :<optchar><optarg>:<optchar><optarg>...

The ":" character is the delimiter. The available options are:

- a - Have Asterisk detect DTMF tones on called channel
- c - Make crypted outgoing call, optarg is keyindex
- d - Send display text to called phone, text is the optarg
- e - Perform echo cancelation on this channel, takes taps as optarg (32,64,128,256)
- e! - Disable echo cancelation on this channel
- f - Enable fax detection
- h - Make digital outgoing call
- h1 - Make HDLC mode digital outgoing call
- i - Ignore detected DTMF tones, don't signal them to Asterisk, they will be transported inband.
- jb - Set jitter buffer length, optarg is length
- jt - Set jitter buffer upper threshold, optarg is threshold
- jn - Disable jitter buffer
- n - Disable mISDN DSP on channel. Disables: echo cancel, DTMF detection, and volume control.
- p - Caller ID presentation, optarg is either 'allowed' or 'restricted'
- s - Send Non-inband DTMF as inband
- vr - Rx gain control, optarg is gain
- vt - Tx gain control, optarg is gain

chan_misdn registers a new dial plan application "misdn_set_opt" when loaded. This application takes the Optionsstring as argument. The Syntax is:

    misdn_set_opt(<OPTIONSSTRING>)

When you set options in the dialstring, the options are set in the external channel. When you set options with misdn_set_opt, they are set in the current incoming channel. So if you like to use static encryption, the scenario looks as follows:

    Phone1 --> * Box 1 --> PSTN_TE PSTN_TE --> * Box 2 --> Phone2

The encryption must be done on the PSTN sides, so the dialplan on the boxes are:

- Box 1:

    exten => _${CRYPT_PREFIX}X.,1,Dial(mISDN/g:outbound/:c1)

- Box 2:

    exten => ${CRYPT_MSN},1,misdn_set_opt(:c1)
    exten => ${CRYPT_MSN},2,dial(${PHONE2})