Sipgate-CLI/status.sh
2021-03-04 20:41:00 +01:00

14 lines
653 B
Bash
Executable file

#! /bin/bash
BASEPATH=$(dirname $(realpath $0))
. $BASEPATH/authorization.sh
while read LINE;
do
JSON=$(curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" "https://api.sipgate.com/v2/history/$LINE" -s)
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' )
echo "Fax $LINE vom $(date +%d.%m.%Y -d $DATE) an $TARGET: $STATUS"
done < $BASEPATH/.fax_history
echo "$(tail $BASEPATH/.fax_history)" > $BASEPATH/.fax_history