[asterisk-users] Polycom 1.6.7 Firmware Messages Button

Greg Boehnlein damin at nacs.net
Mon Aug 7 20:26:16 MST 2006


On Sat, 29 Jul 2006, Douglas Garstang wrote:

> You have a config generator script for the Polycom XML files? What did you build that with?

Bash scripts and some sed logic. It isn't pretty, but it works.

# This creates the actual SED script that we use to modify the template
echo "s/reg.1.displayName=\"\"/reg.1.displayName=\"$NAME\"/" >> $$.sed 
echo "s/reg.1.address=\"\"/reg.1.address=\"$EXTEN\"/" >> $$.sed
echo "s/reg.1.label=\"\"/reg.1.label=\"$EXTEN\"/" >> $$.sed
echo "s/reg.1.auth.userId=\"\"/reg.1.auth.userId=\"$EXTEN\"/" >> $$.sed
echo "s/reg.1.auth.password=\"\"/reg.1.auth.password=\"$EXTEN\"/" >> $$.sed
echo "s/reg.1.server.1.address=\"\"/reg.1.server.1.address=\"$SERVER\"/" >> $$.sed
echo "s/reg.1.server.1.register=\"\"/reg.1.server.1.register=\"1\"/" >> $$.sed

echo "s/CONFIG_FILES=\"phone1.cfg, sip.cfg\"/CONFIG_FILES=\"phone$EXTEN.cfg, sip-n2net.cfg\"/" >> $$.sed
echo "s/LOG_FILE_DIRECTORY=\"\"/LOG_FILE_DIRECTORY=\"$EXTEN\"/" >> $$.sed
echo "s/OVERRIDES_DIRECTORY=\"\"/OVERRIDES_DIRECTORY=\"$EXTEN\"/" >> $$.sed
echo "s/CONTACTS_DIRECTORY=\"\"/CONTACTS_DIRECTORY=\"$EXTEN\"/" >> $$.sed
# Now, we copy the templates to their new filenames

cp phone1.cfg phone$EXTEN.cfg
cp 000000000000.cfg $MAC.cfg

# Sed it up
sed -i -f $$.sed phone$EXTEN.cfg
sed -i -f $$.sed $MAC.cfg

# Create Directories and Set Perms
mkdir $EXTEN
chown -R PlcmSpIp:PlcmSpIp *
chmod -R a+rwx *

# Voila!
rm -f $$.sed phone$EXTEN.cfg~ $MAC.cfg~

-- 
    Vice President of N2Net, a New Age Consulting Service, Inc. Company
         http://www.n2net.net Where everything clicks into place!
                             KP-216-121-ST






More information about the asterisk-users mailing list