In the ideal setup, phones should run on their own vlan so that priority can be establihed. With that said, certain ports for devices must be setup correct, i.e. the data dchp server is only on the data vlan, depending upon model of controller it may need to be only on the voice vlan.
There are several methods to get phones to reside on the desired vlan, i.e. cdp, lldp, dhcp. Not all Mitel phone will support these methods, but most will.
Upon boot the newer phones will seek info from cdp, lldp and then dhcp. Within dhcp, there are several ways to provide phones the needed info. options 43 and 125 versus the older 128,129 etc.
This is in the tech handbook. may not be explained well though.