send sms using kannel url "http://localhost:13131/cgi-bin/sendsms?"

bidyasri7 years ago

Can we send sms notification using kannel GW using url instead of connecting SMPP directly in traccar?
http://localhost:13131/cgi-bin/sendsms?username=xxxx&password=yyyy&from=98xxxxxxxx&to=%2Byyyyyyyyyy&dlr-mask=31&text=test

Anton Tananaev7 years ago

You can try using event forwarding functionality, but it can't be configured per user.

bidyasri7 years ago

Hi Anton;
where should i configure for this? is it available in GUI or some changes on script? i want to try this functionality

Anton Tananaev7 years ago

It's in the configuration file. Read official documentation for more info.

bidyasri7 years ago

I have tried with below;

<entry key='forward.enable'>true</entry>
<entry key='forward.url'>http://xx.yy.xx.yy:13131/cgi-bin/sendsms?username=test1&password=test1&from=traccar&to=%2BXXXXXXXXXX&dlrmask=31&text=Event:{uniqueId}{gprmc}</entry>

but i have received the error as below

Caused by: org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 95; The reference to entity "password" must end with the ';' delimiter.

How shall i breakdown parameters?

Anton Tananaev7 years ago

It has to be a valid XML, so you need to escape special characters. For example, instead of & you should have &amp;.

bidyasri7 years ago

Thanks Anton;
The server got restarted successfully,
how can i test if that event is OK or not?

Anton Tananaev7 years ago

You haven't configured event forwarding, so I don't think it's going to work. You have configured location data forwarding.

bidyasri7 years ago

I have configured as below and restarted;

<entry key='event.forward.enable'>true</entry>
<entry key='event.forward.url'>http://localhost:13131/cgi-bin/sendsms?username=test11&amp;password=test1&amp;from=traccar&amp;to=%2BXXXXXXXX&amp;dlrmask=31&amp;text=Event</entry>
bidyasri7 years ago

and i wanted to test it?

Anton Tananaev7 years ago

You need to generate some events. For example, connect or disconnect a device.

bidyasri7 years ago

I did, but i did not see anything in wrapper.log and tracker-server.log.
and no notification received

Anton Tananaev7 years ago

Have you checked events report to see if there were events? Have you checked your server (localhost:13131) logs?

bidyasri7 years ago

Yes the events are generated at Track server, but not in sms sending server
2018-02-14 11:09:04 am
Ramesh
Device is online

2018-02-14 11:20:01 am
Ramesh
Device has stopped

2018-02-14 12:06:15 pm
Ramesh
Device is online

2018-02-14 12:06:25 pm
Ramesh
Device is moving

2018-02-14 12:40:50 pm
Ramesh
Device is online

2018-02-14 12:43:19 pm
Ramesh
Device is online

2018-02-14 1:41:20 pm
Ramesh
Device is moving

bidyasri7 years ago

I have found out the problem, the traccar sends POST but the SMS sending server accepts GET so the message has been discarded, as

Frame 6: 263 bytes on wire (2104 bits), 263 bytes captured (2104 bits)
Linux cooked capture
Hypertext Transfer Protocol
    HTTP/1.1 400 Bad Request\r\n
        [Expert Info (Chat/Sequence): HTTP/1.1 400 Bad Request\r\n]
            [HTTP/1.1 400 Bad Request\r\n]
            [Severity level: Chat]
            [Group: Sequence]
        Request Version: HTTP/1.1
        Status Code: 400
        Response Phrase: Bad Request
    Server: Kannel/1.4.4\r\n
    Date: Wed, 14 Feb 2018 09:39:25 GMT\r\n
    Content-Length: 20\r\n
    Content-type: text/html\r\n
    Pragma: no-cache\r\n
    Cache-Control: no-cache\r\n
    \r\n
    [HTTP response 1/1]
    [Time since request: 0.000704000 seconds]
    [Request in frame: 4]
    File Data: 20 bytes
Line-based text data: text/html
    Invalid content-type

What can be the solution?