Spoofing caller id.

Can only test in production, which means untested as of now.
This commit is contained in:
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: #Parsing Parameters:
unset $GETOPT_COMPATIBLE 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 ] if [ $? -ne 0 ]
then then
usage usage
fi fi
eval set -- "$ARGV" eval set -- "$ARGV"
REC0= REC0=
SPOOF=0
#Now we have $@ clean and tidy and begin parsing #Now we have $@ clean and tidy and begin parsing
while : while :
do do
@ -41,6 +42,8 @@ do
REC0=$($LETTERHEAD_PATH/Adressen/address.sh -f $HAND 2>/dev/null | sed 's: ::g') REC0=$($LETTERHEAD_PATH/Adressen/address.sh -f $HAND 2>/dev/null | sed 's: ::g')
shift shift
shift ;; shift ;;
"--spoof-callerid")
SPOOF=1
"--") "--")
shift shift
break ;; break ;;
@ -56,6 +59,13 @@ then
usage usage
fi fi
. $BASEPATH/authorization.sh . $BASEPATH/authorization.sh
#Spoof CallerID if wanted
if [ $SPOOF -eq 1 ]
then
$CALLER_ID="+491234556789"
. $BASEPATH/callerid.sh
SPOOF=-1
fi
#Prepare fax credentials: #Prepare fax credentials:
FILE=$1 FILE=$1
echo -n "Sending file ${FILE} " echo -n "Sending file ${FILE} "
@ -109,5 +119,7 @@ else
fi fi
#Check if fax request was accepted by sipgate #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' 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 #And show the account balance
. $BASEPATH/getbalance.sh . $BASEPATH/getbalance.sh

View file

@ -1,5 +1,7 @@
#Add your sipgate username and password here: #Add your sipgate username and password here:
SIPUSER= SIPUSER=
SIPPWD= SIPPWD=
#Add your default CallerID here:
DEFAULT_CALLER_ID=
#uncomment if you use Letterheads Address database #uncomment if you use Letterheads Address database
#LETTERHEAD_PATH= #LETTERHEAD_PATH=