2021-03-04 19:12:46 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
2021-03-04 19:17:30 +00:00
|
|
|
BASEPATH=$(dirname $(realpath $0))
|
|
|
|
. $BASEPATH/authorization.sh
|
2021-03-04 19:12:46 +00:00
|
|
|
while read LINE;
|
|
|
|
do
|
2022-03-22 09:30:29 +00:00
|
|
|
JSON=$(curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --user $SIPUSER:$SIPPWD "https://api.sipgate.com/v2/history/$LINE" -s)
|
2021-03-04 19:12:46 +00:00
|
|
|
STATUS=$(echo $JSON | jq '.faxStatusType' | sed -e 's:"::g' )
|
|
|
|
DATE=$(echo $JSON | jq '.created' | sed -e 's:"::g' )
|
|
|
|
TARGET=$(echo $JSON | jq '.target' | sed -e 's:"::g' )
|
2021-03-11 10:00:58 +00:00
|
|
|
if [ -z $DATE ]
|
|
|
|
then
|
|
|
|
echo "Are you sure fax $LINE was sent from the logged in account? I cannot find it, so I'll skip it."
|
|
|
|
continue
|
|
|
|
fi
|
2021-03-04 19:12:46 +00:00
|
|
|
echo "Fax $LINE vom $(date +%d.%m.%Y -d $DATE) an $TARGET: $STATUS"
|
2021-03-04 19:25:39 +00:00
|
|
|
done < $BASEPATH/.fax_history
|
2021-03-04 19:41:00 +00:00
|
|
|
echo "$(tail $BASEPATH/.fax_history)" > $BASEPATH/.fax_history
|