Skip to content

Instantly share code, notes, and snippets.

@benlangfeld
Last active January 3, 2016 03:29
Show Gist options
  • Save benlangfeld/8402112 to your computer and use it in GitHub Desktop.
Save benlangfeld/8402112 to your computer and use it in GitHub Desktop.
def music_on_hold
output = play! "/path/to/music.wav", :repeat_times => 0
hid = call.on_joined do
output.stop! if output.executing?
end
begin
yield.tap do
output.stop! if output.executing?
end
ensure
call.unregister_handler :event, hid
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment