You may need to add or substract 90 degrees or 180 degrees from the sentry gun's angle depending on how the game initializes building_sentryguns.
Also you have to know that building_sentrygun is NOT the sentry gun itself, it's just the sentry BASE (the three-legged metal slab). The actual sentry gun is a monster_sentry that is built on top of it at the end of the building process. If you had ran pmtools with a listenserver you would know </nitpicking

>
Perhaps it's these monster_ entities you should check for v.owner, dunno. I find it strange though because back in the days of TFC 1.1.0.8 that's how I was doing with my bot and it worked this way.
You should really fire up a listen server and test it out, it would me much easier for comparing the sentry's angles with your player's angles when you're standing next to it, and you could compare easily the contents of the entvars of your player, the sentry gun base, and the sentry gun monster.