Created this function on one of my machines today, thought others might
find it useful:
freesip() {
comm -2 <(seq $2 $3) <(cat $1 | grep ^\\[ | sort | uniq | tr -d \[ | tr -d
\]) | grep ^[[:digit:]]
}
On RedHat/CentOS based systems you can create the following file to have
the function available on login:
/etc/profile.d/freesip.sh
# Free SIP extensions
freesip() {
comm -2 <(seq $2 $3) <(cat $1 | grep ^\\[ | sort | uniq | tr -d \[ | tr
-d \]) | grep ^[[:digit:]]
}
Then if you have a large sip.conf and want to find a free extension between
200 and 299 you can login and do the following:
<begin fake results>
[host]$ freesip /etc/asterisk/sip.conf 200 299
200
201
233
245
[host]$
<end fake results>
--
Kyle Sexton
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users