If your phone is running Android 7.1 , it will automatically enable Do not disturb mode while you're in a call.
Note: You will still hear incoming call and text message notifications when you're in a call and your phone is in speakerphone mode or you're using the supplied earphones.
If you want to hear notifications for reminders, events, incoming calls, and text messages while in a call, you can adjust the Do not disturb settings.