Whether wired headset is connected or not, or which sound device is selected: Phone, Headset or Speaker the loudspeaker is always used.
Moreover, trying to toggle between Phone and Speaker or between Headset and Speaker the Phone (Headset) is always shown on the bottom:

On Motorola Android One it worked.
On huawei BLA-L29 I can vonfirm your report.
looks like it should be Switch Loudspeaker -> Earpiece/Wired Headset doesn't work
For me I have to actually switch to Loudspeaker then back to Headset to work. It seems like the app thinks it's in Headset mode but selecting that without selecting Loudspeaker first will not make the switch correctly
@bmarty is any update there? People say this is one of the most annoying issues.
Not fixed, please reopen.
Please test with version 1.0.6 or at least tell us what are the version you are using.
We are closing issue when fix is merged on develop, which can be sometimes automatically handle by GitHub, not when the application containing the fix is released. This is maybe something we could change (DOD), and on our side we should maybe mention in which version of the app the fix will be available.
All the time the loudspeaker is used and proximity sensors works:

I'm on Element 1.0.6 surely!
Let's reopen it then!
Please make it more important.
This is not good for privacy. If everybody in the room (or public transport or anywhere) hears what the callee says, then it's better to use Messenger or WhatsApp.
While a call is active in Element, an incoming phone call switches the Matrix call back to ear speaker. An outgoing phone dialing sometimes (I'm not sure that in this case, the Matrix call has to be accepted, or dialing is enough).
I haven't tested that it is only the phone call, or any app playing audio on ear speaker would switch Element back to ear speaker.
Let's tell this to your chat partners who currently use Messenger instead of Element because this bug, that there is this workaround, so they can switch to Element, just have to place a phone call to somebody every time they start a Matrix call.
@notramo I believe this is a separate issue.
UX looks like this:
AFAIK this behavior started since spring updates.
It doesn't depends on headset as it happens without them too.
I can confirm that. When I make a call I hear the ringing tone in my headset but when the call is answered the app switches to loudspeaker.
Asus Max Pro m2 (X01BD), LineageOS 16.0 (Android 9), Element Android 1.0.11 (from F-Droid).
Please don't fix this. Do features like emojis (#2514) and confetti chat effect (#2535) instead, because emojis and confetti are important privacy features, which are often used by security-minded people, but being able to talk without everyone hearing the conversation on the public transport isn't important.
Most helpful comment
Please make it more important.
This is not good for privacy. If everybody in the room (or public transport or anywhere) hears what the callee says, then it's better to use Messenger or WhatsApp.