Commit Graph

9 Commits

Author SHA1 Message Date
Shaun Ruffell
69ce6f07e0 dahdi_cfg: Allow dynamic spans to handle udev based span assignment.
Prior to this commit, if auto_assign_spans was set to 0, it was possible to
get in an endless loop creating and destroying spans. The primary reason was
that all dynamic spans are destroyed and recreated each time dahdi_cfg runs, BUT
dahdi_cfg was run each time a new span showed up in udev when auto_assign_spans
was set to 0.

Now dahdi_cfg will only destroy and recreate dynamic spans if dahdi_cfg is run
without a specifc span number. Also, while creating dynamic spans, dahdi_cfg
will pause for up to one second for the span to be assigned in order to ensure
that the spans are numbered consistently when auto span assignment is
configured.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 12:58:57 -06:00
Shaun Ruffell
9989b8779c dahdi_cfg: Add semaphore to prevent parallel execution.
When dahdi is configured for fully dynamic configuration on a device and
span basis via sysfs and udev it is possible for multiple instances of
dahdi_cfg to be run in parallel on different spans. If this happens it
is possible to see errors on the console that tone zones are already
registered since the check for the existence of a tone zone and the
re-registering needs to be atomic.

dahdi_cfg will now prevent itself from running in parallel.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 12:58:57 -06:00
Shaun Ruffell
5ca600c7c7 dahdi_cfg: Wait for all spans to be assigned.
When auto span assignment is disabled, it's possible that simply running

  # /etc/init.d/dahdi restart

Will fail since dahdi_cfg can run in parallel with udev scripts that are
assigning spans, which results in /etc/dahdi/system.conf describing spans that
do not exist in the system.

This change sets up dahdi_cfg, when run without the -C or -S options, to look in
sysfs and make sure all spans for each device are assigned.  dahdi_cfg will wait
5 seconds for span assignment to happen before proceeding normally.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-12-12 09:08:51 -06:00
Oron Peled
dc5c7de9fc dahdi_cfg: can optionally read config from stdin
Allow for the convention of '-' marking stdin:

  dahdi_cfg -c -

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-08 10:05:09 -04:00
Shaun Ruffell
2889d6afee dahdi_cfg: Make -S option based on spannumber instead of order in config file.
If the config file has two spans defined:

  span=1,1,0,esf,b8zs
  bchan=1-23
  dchan=24
  echocanceller=mg2,1-23
  span=2,2,0,esf,b8zs
  bchan=25-47
  dchan=48

And you only want to configure span-2, you would need to pass -S 1 to
dahdi_cfg. Now make the -S option take the span number as assigned in the
config file.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-28 12:34:03 -05:00
Tzafrir Cohen
b093554f54 Fix GCC 4.6 "set but not used" warnings
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10311 17933a7a-c749-41c5-a318-cba88f637d49
2011-11-02 21:57:25 +00:00
Oron Peled
ba070152fc dahdi_cfg: add '-S <spanno>' and '-C <chan-ranges>'
* dahdi_cfg -S <num>: only apply changes to span <num>.
* If span is analog (no 'span=<num>,<channels>,...' statement in
  system.conf), we need to set range: -C <channels>
* With the <basechan> and <channels> attributes in sysfs
  we easily configure each device on the fly.
  Simply run: dahdi_cfg -S <spanno> -C <basechan>+<channels>-1
  from udev script

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@10306 17933a7a-c749-41c5-a318-cba88f637d49
2011-11-02 20:10:06 +00:00
Shaun Ruffell
e878bc06dc dahdi_cfg: DAHDI_INDIRECT -> DAHDI_SPECIFY when configuring pciradio channels.
While slightly less efficient, this is only used when configuring the
channels initially (not the hot path) and allows dahdi-base.c to assume
that the open "file" pointer always refers to the channel on which to
perform the operation.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@9352 17933a7a-c749-41c5-a318-cba88f637d49
2010-09-20 20:30:49 +00:00
Asterisk Development Team
466357f5c2 Import DAHDI-Tools r9159
This revision of DAHDI-Tools is the base revision for the switch to
git.

git-svn-id: http://svn.astersk.org/svn/dahdi/tools/tools/trunk@9159
2010-08-18 13:49:24 +00:00