How do I get all unpassable sides/walls in a navigation mesh?

Hello. I’ve been playing around with navigation meshes and I’m looking for a method that gathers all the sides/walls of a navigation mesh, ie the exact lines where you go from navigable to non-navigable space. I’ve used Rama’s AI code and borrowed some from this thread too to understand how the poly vertices work. Despite this I’ve tried pretty much every poly method in ARecastNavMesh to try to extract only the boundaries for non-naviable space and drawing it using DrawDebugLine to no avail. I have all the data necessary but I just can’t find a method to extract the exact lines I’m looking for.

Basically what I’m looking for are the inner lines around the two blocking objects I have on this map and the outer lines that make the outer bounds of the navigation mesh(although I can just derive those from the bounding box coordinates).

Does anyone have any idea? Because I’m at a loss as to what to do. I’ve been trying to solve it for days and a method that I tried that didn’t work was to check every side of every triangle and if no other triangle shares the same two vertices that would mean it has no neighbor on that side and that the line is a “wall”, but it obviously didn’t get the right lines as can be seen here: