Dec 20, 2013
I'm trying to figure out a way to use tasker turn the sound on for people in my contacts and silence it for everyone else. Any way to do this in tasker?
Hello, chiphaven, thanks for joining Android Forums! :)

It's quite possible to do what you're asking... below explains how to set it up for sleep mode, but you could quite easily modify it if you wanted.

First, you need to create a profile called "Sleep Mode":

Add Context Power
Source: AC //You can also set this to all when you
//charge your phone using USB.

Add Context Time
From: 22:00
To: 07:00
Repeat: Off

Add Start Task
1. Silent Mode
Mode: On
2. Variable Set
To: 1

Add Exit Task
1. Silent Mode
Mode: Off
2. Variable Clear

Next, you would need to create profile "Sleep Mode Emergency Calls":

Add Event Phone Ringing
Caller Number: Add all the numbers you want to get through.

Add Start Task
1. If
%SLEEPMODE = 1 // Make sure you use the Maths: Equals (=),
// and not the Matches (~) to compare. We are
// dealing with numbers here :p.
2. Silent Mode
Mode: Off
3. Wait
Minutes: 5
4. Silent Mode
Mode: On
If: %SLEEPMODE = 1// Here, we check if SLEEPMODE = 1 again, since
// we do not want to set Silent Mode to on again
// if you took the call.
5. End If

This was all taken from the Tasker Wikidot page - if you'd rather download and import the task, you can head there :)