traccar / traccar

Traccar GPS Tracking System
https://www.traccar.org
Apache License 2.0
5.08k stars 2.54k forks source link

Traccar and opengts integration: RulesFactory (geozone e-mail notification) doesn't work. #1131

Closed fm500 closed 9 years ago

fm500 commented 9 years ago

If I update a device's location via traccar to GTS, the gui is perfectly fine but the e-mail notifications on a Geozone arrival/departure (geofencing e-mail notification) does not invoke nor work.

If I use a OpenGTS DCS server, for the same device, this notification works ok.

Is there any way to make Traccar perform whatever process the OpenGTS DCS does when it receives a message so these e-mails work? Or, does anybody know where to start looking to make this work?

tananaev commented 9 years ago

Probably there is some API you need to call to send notifications, but because Traccar works with OpenGTS system through database only, there is no way to do it.

You can try to ask on OpenGTS forums to explain how this feature works.

fm500 commented 9 years ago

http://sourceforge.net/p/opengts/discussion/579835/thread/e51238ef/

I posted it here, no reply.

The problem is it's handled at the DCS server level, the "receiver" invokes the event rules when it detects that the position update moves in/out of a Geozone. With Traccar, we're bypassing the DCS server and hitting the DB server directly. Hypothetically, if traccar impersonated a tk102b and submitted it via TCP to opengts using tk102b instead of hitting the DB, it would work fine.

I'm thinking the only way to actually do this reliably is for someone to code a stand alone module that just reads the Geozones out of the DB, and as a once a minute cronjob just sees what in its records has moved in/out of such a zone. Not very scalable I guess, but should work fine for a few hundred devices anyways.

I'm open for any last ditch ideas and certainly appreciate all your input. However at this point, I think it's beyond my capabilities.

tananaev commented 9 years ago

Does OpenGTS support any HTTP-based protocol?

fm500 commented 9 years ago

There appears to be one called "gprmc". I know the formatting here is bad, so please see the top of page 36 here: http://opengts.sourceforge.net/OpenGTS_Config.pdf

9.1.2) Default "gprmc" Configuration: The default "gprmc" cofiguration (with no special configuration changes made in the "webapp.conf" file) expects a http-based URL formatted as follows: (the URL below displays the various fields on separate lines, but is normally sent to the server as a single URL all on a single line): http://example.com:8080/gprmc/Data? id=123456789012345& code=0xF020& gprmc=$GPRMC,080701.00,A,3128.7540,N,14257.6714,W,000.0,000.0,180707,,,A_1C Where http://example.com:8080/gprmc/Data? Represents the host:port ("example.com:8080") and "gprmc.war" servlet location ("/gprmc/Data?") 123456789012345 Represents the unique mobile ID of the device (such as the IMEI#). (This value should be entered into the "Device Admin" page "Unique ID" field in the format "gprmc_123456789012345"). 0xF020 Represents the status code used for identifying the reason for the event. The status code used here should match the hex, or decimal value of a status code listed in the "Status Codes and Descriptions" manual at the following location: http://www.geotelematic.com/docs/StatusCodes.pdf In addition to one of the above hex/decimal status codes, any of the following text code names may also be used, which will automatically be converted into it's corresponding hex-based status code when it is entered into the EventData table: GPS, PANIC, WAYMARK, etc, (see gprmc source module "Data.java" for a current list). $GPRMC,080701.00,A,3128.7540,N,14257.6714,W,000.0,000.0,180707,,,A_1C Represents the NMEA-0183 $GPRMC record straight from the GPS receiver.

tananaev commented 9 years ago

I don't like NMEA format. Ideally it should be something like OsmAnd protocol: https://www.traccar.org/osmand/

fm500 commented 9 years ago

I appreciate your assistance and reply. I have done some research and currently this is the only DCS that OpenGTS has that is HTTP-based and included in the open source version.

tananaev commented 9 years ago

Where can I find all DCS options available for OpenGTS?

fm500 commented 9 years ago

Section 8.1 here lists some (PDF page 30): http://opengts.sourceforge.net/OpenGTS_Config.pdf

Most TK102/TK103 tracking devices (using the common TK102/TK103 protocols). Astra Telematics AT240, AT110, AT210 Sanav GC-101, MT-101, and CT-24 Personal Tracker (HTTP-based protocol) Sanav GX-101 Vehicle Tracker (HTTP-based protocol) CelltracGTS™/Free for Android phones CelltracGTS™/Pro for Android phones Aspicore GSM Tracker (Nokia, Samsung, Sony Ericsson phones) TAIP (Trimble ASCII Interface Protocol). TrackStick GPS data logger "GPSMapper" capable phones. "NetGPS" capable devices.

How about the Sanav GC-101 http protocol? Or does this have the same GPRMC problem?

Format: IMEI=IMEI Number&rmc=$GPRMC,,,,,,,,

,,, There are plenty more, but they are not in the "free" version of opengts. Go figure. By far the most popular is TK102/TK103 (tk10x) These are likely well known, but I can send a protocol doc if needed. This is actually the coban protocol here, but it copies the xenun closely enough it works fine: https://docs.google.com/spreadsheets/d/1CMzHMx2roGBduMeDbZJKH8PJEUOOIMdWvUtSOMhUNRY/edit?usp=sharing There is also opendmtp. I don't know how much maintenance it's received in recent years, but its supported: http://www.opendmtp.org/ In addition to the http one previously mentioned. Thank you!
tananaev commented 9 years ago

I have implemented HTTP forwarding. Now you can put something like this in the config file:

<entry key='forward.enable'>true</entry>
<entry key='forward.url'>http://example.com:8080/gprmc/Data?id={uniqueId}&amp;code=0x0000&amp;gprmc={gprmc}</entry>
iceman37 commented 7 years ago

hi tananaev,

sorry to bring this up again, i've tried adding this (changed only the domain though) to the traccar.xml file just in the server config section. but had no success. mind guiding me a bit?

<entry key='forward.enable'>true</entry>
<entry key='forward.url'>http://example.com:8080/gprmc/Data?id={uniqueId}&amp;code=0x0000&amp;gprmc={gprmc}</entry>

Thank you :)

tananaev commented 7 years ago

Have you changed the URL to point to your OpenGTS server?

iceman37 commented 7 years ago

yes, i have.

iceman37 commented 7 years ago

So this is how it looks.

    <!-- SERVER CONFIG -->

    <entry key='web.enable'>false</entry>
    <entry key='web.port'>8082</entry>
    <entry key='web.path'>/opt/traccar/web</entry>

    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>google</entry>

    <entry key='logger.enable'>true</entry>
    <entry key='logger.level'>all</entry>
    <entry key='logger.file'>/opt/traccar/logs/tracker-server.log</entry>

    <entry key='event.enable'>true</entry>
    <entry key='event.suppressRepeated'>60</entry>
    <entry key='event.overspeedHandler'>true</entry>
    <entry key='event.globalSpeedLimit'>90</entry>
    <entry key='event.motionHandler'>true</entry>
    <entry key='event.geofenceHandler'>true</entry>

        <entry key='forward.enable'>true</entry>
        <entry key='forward.url'>http://192.89.150.56:8080/gprmc/Data?id={uniqueId}&;code=0x0000&;gprmc={gprmc}</entry>
tananaev commented 7 years ago

Have you tried to submit data to that URL manually and see if it works?

iceman37 commented 7 years ago

hi, thanks for your response.

http://myip:8080/gprmc/Data acct=iceman&dev=op3&gprmc=$GPRMC,041532,A,3128.7540,N,14257.6714,W,000.0,000.0,280916,,*5 [gprmc=$GPRMC,041532,A,3128.7540,N,14257.6714,W,000.0,000.0,280916,,*5&dev=op3&acct=iceman]

so the above is a url sent from GPS2OpenGTS android application. and it seems to work fine..

I cannot fathom how to add manual values to the url you have used.

tananaev commented 7 years ago

That's not a valid URL and also it doesn't match the configuration that you are using for Traccar.

Can you please use proper formatting for stuff that you put in the comments.

esteves67 commented 7 years ago

Hello Mr. Anton, i tested it and its working for geo-fence / geo-zone email notification, but any idea how to pass the info from : ExtractValue(:extended_info, '/info/battery') / 100 (Its successfuly being inserted on the Column 'batteryLevel' on the 'EventData' table from OpenGTS database.) is it possible to pass that info to forward.url? I tried:

<entry key='forward.url'>http://127.0.0.1:8080/gprmc/Data?id={uniqueId}&amp;code=0x0000&amp;batt={batteryLevel}&amp;gprmc={gprmc}</entry> 

But no success =/ Thanks for any help

tananaev commented 7 years ago

@esteves67

  1. DON'T comment on old closed threads.
  2. What is "batteryLevel"? Are you just making up names?
  3. Have you enabled forwarding?
<entry key='forward.enable'>true</entry>
esteves67 commented 7 years ago

Sorry for my mistake, didnt saw it was closed :x