#!/bin/bash

# Demonstrates https://issues.asterisk.org/jira/browse/ASTERISK-23554

# Start asterisk. Have a system with a number of DAHDI PRI spans and
# recent DAHDI. Run this script.

rand_sleep() {
	sleep 0.$((RANDOM % 8))
}

add_remove_loop() {
	for i in `seq $1`; do
		dahdi_span_assignments add
		rand_sleep
		dahdi_span_assignments remove
		rand_sleep
	done 2>&1
}

add_remove_loop 10 &
add_remove_loop 10
