#!/bin/sh
cnt=0
max_delay=30
for ((i=0;i<$max_delay;i++))
do
	if [ -e /dev/wptdm_s1c1 ]; then
        	break;
	fi

	echo "Waiting for TDM API device /dev/wp_tdm ($i/$max_delay)..."
  	sleep 2
done

if [ ! -e /dev/wptdm_s1c1 ]; then
	echo
	echo "Error: Sangoma TDM API device failed to come up";
        echo "Possible Cause: UDEV not installed!";
	echo
	exit 1
fi 

sleep 1

smg_ctrl start
