In the case of a Cisco IP phone with a Cisco switch, when you configure the command
switchport voice vlan 10 for example, the switch and the phone will use CDP to communicate to obtain the information they need to function. Under such circumstances, a phone will send it’s voice frames with a VLAN tag of 10 (info that has been received using CDP), and any frames received from a connected PC would be sent without a tag, and the switch would interpret them as frames on the access VLAN configured on the switchport.
In the event that you use the
switchport voice vlan dot1p command, the switch will tell the phone using CDP of this configuration. The phone will then send all voice frames tagged but with a VLAN of 0, and send all data traffic from any connected PC without a tag. The result is that the switch will place both voice and data frames on the access VLAN configured on the port, but will retain the QoS info in the tag for the voice frame, and use it accordingly.
Now if you’re not using a Cisco phone, then you don’t have the benefit of CDP, so you will then have to manually configure the phone to use the appropriate VLAN tag for voice, for both of the above scenarios.
I hope this has been helpful!