<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[FOP2 buttons_astcli modification for trunks]]></title><description><![CDATA[<p dir="auto">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).</p>
<p dir="auto"><strong>Please note this only works for systems where the peer name is numeric and the trunks are not numeric</strong></p>
<p dir="auto">Also change the MANAGERSECRET to match your fop2 AMI password.</p>
<pre><code>#!/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\&lt; -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) &amp;&amp; TYPE="type=extension" &amp;&amp; LABEL="label=$CIDNAME" &amp;&amp; EXTENSION="extension=$EXTEN" &amp;&amp; MAIL="mailbox=$MAILBOX" &amp;&amp; CON="context=$CONTEXT"
echo "[SIP/$EXTEN]"
echo $TYPE
echo $EXTENSION
echo $LABEL
echo $MAIL
echo $CON
echo
done
</code></pre>
]]></description><link>http://localhost:4567/topic/1179/fop2-buttons_astcli-modification-for-trunks</link><generator>RSS for Node</generator><lastBuildDate>Tue, 27 Oct 2026 08:39:33 GMT</lastBuildDate><atom:link href="http://localhost:4567/topic/1179.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Jun 2012 21:03:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to FOP2 buttons_astcli modification for trunks on Tue, 19 Jun 2012 00:28:35 GMT]]></title><description><![CDATA[<p dir="auto">Thanks!</p>
<p dir="auto">Just wanted to mention that this script is <strong>NOT TO BE USED IN FREEPBX BASED SYSTEMS</strong>, it is just for plain/vanilla Asterisk setups.</p>
]]></description><link>http://localhost:4567/post/5325</link><guid isPermaLink="true">http://localhost:4567/post/5325</guid><dc:creator><![CDATA[nicolas]]></dc:creator><pubDate>Tue, 19 Jun 2012 00:28:35 GMT</pubDate></item></channel></rss>