As we are listening to an azan during zohor praying time (example) at the mosque, what is the ruling? Can we talk or answer someone's greeting or just listen and answer the azan and ignore the rest while azan is going on?

It is makrooh (not recommended) that you talk during Azan. However, answering the salam is wajib.