Jump to content

Call contact via iPhone (new Yosemite feature)


hedgeland

Recommended Posts

With the release of Yosemite yesterday, we can now call and receive calls via our iPhones (if on the same wifi network and logged into FaceTime on both the Mac and the iPhone).

 

It would be awesome to have that as an action when we type in a contact name and select a phone number! I would use that feature all day long!

 

Keep up the good work. Can't use a Mac without Alfred!

 

G

Edited by hedgeland
Link to comment
Share on other sites

You can do it yourself right now. Preferences -> Features -> Contacts -- click on Phone and pick 'Pass to URL Scheme'. In the URL field, enter 'tel://{query}'. Now when you press enter on a contact phone number it'll open the call dialog. You _do_ have to press the Call button to initiate the call though.

 

Great tip.

Note that the 

//

 part is optional, 

tel:{query} 

will do.

On a related note, 

facetime:{query}

 (audio+video) and

facetime-audio:{query}

(audio only) work as well.

A caveat, though it may unique to my setup: among my contacts I found phone numbers with no-break spaces (Unicode 0xa0; UTF-8: 0xc2 0xa0) instead of regular spaces - these won't work.

Edited by mklement0
Link to comment
Share on other sites

Then a couple of days later it stopped working.

 

Any ideas?

 

- It stopped working with the very same contacts that it used to work with? If they're different ones, there may be a problem with their formatting: try retyping the number from scratch in the contact-card field.

- On your iPhone, is Settings > FaceTime > iPhone Cellular Calls still turned on? Can you still *accept* calls on your Mac?

Link to comment
Share on other sites

It doesnt work with any contacts anymore. Apart from that everything works fine.. I can call and recieve calls. it works as its supposed to from both safari or from Contacts and so on.

 

I´ve tried to re-enter: 

 

Preferences -> Features -> Contacts -- click on Phone and pick 'Pass to URL Scheme'. In the URL field, enter 'tel://{query}'

 

Still not working.. 

 

Strange...

Edited by anderslorentsen
Link to comment
Share on other sites

  • 1 month later...

Below is a fairly robust AppleScript that uses tel:// to prepare a call and then presses the Call button using GUI scripting (Alfred needs to be authorized once via System Preferences > Security & Privacy > Accessibility).

It's trivial to adapt it to using facetime:// or facetime-audio:// instead.

 

In my case I've assigned it to an /usr/bin/osascript Run Script action attached to a Contact Action trigger named 'Instantly call with iPhone' in a custom workflow,

and I've associated that contact action with the Phone field in Alfred Preferences > Features > Contacts > Custom Actions.

(I've also created a variant for FaceTime Audio calls and assigned it to the Email field.)

 

Thus, when I press ↩ on a contact's phone number in Alfred, an iPhone call is instantly started.

(And when I press ↩ on a contact's email address, a FaceTime Audio call is instantly started.)

# Open the URL, which will present the click-to-call window. 
# Note: Replace 'tel:' with 'facetime:' or 'facetime-audio:' for FaceTime Video / Audio
do shell script "open tel:" & quoted form of "{query}"

# Wait until the click-to-call window appears.
# Note:
#			If FaceTime wasn't running, that window will be the first and only one to appear.
# 			Otherwise, that window is presented quickly enough to be the front (and only) 
#			window by the time we try to click the button below.
my syncActivateWithWindow("FaceTime")

# Click the 'Call' button to start the call.
tell application "System Events" to click button "Call" of front window of application process "FaceTime"

# ---

# *Synchronously activates* the specified application *and waits for at least one window to open*. 
# I.e., when this subroutine returns, the specified app is frontmost with a window open.
# Required, because on 10.10+ the activate command is *asynchronous*.
# Set TMOUT to adjust the timeout after which an error is raised.
# CAVEAT: Works with non-AppleScriptable apps, but assumes that the application *process* name is the same as the application name.
on syncActivateWithWindow(appName)
	local TMOUT, elapsedSoFar
	set TMOUT to 5 # secs.
	set elapsedSoFar to 0
	tell application appName
		activate
		repeat while not frontmost
			if elapsedSoFar > TMOUT then appName & " failed to activate within " & TMOUT & " seconds."
			delay 0.1
			set elapsedSoFar to elapsedSoFar + 0.1
		end repeat
		tell application "System Events" # Note: We check for windows in the "System Events" context so as to also work with non-AppleScriptable apps.
			tell application process appName
				repeat while true
					if elapsedSoFar > TMOUT then error "No " & appName & " window appeared within " & TMOUT & " seconds."
					try
						front window of it
						exit repeat
					end try
					delay 0.1
					set elapsedSoFar to elapsedSoFar + 0.1
				end repeat
			end tell
		end tell
	end tell
end syncActivateWithWindow

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...