dgreif / ring

Unofficial packages for Ring Doorbells, Cameras, Alarm System, and Smart Lighting
MIT License
1.2k stars 161 forks source link

Video Doorbell Pro & Live Stream - UDP Mapping Requests #191

Closed HybridSarcasm closed 4 years ago

HybridSarcasm commented 4 years ago

DISCLAIMER: I understand the warning on the Camera Troubleshooting wiki page. I'm opening this issue in an attempt to start a discussion on how to find a solution for my particular scenario (and others like it).

Summary: Live Stream video isn't working for me and my Ring Video Doorbell Pro. Fails after 10 seconds with "No Response" message. All other functions work just fine.

Details:

Homebridge logs show only the following when attempting live video:

Nov 30 09:58:31 homebridge-ring homebridge[11018]: [11/30/2019, 9:58:31 AM] [Ring] Preparing Live Stream for Front Entrance
Nov 30 09:58:31 homebridge-ring homebridge[11018]: [11/30/2019, 9:58:31 AM] [Ring] Streaming video only - ffmpeg was not found
Nov 30 09:58:32 homebridge-ring homebridge[11018]: [11/30/2019, 9:58:32 AM] [Ring] Waiting for stream data from Front Entrance (0.613s)
Nov 30 09:58:42 homebridge-ring homebridge[11018]: [11/30/2019, 9:58:42 AM] [Ring] Stopped Live Stream for Front Entrance

Packet Capture of Homebridge server network connection reveals the "Map UDP Request" conversations (as can be seen in this packetcapture.cap.zip file). My switch ends up returning a "Destination unreachable (port unreachable)" message to the Homebridge server IP. I suspect this is the root cause of the live video failure, but I don't know what the solution would be.

I can supply DEBUG Homebridge log files if requested, but I can't make heads or tails of them.

EDIT: Removed "pfSense" from the title since it's been revealed that pfSense really has no part of the problem I'm trying to solve.

HybridSarcasm commented 4 years ago

Did some more digging using tcpdump on the Homebridge server (dump file). Every time I try to get live video, I see a series of NAT-PMP and PCP v2 "Map UDP Request" packets. Both series of requests are sent to the following destinations:

On my network, here are the relevant pieces and their IP addresses:

I have no idea why that list of broadcast IPs is chosen, but only 1 is applicable - that IP of my switch (192.168.10.1). I would think that the requests should be broadcast to the gateway instead of directly to my switch. Each series of requests ends with the aforementioned "Destination unreachable (port unreachable)" from my switch (192.168.10.1).

Is this expected behavior? Is there anyway to manipulate the UDP mapping requests so that they are directed at my router/gateway?

dgreif commented 4 years ago

@SeminolesFan78 I really appreciate the deep dive into the network traffic! And I'm sorry for not replying to your original post, got buried in my inbox. Regarding the traffic being directed at your switch instead of your gateway, I am going to have to defer. I'm using the nat-punch package (https://github.com/mkg20001/nat-puncher) to send those requests, and I have not looked into its inner-workings at all. If you are comfortable with nodejs, I'd suggest you dig into that project a bit, or open an issue to see if the developer can provide any insight. It's entirely possible that there is a small bug in that library that is causing all the remaining issues with live streaming not connecting (not common, but there are still a few users that can't get live streams to work).

Code solutions aside, have you tried bypassing that switch and connecting the Homebridge server directly to the router?

HybridSarcasm commented 4 years ago

@dgreif Thank you! That was very helpful information. I am no programmer. I wouldn't know how to re-build any such NodeJS package. However, I did take a look at the nat-puncher code. It's plain as day in the utils.js file:

/**
 * List of popular router default IPs
 * Used as destination addresses for NAT-PMP and PCP requests
 * http://www.techspot.com/guides/287-default-router-ip-addresses/
 */
var ROUTER_IPS = ['192.168.1.1', '192.168.2.1', '192.168.11.1',
  '192.168.0.1', '192.168.0.30', '192.168.0.50', '192.168.20.1',
  '192.168.30.1', '192.168.62.1', '192.168.100.1', '192.168.102.1',
  '192.168.1.254', '192.168.10.1', '192.168.123.254', '192.168.4.1',
  '10.0.1.1', '10.1.1.1', '10.0.0.13', '10.0.0.2', '10.0.0.138'
]

Since the addMapping function doesn't even have an optional override for a manually-defined array of internal IPs, the most we can do is ask the maintainer to provide such an enhancement. I've just created this feature request on the nat-puncher project.

issues-guy commented 4 years ago

I am also impacted by this issue. @SeminolesFan78, have you found any temporary workaround until the nat-puncher enhancement is brought online?

HybridSarcasm commented 4 years ago

@issues-guy No workaround. The Home app shows the static images every 20 seconds. It also grabs a an image when motion is detected or when the doorbell is rung. If I need live video, I just go to the Ring app for now.

HybridSarcasm commented 4 years ago

Hi @dgreif, seems nat-puncher was updated with a default gateway detection code. Would you mind rolling an update to this plugin with that change? Thanks so much!

dgreif commented 4 years ago

@SeminolesFan78 thanks for the heads up. I’m planning to do some updates, but still taking a break for the holidays. Should be able to get something out tomorrow

dgreif commented 4 years ago

@SeminolesFan78 thanks for your patience and in-depth debugging on this! I've released v5.12.1, which includes the updates to nat-puncher and will automatically install default-gateway as a dependency. Please let me know how it works for you!

HybridSarcasm commented 4 years ago

@dgreif Thanks! I've now got a live video stream!

dgreif commented 4 years ago

Awesome @SeminolesFan78! Thanks again for your help tracking this down. I was treating nat-puncher as a magic black box, but definitely should have dug into it a little more. I think the fix he put in will be valuable for everyone using that module, not just for Ring users. Great job pushing for a solution!

heitol commented 4 years ago

Awesome @SeminolesFan78! Thanks again for your help tracking this down. I was treating nat-puncher as a magic black box, but definitely should have dug into it a little more. I think the fix he put in will be valuable for everyone using that module, not just for Ring users. Great job pushing for a solution!

Unfortunately I can't get it to work; video won't start:

[2/13/2020, 8:05:26 PM] [Ring] Adding new accessory cocoa_camera Garten neu [2/13/2020, 8:05:26 PM] Garten neu is running on port 45439.

[2/13/2020, 8:35:36 PM] [Ring] Preparing Live Stream for Garten neu [2/13/2020, 8:35:36 PM] [Ring] Streaming video only - ffmpeg was not found [2/13/2020, 8:35:36 PM] [Ring] Waiting for stream data from Garten neu (0.182s) [2/13/2020, 8:35:46 PM] [Ring] Stopped Live Stream for Garten neu

Setup: Synology DS218+ running Homebridge 0.4.50 with config ui 4.7.0, ring plugin 6.1.1. Synology is directly plugged in to a fritz!box with NAT/upnp allowed for the cam, the synology and the apple tv.

I really can't figure out what to change to make live video work.

If you need more detailed log files, let me know and I will try to get them.

dgreif commented 4 years ago

Sorry @heitol, not really anything else I can do to help since this is all network dependent. If you find a bug that you can submit a Pull Request for, i'm happy to take a look. Otherwise, you'll just have to live with snapshots

evelynmatson commented 2 years ago

@heitol did you ever get this to work? I think I have the same exact problem.

dgreif commented 2 years ago

@evelynmatson see https://github.com/dgreif/ring/wiki/Camera-Troubleshooting for troubleshooting steps.

evelynmatson commented 2 years ago

Definitely tried all of that. Thanks for replying and pointing me to it though, looks like a helpful document.

On Wed, Oct 20, 2021 at 7:44 AM Dusty Greif @.***> wrote:

@evelynmatson https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_evelynmatson&d=DwMCaQ&c=qgVugHHq3rzouXkEXdxBNQ&r=HyqDX1TUSSqThkEh87_Y7AHB-SN7qB7EFBZE8FkUS9k&m=HCC8jARAMU5kdidkCrvKVgjkzBwHGJ4gjuyt-wLW2ovQMc6u_fEq84vleYu6wqYp&s=xS3odo8_xf2Q-QaP9iMGAM-32PeXC6D9FsIiXUvsYjw&e= see https://github.com/dgreif/ring/wiki/Camera-Troubleshooting https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_dgreif_ring_wiki_Camera-2DTroubleshooting&d=DwMCaQ&c=qgVugHHq3rzouXkEXdxBNQ&r=HyqDX1TUSSqThkEh87_Y7AHB-SN7qB7EFBZE8FkUS9k&m=HCC8jARAMU5kdidkCrvKVgjkzBwHGJ4gjuyt-wLW2ovQMc6u_fEq84vleYu6wqYp&s=yBL-YyqKJQNEyzz391GEPf-ckO_40GES43iickBaIvE&e= for troubleshooting steps.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_dgreif_ring_issues_191-23issuecomment-2D947739349&d=DwMCaQ&c=qgVugHHq3rzouXkEXdxBNQ&r=HyqDX1TUSSqThkEh87_Y7AHB-SN7qB7EFBZE8FkUS9k&m=HCC8jARAMU5kdidkCrvKVgjkzBwHGJ4gjuyt-wLW2ovQMc6u_fEq84vleYu6wqYp&s=gaL2s_ZX97mGB-Zfx4PvukW_42D_suNUuULr-j3p9KI&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_ADHQOKWLCPQCK2TMNNJZPMDUH3IWTANCNFSM4JTHEB3A&d=DwMCaQ&c=qgVugHHq3rzouXkEXdxBNQ&r=HyqDX1TUSSqThkEh87_Y7AHB-SN7qB7EFBZE8FkUS9k&m=HCC8jARAMU5kdidkCrvKVgjkzBwHGJ4gjuyt-wLW2ovQMc6u_fEq84vleYu6wqYp&s=MLy6tdxpRdcSU7N69N9tMmfRLVVve0WoaH-oKNjCanM&e= .

-- Evelyn Matson (she/her/hers) BS in Computer Science USF RA in USF Data Visualization Lab TA for Alark Joshi, CS 360/560: Data Visualization Production Manager, ASUSF College Players (425) 677-4572 | @. @.>