Nothing Special   »   [go: up one dir, main page]

0% found this document useful (0 votes)
244 views24 pages

DAHDI Overview For Asterisk Developers: Presented by Matthew Fredrickson and Shaun Ruffell

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 24

DAHDI Overview for

Asterisk Developers
Presented by
Matthew Fredrickson
(creslin@digium.com)
and Shaun Ruffell
(sruffell@digium.com)
What is DAHDI?
• Digium Asterisk Hardware Device Interface
• It is...
– A high density kernel telephony interface
for PSTN hardware
– Abstracts the hardware interface.
– A collection of kernel modules to
implement this interfaces.
• It was...
– Formerly known as Zaptel.
2
Presentation Goals
• We hope to...
– Give an overview of directory and code
structure for DAHDI
– Point out differences between DAHDI
and Zaptel
– Provide an overview of some of the
internals of DAHDI, including an overview
of the main data path to and from a card.

3
Code Structure
• Two Packages
– dahdi-tools
• Userland programs and utilities
• http://svn.digium.com/svn/dahdi/tools/trunk
– dahdi-linux
• Kernel modules
• http://svn.digium.com/svn/dadhi/linux/trunk
– Divided into two parts to ease binary
distribution.
dahdi-linux organization
• System header files
– include/dahdi/user.h
– include/dahdi/kernel.h
– include/dahdi/wctdm_user.h
– include/dahdi/fasthdlc.h
• Kernel modules
– drivers/dahdi/
• Changed to allow building of DAHDI in the
kernel tree (mostly for distributions)
– No more menuselect 5
dahdi-tools organization
• /doc/
– contains man pages for tools
• /build_tools/
– Contains tools used by build system (version
information, generate udev rules,
deprecated module removal)
• /ppp/
– Contains pppd plugin for DAHDI data mode
• /
– Contains all utilities, system scripts, and
6
sample configuration files
Installed Scripts and Config Files

• /etc/init.d/dahdi
• /etc/modprobe.d/dahdi
• /etc/modprobe.d/dahdi.blacklist
• /etc/dahdi/modules
• /etc/udev/rules.d/dahdi.rules

7
/etc/dahdi/system.conf
• Why do we have
/etc/dahdi/system.conf and
/etc/asterisk/chan_dahdi.conf?
• Syntax compatible with existing
zaptel.conf (just copy old zaptel.conf
to /etc/dahdi/system.conf)
• NOTE!! Must now explicitly set
echocanceller for channels in this file.
• dahdi_cfg activates configuration 8
Useful DAHDI tools and
utilities
• dahdi_tool
• dahdi_test
• dahdi_monitor
• fxotune

9
dahdi_tool
• Graphical front end for
viewing spans on a
system.
• Can activate loop up
and loop down of spans.
• Can display signalling
bits (ABCD) of span.
• And other span related
information (Bipolar
violations, IRQ misses)
• Requires libnewt to
compile
10
dahdi_test
• Used for troubleshooting and
qualifying platforms.
• Measures the amount of bytes
generated by DAHDI each second
• If operating properly (no system or
system latency problems) should be
very close to 100% (99.99, 99.98,
99.97).
11
dahdi_monitor
• Used to record pre and post echo
cancelled data on tx and rx directions
of a DAHDI channel
• Can be run while Asterisk is running to
monitor data through a channel
• Can also provide a visual indication of
tx and rx signal levels on a line (good
for doing gain normalization).
12
fxotune
• Used to balance hybrid on most
DAHDI FXO hardware (SI3050 based)
• Can dramatically reduce echo on
analog lines.
• First thing to use when debugging
echo problems on FXOs
• /etc/fxotune.conf
• fxotune -s
13
High Level Overview
dahdi tools

asterisk dahdi_cfg
dahdi_cfg
dahdi_cfg
chan_dahdi.so
User Mode

Kernel Mode

dahdi.ko

dahdi_transcode.ko
WCTDM.KO
wctdm.ko
WCTDM.KO dahdi_echocan_mg2.ko
dahdi_echocan_mg2.ko
dahdi_echocan_mg2.ko
WCTDM.KO
wctc4xxp.ko
wctc4xxp.ko
wctc4xxp.ko

Hardware

TDM800P TC400M

14
Kernel Interfaces
• User mode
– Device Files /dev/dahdi/
– ioctl(), read(), write(), poll()
– /usr/include/dahdi/user.h
• Kernel mode
– struct file_operations
– request_irq()
– Interrupt handlers (bottom half)
15
DAHDI Main Modules
• dahdi-base.c (dahdi.ko)
– This file contains the dahdi core, including
all core telephony functionality and
userspace interface.
– All telephony related ioctls are handled
here.
– Board driver interface is also located here
(dahdi_transmit/dahdi_receive,
dahdi_ec_chunk)
16
DAHDI Main Modules
• dahdi_echocan_*
– Echo canceller modules
– MG2 is the latest and greatest
– echocanceller=mg2,1-8
• /etc/dahdi/system.conf syntax

17
struct dahdi_chan
• Read Buffers
– u_char * readbuf[DAHDI_MAX_NUM_BUFS];
– int inreadbuf;
– int outreadbuf;
– u_char * readchunk;
• Write Buffers
– u_char * writebuf[ZT_MAX_NUM_BUFS];
– int inwritebuf;
– int outwritebuf;
– u_char * writechunk; 18
User mode interface of
dahdi-base.c
• dahdi_chan_read()
– Data is copied from channel buffers and
placed into user buffers in chan_dahdi
• dahdi_chan_write()
– Data is copied from buffers in
chan_dahdi and placed into channel
buffers for preparation to be transmitted
to the card.

19
Device interface of dahdi-
base.c
• dahdi_register()
• dahdi_transmit()
– Passes TDM data from dahdi_chan buffers to
hardware driver for transmission out on the line.
• dahdi_receive()
– Takes TDM data from hardware driver and
places it in dahdi_chan buffers.
• dahdi_ec_span()
– Allows echo cancellers to run (if enabled and
active) 20
Read example
TDM410P wctdm24xxp.ko dahdi.ko chan_dahdi.so

DMA to host

interrupt

Move into
readchunk dahdi_ec_chunk()

dahdi_receive()

Copy readchunk
into readbuf
dahdi_chan_read()

Copy readbuf to
user

21
One Last Important Thing
• Master Span
– One span is the master span
– Triggered by dahdi_receive() on master
span
• Master Span Processing
– Conferencing Engine
– DAHDI Timer Processing
– Span Synchronization Functions

22
chan_dahdi debugging
• core set verbose 100 :-)
• enable all messages in logger.conf
console=warning,error,notice,
verbose,debug
• core set debug 1
• pri debug span x
• ss7 debug linkset x

23
Questions?

24

You might also like