In order to discern the voice of God, we must cultivate an intimate relationship with God and we must be committed to obeying him. We must also test all prophecies, dreams, or visions with the truth of the Bible.
One principle that we could conclude from the dream examples mentioned in the Bible is that true dreams of God are always good for the dreamer or for other people. God breaks into a situation with prophetic means. God promised not to hold back what he was going to do. He would tell his servants. He also hates people who abuse his name. False prophets speak messages on his behalf even though they have not received any revelation from God. He severely rebuked this in the book of Jeremiah.
The first book of Corinthians chapter 14 verse 3: he who prophesies speaks to men for edification, exhortation and comfort. All dreams and visions must meet these criteria. Real revelations bring life, hope and love. It helps the dreamer with advice. This frees someone from bondage. It can be a turning point, the answer for a puzzled man.
The sages we often see in Christmas plays offering gold, frankincense, and myrrh to Jesus, had a dream that has benefited thousands and thousands of people . When they observed a star in the sky, they knew a great king had been born. They came to Jerusalem and saw Herod, the then king. Herod wanted to kill Jesus. After the wise men found the baby Jesus, the Lord asked them in a dream not to return to Herod. This historic dream of God is very beneficial, both for dreamers and for others.
The Lord often communicates with his prophets through dreams and visions. A famous example is the story of Daniel the Prophet. At that time, the Israelites were captured and live in Babylon. King Nebuchadnezzar rules them. One day he had a dream and disturbed him. He ordered his wizards and fortune tellers to give the interpretation without telling them the content of the dream. He didn't get a satisfactory response so he ordered everyone to kill him, including Daniel. The Lord then gave Daniel a night vision of the dream and the interpretation. The vision saved not only Daniel but the lives of many people as well. Most importantly, he was manifesting the glory and wisdom of the Lord!
As we see in the incidents above, dreams, visions, or other revelations from God are always good. The Lord makes everything work together for the good of the people who love him. Messages from him should be heartwarming, loving, bringing hope and righteousness, for these are the attributes of the highest God. The encounters that bring the opposite, as astonishing as they are, do not come from God but from enemies.