Error with SMS-Notification 5.7

Henrick Langnera year ago

I'm using the traccar SMS gateway with latest traccar-version. Fireing a test event works, but firering a real sms notification doensn't work and I recieve this warning in my logs:

2023-05-27 01:05:31  WARN: Notification failed -  ... Unexpected token in JSON at position 104 ... - MessageException (HttpSmsClient:96 < NotificatorSms:51 < NotificationManager:110 < ...)

My configuration looks like this (I didn't change the default.xml!):

<!-- SMS-TraccarGateway -->

<entry key='sms.http.url'>https://www.traccar.org/sms/</entry>
<entry key='sms.http.authorization'>TOKEN</entry>
<entry key='sms.http.template'>
    {
        "to": "{phone}",
        "message": "{message}"
    }
</entry>

Any advices??

Anton Tananaeva year ago

I left the relevant part. Seems like the token is invalid.

Henrick Langnera year ago

Should I use „token for cloud Service“ from the messenger or the one for local service?

And why does the test notifications gets delivered?

Henrick Langnera year ago

Hi Anton,

I‘ve to update my question:

The TOKEN doesn‘t seem to be the problem. Delivering sms notifications seems to work - but with a huge delay and I’m not able to recognize any patterns.

At 08:14 AM I received 5 SMS in a row, each with another timestamp:

03:36:48 AM - Event: Device Online
04:02:37 AM - Event: Device Offline 
04:07:45 AM - Event: Device Online
05:19:21 AM - Event: Device Online
05:28:22 AM - Event: Device Offline

There are no matching lines in the log for those timestamps.

The smartphone which is used for sms gateway is always on and connected to the network. It‘s up to date and working fine.

Any advise?

Anton Tananaeva year ago

Then maybe some problem with the templates?

Henrick Langnera year ago

Sorry, but what kind of problems would cause such a delay and a warning in the logs like I showed you in my first post?

And I didn‘t change the default short templates by the way.

Anton Tananaeva year ago

I don't really know without investigating it, but I'm trying to give you some pointers on what to check. If you changed any templates, try reverting everything. Try changing the URL to your own service to see what is actually sent in the request.

Henrick Langnera year ago

Like I said, I didn't change the default short templates. So would you mind to investigate on it?
What ist meant by changing URL to my own service?

Anton Tananaeva year ago
Henrick Langnera year ago

Hm... I've only installed traccar following your documentation, edited my config like I already showed you and afterwards there appeared an error. Don't think, that there is an error caused through my changes.
Am I the only person with this error?

And what is meant by changing URL to my own service?

Anton Tananaeva year ago

Yes, you are the first person with this problem, as far as I know.

And what is meant by changing URL to my own service?

Well, I'm not sure how to explain it differently. I'm suggesting to change the URL to some service where you can capture the request to see if there's some problem with it.

Henrick Langnera year ago

Installing 5.8 fixed the problem so I think it was a problem with 5.7 or my local installation.

Thanks so far for your fast reply Anton!

Henrick Langner10 months ago

I‘m sorry to inform you, that those problems I wrote about in my further posts still exist.
Sometimes the gateways works immediately and sometimes there is a huge delay.
I’m still using Traccar 5.8 and the latest version of the android gateway app.