[asterisk-dev] [Code Review] dial by name: use device names in system.conf
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Sun May 30 19:41:48 CDT 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/677/
-----------------------------------------------------------
Review request for Asterisk Developers.
Summary
-------
As part of the work to avoid relying on the order of hardware registration with DAHDI, we wish to avoid including explicit channel and span names in system.conf (/etc/dahdi/system.conf).
Elsewhere in the "sysfs" branhces (Linux-specific, and not included in this review request) we generate the following device files automatically for each channel:
/dev/dahdi/spans/<span-num>/<chan-num>
(<chan-num> is the numbering inside the span, rather than global numbering). We also generate symlinks under
/dev/dahdi/span-name to spans. Those may either be arbitrary "aliases" or generated by the location/label and port number. Thus do not depend on the specific load order.
Those changes are quite Linux-specific. However the changes we have for system.conf and dahdi_cfg.c are not. They basically allow that the user (if indeed wishes to use the new format) has a way of generating those permanent file locations.
Thus we wish to avoid using channel numbers and span numbers in system.conf. Instead we use relative paths under /dev/dahdi , with '/' replaced with '!' (this is done because we want to use the same string in Astrisk. And using '/' as part of an Asterisk channel name is not a good idea).
* Channels are identified by the minor number of the target of the file.
- Their name must also be a number (not necesserily the same as their minor number).
* Spans are identified as the filename of the target of the symlink.
* '-' for a range of channels and ',' for a list of channels work as before, but only after the last '!'.
Another goal we wish to achieve is to allow starting DAHDI even if one of the devices is not present. For that reason we add the option '-k' - Keep going even if a certain channel is missing (as long as we use paths and not numbers). The point is that if you set your configuration properly, you don't depend on the order of probing and hence there won't be a potential problem of confusing different channels.
Example partial system.conf:
span=span-names!QA-12(00),1,0,ccs,hdb3,crc4
bchan=span-names!QA-12(00)!1-15,17-31
dchan=span-names!QA-12(00)!16
echocanceller=mg2,span-names!QA-12(00)!1-15,17-31
span=span-names!QA-12(01),0,0,ccs,hdb3,crc4
bchan=span-names!QA-12(01)!1-15,17-31
dchan=span-names!QA-12(01)!16
echocanceller=mg2,span-names!QA-12(01)!1-15,17-31
In the above examples, 'QA-12(00)' is the name of the span of the first port of the device called 'QA-12' and QA-12(01) is its second port.
See also:
http://svn.asterisk.org/dahdi/linux/team/tzafrir/sysfs
http://svn.asterisk.org/dahdi/tools/team/tzafrir/sysfs
https://reviewboard.asterisk.org/r/535
TODO:
* Dynamic spans: how do they fit in? Having them destroyed on each dahdi_cfg run will cause problems.
* Fix handling of 'channel' / 'channels' (Radio hardware). Should be simple, but I have no hardware to test with.
* Better documentation.
Diffs
-----
/tools/trunk/dahdi_cfg.c 8711
Diff: https://reviewboard.asterisk.org/r/677/diff
Testing
-------
Thanks,
Tzafrir
More information about the asterisk-dev
mailing list