Bug in autoconfig-buttons-freepbx.sh
Asterisk 1.6 using dahdi
In autoconfig-buttons-freepbx.sh, the following code is supposed to be checking for dahdi trunks, it executes a "zap show channels" command. Zap show channels will report it as "no such command". It should be "dahdi show channels" - I've bolded the error.
DAHDI=`asterisk -rx "zap show channels" | grep -v from-internal | grep -v pseudo | grep -v Language | awk '{print $1}' | head -n 1`
if [ "X${DAHDI}" != "X" ]; then
echo
echo "[DAHDI/$DAHDI]"
echo "type=trunk"
echo "label=DAHDI"
asterisk -rx "zap show channels" | grep -v from-internal | grep -v pseudo | grep -v Language | awk '{print $1}' | tail -n +2 | while read LINEA
do
echo "channel=DAHDI/$LINEA"
done
In autoconfig-buttons-freepbx.sh, the following code is supposed to be checking for dahdi trunks, it executes a "zap show channels" command. Zap show channels will report it as "no such command". It should be "dahdi show channels" - I've bolded the error.
DAHDI=`asterisk -rx "zap show channels" | grep -v from-internal | grep -v pseudo | grep -v Language | awk '{print $1}' | head -n 1`
if [ "X${DAHDI}" != "X" ]; then
echo
echo "[DAHDI/$DAHDI]"
echo "type=trunk"
echo "label=DAHDI"
asterisk -rx "zap show channels" | grep -v from-internal | grep -v pseudo | grep -v Language | awk '{print $1}' | tail -n +2 | while read LINEA
do
echo "channel=DAHDI/$LINEA"
done
Comments
# DAHDI EXTENSIONS
mysql -ENB -u $DBUSER -p$DBPASS -h $DBHOST $DBNAME -e "select concat('DAHDI/',extension) as channel,extension,name as label,s1.data as mailbox,s2.data as context,concat('*',s1.data) as extenvoicemail from users as u left join zap as s1 on u.extension=s1.id and s1.keyword='mailbox' left join zap as s2 on u.extension=s2.id where s2.keyword='context' order by extension" | sed '/\*\*/d' | sed 's/: /=/g' | while read LINEA
do
echo $LINEA | sed 's/channel=\(.*\)/\n[\1]\ntype=extension/g'
done
There are also some old installations out there that still require zap. So this solution will not fit everyone. And the autoconfig scripts are actually script so people can tweak them as you did.