[asterisk-users] What is dahdi.auto_assigned_spans and why should you care? (II)

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Jan 21 11:31:41 CST 2014


Hi again,

Some other things missing from the previous message: setting E1/T1/[J1?]
and upgrading.


E1/T1
-----
an E1/T1/J1 should be configured to be either E1 or T1.There are a
number of ways to set this. Specifically: quite a few different ways.

With the new DAHDI initialization scheme we also provide a new standard
method[X] for setting the "type" (E1/T1/J1) of the span.

If you set dahdi.auto_assign_spans=0, the spans are not assigned
automatically. Before assigning them, the user may set the "spantype"
attribute[K]. This "user" is normally the udev hook script
/usr/share/dahdi/dahdi_handle_device which will run 'dahdi_span_types
set' for the span before assigning the spans of the device[C].

There are several sensible values to put in that file:

1. Just not have it. In this case you fall back to the previous settings
of your drivers.

2. All spans are E1: Just include the following line:

* *:E1

(If you want T1 or J1. put that type instead)


3. Anything more complex: it's easy to do that. you can start with:

  dahdi_span_types dumpconfig

and set the specific spans there to be E1 or T1. Note that the
configuration lines are read in order[D] and hence if you have a default
("* *:T1") line and some more specific lines ("id1234 [13]:E1"), the
default must come first.

See the sample span-types.conf[4]

In 2.8 dahdi_genconf generates span-types.conf by default with lines for
each existing Astribank. This has turned out to be a bad idea. In 2.9
merely running 'dahdi_genconf' will not generate span-types.conf .
You'll need to explicitly use 'dahdi_genconf spantypes' . And the option
you'll normally use is:

  dahdi_genconf --tdm-type=J1


Upgrades
--------
You have on your system a version of DAHDI in which
dahdi.auto_assign_spans is set to 1. Now you upgrade it to a version
in which auto_assign_spans is set to 0. What happens?

Workaround
~~~~~~~~~~
There is the workaround of setting 'options dahdi auto_assign_spans=1' 
in a file in /etc/modprobe.d . It will work, but we're trying to avoid
that.


Planning Ahead
~~~~~~~~~~~~~~
If you plan ahead, you can run before the upgrade:

  dahdi_genconf assignedspans

which is a glorified way of running:

  dahdi_span_assignments dumpconfig >/etc/dahdi/assigend-spans.conf

However this will not work for some older versions of DAHDI (as the
interface may not be there, is is not complete). And besides, why plan
ahead?


Just Upgrade
~~~~~~~~~~~~
So, what happens if If you just load the system (make sure that there's
no existing /etc/dahdi/assigned-spans.conf), spans get registered in the
same order as they appear. So basically you should see once that the
system started properly, and then run:

  dahdi_genconf assignedspans

This will be used for the next time the module is loaded, so there is no
need to run anything afterwards to "apply" the changes.

I wonder if this fits in a postinst script of a package of dahdi kernel
modules.


Astribanks
~~~~~~~~~~
For Astribanks the upgrade is trickier: Astribanks have their own
mechanism that was intended to provide stable channel and span numbers
in DAHDI: just before registering all the Astribanks with DAHDI they
would wait and registration was done by a specific order (so it worked
well s long as noon was added or removed).

The configuration is a list of Astribanks in /etc/dahdi/xpp_order .

With the upgrade the Astribanks will no longer wait. Thus the "Just
Upgrade" method will not work[2]. This problem, like any other problem
in DAHDI, can be fixed by adding another layer of shell scripts.
Specifically in case the startup scripts notice that:

* The system has Astribanks
* There is an xpp_order file and is not completely remmed-out
* There is no assigned-spans.conf 

we run a script that unassigns all devices, and re-assigns them by the
order written in the xpp_order file.

And write a notice to the console that asks the user to kindly run
'dahdi_genconf assignedspans'.

So all's well here as well.


Temporarily Set auto_assign_spans=1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following script unloads dahdi and loads it temporarily with
auto_assign_spans set to 1 to generate configuration:

#!/bin/sh
set -e
# Make it the last, in case we have those setting elsewhere:
modprobe_conf="/etc/modprobe.d/zz_xpp_order_upgrade.conf"
echo "options dahdi auto_assign_spans=1" >"$modprobe_conf"
/etc/init.d/dahdi restart
dahdi_genconf assignedspans
rm "$modprobe_conf"
/etc/init.d/dahdi restart

I suspect it won't be needed, but just in case.

Conclusion
~~~~~~~~~~
Upgrading should work. No need to set auto_assign_spans=1 . But please
help us test it.



[X] XKCD-927 compatible

[K] Again, see http://docs.tzafrir.org.il/dahdi-linux/#_devices_bus

[C] Again, see http://docs.tzafrir.org.il/dahdi-tools/#_new_devices

[D] Still not the case in 2.8.0, will be the case in 2.9.0

[4] http://docs.tzafrir.org.il/dahdi-tools/#_new_devices

[2] That is: it will work with probability 1/n!, where n is the number
of the Astribanks on the system.

-- 
               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-users mailing list