2022-02-05 17:05:49 +00:00
|
|
|
BASEPATH=$(dirname $(realpath $0))
|
|
|
|
. $BASEPATH/authorization.sh
|
2022-02-05 17:30:52 +00:00
|
|
|
CALLER_ID="+49"
|
|
|
|
CALLER_ID_JSON=
|
2022-02-05 17:05:49 +00:00
|
|
|
case "$SPOOF" in
|
|
|
|
"1")
|
2022-02-05 17:30:52 +00:00
|
|
|
RANDOM=$(date +%s%N | cut -b10-19)
|
|
|
|
for (( x=1;x<=11;x++ ));
|
|
|
|
do
|
|
|
|
CALLER_ID="${CALLER_ID}$[$RANDOM % 10]"
|
|
|
|
done
|
2022-02-05 17:05:49 +00:00
|
|
|
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)
|
2022-02-05 17:30:52 +00:00
|
|
|
#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)
|
|
|
|
echo $OLD_CALLER_ID_JSON $CALLER_ID_JSON
|