Compare commits
2 commits
3cf1c5a4fa
...
0ec4d3b168
Author | SHA1 | Date | |
---|---|---|---|
Gandalf | 0ec4d3b168 | ||
Gandalf | bae84edee5 |
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
FILE=$1
|
FILE=$1
|
||||||
echo $FILE
|
echo $FILE
|
||||||
REC=$(sed 's/^0/+49/' $2)
|
REC=$(echo $2 | sed -e 's:[^+0-9]::g' -e 's:^0\([1-9]\):+49\1:')
|
||||||
. login_credentials.sh
|
. 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')
|
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" ];
|
if [ -z "$AUTH_TOKEN" ];
|
||||||
|
@ -12,7 +12,10 @@ else
|
||||||
echo "Logged in"
|
echo "Logged in"
|
||||||
fi
|
fi
|
||||||
CONTENT=$(base64 $FILE -w 0)
|
CONTENT=$(base64 $FILE -w 0)
|
||||||
#echo "$CONTENT"
|
if [ -z "$CONTENT" ];
|
||||||
|
then
|
||||||
|
echo "Encoding failed"
|
||||||
|
fi
|
||||||
DATA='{"faxlineId":"f0", "recipient":"+495512829364", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}'
|
DATA='{"faxlineId":"f0", "recipient":"+495512829364", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}'
|
||||||
#echo "$DATA"
|
#echo "$DATA"
|
||||||
curl -i --request POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" --data "$DATA" "https://api.sipgate.com/v2/sessions/fax" -s
|
curl -i --request POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" --data "$DATA" "https://api.sipgate.com/v2/sessions/fax" -s
|
||||||
|
|
Loading…
Reference in a new issue