FOP2 buttons_astcli modification for trunks
-
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 -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login