Configuration Traccar SMS Gateway for Android

Mohcine Madkour4 years ago

Hello, Anton, all,

I am trying to configure Traccar SMS Gateway to send sms notifications: I put the following config in traccar.xml:

    <entry key='sms.enable'>true</entry>
    <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.1.245:8082/</entry>
    <entry key='sms.http.authorization'>xxxxxxxx</entry>
    <entry key='sms.http.template'>
            {
                "to": "{phone}",
                "message": "{message}"
            }</entry>

I Used the API Key : xxxxxxxx (hiden) from the gateway app in the phone in the authorization and the http://192.168.1.245 is the wifi ip address, and it did not work.
I changed the port 8082 to 80 to 80 as it is my web port but also it didnt work
I also fixed the http://192.168.1.245 as static in my phone and it did not work as well

Please advise on what is wrong with my config.

Thanks in advance!

Anton Tananaev4 years ago

Have you tried opening that URL in a web browser?

Mohcine Madkour4 years ago

yes it is saying:

This site can’t be reachedhttp://192.168.1.245:8082/ is unreachable.
ERR_ADDRESS_UNREACHABLE
Anton Tananaev4 years ago

Looks like you have some network issue.

Mohcine Madkour4 years ago

Hi Anton,
I was able to fix the network issue by configuring static ip address in my phone, now http://192.168.1.245:8082/ is showing the following message:
Send SMS using following API:

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

I tried again with the same traccar config above, I put the phone number 281652xxxx on the extra property on the device config on traccar interface but the SMS notification did not work. I also tried to change the traccar xml config to

<entry key='sms.enable'>true</entry>
<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.1.245:8082/</entry>
<entry key='sms.http.authorization'>xxxxxxxx</entry>
<entry key='sms.http.template'>
        {
            "to": "+10000000000",
            "message": "{message}"
        }</entry>

But SMS notification is still not working. can you please advice on what is wrong here?

Anton Tananaev4 years ago

What's the error you get?

Mohcine Madkour4 years ago

In the log file I got the following:

2021-06-07 15:28:27  INFO: [c4fe1c40: osmand < 99.43.56.222] HEX: 504f5354202f3f69643d3730343038312674696d657374616d703d31363233303739373036266c61743d33392e323039363935266c6f6e3d2d38352e3930363536312673706565643d302662656172696e673d3026616c7469747564653d3139342e363034363332383936383138392661636375726163793d392e33333631303237303737303939363226626174743d373320485454502f312e310d0a486f73743a203136322e3234332e3137322e3233303a353035350d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a4163636570743a202a2f2a0d0a557365722d4167656e743a2054726163636172436c69656e742f35372043464e6574776f726b2f313232302e312044617277696e2f32302e332e300d0a4163636570742d4c616e67756167653a20656e2d75730d0a436f6e74656e742d4c656e6774683a20300d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174650d0a0d0a

2021-06-07 15:28:27  INFO: [c4fe1c40: osmand > 99.43.56.222] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a

2021-06-07 15:28:27  INFO: [c4fe1c40] id: 704081, time: 2021-06-07 15:28:26, lat: 39.20970, lon: -85.90656, course: 0.0, accuracy: 9.3

2021-06-07 15:28:27  INFO: [0809257c: meiligao < 102.78.134.35] HEX: 242400715468410092013499553135323832332c412c323731302e333133332c4e2c30313331312e353438372c572c33362e302c3134372e302c3037303632312c2c2c417c302e367c34362e337c313830307c303042412c303033367c3030303234383531357c3030303030301c630d0a

By the way the 99.43.56.222 is the IP address listed in android phone when checking whatsmyipaddress

Anton Tananaev4 years ago

Unfortunately this doesn't help.

Mohcine Madkour4 years ago

What could be the issue ? Any idea?

document3 years ago

@Anton, I am having exactly the same problem. The error comes up saying communication failure

Aakansha3 years ago

But it's also not working I guess.
I inputted this now

<entry key='sms.http.url'>http://192.168.0.100:8082/</entry>

Now it's showing Communication Failure !!!

https://drive.google.com/file/d/1gwnl18iJaIil42M1mcS9lnWTRhCStsQh/view?usp=sharing

Aakansha3 years ago

Did anyone solved this issue of Communication Failure ??

Aakansha3 years ago

Hiii
I'm getting this in logs many times SMS sent failed, Connection time out, Connection Exception.

    <entry key='sms.enable'>true</entry>
    <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.0.100:8082/</entry>
    <entry key='sms.http.authorization'>xxxxxxxx</entry>
    <entry key='sms.http.template'>
            {
                "to": "{+91XXXXXXXXXX}",
                "message": "{message}"
            }</entry>