OpenALPR Webhook Processor for IP Cameras

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Ok. Not a problem. I'l port forward it now to test. I'm using a Dahua cam so we will see how it goes.
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
The service is written in c# asp.net core so it would be possible to run it as a windows service/exe, mac, linux, etc. not just docker. i'll look into how to create a windows service in the build pipeline that will make it easier for people who aren't using docker.

If you haven't tried virtualization, you should it's awesome
1609608199329.png
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
So port forwarding to the container works fine. I get the "Test Succeed 500 code" response from the OpenALPR website webhook test page. I'm not getting anything actually written to the camera overlay after a plate is read. The container is running and I updated the appsettings.json with this:

JSON:
{
  "AllowedHosts": "*",
  "Cameras": {
    "Cameras": [
      {
        "Manufacturer": "Dahua",
        "OpenAlprCameraId": <ID>,
        "Password": "<password>",
        "UpdateOverlayTextUrl": "http://10.200.200.12:65002/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=",
        "Username": "admin"
      },
      }
    ]
  }
}
I'm not sure how to determine the "Digest" authentication mode of the Dahua. I don't see that listed anywhere.
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
I think Dahua only uses digest authentication now, so that shouldn't be an issue. If you look at the docker logs for the running container it outputs debug information. Verify that when you go to
in a browser that you get an authentication prompt, that means you can access that address.

Code:
[09:05:56 INF] Route matched with {action = "Post", controller = "WebhookProcessor"}. Executing controller action with signature Void Post(OpenAlprWebhookProcessor.WebhookProcessor.OpenAlprWebhook) on controller OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor (OpenAlprWebhookProcessor).
[09:05:56 INF] request received from: ::ffff:192.168.1.68
[09:05:56 INF] adding job for plate: HF5635
[09:05:56 INF] processing job for plate: HF5635
[09:05:56 INF] Executed action OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor) in 2.8344ms
[09:05:56 INF] Executed endpoint 'OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor)'
[09:05:56 INF] HTTP POST /webhook responded 200 in 3.8108 ms
[09:05:56 INF] Request finished in 4.6247ms 200
[09:06:02 INF] clearing expired overlay for: 106232742
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
I get an "OK" from the webpage when I click that link and input my username/password so I know that works. I'll check the docker logs. Gotta run out for a bit but will pick this up in a while.
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
Also make sure you have text overlays enabled in the camera UI, right now the service won't do that for you.
 

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,472
Reaction score
2,125
Location
SF BayArea, USA
Maybe I will wait for biggen and hopefully some one can walk me thru the setup. I have got the thing installed not sure rite now how to go about configuring it. I can get the port forwarding started for me Does it has to be any specific port ? Also where are we port forwarding to is this going to be the machine/host ip Where docker is installed ? guessing
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Ok, here is a tail -f of the log:

Code:
{"log":"[19:15:14 INF] Request starting HTTP/1.1 POST http://<ip address>:3859/webhook application/json 24405\n","stream":"stdout","time":"2021-01-02T19:15:14.374649987Z"}
{"log":"[19:15:14 INF] Executing endpoint 'OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor)'\n","stream":"stdout","time":"2021-01-02T19:15:14.375403261Z"}
{"log":"[19:15:14 INF] Route matched with {action = \"Post\", controller = \"WebhookProcessor\"}. Executing controller action with signature Void Post(OpenAlprWebhookProcessor.WebhookProcessor.OpenAlprWebhook) on controller OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor (OpenAlprWebhookProcessor).\n","stream":"stdout","time":"2021-01-02T19:15:14.380248317Z"}
{"log":"[19:15:14 INF] request received from: ::ffff:52.201.255.102\n","stream":"stdout","time":"2021-01-02T19:15:14.515617482Z"}
{"log":"[19:15:14 INF] adding job for plate: 776EH\n","stream":"stdout","time":"2021-01-02T19:15:14.516520987Z"}
{"log":"[19:15:14 INF] processing job for plate: 776EH\n","stream":"stdout","time":"2021-01-02T19:15:14.517309471Z"}
{"log":"[19:15:14 ERR] Value cannot be null. (Parameter 'source')\n","stream":"stdout","time":"2021-01-02T19:15:14.518298862Z"}
{"log":"[19:15:14 INF] Executed action OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor) in 136.8566ms\n","stream":"stdout","time":"2021-01-02T19:15:14.520044891Z"}
{"log":"[19:15:14 INF] Executed endpoint 'OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor)'\n","stream":"stdout","time":"2021-01-02T19:15:14.52084357Z"}
{"log":"[19:15:14 INF] HTTP POST /webhook responded 200 in 146.6037 ms\n","stream":"stdout","time":"2021-01-02T19:15:14.52166856Z"}
{"log":"[19:15:14 INF] Request finished in 148.4279ms 200 \n","stream":"stdout","time":"2021-01-02T19:15:14.523152022Z"}
You can see the container is getting the plate from the ALPR webhook. Then it appears to have an error there: Value cannot be null. (Parameter 'source')\n","stream":"stdout","time":"2021-01-02T19:15:14.518298862Z"}
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
biggen can you post your appsettings? obviously remove your credentials.

also, github will now generate packages you can run on windows. go to the releases page download the latest version then from a command line run dotnet .\OpenAlprWebhookProcessor.dll from within that folder. You won't need docker this way. You will need the dotnet core 3.1 runtime for this to work.
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Sure. Here you go:

JSON:
{
  "AllowedHosts": "*",
  "Cameras": {
    "Cameras": [
      {
        "Manufacturer": "Dahua",
        "OpenAlprCameraId": 000,
        "Password": "password",
        "UpdateOverlayTextUrl": "http://10.200.200.12/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=",
        "Username": "user"
      }
      }
    ]
  }
}
I removed the code for the other cameras and just left the Dahua. Perhaps that is the issue.
 
Last edited:

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
K get rid of the extra } then you should be good
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Alright. Just restarted the container. Waiting for a car.

Yeah, I should have realized I had too many brackets.
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Still getting this error in the log:

{"log":"[19:46:47 ERR] Value cannot be null. (Parameter 'source')\n","stream":"stdout","time":"2021-01-02T19:46:47.981745156Z"}

Here is the current appsettings.json

JSON:
{
  "AllowedHosts": "*",
  "Cameras": {
    "Cameras": [
      {
        "Manufacturer": "Dahua",
        "OpenAlprCameraId": 254963574,
        "Password": "password",
        "UpdateOverlayTextUrl": "http://10.200.200.12/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=",
        "Username": "admin"
      }
    ]
  }
}
Where is that error generated from? Your code or at the camera?

Let me try to modify the file location of the appsettings.json in the docker cmd line. That may be the issue.
 
Last edited:

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Hm... There is this in the docker log:

{"log":"[20:00:08 WRN] Failed to determine the https port for redirect.\n","stream":"stdout","time":"2021-01-02T20:00:08.903529826Z"}
but also still this:
{"log":"[20:00:09 ERR] Value cannot be null. (Parameter 'source')\n","stream":"stdout","time":"2021-01-02T20:00:09.595323567Z"}

So I'm not sure what the issue is. Here is my appsettings.json again:

JSON:
{
  "AllowedHosts": "*",
  "Cameras": {
    "Cameras": [
      {
        "Manufacturer": "Dahua",
        "OpenAlprCameraId": 0000,
        "Password": "pass",
        "UpdateOverlayTextUrl": "http://10.200.200.12/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=",
        "Username": "admin"
      }
    ]
  }
}
Here is the start.sh file I used to kick off the container:

Bash:
#!/bin/bash

docker run -d \
--name=openalprwebhookprocessor \
--net=bridge \
-v /home/joe/webhook_alpr/app/appsettings.json:/appsettings.json \
-p 3859:80 \
mlapaglia/openalprwebhookprocessor
My appsettings.json full path is indeed /home/joe/webhook_alpr/app/appsettings.json just as its listed in that file.
 
Last edited:

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
Ok I have added more logging around the area I think it's failing, pull the latest version and try again
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Just so I'm clear your default container start is:

Bash:
docker run -d \
--name=openalprwebhookprocessor \
--net=bridge \
-v /app/appsettings.json:/appsettings.json \
-p 3859:80 \
mlapaglia/openalprwebhookprocessor
So the appsettings.json is designed to be placed in /app. So if I'm on Linux the full path is just /app/appsettings.json, correct?
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,539
Reaction score
2,765
Well I don't know. There is the log with the new image:

Code:
{"log":"[21:20:12 INF] Now listening on: http://[::]:80\n","stream":"stdout","time":"2021-01-02T21:20:12.151830111Z"}                         
{"log":"[21:20:12 INF] Application started. Press Ctrl+C to shut down.\n","stream":"stdout","time":"2021-01-02T21:20:12.152431156Z"}         
{"log":"[21:20:12 INF] Hosting environment: Production\n","stream":"stdout","time":"2021-01-02T21:20:12.152542626Z"}                         
{"log":"[21:20:12 INF] Content root path: /app\n","stream":"stdout","time":"2021-01-02T21:20:12.152681455Z"}                                 
{"log":"[21:28:05 INF] Request starting HTTP/1.1 POST http://IP:3859/webhook application/json 27688\n","stream":"stdout","time":"2021-01-02T21:28:05.975482668Z"}
{"log":"[21:28:05 WRN] Failed to determine the https port for redirect.\n","stream":"stdout","time":"2021-01-02T21:28:05.985276557Z"}
{"log":"[21:28:06 INF] Executing endpoint 'OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor)'\n","stream":"stdout","time":"2021-01-02T21:28:06.063968085Z"}
{"log":"[21:28:06 INF] Route matched with {action = \"Post\", controller = \"WebhookProcessor\"}. Executing controller action with signature Void Post(OpenAlprWebhookProcessor.WebhookProcessor.OpenAlprWebhook) on controller OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor (OpenAlprWebhookProcessor).\n","stream":"stdout","time":"2021-01-02T21:28:06.175609602Z"}
{"log":"[21:28:06 INF] request received from: ::ffff:54.165.211.244\n","stream":"stdout","time":"2021-01-02T21:28:06.49614601Z"}
{"log":"[21:28:06 INF] adding job for plate: 764RNC\n","stream":"stdout","time":"2021-01-02T21:28:06.502409927Z"}
{"log":"[21:28:06 INF] processing job for plate: 764RNC\n","stream":"stdout","time":"2021-01-02T21:28:06.504295849Z"}
{"log":"[21:28:06 ERR] Value cannot be null. (Parameter 'source')\n","stream":"stdout","time":"2021-01-02T21:28:06.515348019Z"}
{"log":"[21:28:06 INF] Executed action OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor) in 344.5401ms\n","stream":"stdout","time":"2021-01-02T21:28:06.536410993Z"}
{"log":"[21:28:06 INF] Executed endpoint 'OpenAlprWebhookProcessor.WebhookProcessor.WebhookProcessor.Post (OpenAlprWebhookProcessor)'\n","stream":"stdout","time":"2021-01-02T21:28:06.53931824Z"}
{"log":"[21:28:06 INF] HTTP POST /webhook responded 200 in 554.0256 ms\n","stream":"stdout","time":"2021-01-02T21:28:06.547187688Z"}
{"log":"[21:28:06 INF] Request finished in 589.2181ms 200 \n","stream":"stdout","time":"2021-01-02T21:28:06.552650447Z"}
I may not be destined to get this working. I moved the appsettings.json into the /app/ directory as you indicate. Still can't get it working.
 
Top