Thanks to help from nicolas we were able to modify the buttons_astcli.sh file to declare non numeric SIP peers as trunks. Previously if you ran the script prior to defining the trunks themselves, the script would intepret them as regular peers (and ignore the trunks manually entered).
Please note this only works for systems where the peer name is numeric and the trunks are not numeric
Also change the MANAGERSECRET to match your fop2 AMI password.
#!/bin/bash MANAGERUSER=fop2 MANAGERSECRET=CHANGETOYOURPASSWORD MANAGERHOST=localhost function isNumeric(){ [ "$(echo $*|grep -v "[^0-9]")" ];} /usr/local/fop2/astcli -u $MANAGERUSER -s $MANAGERSECRET -h $MANAGERHOST "sip show peers" | sed '/Monitored/d' |sed '/Name\/username/d' | sort | while read LINEA do EXTEN=`echo $LINEA | cut -d\/ -f 1` EXTEN=`echo $EXTEN | awk '{ print $1}'` CONTEXT=`./astcli -u $MANAGERUSER -s $MANAGERSECRET -h $MANAGERHOST "sip show peer $EXTEN" | grep Context | cut -d: -f 2 | sed 's/ //g'` CIDNAME=`./astcli -u $MANAGERUSER -s $MANAGERSECRET -h $MANAGERHOST "sip show peer $EXTEN" | grep Callerid | cut -d: -f 2 | cut -d\< -f 1 | sed 's/ "//g' | sed 's/"//g'` MAILBOX=`./astcli -u $MANAGERUSER -s $MANAGERSECRET -h $MANAGERHOST "sip show peer $EXTEN" | grep Mailbox | cut -d: -f 2 | sed 's/ //g'` TYPE="type=trunk" LABEL="label=$EXTEN" EXTENSION="channel=SIP/$EXTEN" MAIL="server=0" CON="" $(isNumeric $EXTEN) && TYPE="type=extension" && LABEL="label=$CIDNAME" && EXTENSION="extension=$EXTEN" && MAIL="mailbox=$MAILBOX" && CON="context=$CONTEXT" echo "[SIP/$EXTEN]" echo $TYPE echo $EXTENSION echo $LABEL echo $MAIL echo $CON echo done