Traccar SMS Gateway for Android

henry beltran4 years ago

What could be wrong? this is the escenario:

1.- Running 4.9 windows traccar version in LAN (local ip 192.168.1.13)
lines in traccar. xml file:

    <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
    <entry key='sms.http.url'>http://192.168.1.11:8082/</entry>
    <entry key='sms.http.template'>
    {
        "to": "{phone}",
        "message": "{message}"
    }
    </entry>

2.- Installed Traccar SMS Gateway V1.2 in Huawei Android 6.0 (local ip 192.168.1.11)

3.- Open in web explorer in server windows http://192.168.1.11:8082 and get this message:
Send SMS using following API:

    POST /
    {
        "to": "+10000000000",
        "message": "Your message"
    }

4.- Configured in user profile traccar the number in this format: 54896244 (the same format to send a normal sms in the phone)

5.- Nothing happen, no receive sms, no visible action in the app sms gateway phone

6.- Installed in phone app "TCP Server" to create a service in the port 8082 in the phone to capture the packet from the server, and it receive this:

POST / HTTP/1.1
Content-Type: application/json
User-Agent: Jersey/2.31 (HttpUrlConnection 1.8.0_111)
Host: 192.168.1.11:8082
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 95

{
        "to": "54896244",
        "message": "HB Alarma: sos a las 2020-07-25 22:19:16"
    }

that means the phone can receive data from server, but the sms gateway no sent the sms

Anton Tananaev4 years ago

You are missing the key:

https://www.traccar.org/http-sms-api/

henry beltran4 years ago

Now I am more confused, where can I find the API KEY of the traccar server installed on a local network as a test server?
The traccar sms gateway need any third party sms service? like smsgateway.me?

Anton Tananaev4 years ago

Key is in the app. You don't need any third party.

Totuus4 years ago

Hello Anton,
Congratulations, it works really fine!

To make clear to others:
The android device does not have to be on the same network as the server.
Create a fixed IP for your phone on your network
Assign the port 8082 to your phone fixed IP
Open the port 8082 on your modem (Vitual Server)
Dynamic DNS services can solve fixed IP issue.


I wonder if it is possible to send SMS commands to device using this Android SMS Gateway, but I think we need to have a SMPP Server configured for it.

When I try to send commands, I got this message:

SMS is not enabled - RuntimeException (BaseProtocol:127 < CommandsManager:65 < CommandResource:72 < ...)

After enable this option <entry key='sms.enable'>true</entry>, the application gives an warn message:

WARN: Unable to connect to SMPP server:  - Unable to connect to host [localhost] and port [2775]: Connection refused: localhost/127.0.0.1:2775 - SmppChannelConnectException (... < SmppClient:171 < ReconnectionTask:29 < ...)

My question is, it is possible to send SMS commands to the device using Android SMS Gateway? It will be in the future?

Best regards,
Alexandre.

Anton Tananaev4 years ago

Yes, we want to enable commands at some point.

henry beltran4 years ago

I keep looking for the api key, I'm sure it's a silly question, but I can't find it

Anton Tananaev4 years ago

In the app to go "Gateway" option in the menu. You should have it there.

henry beltran4 years ago

I knew I was doing something silly very wrong, I was using one of the first versions of sms gateway available (1.1), I compiled it from source code. When updating the application I finally found the API KEY. Thanks a lot. Now to try.

br2e4 years ago

hello i get the following error:

I have already reviewed everything notification is created correctly for active sms in traccar.xml, the number format is 5511991414646, port 8082 open on the firewall

        <entry key='notificator.types'>web,mail,sms</entry>
        <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
        <entry key='sms.http.url'>http://192.168.11.3:8082/</entry>
        <entry key='sms.http.authorization'>*****</entry> as app tells me the api key
        <entry key='sms.http.template'>
            {
                "to": "{phone}",
                "message": "{message}"
            }
        </entry>
2020-09-01 02:42:02  WARN: SMS send failed - Connection timed out (Connection timed out) - ConnectException (...)
Anton Tananaev4 years ago

Your IP is probably inaccessible from the server.

br2e4 years ago

really ping without success, how do I solve

Anton Tananaev4 years ago

Talk to your ISP? Figure out what IP to use.

Joystick4 years ago

Hi Eliseu, you most likely did but I just thought to check. If connected to a home router/wifi, did you forward port 8082 to the IP you are using for the app?

henry beltran4 years ago

This app really a good idea to send SMS notifications to each user, now, it is possible to have a ip bakcup? or it is possible to send at same time the event to two ip different?