astobj2: Correct ao2_iterator opacity violations

This corrects the ao2_iterator opacity violations in
res_pjsip_session.c by adding a global function to get the number of
elements inside the container hidden behind the iterator.

(closes issue ASTERISK-23053)
Review: https://reviewboard.asterisk.org/r/3111/
Reported by: Richard Mudgett


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/12@405253 f38db490-d61c-443f-a65b-d21fe96a405b