Try using the earphones with the microphone attachment to make or receive a call.
If you still can't be heard when doing this then there is a problem with the voice transmission circuits on the systemboard.
If you can be heard OK then there the is a problem with the phone's internal microphone OR perhaps the voice inlet hole, located on the bottom edge of the phone may be blocked with lint etc,.
To check this possibility, use a strong light and a magnifying glass to inspect the hole to see if it is blocked.
If it is (or even if you can't tell) use a vacuum cleaner to try and clear the blockage. DO NOT use a pin or probe to try and clear the hole, as you may damage the microphone, which is directly behind it.
If it is the internal microphone that is the problem, here is a link to the ifixit OnePlus 5 repair guides which may be of some help.
Here is a link to a supplier of the replacement part. It is not a recommendation to use them. It is shown to give an idea of the cost of the part. There are other suppliers online that may suit you better. Just search for Alcatel One plus 5 microphone part for results.
As it seems to be a relatively newly released model and if the microphone appears to be the problem, verify the purchase date of the phone. Then check the manufacturer's warranty statement that came with the phone. If the warranty period on the phone is still valid, follow the warranty instructions as to what you have to do to make a claim for a manufacturer's warranty repair or replacement.