Consider absolute paths

callerid
Gandalf 2021-03-04 20:17:30 +01:00
parent 5ca77e7479
commit 59309ba5ed
4 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,5 @@
. login_credentials.sh
BASEPATH=$(dirname $(realpath $0))
. $BASEPATH/login_credentials.sh
AUTH_TOKEN=$(echo $(curl --request POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --data-urlencode client_id=sipgate-app-web --data-urlencode grant_type=password --data-urlencode username=$SIPUSER --data-urlencode password=$SIPPWD https://api.sipgate.com/login/sipgate-apps/protocol/openid-connect/token -s | jq '.access_token') | sed 's/\"//g')
if [ -z "$AUTH_TOKEN" ];
then

View File

@ -1,4 +1,5 @@
#! /bin/bash
. authorization.sh
. getbalance.sh
BASEPATH=$(dirname $(realpath $0))
. $BASEPATH/authorization.sh
. $BASEPATH/getbalance.sh

7
fax.sh
View File

@ -8,7 +8,8 @@ then
where <recipient> has to be a german faxline number"
exit 1
fi
. authorization.sh
BASEPATH=$(dirname $(realpath $0))
. $BASEPATH/authorization.sh
#Prepare fax credentials:
FILE=$1
echo -n "Sending file ${FILE} "
@ -28,9 +29,9 @@ then
echo "Something went wrong, I didn't receive some fax id back."
else
echo "Sipgate took your fax as sessionID $FAXID"
echo "$FAXID" >> .fax_history
echo "$FAXID" >> $BASEPATH/.fax_history
fi
#Check if fax request was accepted by sipgate
curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" "https://api.sipgate.com/v2/history/$FAXID" -s | jq '.faxStatusType'
#And show the account balance
. getbalance.sh
. $BASEPATH/getbalance.sh

View File

@ -1,6 +1,7 @@
#! /bin/bash
. $(dirname $(realpath $0))/authorization.sh
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)