on incoming_call given call:the_call, callerid:the_cid -- By default, tell Phlink not to call this script again on the next ring. set my_call_again to false tell application "Ovolab Phlink" tell the_call -- Setup the notification title set the_title to "Incoming call" if the_cid is "" then -- We haven't received the caller ID yet, tell Phlink to call us back on the next ring. set my_call_again to true -- We still want to pause the video on mini2 do shell script "/users/gb/bin/automate_notification.php '" & the_title & "' 'CallerID not yet available' 'CallerID not yet available' 'mini2+pause' '' ''" else -- Check if we know the name of the calling party if the name of the calling party is "" then set the_caller to the (formatted phone) of the calling party set the_caller_for_xbmc to the (formatted phone) of the calling party else set the_caller to the name of the calling party & " " & the (formatted phone) of the calling party set the_caller_for_xbmc to the name of the calling party & " @ " & the (formatted phone) of the calling party end if set the_photo to the image of the calling party set image_parameter to "'iconpath' '/Applications/Telephone.app'" if the_photo is not equal to missing value then set the_file to "LeopardHD:Users:gb:Documents:Phlink Items:caller.tif" as file specification try open for access the_file with write permission set eof of the_file to 0 write (the_photo) to the_file starting at eof close access the_file set image_parameter to "'image' '/Volumes/Phlink Items/caller.tif'" on error try close access the_file end try end try end if -- Send the notification -- Don't pause mini2, because it's already paused, and that would restart the video! do shell script "/users/gb/bin/automate_notification.php '" & the_title & "' '" & the_caller & "' '" & the_caller_for_xbmc & "' 'macbook,imac,mini2,appletv' " & image_parameter end if end tell end tell return my_call_again end incoming_call