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

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Dec 26 05:11:39 CST 2017


On Mon, Apr 25, 2016 at 04:53:22PM +0300, Tzafrir Cohen wrote:
> 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 needed to play again with dynamic spans.

This time I decided to skip a loading script and have everything in a
Systemd unit:

#####################################
# cat /lib/systemd-system/dahdi-dynamic.service
[Unit]
Description=Dynamic DAHDI devices
Documentation=man:dahdi_cfg(1)
ConditionPathExists=/etc/dahdi/dynamic.conf

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/sbin/modprobe dahdi
ExecStop=/usr/sbin/dahdi_span_assignments remove ; \
	 /usr/sbin/dahdi_cfg -c /etc/dahdi/dynamic.conf -s
ExecStart=/usr/sbin/dahdi_cfg -c /etc/dahdi/dynamic.conf

[Install]
WantedBy=sysinit.target
#####################################

Assuming you set auto_assign_spans=0 and have
/etc/dahdi/assigned-spans.conf and /etc/dahdi/system.conf , this
configures spans automatically at startup. Those files can be generated
using:

  dahdi_span_assignments auto
  dahdi_genconf

  # Apply the new configuration:
  dahdi_span_assignments remove
  dahdi_span_assignments add

> 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
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com



More information about the asterisk-dev mailing list