Spoofing caller id.

Can only test in production, which means untested as of now.
callerid
Gandalf 2022-02-05 18:05:49 +01:00
parent fef572359f
commit b615aaa634
3 changed files with 31 additions and 1 deletions

16
callerid.sh Executable file
View File

@ -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)

14
fax.sh
View File

@ -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

View File

@ -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=