From b615aaa634249eefbbf73f16301502244f062afd Mon Sep 17 00:00:00 2001 From: Gandalf Date: Sat, 5 Feb 2022 18:05:49 +0100 Subject: [PATCH] Spoofing caller id. Can only test in production, which means untested as of now. --- callerid.sh | 16 ++++++++++++++++ fax.sh | 14 +++++++++++++- login_credentials_muster.sh | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 callerid.sh diff --git a/callerid.sh b/callerid.sh new file mode 100755 index 0000000..dc6317e --- /dev/null +++ b/callerid.sh @@ -0,0 +1,16 @@ +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) + diff --git a/fax.sh b/fax.sh index 713beae..e4831bc 100755 --- a/fax.sh +++ b/fax.sh @@ -19,13 +19,14 @@ BASEPATH=$(dirname $(realpath $0)) #Parsing Parameters: unset $GETOPT_COMPATIBLE -ARGV=$(getopt -n "$0" -a -o "" -l "help,handle:" -- "$@") +ARGV=$(getopt -n "$0" -a -o "" -l "help,spoof-callerid,handle:" -- "$@") if [ $? -ne 0 ] then usage fi eval set -- "$ARGV" REC0= +SPOOF=0 #Now we have $@ clean and tidy and begin parsing while : do @@ -41,6 +42,8 @@ do REC0=$($LETTERHEAD_PATH/Adressen/address.sh -f $HAND 2>/dev/null | sed 's: ::g') shift shift ;; + "--spoof-callerid") + SPOOF=1 "--") shift break ;; @@ -56,6 +59,13 @@ then usage fi . $BASEPATH/authorization.sh +#Spoof CallerID if wanted +if [ $SPOOF -eq 1 ] +then + $CALLER_ID="+491234556789" + . $BASEPATH/callerid.sh + SPOOF=-1 +fi #Prepare fax credentials: FILE=$1 echo -n "Sending file ${FILE} " @@ -109,5 +119,7 @@ else 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' +#Revert CallerID spoofing +. $BASEPATH/callerid.sh #And show the account balance . $BASEPATH/getbalance.sh diff --git a/login_credentials_muster.sh b/login_credentials_muster.sh index d0ac3b4..0a4baba 100755 --- a/login_credentials_muster.sh +++ b/login_credentials_muster.sh @@ -1,5 +1,7 @@ #Add your sipgate username and password here: SIPUSER= SIPPWD= +#Add your default CallerID here: +DEFAULT_CALLER_ID= #uncomment if you use Letterheads Address database #LETTERHEAD_PATH=