MISDN
Aus A-Enterprise
- This package contains the mISDN Channel Driver for the Asterisk PBX.
It supports every mISDN Hardware and provides an interface for asterisk.
Inhaltsverzeichnis |
Features
- NT and TE mode
- PP and PMP mode
- BRI and PRI (with BNE1 and BN2E1 Cards)
- Hardware Bridging
- DTMF Detection in HW+mISDNdsp (much better than asterisks internal!)
- Display Messages to Phones (which support display msg)
- HOLD/RETRIEVE/TRANSFER on ISDN Phones : )
- Screen/ Not Screen User Number
- Basic EchoCancellation
- Volume Control
- Crypting with mISDNdsp (Blowfish)
- Data (HDLC) callthrough
- Data Calling (with app_ptyfork +pppd)
- Echo cancellation
- CallDeflection
- Some other
Supported Hardware
chan_misdn supports any mISDN compatible Hardware, like HFC chip based cards.
Fast Installation Guide
It is easy to install mISDN and mISDNuser. Using the Makefile from channels/misdn. You just need to type:
cd channels/misdn make misdn
Then all the necessary files are fetched from isdn4linux.de.
Pre-Requisites
To compile and install this driver, you'll need at least one mISDN Driver and the mISDNuser package. Chan_misdn works with both, the current release version and the development (svn trunk) version of Asterisk. mISDNuser and mISDN must be fetched from cvs.isdn4linux.de.
Please Note that mISDN works good for the linux-2.6.x kernels. Some of the mISDN drivers do not compile against the 2.4.x or older kernels, you can patch them, but than you'll get mysterious errors.
Using Kernels > 2.6.9 works perfect.
Ok so far so good, now follow the compilation instructions.
!! Dont forget to create the /dev/mISDN device node.
Compilation
The compilation of chan_misdn requires a library which will be generated under channels/misdn/.
To compile this library you just need to go into this directory and type make. Now you can go back to the asterisk source root and type make install again, which now should compile and install chan_misdn.
Installation
Chan_misdn is automatically installed by the asterisk installation process.
There is a sample init.d script for loading the mISDN modules (mISDN.sample), 5Asimply copy it to /etc/init.d/ and modify it, there you can enter your cards.
!! Forget to use capi together with chan_misdn.
Configuration
First of all you must configure the mISDN drivers. Each driver module has got an options and layermask option, which tells the driver wether to start in TE, NT, PP or PMP mode (there are lots more, please read docs in misdn for that).
After thinking about the above you'll probably want to configure the misdn.conf file which resides in the asterisk config directory (normally /etc/asterisk).
- misdn.conf
- [general]
The misdn.conf file contains a "general" Section, and user sections which contain misdn port settings and different Asterisk contexts.
The general section contains especially a variable named context with which the default context is set. There is also 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 tracefile option, which takes a path+filename where debug output is written to.
- misdn.conf
- [default] section
The default section is another special section which can contain all the options available int the usr/port sections. the user/port section inherit their parameters from the default section.
- misdn.conf
- user/port sections
The user sections have names which are unequal to "general". Those sections contain the ports variable which mean the mISDN Ports. Here you can add multiple ports, comma separated.
Espacially for TE-Mode Ports there is a msns variable. This variable tells the chan_misdn driver to listen for incomming calls with the given msns, you can insert a '*' as single msn, which leads in getting every incoming call (if you want to share on PMP TE S0 with a asterisk and a phone or isdn card you should insert here the msns which you'll like to give the Asterisk). Finally a context variable resides in the user sections, 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>|g:<group>/<extension>[/<OPTIONSSTRING>] The Optionsstring looks Like: :<optchar1><OptParam1>:<optchar2><OptParam2> the ":" character is the delimiter. The available Optchars are: d - Send display text on called phone, text is the optparam n - don't detect dtmf tones on called channel h - make digital outgoing call c - make crypted outgoing call, param is keyindex e - perform echo cancelation on this channel, takes taps as arguments (32,64,128,256) s - send Non Inband DTMF as inband vr - rxgain control vt - txgain control
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})
misdn cli commands
At the Asterisk cli you can try to type in: misdn <tab> <tab> Now you should see the misdn cli commands: - clean -> pid (cleans a broken call, use with care, leads often to a segmentation fault) - send -> display (sends a Text Message to a Asterisk channel, this channel must be an misdn channel) - set -> debug (sets debug level) - show -> config (shows the configuration options) -> channels (shows the current active misdn channels) -> channel (shows details about the given misdn channels) -> stacks (shows the currend ports, there protocols and states) -> fullstacks (shows the current active and inactive misdn channels) - restart -> port (restarts given port (L2 Restart) ) - reload (reloads misdn.conf)
You can only use "misdn send display" when an Asterisk channel is created and isdn is in the correct state. "correct state" means that you have established a call to another phone (mustn't be isdn though).
Then you use it like this:
misdn send display mISDN/1/101 "Hello World!"
where 1 is the Port of the Card where the phone is plugged in, and 101 is the msn (callerid) of the Phone to send the text to.
mISDN Variables ---- mISDN Exports/Imports a few Variables: MISDN_ADDRESS_COMPLETE : Is either set to 1 from the Provider, or you can set it to 1 to force a sending complete.
Debugging and sending bug reports
If you encounter problems, you should set up the debugging flag, usually debug=1 should be enough. the messages are divided in asterisk and misdn parts. Misdn Debug messages begin with an 'I', asterisk messages begin with an '*', the rest is clear I think.
Please take a trace of the problem and open a report in the Asterisk issue tracker at http://bugs.digium.com in the "channel drivers" project, "chan_misdn" category. Read the bug guidelines to make sure you provide all the information needed.
Examples
Here are some examples of how to use chan_misdn in the dialplan (extensions.conf):
[globals] OUT_PORT=1 ; The physical Port of the Card OUT_GROUP=ExternE1 ; The Group of Ports defined in misdn.conf
[misdnIn] exten => _X.,1,Dial(mISDN/${OUT_PORT}/${EXTEN}) exten => _0X.,1,Dial(mISDN/g:${OUT_GROUP}/${EXTEN:1}) exten => _1X.,1,Dial(mISDN/g:${OUT_GROUP}/${EXTEN:1}/:dHello) exten => _1X.,1,Dial(mISDN/g:${OUT_GROUP}/${EXTEN:1}/:dHello Test:n)
In the last line you will notice the last argument (Hello), this is sended as Display Message to the Phone.
Known working configurations
In this section I'll put working configurations for chan_misdn. Beware It seems that between Kernel 2.6.3 and Kernel 2.6.8 there were lots of mISDN Bugs. I use Kernel 2.6.9 now, it works quite ok, Kernel 2.6.10+ has changed the pci_find_subgsys funktion, so hfc_multi from mISDN doesn't compile against it, you can just change pci_find_subsys to pci_get_subsys, this works.
- chan_misdn-0.2.1
- linux-kernel >= 2.6.8 (but at least 2.6)
- asterisk >= v1.2 , also CVS Head
- mISDN/mISDNuser (3.0) from isdn.jolly.de
Known Problems
- When I use mISDN->IAX I cannot make Trunk calls
-> You need to use ztdummy as dummy zaptel interface for the iax timing in trunking mode, simply grab libpri, zaptel and compile them (i think you need to modify the makefile in zaptel to add ztdummy to the defaultly compiled modules) then modprobe ztdummy, this resolves the problem.
- I cannot hear any tone after succesfull CONNECT to other end
-> you forgot to load mISDNdsp, which is now needed by chan_misdn for switching and dtmf tone detection
- I have strange ISDN behavior
- sometimes I hear the other end, sometimes
not. Also I get STATUS Events with cause 100, with misdn debugging
-> Please update to newest version of chan_misdn and set the te_choose_channel option in misdn.conf to yes
Example misdn.conf
; ; chan_misdn sample config ; ; general section: ; ; for debugging and general setup, things that are not bound to port groups ; [general] ; ; Sets the Path to the misdn-init.conf (for nt_ptp mode checking) ; misdn_init=/etc/misdn-init.conf ; set debugging flag: ; 0 - No Debug ; 1 - mISDN Messages and * - Messages, and * - State changes ; 2 - Messages + Message specific Informations (e.g. bearer capability) ; 3 - very Verbose, the above + lots of Driver specific infos ; 4 - even more Verbose than 3 ; ; default value: 0 ; debug=0 ; set debugging file and flags for mISDNuser (NT-Stack) ; ; flags can be or'ed with the following values: ; ; DBGM_NET 0x00000001 ; DBGM_MSG 0x00000002 ; DBGM_FSM 0x00000004 ; DBGM_TEI 0x00000010 ; DBGM_L2 0x00000020 ; DBGM_L3 0x00000040 ; DBGM_L3DATA 0x00000080 ; DBGM_BC 0x00000100 ; DBGM_TONE 0x00000200 ; DBGM_BCDATA 0x00000400 ; DBGM_MAN 0x00001000 ; DBGM_APPL 0x00002000 ; DBGM_ISDN 0x00004000 ; DBGM_SOCK 0x00010000 ; DBGM_CONN 0x00020000 ; DBGM_CDATA 0x00040000 ; DBGM_DDATA 0x00080000 ; DBGM_SOUND 0x00100000 ; DBGM_SDATA 0x00200000 ; DBGM_TOPLEVEL 0x40000000 ; DBGM_ALL 0xffffffff ; ntdebugflags=0 ntdebugfile=/var/log/misdn-nt.log ; the big trace ; ; default value: [not set] ; ;tracefile=/var/log/asterisk/misdn.log ; set to yes if you want mISDN_dsp to bridge the calls in HW ; ; default value: yes ; bridging=no ; stops dialtone after getting first digit on nt Port ; ; default value: yes ; stop_tone_after_first_digit=yes ; whether to append overlapdialed Digits to Extension or not ; ; default value: yes ; append_digits2exten=yes ;;; CRYPTION STUFF ; Whether to look for dynamic crypting attempt ; ; default value: no ; dynamic_crypt=no ; crypt_prefix, what is used for crypting Protocol ; ; default value: [not set] ; crypt_prefix=** ; Keys for cryption, you reference them in the dialplan ; later also in dynamic encr. ; ; default value: [not set] ; crypt_keys=test,muh ; users sections: ; ; name your sections as you which but not "general" ! ; the sections are Groups, you can dial out in extensions.conf ; with Dial(mISDN/g:extern/101) where extern is a section name, ; chan_misdn tries every port in this section to find a ; new free channel ; ; The default section is not a group section, it just contains config elements ; which are inherited by group sections. ; [default] ; define your default context here ; ; default value: default ; context=misdn ; language ; ; default value: en ; language=en ; ; sets the musiconhold class ; musicclass=default ; ; Either if we should produce DTMF Tones ourselves ; senddtmf=yes ; ; If we should generate Ringing for chan_sip and others ; far_alerting=no ; ; here you can define which bearers should be allowed ; allowed_bearers=all ; Prefixes for national and international, those are put before the ; oad if an according dialplan is set by the other end. ; ; default values: nationalprefix : 0 ; internationalprefix : 00 ; nationalprefix=0 internationalprefix=00 ; set rx/tx gains between -8 and 8 to change the RX/TX Gain ; ; default values: rxgain: 0 ; txgain: 0 ; rxgain=0 txgain=0 ; some telcos especially in NL seem to need this set to yes, also in ; switzerland this seems to be important ; ; default value: no ; te_choose_channel=no ; ; This option defines, if chan_misdn should check the L1 on a PMP ; before making a group call on it. The L1 may go down for PMP Ports ; so we might need this. ; But be aware! a broken or plugged off cable might be used for a group call ; as well, since chan_misdn has no chance to distinguish if the L1 is down ; because of a lost Link or because the Provider shut it down... ; ; default: no ; pmp_l1_check=no ; ; in PMP this option defines which cause should be sent out to ; the 3. caller. chan_misdn does not support callwaiting on TE ; PMP side. This allows to modify the RELEASE_COMPLETE cause ; at least. ; reject_cause=16 ; ; Send Setup_Acknowledge on incoming calls anyway (instead of PROCEEDING), ; this requests additional Infos, so we can waitfordigits ; without much issues. This works only for PTP Ports ; ; default value: no ; need_more_infos=no ; ; set this to yes if you want to disconnect calls when a timeout occurs ; for example during the overlapdial phase ; nttimeout=no ; set the method to use for channel selection: ; standard - always choose the first free channel with the lowest number ; round_robin - use the round robin algorithm to select a channel. use this ; if you want to balance your load. ; ; default value: standard ; method=standard ; ; dialplan means Type Of Number in ISDN Terms (for outgoing calls) ; ; there are different types of the dialplan: ; ; dialplan -> outgoing Number ; localdialplan -> callerid ; cpndialplan -> connected party number ; ; dialplan options: ; ; 0 - unknown ; 1 - International ; 2 - National ; 4 - Subscriber ; ; This setting is used for outgoing calls ; ; default value: 0 ; dialplan=0 localdialplan=0 cpndialplan=0 ; ; turn this to no if you don't mind correct handling of Progress Indicators ; early_bconnect=yes ; ; turn this on if you like to send Tone Indications to a Incoming ; isdn channel on a TE Port. Rarely used, only if the Telco allows ; you to send indications by yourself, normally the Telco sends the ; indications to the remote party. ; ; default: no ; incoming_early_audio=no ; uncomment the following to get into s extension at extension conf ; there you can use DigitTimeout if you can't or don't want to use ; isdn overlap dial. ; note: This will jump into the s exten for every exten! ; ; default value: no ; ;always_immediate=no ; ; set this to yes if you want to generate your own dialtone ; with always_immediate=yes, else chan_misdn generates the dialtone ; ; default value: no ; nodialtone=no ; uncomment the following if you want callers which called exactly the ; base number (so no extension is set) jump to the s extension. ; if the user dials something more it jumps to the correct extension ; instead ; ; default value: no ; ;immediate=no ; uncomment the following to have hold and retrieve support ; ; default value: no ; ;hold_allowed=yes ; Pickup and Callgroup ; ; default values: not set = 0 ; ;callgroup=1 ;pickupgroup=1 ; ; these are the exact isdn screening and presentation indicators ; if -1 is given for both values the presentation indicators are used ; from asterisks SetCallerPres application. ; s=0, p=0 -> callerid presented not screened ; s=1, p=1 -> callerid presented but screened (the remote end does not see it!) ; ; default values s=-1, p=-1 presentation=-1 screen=-1 ; this enables echocancellation, with the given number of taps ; be aware, move this setting only to outgoing portgroups! ; A value of zero turns echocancellation off. ; ; possible values are: 0,32,64,128,256,yes(=128),no(=0) ; ; default value: no ; ;echocancel=no ; ; chan_misdns jitterbuffer, default 4000 ; jitterbuffer=4000 ; ; change this threshold to enable dejitter functionality ; jitterbuffer_upper_threshold=0 ; ; change this to yes, if you want to bridge a mISDN data channel to ; another channel type or to an application. ; hdlc=no [intern] ; define your ports, e.g. 1,2 (depends on mISDN-driver loading order) ports=1,2 ; context where to go to when incoming Call on one of the above ports context=Intern [internPP] ; ; adding the postfix 'ptp' to a port number is obsolete now, chan_misdn ; parses /etc/misdn-init.conf and sets the ptp mode to the corresponding ; configs. For backwards compatibility you can still set ptp here. ; ports=3 [first_extern] ; again port defs ports=4 ; again a context for incoming calls context=Extern1 ; msns for te ports, listen on those numbers on the above ports, and ; indicate the incoming calls to asterisk ; here you can give a comma separated list or simply an '*' for ; any msn. msns=* ; here an example with given msns [second_extern] ports=5 context=Extern2 callerid=15 msns=102,144,101,104

