Jump to content
hedgeland

Call contact via iPhone (new Yosemite feature)

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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hmm.. I did this and it worked fine..

 

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

 

Then a couple of days later it stopped working.

 

Any ideas?

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

For the truly lazy (and I don't mean it in a bad way because I may set this up haha) you could just use AppleScript to open the tel:// url and then wait.. half a second or 1 second then simulate pressing enter.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...