No need for AI or face recognition to do that: BT equipped system in elevator detects phones through their Bluetooth Device Address (sort of MAC address for BT), then calls a central repository of names to pair that phone with an identity, DNS style, then calls an advertising seller (for example, Google) that will happily give back the appropriate ads according to target, time, location and context.
Or, in a even more dystopian and much simpler scenario: some system app in the phone detects a beacon in the elevator through the above Device Address, then calls home (again, Google and others) and receives the ads to be shown in the elevator (or any other place with a audio/video system plus BT).
Hmm, perhaps there is a business model there: an elevator that writes music about the people inside the elevator, and adapts as the situation changes.