diff --git a/fax.sh b/fax.sh index 6962bad..903c299 100755 --- a/fax.sh +++ b/fax.sh @@ -22,12 +22,14 @@ then echo "Encoding failed" exit 2 fi -DATA='{"faxlineId":"f0", "recipient":"'${REC}'", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}' +echo '{"faxlineId":"f0", "recipient":"'${REC}'", "filename":"fax.pdf", "base64Content":"'${CONTENT}'"}' > $BASEPATH/.data.txt #Send fax -FAXID=$(curl --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 | jq '.sessionId' | sed -e 's:"::g' ) +FAXID=$(curl --request POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" --data @data.txt "https://api.sipgate.com/v2/sessions/fax" -s | jq '.sessionId' | sed -e 's:"::g' ) +rm $BASEPATH/.data.txt if [ -z $FAXID ] then echo "Something went wrong, I didn't receive some fax id back." + exit 2 else echo "Sipgate took your fax as sessionID $FAXID" echo "$FAXID" >> $BASEPATH/.fax_history