Older house. When I flush the toilet sometimes it works fine. But most of the time the water does not drain. Here is what I have done so far. I rented a commercial drain cleaner machine and took off the toilet and snaked it to the clean-out plug in the basement where the line then goes to the street and the city sewer line.
The toilet worked fine for 6 flushes or so... then the water would not go down and big gurggling in the toilet with large air bubbles.
Thinking it must be the vent line I went to the roof and ran a hand snake line down 20 feet which was as long as the snake was. Then I pushed a garden hose inside the vent on the roof and pushed the hose until it hit the trap at the bottom and turned on the water. I let it run at full pressure for 5 minutes. But when I flush the toilet the same problem exists. The sink, toilet and tub/shower share the same vent line to the roof. Those fixtures are about 5 feet from the vent line to the roof.

I did find that if I leave the cleanout plug out (removed) in the basement that it flushes properly. If I close the clean-out plug and flush.. the toilet does not drain. When that happened I went to that basement cleanout plug and removed the plug and there was a sudden whoosh of air. Then the toilet drains fine.

Can you help me pinpoint what I need to do.