Skip to content

Extend functionality by SMS #1

@MulMic

Description

@MulMic

Hi AJR,

I just tested your project on my Huawei B818-263 LTE Router, it works nicely, thank you.

As my unit has the capability to receive and send SMS messages, I ventured to extend your projects scope accordingly.

I found the SMS functions at Salamek's project

MulMic

#!/bin/bash
#https://github.com/theRealAJR/LTE-Router-Huawei-B618s-22d
#sendSMS

Phone=$1
SMS=$2
length=${#SMS}

#echo -e "$Phone, $SMS, $length\n"

. "$(dirname "$0")"/base

"$(dirname "$0")"/login || exit 1

N=40

get $URL_PREFIX/
TOKEN=`grep csrf $DIR/$N_PRETTY.html |cut -d '"' -f 4|tail -n 1`
#echo -e "\n$TOKEN\n"
echo "<?xml version=\'1.0\' encoding=\'UTF-8\'?><request><Index>-1</Index><Phones><Phone>$Phone</Phone></Phones><Sca></Sca><Content>$SMS</Content><Length>$length</Length><Reserved>1</Reserved><Date>1</Date></request>" >$DIR/sendsms.xml
post --body-file=$DIR/sendsms.xml --header="__RequestVerificationToken:$TOKEN" $URL_PREFIX/api/sms/send-sms

"$(dirname "$0")"/logout

#cat $DIR/0042.html
#!/bin/bash
#https://github.com/theRealAJR/LTE-Router-Huawei-B618s-22d
#listSMS

. "$(dirname "$0")"/base

"$(dirname "$0")"/login || exit 1

N=30

get $URL_PREFIX/
TOKEN=`grep csrf $DIR/$N_PRETTY.html |cut -d '"' -f 4|tail -n 1`
echo -e "\n$TOKEN\n"
echo '<?xml version "1.0" encoding="UTF-8"?><request><PageIndex>1</PageIndex><ReadCount>20</ReadCount><BoxType>1</BoxType><SortType>0</SortType><Ascending>0</Ascending><UnreadPreferred>0</UnreadPreferred></request>' >$DIR/getsmslist.xml
post --body-file=$DIR/getsmslist.xml --header="__RequestVerificationToken:$TOKEN" $URL_PREFIX/api/sms/sms-list

"$(dirname "$0")"/logout

cat $DIR/0032.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions