Sangoma Wanpipe E1/T1 PRI cards signalling and data driver.
This module can build signalling interfaces (D-channels) or audio channels (B-channels) on E1/T1 spans.
Note:The API for communicating with the wanpipe kernel drivers has changed over time. We currently recommend drivers version 126.96.36.199 - anything older or newer may or may not compile or run correctly.
The wanpipe devices must be started before starting Yate (use the wanrouter script to start all or specific wanpipe device(s)).
Building a D-channel
D-channels are built and managed on request (by API calls), not at startup. The configuration file is read when a request is processed.
The sig parameter of the request MUST indicate an existing section in wpcard.conf and a valid card configured in driver (e.g. wanpipe1).
The siggroup parameter from the section given by sig MUST indicate a valid device configured in driver (e.g. w1g1).
An interface opens its wanpipe device and starts the worker thread when enabled by the owner. It closes the device and stop the worker thread when is disabled.
Note: No check is made if the wanpipe device is in use. If the wanpipe device is in use (by other programs or Yate) the D-channel creation won't fail.
Building a B-channel group (voice span)
B-channel groups are built and managed on request (by API calls), not at startup. The configuration file is read when a request is processed.
The voice parameter of the request MUST indicate an existing section in wpcard.conf and a valid card configured in driver (e.g. wanpipe1).
The voicegroup parameter from the section given by voice MUST indicate a valid device configured in driver (e.g. w1g2).
A voice span opens its wanpipe device and starts the worker thread when created. It closes the device and stop the worker thread when destroyed.
Voice span creation will fail if:
- The section indicated by the voice parameter is not found in configuration file.
- The voicegroup parameter from the span configuration section is invalid.
- Failed to open the wanpipe device.
- Failed to start the worker thread.
Configuration file: wpcard.conf
; This file keeps the configuration of cards using the wanpipe driver ; Each section except for 'general' configures a group (span) of wanpipe channels [general] ; This section is used to configure the module and set default values for ; span parameters ; bitswap: boolean: Specify if sent/received data has each byte rotated (swapped) ; If missing, enable is assumed ; This parameter can be overridden in group sections ;bitswap=enable ; idlevalue: integer: The value to send for unused voice data channels ; Interval: 0..255. Default value: 255 (0xFF) for T1, 213 (0xD5) for E1 and BRI ; A value of -1 sets the circuit code as idle value (for circuit identification) ; This parameter can be overridden in group sections ;idlevalue= ; buflen: integer: The length of the buffers used by the data sources and consumers ; Data consumers' buffers will be twice this value ; This value can't be 0. Defaults to 160 ; This parameter can be overridden in group sections ;buflen=160 ; hwrepeatcapable: boolean: Use HW signalling packet repeat capability ; If disabled, the module will handle packet repeat when requested by the upper layer ; This parameter can be overridden in group sections ;hwrepeatcapable=true ;[wanpipe1] ;The section's name is the card name defined in wanpipe driver ;E.g. wanpipe1 ; type: string: Specify the span type ; Allowed values: ; E1, T1 ; Defaults to E1 ;type=E1 ; readonly: boolean: Specifies if this is a read only span (signalling and audio data) ; If enabled, no data will be sent through this span ; Defaults to no ;readonly=no ; siggroup: string: The name of the device containing the signalling channel(s) ; E.g. w1g1 ; This parameter is required when creating a signalling interface (D-channel) ;siggroup=w1g1 ; voicegroup: string: The name of the device containing the voice (data) channel(s) ; This parameter is required when creating a voice group ; E.g. w1g2 ;voicegroup=w1g2 ; voicechans: string: The range of channels used for voice (data) transfer ; Channel intervals may be specified by separating the margins using the '-' character ; Individual channels or channel intervals may be separated by '.' ; Duplicate, not strict positive channel numbers, or channel numbers greater then channel ; count (channel count defaults to 31 for E1 and to 24 for T1) are not allowed ; E.g. 1-15.17-31 or 1-23 or 1.2.3-15.17.18-30.31 ; If missing, will be computed from type (E1: 1-15.17-31, T1: 1-23) ;voicechans=1-15.17-31 ; offset: integer: Positive value to add to each voice channel number ; Defaults to 0 if missing or invalid ;offset= ; start: integer: Absolute start of circuits numbers, ignore group's start ; Default is offset + group's current start ;start= ; increment: integer: How much will increment this span the circuit number in ; the group it belongs to ; Defaults to 32 for E1, 24 for T1 ;increment= ; samples: integer: Specify the number of data samples expected to be received ; It is used to create the buffer to read data from span. The total buffer will have the ; number of bytes given by the number of samples multiplied by the number of voice ; channels configured for this span ; If missing or 0, it will be computed from type (E1: 50, T1: 64) ;samples=50 ; errormask: integer: Value to AND with the received error byte ; The errors controlled by this mask are 1: RX overrun, 2: CRC, 4: Abort/align ; Maximum value 255 ; Defaults to 250 (all except overrun and abort) if missing or invalid ;errormask=250 ; echocancel: boolean: Enable or disable echo canceller on voice circuits ; Defaults to no ;echocancel=no ; dtmfdetect: boolean: Enable or disable tone detector on voice circuits ; Defaults to no ;dtmfdetect=no
Here is an example of config from working environment:
[general] ;bitswap=enable idlevalue=255 buflen=160 hwrepeatcapable=true dumpevents=yes [wanpipe1] type=E1 readonly=no siggroup=w1g1 voicegroup=w1g2 voicechans=2-31 ;offset=0 increment=32 samples=40 errormask=255 echocancel=yes dtmfdetect=yes bitswap=false
Here we used Sangoma card with hardware echo cancelation module.
And here is a config wanpipe1.conf which used by WanRouter:
[devices] wanpipe1 = WAN_AFT_TE1, Comment [interfaces] w1g1 = wanpipe1, , API, Comment w1g2 = wanpipe1, , API, Comment [wanpipe1] CARD_TYPE = AFT S514CPU = A CommPort = PRI AUTO_PCISLOT = NO PCISLOT = 1 PCIBUS = 10 FE_MEDIA = E1 FE_LCODE = HDB3 FE_FRAME = NCRC4 FE_LINE = 1 TE_CLOCK = NORMAL TE_REF_CLOCK = 0 TE_HIGHIMPEDANCE= NO TE_RX_SLEVEL = 120 LBO = 120OH TE_SIG_MODE = CCS FE_TXTRISTATE = NO MTU = 1500 UDPPORT = 9000 TTL = 255 ;TDMV_SPAN = 1 IGNORE_FRONT_END = NO TDMV_HW_DTMF = YES ;TDMV_HW_FAX_DETECT = YES ACTIVE_CH = ALL DATA_MUX_MAP = 0x01234567 [w1g1] HDLC_STREAMING = YES ACTIVE_CH = 1 TDMV_HWEC = NO [w1g2] HDLC_STREAMING = NO ACTIVE_CH = 2-31 IDLE_FLAG = 0x7E MTU = 1200 MRU = 1200 DATA_MUX = YES TDMV_HWEC = YES