Set DirectMedia in dialplan?


Is there any way to set DirectMedia in dialplan before dialing?
We dial 2 contacts (one is a softphone and the other is a physical phone).
It’s the same endpoint in our database, but I would like the softphone to not allow direct_media.
Can I just set direct_media to no in the DB before dialing or direct_media will be set once the softphone register?