The first issue you have is that the includes are only used when there is no match in the current context. Secondly, macro-dialout-one-predial-hook is called before the devices are dialed so you don’t actually need to add an include = statement anywhere. It’s being called already.
Finally, Playback() requires a file name or a list of filenames, Playback(file1&file2), what you have will not work as it will be (assuming D_OPTIONS is empty) Playback(D_OPTIONS=m(moh1)) which will fail.
Also doing what you’re doing might result in the destination being dialed twice as once the macro is done executing as it is now…it will return back to the dialplan it jumped from and continue processing which could include dialing the extension all over again.
That’s how it works, but you still have to wait a long time and listen to a music class.
[from-internal-custom]
;----- Playback Wait for answer in INUSE line -----
[macro-dialout-one-predial-hook]
exten => s,1,Noop(DEVICE STATE - ${DEVICE_STATE(${DSTRING})})
exten => s,n,ExecIf($["${DEVICE_STATE(${DSTRING})}" = "INUSE"]?Playback(moh1))
exten => s,n,ExecIf($["${DEVICE_STATE(${DSTRING})}" = "INUSE"]?Set(D_OPTIONS=${D_OPTIONS}m(moh1)))
Is it possible to play not music but a greeting in such a scheme? That is, if the subscriber is busy, the greeting is played, and in the greeting you can set up the handset? Has no one implemented such a scheme?