Sipgate-CLI/callerid.sh

17 lines
711 B
Bash
Executable File

BASEPATH=$(dirname $(realpath $0))
. $BASEPATH/authorization.sh
case "$SPOOF" in
"1")
CALLER_ID_JSON='{"value":"'${CALLER_ID}'"}'
;;
"-1")
CALLER_ID_JSON=$OLD_CALLER_ID_JSON
;;
"0")
CALLER_ID_JSON='{"value":"'${DEFAULT_CALLER_ID}'"}'
;;
esac
OLD_CALLER_ID_JSON=$(curl --request GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" "https://api.sipgate.com/v2/w0/faxlines/f0/callerid" -s)
REPLY=$(curl --request PUT --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer $AUTH_TOKEN" --data ${CALLER_ID_JSON} "https://api.sipgate.com/v2/w0/faxlines/f0/callerid" -s)