While the Messenger of Allah ﷺ was on one of his journeys, he heard a caller saying, "Allah is the greatest, Allah is the greatest."The Messenger of Allah ﷺ said, "He is upon the natural disposition."Then the caller said, "I bear witness that there is no god but Allah."The Messenger of Allah ﷺ said, "He has testified to the truth."Then the caller said, "I bear witness that Muhammad is the Messenger of Allah."The Messenger of Allah ﷺ said, "He has been freed from the Fire. Look for him, you will find him either a shepherd tending goats far from his people or a man training hunting dogs."So they searched for him and found him to be a shepherd. The time of prayer had come, so he made the call to it.
حدثنا عبد الله حدثني أبي حدثنا سريج حدثنا الحكم بن عبد الملك عن عمار بن محمد العبسي عن عبد الرحمن بن أبي ليلى
بينما رسول الله ﷺ في بعض أسفاره إذ سمع مناديا يقول الله أكبر الله أكبر فقال على الفطرة فقال أشهد أن لا إله إلا الله فقال شهد بشهادة الحق قال أشهد أن محمدا رسول الله قال خرج من النار انظروا فستجدونه إما راعيا معزبا وإما مكلبا فنظروه فوجدوه راعيا حضرته الصلاة فنادى بها
Its chain is daif due to Hakam bin Abdul-Malik Qurashi, whom the majority declared daif. Haythami said the same, 1/334. The hadith was narrated with similar wording by Muslim, 1/288, no. 382, Tirmidhi, 4/163, no. 1618, Tabarani in al-Kabir, 10/115, no. 10063, and Abdul-Razzaq, 1/485. It was also narrated by Bayhaqi, 1/405, and Khatib in Tarikh Baghdad, 8/220.