This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

SMS text via DWR-921 4G LTE Router
#1
Hello,
Has anyone tryied to use the Dlink DWR-921 4G LTE Router as SMS gateway for LM?
It only has a web interface and i haven't being able to find any API.
Reply
#2
Sending SMS should be possible via a HTTP request from LM. You just need to know the correct URL and GET/POST variables. You can view the full request in your browser developer tools by pressing F12 and switching to Network tab.
Reply
#3
I am a bit stuck here  Confused Confused

I have managed to trace the login and send sms URLs but I can't replicate them outside the routers web interface.

Is seems to authenticate with the login URL but when i post the send sms URL i got the OK reply but the message never sends.
I have attached the HTTP posts/replies from routers web interface that used in order to login and send a test sms.

Quote:Line 243
GET http://192.168.16.1/log/in?un=admin&pw=password&rd=%2Fuir%2Fstatus.htm&rd2=%2Fuir%2Fwanst.htm&Nrd=1

Line 442 
GET http://192.168.16.1/smsmsg.htm?Nsend=1&N...&S801E2700=6979555555&S801E2800=Test%20send%20sms


Any help would be much appreciated.

Attached Files
.txt   DLink trace.txt (Size: 29.42 KB / Downloads: 9)
Reply
#4
Have you tried sending these requests from your browser or from LM?
Reply
#5
(15.10.2015, 07:28)admin Wrote: Have you tried sending these requests from your browser or from LM?


First off all i figure out that it needs a third post in order to send the sms (GET http://192.168.16.1/sms2.htm?Ncmd=2) 
I have tested it from several browsers and from LM and it works just for the first time.
I think it has to do with cookies... 

On my http sniffer i get some changes everytime i login on routers web interface. The header has a definition "cookies" (AMSESSIONID) that changes in every session.
Now I think i need a way to grab that AMSESSIONID and use it on further requests.



Code:
Accept: */*
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,el;q=0.6
Cookie: ID=AMIT0000; AMSESSIONID=7737225
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36



Code:
Accept: */*
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,el;q=0.6
Cookie: ID=AMIT0000; AMSESSIONID=8449948
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36
Reply
#6
Your first request to login URL should look like this:
Code:
res, code, hdr = socket.http.request('http://...')
if hdr['set-cookie'] then
  cookie = hdr['set-cookie']:split(';')[ 1 ]
end

All further requests must pass the cookie received from the first request:
Code:
res = socket.http.request({
  url = 'http://...',
  headers = {
    Cookie = cookie
  }
})
Reply


Forum Jump: