Bug in autoconfig-buttons-freepbx.sh

  1. 14 years ago

    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

  2. Also to configure the Dahdi channels for extensions, the MySQL database for zap must be parsed. Add the following after the IAX extensions:

    # 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

  3. admin

    16 Mar 2010 Administrator

    Thanks! I believe both issues were already addressed on the beta (when using it in conjunction with fop2 freepbx module).

    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.

or Sign Up to reply!