#!/bin/sh
# Copyright (C) 2000-2001 Open Source Telecom Corporation.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
#
sed="-e s/%caller/%session.callerid/g"
sed="$sed -e s/%annotation/%audio.annotation/g"
sed="$sed -e s/%played/%audio.played/g"
sed="$sed -e s/%recorded/%audio.recorded/g"
sed="$sed -e s/%created/%audio.created/g"
sed="$sed -e s/%extension/%audio.extension/g"
sed="$sed -e s/%trim/%audio.trim/g"
sed="$sed -e s/%volume/%audio.volume/g"
sed="$sed -e s/%format/%audio.format/g"
sed="$sed -e s/%language/%application.language/g"
sed="$sed -e s/%voice/%application.voice/g"
sed="$sed -e s/%digits/%session.digits/g"
sed="$sed -e s/%count/%session.count/g"
sed="$sed -e s/%duration/%session.duration/g"
sed="$sed -e s/%gid/%session.id/g"
sed="$sed -e s/%clid/%pstn.clid/g"
sed="$sed -e s/%name/%pstn.name/g"
sed="$sed -e s/%dnid/%pstn.dnid/g"
sed="$sed -e s/%infodigits/%pstn.infodigits/g"
sed="$sed -e s/%ringid/%pstn.ringid/g"
sed="$sed -e s/%rings/%pstn.rings/g"
sed="$sed -e s/%redirect/%pstn.redirect/g"
sed="$sed -e s/%starttime/%session.starttime/g"
sed="$sed -e s/%startdate/%session.startdate/g"
sed="$sed -e s/%date/%session.date/g"
sed="$sed -e s/%time/%session.time/g"
sed="$sed -e s/%group/%policy.name/g"
sed="$sed -e s/%start/%session.home/g"

if test -z "$*" ; then
	echo "use bayonne_update [files]"
	exit -1
fi

for file in $* ; do
	sed $sed <$file >$file.tmp
	mv -f $file.tmp $file
done

