[asterisk-dev] dahdi dynamic spans and auto-assignment: mostly success

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Apr 25 08:53:22 CDT 2016


Hi,

I wanted to play with local (dynamic) dahdi spans. Therefore I wanted to
figure out how they work with span auto-assignment. It turned out that
reasonably well.

For starters: move the dynamic= lines out of /etc/dahdi/system.conf .
I placed them in a file called /etc/dahdi/dynamic.conf (an arbitrary
name):

* Allows calling dahdi_cfg as many times as required
* Allows regenerating system.conf without caring about dynamic=lines.
* There is currently no option is dahdi_cfg to only process dynamic
  spans and I see no point to add such an option.

I wrote a separate script (maybe it should be merged into an existing
one):

# cat /usr/share/dahdi/load_dynamic 
#!/bin/sh

DYNAMIC_FILE=/etc/dahdi/dynamic.conf

if [ ! -r "$DYNAMIC_FILE" ]; then
	exit 0
fi

set -e

modprobe dahdi # Really needed? Loading the synamic module will load it
               # as well, right?
dahdi_cfg -c "$DYNAMIC_FILE"
####################################

There is nothing automatic to trigger it. Hence I needed a separate
systemd service to load it:

# cat /etc/systemd/system/dahdi-dynamic.service 
[Unit]
Description=Load DAHDI dynamic modules

[Service]
ExecStart=/usr/share/dahdi/load_dynamic
Type=oneshot

[Install]
WantedBy=multi-user.target
###############################################


This mostly puts the pieces into place. However, not all is well (see
below).

My configuration files:

# cat /etc/dahdi/dynamic.conf 
dynamic=loc,1:0,31,0
dynamic=loc,1:1,31,1
#############################

# cat /etc/dahdi/assigned-spans.conf
#
# Map devices + local spans to span + base channel number

# Device: [DYN/loc/1:0] @ /sys/devices/dynamic:loc:0
DYN/loc/1:0                    1:1:1

# Device: [DYN/loc/1:1] @ /sys/devices/dynamic:loc:1
DYN/loc/1:1                    1:2:32
#########################################################

(Nothing special in the rest of the configuration files)

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com



More information about the asterisk-dev mailing list