Compare commits
10 Commits
v2.9.0-rc1
...
v2.9.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1292ea9078 | ||
|
|
cfee27106b | ||
|
|
066fa2aff3 | ||
|
|
bce5afacf1 | ||
|
|
dd752529f0 | ||
|
|
27d07446ef | ||
|
|
8e2a5def27 | ||
|
|
e553ffde2b | ||
|
|
d1fb614ac8 | ||
|
|
98ecc272d1 |
1
Makefile
1
Makefile
@@ -108,6 +108,7 @@ endif
|
||||
ASSIGNED_DATA_SCRIPTS:=\
|
||||
dahdi_handle_device \
|
||||
dahdi_span_config \
|
||||
dahdi_auto_assign_compat \
|
||||
span_config.d/10-dahdi-cfg \
|
||||
span_config.d/20-fxotune \
|
||||
span_config.d/50-asterisk \
|
||||
|
||||
7
README
7
README
@@ -264,7 +264,8 @@ to user space. Those events are normally handled by udevd. Configurations
|
||||
for udevd ("udev rules") may be placed in /etc/udev/rules.d or
|
||||
/lib/udev/rules.d. This package installs rules that instruct udevd to
|
||||
run the script `/usr/share/dahdi/dahdi_handle_device` on each new
|
||||
device. This script will:
|
||||
device, which runs all the scripts in `/usr/share/dahdi/handle_device.d`.
|
||||
Those scripts will:
|
||||
|
||||
* If `/etc/dahdi/span-types.conf` exists, apply it to the device. It is
|
||||
used for E1/T1/J1 settings. See
|
||||
@@ -298,12 +299,14 @@ listed under its device. As a new kernel object was created, an event is
|
||||
sent to udev.
|
||||
|
||||
The standard DAHDI udev rules instruct udevd to run the script
|
||||
`/usr/share/dahdi/dahdi_span_config`. This script configures the new
|
||||
`/usr/share/dahdi/dahdi_span_config` which runs all the scripts in
|
||||
`/usr/share/dahdi/span_config.d`. Those script configures the new
|
||||
span:
|
||||
|
||||
* If system.conf does not exist, generates a temporary configuration
|
||||
for the span using link:doc/dahdi_genconf.8.html[dahdi_genconf
|
||||
system].
|
||||
|
||||
* Runs link:doc/dahdi_cfg.8.html[dahdi_cfg] on the new span (using `-S`
|
||||
and -C`).
|
||||
|
||||
|
||||
@@ -148,11 +148,6 @@ xpp_startup() {
|
||||
if ! /usr/share/dahdi/waitfor_xpds; then return 0; fi
|
||||
|
||||
hotplug_exit_after_load
|
||||
|
||||
# overriding locales for the above two, as perl can be noisy
|
||||
# when locales are missing.
|
||||
# No register all the devices if they didn't auto-register:
|
||||
LC_ALL=C dahdi_registration on
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +258,9 @@ case "$1" in
|
||||
|
||||
xpp_startup
|
||||
|
||||
# Assign all spans that weren't handled via udev + /etc/dahdi/assigned-spans.conf
|
||||
/usr/share/dahdi/dahdi_auto_assign_compat
|
||||
|
||||
if [ $system = debian ]; then
|
||||
echo -n "Running dahdi_cfg: "
|
||||
$DAHDI_CFG_CMD 2> /dev/null && echo -n "done"
|
||||
|
||||
@@ -1672,13 +1672,13 @@ finish:
|
||||
|
||||
lock = sem_open(SEM_NAME, O_CREAT, O_RDWR, 1);
|
||||
if (SEM_FAILED == lock) {
|
||||
error("Unable to create 'dahdi_cfg' mutex.\n");
|
||||
perror("Unable to create 'dahdi_cfg' mutex");
|
||||
exit_code = 1;
|
||||
goto release_sem;
|
||||
}
|
||||
|
||||
if (-1 == sem_wait(lock)) {
|
||||
error("Failed to wait for dahdi_cfg mutex.\n");
|
||||
perror("Failed to wait for 'dahdi_cfg' mutex");
|
||||
exit_code = 1;
|
||||
goto unlink_sem;
|
||||
}
|
||||
@@ -1730,7 +1730,7 @@ finish:
|
||||
}
|
||||
|
||||
if (-1 == sem_wait(lock)) {
|
||||
error("Failed to wait for dahdi_cfg mutex after creating dynamic spans.\n");
|
||||
perror("Failed to wait for 'dahdi_cfg' mutex after creating dynamic spans");
|
||||
exit_code = 1;
|
||||
goto unlink_sem;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
dahdi_cfg \- configures DAHDI kernel modules from /etc/dahdi/system.conf
|
||||
.SH SYNOPSIS
|
||||
|
||||
.B dahdi_cfg [\-c \fICFG_FILE\fB] [\-S\fINUM\fB [-S\fICHANS\fB]] [\-s] [\-f] [\-t] [\-v [\-v ... ] ]
|
||||
.B dahdi_cfg [\-c \fICFG_FILE\fB] [\-S\fINUM\fB [\-S\fICHANS\fB]] [\-s] [\-f] [\-t] [\-v [\-v ... ] ]
|
||||
|
||||
.B dahdi_cfg \-h
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ Insert an error of a specific type
|
||||
.SH EXAMPLES
|
||||
Enable network line loopback on span 1:
|
||||
|
||||
dahdi_maint -s 1 --loopback networkline
|
||||
dahdi_maint \-s 1 \-\-loopback networkline
|
||||
|
||||
Disable network line loopback on span 1:
|
||||
|
||||
dahdi_maint -s 1 --loopback off
|
||||
dahdi_maint \-s 1 \-\-loopback off
|
||||
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
@@ -35,7 +35,7 @@ Normally there's a different option that you need that implies it.
|
||||
|
||||
.B \-o
|
||||
.RS
|
||||
Plays the output to OSS (/dev/dsp). Requires -m not to be used.
|
||||
Plays the output to OSS (/dev/dsp). Requires \-m not to be used.
|
||||
.RE
|
||||
|
||||
.B \-v
|
||||
@@ -44,7 +44,7 @@ Display Visual audio levels. With two v-s, Verbose mode is enabled, that
|
||||
shows the actual levels as numbers. Note that this requires a terminal
|
||||
wider than 80 columns to be properly displayed.
|
||||
|
||||
Implies -m.
|
||||
Implies \-m.
|
||||
.RE
|
||||
|
||||
.B \-f \fIFILE
|
||||
@@ -62,14 +62,14 @@ to a file.
|
||||
.RS
|
||||
Record the content of the Rx channel to a file.
|
||||
|
||||
Implies -m.
|
||||
Implies \-m.
|
||||
.RE
|
||||
|
||||
.B \-R \fIFILE
|
||||
.RS
|
||||
Record the content of the R channel before the echo canceler to a file.
|
||||
|
||||
Implies -m.
|
||||
Implies \-m.
|
||||
.RE
|
||||
|
||||
.B \-s \fIFILE
|
||||
@@ -87,47 +87,47 @@ canceler to a file.
|
||||
.RS
|
||||
Record the content of the Tx channel to a file.
|
||||
|
||||
Implies -m.
|
||||
Implies \-m.
|
||||
.RE
|
||||
|
||||
.B \-T \fIFILE
|
||||
.RS
|
||||
Record the content of the Tx channel before the echo canceler to a file.
|
||||
|
||||
Implies -m.
|
||||
Implies \-m.
|
||||
.RE
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
Visualize audio levels on DAHDI channel 2:
|
||||
|
||||
dahdi_monitor 2 -v
|
||||
dahdi_monitor 2 \-v
|
||||
|
||||
|
||||
Record channel 3 to a file:
|
||||
|
||||
dahdi_monitor 3 -f output.raw
|
||||
dahdi_monitor 3 \-f output.raw
|
||||
|
||||
This will create a raw PCM file (signed-linear, 8kHz, mono, 16 bits per
|
||||
sample). Both the Tx and Rx will be multiplexed in a single channel.
|
||||
It can be converted to a WAV file using e.g.:
|
||||
|
||||
sox -s -c1 -2 -r8000 output.raw output.wav
|
||||
sox \-s \-c1 \-2 \-r8000 output.raw output.wav
|
||||
|
||||
|
||||
Record Tx and Rx of channel 5 to separate files. This time directly to
|
||||
WAV files:
|
||||
|
||||
dahdi_monitor 5 -r output_rx.wav -t output_tx.wav
|
||||
dahdi_monitor 5 \-r output_rx.wav \-t output_tx.wav
|
||||
|
||||
|
||||
Record channel 8 to a stereo file (Tx and Rx on its two channels):
|
||||
|
||||
dahdi_monitor 8 -s output.raw
|
||||
dahdi_monitor 8 \-s output.raw
|
||||
|
||||
Converting it to a WAV file:
|
||||
|
||||
sox -s -c2 -2 -r8000 output.raw output.wav
|
||||
sox \-s \-c2 \-2 \-r8000 output.raw output.wav
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ at all).
|
||||
.B dahdi_span_assignments
|
||||
is used to assign those spans or to help creating the configuration
|
||||
file used in their assignment:
|
||||
.B /etc/dahdi/assigned-spans.conf .
|
||||
.B /etc/dahdi/assigned\-spans.conf .
|
||||
|
||||
.SH SUB-COMMANDS
|
||||
|
||||
@@ -46,14 +46,14 @@ Parameters are paths (in SysFS) to DAHDI devices with unassigned
|
||||
spans.
|
||||
|
||||
The command will assign spans with DAHDI according to
|
||||
configuration in \fBassigned-spans.conf\fR.
|
||||
configuration in \fBassigned\-spans.conf\fR.
|
||||
|
||||
If no line matches the span, or if the assignment for it fails (it is
|
||||
not available) it will remain unassigned.
|
||||
|
||||
If any of the span settings fails (the span number or range of channels
|
||||
is already in use), the program will print a message, but continue
|
||||
applying the others. In such a case you should fix assigned-spans.conf
|
||||
applying the others. In such a case you should fix assigned\-spans.conf
|
||||
and re-run \fBadd\fR (or run \fBauto\fR to give those channels the
|
||||
first available range and regenerate the file with 'dahdi_genconf
|
||||
assignedspans').
|
||||
@@ -161,7 +161,7 @@ The value in this field is matched (when the commands \fBadd\fR and
|
||||
See above for their descriptions. The value may include shell wildcards:
|
||||
*, ? and [], which are used in the match. The values to be matched are
|
||||
first cleaned up: '!' is replaced with '/' and any character beyond
|
||||
"a-zA-Z0-9/:.-" is removed.
|
||||
"a\-zA\-Z0\-9/:.\-" is removed.
|
||||
|
||||
.SS Span Specification
|
||||
|
||||
@@ -197,13 +197,13 @@ space must be available.
|
||||
|
||||
.B DAHDICONFDIR
|
||||
.RS
|
||||
The directory in which assigned-spans.conf resides. /etc/dahdi if not
|
||||
The directory in which assigned\-spans.conf resides. /etc/dahdi if not
|
||||
overridden from the environment.
|
||||
.RE
|
||||
|
||||
.B DAHDISASSIGNEDSPANSCONF
|
||||
.RS
|
||||
The path to assigned-spans.conf resides. /etc/dahdi/assigned-spans.conf if
|
||||
The path to assigned-spans.conf resides. /etc/dahdi/assigned\-spans.conf if
|
||||
not overridden from the environment.
|
||||
.RE
|
||||
|
||||
@@ -216,7 +216,7 @@ environment.
|
||||
|
||||
.SH FILES
|
||||
|
||||
.B /etc/dahdi/assigned-spans.conf
|
||||
.B /etc/dahdi/assigned\-spans.conf
|
||||
.RS
|
||||
The default location for the configuration file.
|
||||
.RE
|
||||
|
||||
@@ -24,18 +24,18 @@ The device is marked as a path in the SysFS tree.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.B -h|--help
|
||||
.B \-h|\-\-help
|
||||
.RS
|
||||
Output usage message and exit
|
||||
.RE
|
||||
|
||||
.B -n|--dry-run
|
||||
.B \-n|\-\-dry\-run
|
||||
.RS
|
||||
During \fB"set"\fR operation, only show what would be done, without actually
|
||||
changing anything.
|
||||
.RE
|
||||
|
||||
.B -v|--verbose
|
||||
.B \-v|\-\-verbose
|
||||
.RS
|
||||
During \fB"set"\fR operation, show the actions that are being performed.
|
||||
.RE
|
||||
@@ -53,7 +53,7 @@ to override the "wildcard".
|
||||
.SH SUB-COMMANDS
|
||||
.B set
|
||||
.RS
|
||||
Reads settings from \fBspan-types.conf\fR and applies them to the
|
||||
Reads settings from \fBspan\-types.conf\fR and applies them to the
|
||||
device(s) specified in the command line (or all devices, if none
|
||||
specified).
|
||||
.RE
|
||||
@@ -67,7 +67,7 @@ dahdi_span_types (E1/T1/J1 spans).
|
||||
.B dumpconfig
|
||||
.RS
|
||||
List types for the spans in a format fit to be used in
|
||||
\fBspan-types.conf\fR. Use this to generate a configuration file after
|
||||
\fBspan\-types.conf\fR. Use this to generate a configuration file after
|
||||
you have (perhaps manually) set all existing spans.
|
||||
|
||||
.B dahdi_genconf spantypes
|
||||
@@ -76,7 +76,7 @@ uses this command internally.
|
||||
|
||||
.SH CONFIGURATION
|
||||
.SS General structure
|
||||
.B span-types.conf
|
||||
.B span\-types.conf
|
||||
is a file with lines specifying line modes of spans.
|
||||
|
||||
Empty lines or lines beginning with '#' are ignored.
|
||||
@@ -106,7 +106,7 @@ used) to the following values:
|
||||
See above for their descriptions. The value may include shell wildcards:
|
||||
*, ? and [], which are used in the match. The values to be matched are
|
||||
first cleaned up: '!' is replaced with '/' and any character not in
|
||||
"a-zA-Z0-9/:.-" is replaced by "_".
|
||||
"a\-zA\-Z0\-9/:.\-" is replaced by "_".
|
||||
|
||||
Note that while span\-types.conf allows an arbitrarily-complex
|
||||
combination of E1, J1 and T1 ports, it would normally have just a single
|
||||
@@ -154,13 +154,13 @@ usb:X1234567 [34]:E1 # Except spans 3,4 on the device which will be E1
|
||||
|
||||
.B DAHDICONFDIR
|
||||
.RS
|
||||
The directory in which span-types.conf resides. /etc/dahdi if not
|
||||
The directory in which span\-types.conf resides. /etc/dahdi if not
|
||||
overridden from the environment.
|
||||
.RE
|
||||
|
||||
.B DAHDISPANTYPESCONF
|
||||
.RS
|
||||
The path to span-types.conf resides. /etc/dahdi/span\-types.conf if
|
||||
The path to span\-types.conf resides. /etc/dahdi/span\-types.conf if
|
||||
not overridden from the environment.
|
||||
.RE
|
||||
|
||||
|
||||
25
hotplug/dahdi_auto_assign_compat
Executable file
25
hotplug/dahdi_auto_assign_compat
Executable file
@@ -0,0 +1,25 @@
|
||||
#! /bin/sh
|
||||
|
||||
devdir='/sys/bus/dahdi_devices/devices'
|
||||
|
||||
# DAHDI is loaded?
|
||||
if [ ! -d "$devdir" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
devices_by_registration_time() {
|
||||
grep -H '' $devdir/*/registration_time 2>/dev/null | \
|
||||
sed 's,/registration_time:,\t,' | \
|
||||
sort -k 2,2
|
||||
}
|
||||
|
||||
# First assign non-Astribank devices
|
||||
devices_by_registration_time | \
|
||||
grep -v '/astribanks:' | \
|
||||
while read devpath time; do
|
||||
echo >&2 "D: auto '$devpath'"
|
||||
dahdi_span_assignments auto "$devpath"
|
||||
done
|
||||
|
||||
# Now handle Astribanks
|
||||
LC_ALL=C dahdi_registration -Rv on
|
||||
@@ -36,16 +36,6 @@ if [ "$DAHDI_UDEV_DISABLE_DEVICES" = 'yes' ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if we can safely do our job
|
||||
if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then
|
||||
echo "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
if [ `cat /sys/module/dahdi/parameters/auto_assign_spans` -eq 1 ]; then
|
||||
echo "auto_assign_spans=1. Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Can we pass a different value so we can use
|
||||
# alternate (testing) configuration?
|
||||
# Meanwhile, make it hard-coded.
|
||||
@@ -72,12 +62,24 @@ run_parts() {
|
||||
case "$ACTION" in
|
||||
add)
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
|
||||
# Check if we can safely do our job
|
||||
if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then
|
||||
echo "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
if [ `cat /sys/module/dahdi/parameters/auto_assign_spans` -ne 0 ]; then
|
||||
echo "auto_assign_spans=1. Skip $DEVPATH" | $LOGGER
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Background run -- don't block udev
|
||||
run_parts 2>&1 < /dev/null | $LOGGER &
|
||||
;;
|
||||
remove)
|
||||
# Nothing to do yet...
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
# Background run -- don't block udev
|
||||
run_parts 2>&1 < /dev/null | $LOGGER &
|
||||
;;
|
||||
*)
|
||||
echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
|
||||
|
||||
@@ -62,6 +62,20 @@ run_parts() {
|
||||
case "$ACTION" in
|
||||
add)
|
||||
echo "$ACTION: $DEVPATH" | $LOGGER
|
||||
|
||||
# Old driver. These scripts probably won't work anyway.
|
||||
if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then
|
||||
if [ -f /sys/module/dahdi ]; then
|
||||
$LOGGER "Old driver (no auto_assign_spans parameter). Skip $DEVPATH"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $(cat /sys/module/dahdi/parameters/auto_assign_spans) -ne 0 ]; then
|
||||
$LOGGER "auto_assign_spans=1. Skip $DEVPATH"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Set variables
|
||||
span_devpath="/sys$DEVPATH"
|
||||
SPANNO=`echo "$span_devpath" | sed 's,.*/span-,,'`
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#! /bin/sh
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
esac
|
||||
|
||||
if [ -r "$DAHDICONFDIR/span-types.conf" ]; then
|
||||
dahdi_span_types set "/sys$DEVPATH"
|
||||
fi
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
#! /bin/sh
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
esac
|
||||
|
||||
# For now, handle only spans in assigned-spans.conf
|
||||
# We leave other cases to /etc/init.d/dahdi, so
|
||||
# legacy ordering can be preserved.
|
||||
if [ -r "$DAHDICONFDIR/assigned-spans.conf" ]; then
|
||||
dahdi_span_assignments add "/sys$DEVPATH"
|
||||
else
|
||||
# No configuration. No order guaranteed
|
||||
dahdi_span_assignments auto "/sys$DEVPATH"
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
#! /bin/sh
|
||||
|
||||
# This file, if installed under /usr/share/dahdi/span_config.d/ , will
|
||||
# attempt to add a newly-generated span to a running copy of Asterisk.
|
||||
# Asterisk has to be running (if not: it will pick the span on its
|
||||
# startup), and has to have the channels already configured.
|
||||
|
||||
if [ "$ACTION" != 'add' ]; then
|
||||
# Nothing to do here
|
||||
exit 0
|
||||
|
||||
@@ -35,7 +35,7 @@ my %opts;
|
||||
getopts('vRs:', \%opts) || usage;
|
||||
|
||||
my $dahdi_autoreg = check_param('/sys/module/xpp/parameters/dahdi_autoreg') eq 'Y';
|
||||
my $auto_assign_spans = check_param('/sys/module/dahdi/parameters/auto_assign_spans') eq '1';
|
||||
my $auto_assign_spans = check_param('/sys/module/dahdi/parameters/auto_assign_spans') ne '0';
|
||||
my $assigned_spans_config = $ENV{'ASSIGNED_SPANS_CONF_FILE'} || '/etc/dahdi/assigned-spans.conf';
|
||||
my $span_types_config = $ENV{'SPAN_TYPES_CONF_FILE'} || '/etc/dahdi/span-types.conf';
|
||||
my $have_assigned_spans_config = -f $assigned_spans_config || 0;
|
||||
|
||||
@@ -72,6 +72,10 @@ waitfor_ab_initialization() {
|
||||
fi
|
||||
test "$oldab" != "$ab"
|
||||
do
|
||||
if [ "$ab" = '' ]; then
|
||||
echo >&2 "Astribanks disappeared"
|
||||
break
|
||||
fi
|
||||
oldab="$ab"
|
||||
cat $ab
|
||||
#echo -n 1>&2 "_"
|
||||
|
||||
Reference in New Issue
Block a user