e-commerce shopping cart ecommerce

"... customizable shopping cart program ... the webmaster's choice worldwide ... installs on virtually any *nix website ... "

Setting Up Shop Has Never Been Easier!


 
Navigation Menu

"We've been using SurfShop™ since March 2003 and we couldn't be happier with it. And now with SurfShopPRO™, it's even better! I've lost sleep over many business decisions over the years, but trusting my business to SurfShop™ was not one of them. How much is peace of mind worth? Everything!"
Nick

FAQ

Questions?
Contact Us

Back to Index of Scripts

AppleScript code for Ovolab Phlink

Answer the phone and block solicitors automatically

Ovolab's Phlink is a powerful phone answering system that can be extensively controlled via AppleScript.  Here are some scripts that show just how powerful your phone can become.

These scripts are offered 'as-is' and are unsupported.

Written and tested with Phlink 4.0.3 and Mac OS 10.5.8


-- This script processes calls from Area Codes placed in 'stopList' and specific blocked calls listed in the 'bannedList' so they can be handled appropriately by the greeting.scpt.

property myAreaCode : 212

on incoming_call given call:the_call, callerid:the_cid, ringcount:the_count
set my_call_again to false -- By default, tell Phlink not to call this script again on the next ring.
tell application "Ovolab Phlink"
tell the_call

-- Variables passed through a 'bag' need to be set within the tell block
set sendEmail to "Yes"
set possibleSpammer to ""

if the_cid is "" then
-- We haven't received the caller ID yet, tell Phlink to call this script again on the next ring.
set my_call_again to true
else
-- variable stopList contains Area Codes from the most persistent telemarketers
set stopList to {"800", "866", "877", "888"}

-- variable 'bannedList' contains complete numbers of parties you wish to block
set bannedList to {"1234567890", "2123369866", "5055551212", "2006335221"}

-- initialize variable areaCode, even if number is empty
if (the phone of the calling party is "") or (the phone of the calling party contains "unknown") then
set areaCode to (("XXX") as text) -- empty or <unknown> number
set callingNumber to ""
else
set callingNumber to ((the phone of the calling party) as text) -- complete number
if the length of callingNumber is 10 then
-- no leading 1 in callingNumber
set areaCode to ((characters 1 thru 3 of callingNumber) as text)
else if (the length of callingNumber is 11) and (the first character of callingNumber is "1") then
-- leading 1 in callingNumber
set areaCode to ((characters 2 thru 4 of callingNumber) as text)
set callingNumber to ((characters 2 thru 11 of callingNumber) as text) -- lose the "1" prefix
else
-- local call
set areaCode to myAreaCode
end if
end if

-- Area Code is in stopList, number is in bannedList, caller has blocked their #, etc.
if ¬
(areaCode is in stopList) or ¬
((areaCode as integer) ≤ 200) or ¬
(callingNumber is in bannedList) or ¬
(the phone of the calling party contains "withheld") or ¬
(the phone of the calling party contains "unavailable") ¬
then
-- turn off ringtones, call screening, talking Caller ID, and beep after greeting for this call
set ringtone activation to false
set call screening to false
set call announcement to false
set the beep after greeting to false

set possibleSpammer to "Yes"
set sendEmail to "No"
answer -- answer call immediately
end if

-- pass variables along in a 'bag' to the greeting and postprocess scripts so they only have to be set once
make new bag with properties {name:"callInfo", stopLst:stopList, banLst:bannedList, areaCd:areaCode, callNum:callingNumber, sendEm:sendEmail, possSpam:possibleSpammer}
end if
end tell
end tell
end incoming_call


-- This script hangs up on calls from Area Codes placed in stopList and specific blocked calls listed in the bannedList,
-- or will play the "disconnected" phone company recording to telemarketers <http://www.payphone-directory.org/sounds.html>,
-- and will greet other callers.

property disconnectRECORDING : "disconnected.wav"

on do_action given call:the_call, callerid:the_cid
tell application "Ovolab Phlink"
tell the_call

set sendEmail to sendEm of bag "callInfo"
set stopList to stopLst of bag "callInfo"
set bannedList to banLst of bag "callInfo"
set areaCode to areaCd of bag "callInfo"
set callingNumber to callNum of bag "callInfo"
set possibleSpammer to possSpam of bag "callInfo"

-- anonymous call - Caller ID is blocked, so bag was never created in ring.scpt
if (the_cid is "P") or (the phone of the calling party contains "withheld") then
speak "We're sorry, but we do not accept calls from blocked numbers. Please unblock your number and try your call again. Thank you." with waiting until completion
log ("Blocked phone number (" & the_cid & ")") as text
hang up
else if possibleSpammer is "Yes" then
delete every recording
delay 1
play disconnectRECORDING with waiting until completion
delay 0.5
play disconnectRECORDING with waiting until completion
log ("Caller is banned. Phone number is " & the phone of the calling party) as text
delay 1
hang up
else

-- This script tells Phlink to answer calls using a different greeting
-- depending on the time of the day.
--
-- Phlink will look for a greeting named "greeting_sunday.txt" on Sundays;
-- for a greeting named "greeting_day.txt" between 7:30 am and 9 pm;
-- for a greeting named "greeting_night.txt" at other times.

set my_items_folder to the items folder

-- Decide which greeting we should play. Create the text files listed in this section to say what you want.
tell application "Finder"
if (the weekday of the (current date) as string) is "Sunday" then
set my_greeting to "greeting_sunday.txt"
else
set the_time to the time of (current date)
if (the_time ≥ 7 * hours + 30 * minutes) and (the_time < 12 * hours) then
set my_greeting to "greeting_morning.txt"
else if (the_time ≥ 12 * hours) and (the_time < 17 * hours) then
set my_greeting to "greeting_afternoon.txt"
else if (the_time ≥ 17 * hours) and (the_time < 21 * hours + 30 * minutes) then
set my_greeting to "greeting_evening.txt"
else
set my_greeting to "greeting_night.txt"
end if
end if

-- Look for the greeting inside the top level of the Phlink Items folder.
try
set my_list to (name of (document files of my_items_folder whose name extension is not "scpt" and name contains my_greeting))

-- If we found multiple items, choose the first one.
tell application "Ovolab Phlink"
tell the_call to play (((my_items_folder as text) & item 1 of my_list) as alias)
end tell
on error

set my_err to false -- Do not call the Log Error Routine.

-- No such file was found, just try with "greeting.txt".
try
set my_list to (name of (document files of my_items_folder whose name extension is not "scpt" and name contains "greeting.txt"))

-- If we found multiple items, choose the first one.
tell application "Ovolab Phlink"
tell the_call to play (((my_items_folder as text) & item 1 of my_list) as alias)
end tell
on error
set my_err to true -- Call the Log Error Routine.
end try

-- Log Error Routine
if my_err is true then
-- No greetings were found.
tell application "Ovolab Phlink"
tell the_call to log ("Greeting script: items folder does not contain " & my_greeting & ".")
tell the_call to speak ("Hello. The items folder does not contain " & my_greeting & ".")
end tell
end if

end try
end tell


-- all other callers can leave a message

speak "Hello. I was unable to find a human to answer your call. I am sorry, but I am only a machine. Please leave a message at the tone and someone will listen to it later. Thank you." with waiting until completion

end if
end tell
end tell
end do_action


on postprocess given call:the_call, recording:the_recording, archivedfile:the_file
using terms from application "Ovolab Phlink"
tell the_call

if not (bag "callInfo" exists) then
-- The bag will not be created when Phlink records an outgoing call, so sendEmail needs a dummy value
set sendEmail to "x"
else
set sendEmail to sendEm of bag "callInfo" -- do not e-mail recordings from banned numbers

end if

if (snooped is false) and (incoming is true) and (sendEmail is "Yes") then
set the_message to "Voicemail from " & the name of the calling party & " (" & the phone of the calling party & ") - duration: " & (the duration of the_recording as integer) & " seconds"
set the_subject to "Voicemail from " & the name of the calling party
set the_recipient to the email recipient

-- Send recording with Apple's Mail.app
tell application "Mail"
set newMessage to make new outgoing message with properties ¬
{subject:the_subject, content:the_message}

tell newMessage
make new to recipient at beginning of to recipients with properties ¬
{address:"you@name.com"}

tell content
make new attachment with properties {file name:the_file} ¬
at after the last word of the last paragraph
end tell
end tell
send newMessage
end tell
end if
end tell
end using terms from
end postprocess

Sign up for PayPal and start accepting credit card payments instantly.

 

777