Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reject Call and Hang Up based on Caller ID
Goto page 1, 2  Next
 
Post new topic   Reply to topic     Forum Index -> Phlink scripters
View previous topic :: View next topic  
Author Message
jerrykrinock



Joined: 24 Jun 2004
Posts: 9

PostPosted: Sat Oct 02, 2004 11:32 am    Post subject: Reject Call and Hang Up based on Caller ID Reply with quote

We are called every day by some telephone solicitor. They give their called ID. They never say anything, even when we answer. "Phlink to the Rescue!!", I told my wife.

I inserted the following at the appropriate place in ring.scpt:

if the_cid is "4082048799" then
say "Junk telephone call detected"
end if

and it works. From reading the archives I get the impression that there is a command to tell Phlink to "hang up", but I cannot find it in any of the sample scripts or the dictionary. It seems that if I put that command in the above "if" clause, I could be a hero and maybe my wife would begin to appreciate Phlink? What is the command that I am looking for?

Jerry
Back to top
View user's profile Send private message
AJZ



Joined: 12 Sep 2004
Posts: 21

PostPosted: Sat Oct 02, 2004 11:42 am    Post subject: Reply with quote

This should work:
Code:

on incoming_call given call:the_call, ringcount:the_count
   tell application "Ovolab Phlink"
      if the_cid is "4082048799" then
         stop recording the_call
         hang up the_call
      end if
   end tell
end incoming_call

NOTE: This is a complete ring script. If you already have a ring script, you do not need the first or last line, and only need to place this in between these lines, that should already be in your script.
Back to top
View user's profile Send private message
jerrykrinock



Joined: 24 Jun 2004
Posts: 9

PostPosted: Sat Oct 02, 2004 7:05 pm    Post subject: Got it working! Reply with quote

THANKS AJ! That hung up Phlink, but our phone kept ringing, so I added some lines to make it go off-hook for 2 seconds, then on hook. It seems to work now:

on incoming_call given call:the_call, ringcount:the_count
   tell application "Ovolab Phlink"
      if the_cid is "4082048799" then
say "Junk telephone call detected. Answering."
answer the_call
stop recording the_call
do shell script "sleep 2"
say "hanging up"
hang up the_call
      end if
   end tell
end incoming_call
Back to top
View user's profile Send private message
Alberto
Site Admin


Joined: 06 Feb 2004
Posts: 1412
Location: Torino, Italy

PostPosted: Sun Oct 03, 2004 7:52 am    Post subject: Re: Got it working! Reply with quote

jerrykrinock wrote:
do shell script "sleep 2"


Or just:

delay 2

will do (it's the AppleScript equivalent to /bin/sleep). If you happen to get a brief recording of such calls (I mean, those two seconds of silence), you may want to change your script to:

Code:
on incoming_call given call:the_call, callerid:the_cid
   tell application "Ovolab Phlink"
      tell the_call
         if the_cid is "4082048799" then
            say "Junk telephone call detected. Answering."
            answer
            delete every recording
            delay 2
            say "hanging up"
            hang up
         end if
      end tell
   end tell
end incoming_call
Back to top
View user's profile Send private message
Motorcycle Michael



Joined: 05 Aug 2004
Posts: 37
Location: Northern California

PostPosted: Mon Oct 04, 2004 4:02 pm    Post subject: Reply with quote

Here's my contribution to the cause (still a work in progress). It consists of a very short <ring.scpt>, followed by a <greeting.scpt> to weed-out telemarketers by area code (including spoofed CIDs containing all zeros). After these two scripts execute, an <enter.aif> recording plays to surviving callers.

The only remaining problem (that I know of) is this: "Hang up" commands in the <greeting.scpt> do not seem to terminate the call and/or stop playback of the following <enter.aif> recording.
<ring.scpt>:
Code:
on incoming_call given call:the_call, callerid:the_cid
   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
         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
         end if
      end tell
   end tell
   return my_call_again
end incoming_call

<greeting.scpt>:
Code:
-- This script hangs up on out-of-area calls with no number and calls from area codes placed in stopList.

on do_action given call:the_call, callerid:the_cid
   tell application "Ovolab Phlink"
      tell the_call
         -- variable stopList contains area codes from the most persistent telemarketers
         set stopList to {"000", "503", "707", "800", "816", "866", "888", "951"}
         -- 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 string) -- empty or <unknown> number
         else
            set areaCode to ((the phone of the calling party) as string) -- complete number
            set areaCode to ((characters 1 thru 3 of areaCode) as string) -- lose all except area code
         end if
         -- Out of Area (= O) with no number (= empty or <unknown>), hang up
         if (the name of the calling party is "O") and areaCode is "XXX" then
            answer
            delete every recording
            delay 2
            play "MaBellDC.aif"
            my waitUntilDonePlaying
            log ("No CID Termination " & the phone of the calling party) as text -- just in case
            delay 1
            hang up
         else
            -- Area Code is in stopList, hang up
            if areaCode is in stopList then
               answer
               delete every recording
               delay 2
               play "MaBellDC.aif"
               my waitUntilDonePlaying
               log ("Area Code Termination " & the phone of the calling party) as text
               delay 1
               hang up
            else
               -- Out of Area with a number, speak number
               if (the name of the calling party is "O") and (the phone of the calling party is not "") then
                  say "Out of Area."
                  set my_caller to my getSpokenNumber(the_cid)
                  log ("Unidentified Caller " & the phone of the calling party) as text
                  say (my_caller as text)
               else
                  -- Private with a number, speak number
                  if (the name of the calling party is "P") and (the phone of the calling party is not "") then
                     say "Private."
                     set my_caller to my getSpokenNumber(the_cid)
                     log ("Private Caller " & the phone of the calling party) as text
                     say (my_caller as text)
                  else
                     -- Say the name of the caller.
                     set my_caller to the name of the calling party
                     say (my_caller as text)
                  end if
               end if
            end if
         end if
      end tell
   end tell
end do_action

on waitUntilDonePlaying(the_call)
   using terms from application "Ovolab Phlink"
      tell the_call
         delay 1
         repeat until the playback status is stopped
            delay 1
         end repeat
      end tell
   end using terms from
end waitUntilDonePlaying

-- This function turns a string which contains a phone number into a speakable string by adding spaces between digits.
on getSpokenNumber(the_number)
   set out_string to ""
   repeat with i from 1 to the length of the_number
      set out_string to (out_string & " " & character i of the_number)
   end repeat
   return out_string
end getSpokenNumber

(The <MaBellDC.aif> sound is the phone company's three-tone disconnected number signal. Unknown as yet if this is getting thru to caller, or if it will drop me from autodialer lists.)

How can I stop processing at each "hang up" command and return Phlink to standby? Any suggestions would be appreciated... thanks!
Back to top
View user's profile Send private message Visit poster's website
CultureOfOne



Joined: 05 Mar 2007
Posts: 23

PostPosted: Mon Jul 23, 2007 3:20 pm    Post subject: Reply with quote

This code came in really handy. Motorcycle Michael was definitely on the right track with this script, but I'd like to suggest a handful of modifications.

Because sometimes a call comes in without an area code, sometimes with, and sometimes with a leading 1, establishing the area code needs to be more specific. In the original code, the following routine occurs:

Code:
         -- 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 string) -- empty or <unknown> number
         else
            set areaCode to ((the phone of the calling party) as string) -- complete number
            set areaCode to ((characters 1 thru 3 of areaCode) as string) -- lose all except area code
         end if


I replaced it with the following:

Code:

         -- 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 string) -- empty or <unknown> number
            set callingNumber to ""
         else
            set callingNumber to ((the phone of the calling party) as string) -- 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 string) -- lose all except area code
            else
               if the length of callingNumber is 11 then
                  -- leading 1 in callingNumber
                  set areaCode to ((characters 2 thru 4 of callingNumber) as string) -- lose all except area code
               else
                  set areaCode to "506" -- my local area code; could be coded as a property instead
               end if
            end if
         end if


This code not only compensates for the length of the number, or lack of area code, but by trapping the complete number as a separate variable, one can weed out specific numbers in the routines that follow as well.

There is another problem with the greeting.scpt file in Motorcycle Michael's post: one cannot answer calls in a greeting script (as they have already been answered by then). Calls can only be answered in the ring.scpt. Unfortunately, if you attempt to process the calls at this stage, it won't prevent the greeting from being run as well (even after the hangup), so it is necessary to split the functionality between two scripts.

Here are the complete scripts I created:

ring.scpt:
Code:
-- This script hangs up on out-of-area calls with no number and calls from area codes placed in stopList.

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
         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
         else
            -- variable stopList contains area codes from the most persistent telemarketers
            set stopList to {"000", "800", "866", "888"}
            -- variable blockedList contains complete pnone numbers you wish to block
            set blockedList to {}
            -- 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 string) -- empty or <unknown> number
               set callingNumber to ""
            else
               set callingNumber to ((the phone of the calling party) as string) -- 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 string) -- lose all except area code
               else
                  if the length of callingNumber is 11 then
                     -- leading 1 in callingNumber
                     set areaCode to ((characters 2 thru 4 of callingNumber) as string) -- lose all except area code
                  else
                     set areaCode to "506"
                  end if
               end if
            end if
            -- Out of Area (= O) with no number (= empty or <unknown>), hang up
            (* if (the name of the calling party is "O") and areaCode is "XXX" then
            answer
            delete every recording
            delay 2
            play "MaBellDC.wav"
            my waitUntilDonePlaying
            log ("No CID Termination " & the phone of the calling party) as text -- just in case
            delay 1
            hang up
         else  *)
            -- Area Code is in stopList, hang up
            if areaCode is in stopList or callingNumber is in blockedList then
               answer
            end if
            
            -- pass info along to greeting script
            make new bag with properties {name:"callInfo", stopLst:stopList, blockLst:blockedList, areaCd:areaCode, callNum:callingNumber}
         end if
      end tell
   end tell
end incoming_call

on waitUntilDonePlaying(the_call)
   using terms from application "Ovolab Phlink"
      tell the_call
         delay 1
         repeat until the playback status is stopped
            delay 1
         end repeat
      end tell
   end using terms from
end waitUntilDonePlaying

-- This function turns a string which contains a phone number into a speakable string by adding spaces between digits.
on getSpokenNumber(the_number)
   set out_string to ""
   repeat with i from 1 to the length of the_number
      set out_string to (out_string & " " & character i of the_number)
   end repeat
   return out_string
end getSpokenNumber


greeting.scpt:
Code:
-- This script hangs up on out-of-area calls with no number and calls from area codes placed in stopList.

on do_action given call:the_call, callerid:the_cid
   tell application "Ovolab Phlink"
      tell the_call
         if the_cid is "" then
            -- anonymous call
            -- caller id is blocked, so bag was never created in ring.scpt
            play "greetings.mp3"
            my waitUntilDonePlaying
         else
            -- variable stopList contains area codes from the most persistent telemarketers
            set stopList to stopLst of bag "callInfo"
            set blockedList to blockLst of bag "callInfo"
            set areaCode to areaCd of bag "callInfo"
            set callingNumber to callNum of bag "callInfo"
            -- log "areaCode: " & areaCode & " callingNumber: " & callingNumber
            --log "blockedList: " & blockedList
            -- Out of Area (= O) with no number (= empty or <unknown>), hang up
            (* if (the name of the calling party is "O") and areaCode is "XXX" then
            answer
            delete every recording
            delay 2
            play "MaBellDC.wav"
            my waitUntilDonePlaying
            log ("No CID Termination " & the phone of the calling party) as text -- just in case
            delay 1
            hang up
         else *)
            -- Area Code is in stopList, hang up
            if areaCode is in stopList then
               delete every recording
               delay 1
               play "MaBellDC.wav"
               my waitUntilDonePlaying(the_call)
               log ("Area Code Termination " & the phone of the calling party) as text
               delay 7
               hang up
            else
               if callingNumber is in blockedList then
                  delete every recording
                  delay 1
                  play "MaBellDC.wav"
                  my waitUntilDonePlaying(the_call)
                  log ("Blocked Caller: " & the phone of the calling party) as text
                  delay 1
                  hang up
               else
                  -- Out of Area with a number, speak number
                  if (the name of the calling party is "O") and (the phone of the calling party is not "") then
                     --say "Out of Area."
                     set my_caller to my getSpokenNumber(the_cid)
                     log ("Unidentified Caller " & the phone of the calling party) as text
                     --say (my_caller as text)
                  else
                     -- Private with a number, speak number
                     if (the name of the calling party is "P") and (the phone of the calling party is not "") then
                        --say "Private."
                        set my_caller to my getSpokenNumber(the_cid)
                        log ("Private Caller " & the phone of the calling party) as text
                        --say (my_caller as text)
                     else
                        -- Say the name of the caller.
                        set my_caller to the name of the calling party
                        --say (my_caller as text)
                     end if
                  end if
                  
                  play "greetings.mp3"
                  my waitUntilDonePlaying
               end if
            end if
         end if
      end tell
   end tell
end do_action

on waitUntilDonePlaying(the_call)
   using terms from application "Ovolab Phlink"
      tell the_call
         delay 1
         repeat until the playback status is stopped
            delay 1
         end repeat
      end tell
   end using terms from
end waitUntilDonePlaying

-- This function turns a string which contains a phone number into a speakable string by adding spaces between digits.
on getSpokenNumber(the_number)
   set out_string to ""
   repeat with i from 1 to the length of the_number
      set out_string to (out_string & " " & character i of the_number)
   end repeat
   return out_string
end getSpokenNumber


I commented out a few lines for my own uses (in fact I've commented out the "Out Of Area" stuff, as I didn't need it in my code - be sure to add in the end if lines if you reactivate these bits), but you get the basic idea. I have streamline this code to create a bag to reuse the variables (stopList, blockedList, areaCode, callingNumber) rather than redefining and recalculating them in two places. In order to use this code yourself, you should only have to modify three things: update the list of area codes to block, update the list of specific numbers to block, and change the local area code. Perhaps this will come in useful to anybody else who wants to try this level of call filtering.

Greg Marks
CultureOfOne
Back to top
View user's profile Send private message Visit poster's website
CultureOfOne



Joined: 05 Mar 2007
Posts: 23

PostPosted: Tue Jul 24, 2007 7:37 am    Post subject: Reply with quote

It occurred to me I should provide the "trimmed" versions of my scripts as well. These take out all of the unnecessary/commented out commands etc. leaving only what I use.

ring.scpt:
Code:
-- This script answers calls from area codes placed in stopList and specific blocked calls listed in the blockedList so they can be processed by the greeting.scpt.

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
         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 {"000", "800", "866", "888"}
            
            -- variable blockedList contains complete numbers of parties you wish to block
            set blockedList to {}
            
            -- 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 string) -- empty or <unknown> number
               set callingNumber to ""
            else
               set callingNumber to ((the phone of the calling party) as string) -- 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 string) -- lose all except area code
               else
                  if the length of callingNumber is 11 then
                     -- leading 1 in callingNumber
                     set areaCode to ((characters 2 thru 4 of callingNumber) as string) -- lose all except area code
                  else
                     -- local call
                     set areaCode to "506"
                  end if
               end if
            end if
            
            -- Area Code is in stopList, or number is blockedList: answer now
            if areaCode is in stopList or callingNumber is in blockedList then
               answer
            end if
            
            -- pass info along to greeting script so variables only have to be set once
            make new bag with properties {name:"callInfo", stopLst:stopList, blockLst:blockedList, areaCd:areaCode, callNum:callingNumber}
         end if
      end tell
   end tell
end incoming_call

on waitUntilDonePlaying(the_call)
   using terms from application "Ovolab Phlink"
      tell the_call
         delay 1
         repeat until the playback status is stopped
            delay 1
         end repeat
      end tell
   end using terms from
end waitUntilDonePlaying


greeting.scpt:
Code:
-- This script hangs up on calls from area codes placed in stopList and specific blocked calls listed in the blockedList.

on do_action given call:the_call, callerid:the_cid
   tell application "Ovolab Phlink"
      tell the_call
         if the_cid is "" then
            -- anonymous call
            -- caller id is blocked, so bag was never created in ring.scpt
            play "greetings.mp3"
            my waitUntilDonePlaying
         else
            -- variable stopList contains area codes from the most persistent telemarketers
            set stopList to stopLst of bag "callInfo"
            set blockedList to blockLst of bag "callInfo"
            set areaCode to areaCd of bag "callInfo"
            set callingNumber to callNum of bag "callInfo"
            
            -- Area Code is in stopList, hang up
            if areaCode is in stopList then
               delete every recording
               delay 1
               play "MaBellDC.wav"
               my waitUntilDonePlaying(the_call)
               log ("Area Code Termination " & the phone of the calling party) as text
               delay 7
               hang up
            else
               if callingNumber is in blockedList then
                  delete every recording
                  delay 1
                  play "MaBellDC.wav"
                  my waitUntilDonePlaying(the_call)
                  log ("Blocked Caller: " & the phone of the calling party) as text
                  delay 1
                  hang up
               else
                  -- Out of Area with a number, log number
                  if (the name of the calling party is "O") and (the phone of the calling party is not "") then
                     log ("Unidentified Caller " & the phone of the calling party) as text
                  else
                     -- Private with a number, log number
                     if (the name of the calling party is "P") and (the phone of the calling party is not "") then
                        log ("Private Caller " & the phone of the calling party) as text
                     end if
                  end if
                  
                  -- allow normal access to voicemail, etc.
                  play "greetings.mp3"
                  my waitUntilDonePlaying
               end if
            end if
         end if
      end tell
   end tell
end do_action

on waitUntilDonePlaying(the_call)
   using terms from application "Ovolab Phlink"
      tell the_call
         delay 1
         repeat until the playback status is stopped
            delay 1
         end repeat
      end tell
   end using terms from
end waitUntilDonePlaying


Certainly, there is still room for improvement in these scripts, but they seem to do the trick. I see in another thread (http://www.ovolab.com/phlink/forum/viewtopic.php?t=2000&highlight=area+code) that Rycardo provides a script for blocking based on any length segment of a number. It might be interesting to fuse the two solutions together, but for now I'll stick with what I have.

I should also mention that like Motorcycle Michael, when I reject a caller I play a sound file of a typical "Ma Bell" response that I felt best suited my needs: http://www.payphone-directory.org/sounds/wav/bell/using.wav. More such responses are available in the Phone Recording Archive at http://www.payphone-directory.org/sounds.html.

Enjoy,

Greg Marks
CultureOfOne
Back to top
View user's profile Send private message Visit poster's website
rycardo



Joined: 19 Jul 2004
Posts: 552
Location: East Coast

PostPosted: Wed Jul 25, 2007 2:33 pm    Post subject: Reply with quote

Hey All,

There is a website called WhoCalled.us that helps determine if the person calling you is a known telephone marketer. It is based on user reporting and feedback. I believe it's only for use in the states, maybe there is a similar site for other countries.

To use the scripting interface to the site, you need to register an account (which only requires an email address, user name, and password). Then you query their website with the caller id you are interested in. It will return a score for that telephone number. The score is equal to the number of times that number has been reported.

BTW, I have also scripted the reporting of numbers to whocalled.us, if you are interested in this please let me know.

If you want to use this:
1. Register on WhoCalled.us
2. Copy the first block of the below code to Script Editor
3. Fill in your User Name and Password where indicated
4. Save the script to your Phlink Items folder as WhoCalled.scpt
5. Merge the second block of the below code with your ring.scpt, the WhoCalled portion is indicated. Be sure to either keep or add code for handling the calls with a score over 0. Whether that is to hang up on the caller, or to play a 'put me on your do not call list' greeting.

Hope this helps,

Rycardo

First Block Of Code - WhoCalled.scpt
Quote:
------------------------
-- WhoCalled.scpt --
------------------------
(*
     WhoCalled Script
     by Rycardo at the Ovolab Forums
     25 July, 2007
     
     To Use this script: Save this in your Phlink Items folder,
     and include the WhoCalledScore code in your ring.scpt
*)

-- To use whocalled.us, you need to register a user name and password.
-- Store that information here:
property my_name : "YOUR_WHOCALLED_USER_NAME_HERE"
property my_pass : "YOUR_WHOCALLED_PASSWORD_HERE"

-- To Test This Script:
-- Remove the -- from the next line, and run the script
--display dialog (my WhoCalledScore("8006790336"))

on WhoCalledScore(the_num)
     tell application "System Events"
          set my_shell to "curl -d action=getScore -d name=" & my_name & " -d pass=" & my_pass & " -d phoneNumber=" & the_num & " whocalled.us/do?"
          
          set the_result to do shell script my_shell
          set start_at to ((the offset of "success=" in the_result) + Cool
          set is_success to (text start_at thru start_at of the_result) as string
          if is_success is equal to "1" then
               set start_at to ((the offset of "score=" in the_result) + 5)
               set the_score to (text start_at thru (length of the_result) of the_result) as string
               if the_score is equal to "=" then
                    set the_score to 0
               else
                    set the_score to (text (start_at + 1) thru -1 of the_result) as number
               end if
          else
               --There was an error, return -99
               set the_score to -99
          end if
     end tell
     return the_score
end WhoCalledScore



Second Block Of Code - merge with your ring.scpt
Quote:
------------------------
-- WhoCalled.scpt --
------------------------
(*
     ring.scpt code to be used with the WhoCalled Script
     by Rycardo at the Ovolab Forums
     25 July, 2007
     
     To Use this script, add the WhoCalled portion to your ring.scpt, and include the
     WhoCalled.scpt in your Phlink Items folder
*)

on incoming_call given call:the_call, callername:the_name, callerid:the_cid, ringcount:the_ring
     tell application "Ovolab Phlink"
          set phlink_items to (get items folder) as string
          tell the_call
               if (the caller id of the calling party) is "" then
                    --Caller ID has NOT been sent, run script on next ring
                    return true
               else
                    (*
                    Begin of WhoCalled portion of ring script
                    *)
                    --Find out if caller is in the addressbook
                    set adbook_person to the id of the calling party
                    if adbook_person is equal to "" then
                         --Not in Address Book, Check WhoCalled Score
                         set who_called to load script (phlink_items & "WhoCalled.scpt") as alias
                         tell who_called to set the_score to WhoCalledScore(the_cid)
                         log "WhoCalled score->" & the_score
                    else
                         set the_score to 0
                    end if
                    if the_score > 0 then
                         -- Add your Answer+Hang Up -or- Answer+Play 'Do Not Call List' Message Here --
                    end if
                    (*
                    End of WhoCalled portion of ring scipt
                    *)
                    --Caller ID HAS been sent, do not run script on next ring
                    return false
               end if
          end tell
     end tell
end incoming_call



NB: In case you are wondering why I have the WhoCalled code in it's own file, I have other code in my version of the file, and I use it from a couple other scripts.



-------------------------
[Both Blocks Of Code were automatically tagged for color coded syntax by Convert Script to Markup Code]
Back to top
View user's profile Send private message
Motorcycle Michael



Joined: 05 Aug 2004
Posts: 37
Location: Northern California

PostPosted: Sat Sep 01, 2007 10:07 am    Post subject: Reply with quote

Wow, major improvements! Thanks Greg (CultureOfOne), you've definitely dialed-in the AreaCode ops. Scripting to <whoCalled.us> is a nice touch, too, Rycardo. You guys are awesome!

Meanwhile, I've been dealing with spoofed calls, too.
Code:
   -- Spoofed area code and phone number, typically all zeros or nines
         if (areaCode is "000") or (areaCode is "999") then
            say "Zero spoof"
            answer
            delete every recording
            delay 1 -- must be here for next 'stop playback' command
            stop playback
            --   play "MaBellDC.aif" -- 3-tone disconnected number sound
            --   my waitUntilDonePlaying(the_call)
            --   set the pause recording during playback to true
            --   speak "Go spoof yourself."
            delay 0.5
            hang up
            say "Terminated." -- ? disable to silence
            log ("Zero Spoof Termination " & the phone of the calling party) as text -- just in case
         else

The lines that are commented-out proved so entertaining to whoever my spoof caller was that they called back 42 times over two days, including 26 calls in the space of 30 minutes. So, I commented-out everything but the hangup and log entry.

Most calls were all zeros; some were 000-000-0300. A couple were "Out of Area" with no number (guessing it was same caller by call timing). By the way, in this age of Homeland Security, tracing such calls is impossible (according to ATT). Big help there.

So here's a question: To my knowledge, there are no valid area codes between 000 and 200 inclusive. How can I turn the AreaCode string into a math function that would tag area codes less-than or equal to 200?

Thanks, guys!
Mike
Back to top
View user's profile Send private message Visit poster's website
Alberto
Site Admin


Joined: 06 Feb 2004
Posts: 1412
Location: Torino, Italy

PostPosted: Tue Sep 04, 2007 9:41 am    Post subject: Reply with quote

Motorcycle Michael wrote:
How can I turn the AreaCode string into a math function that would tag area codes less-than or equal to 200?


You can do that with a condition like:

if ((areaCode as integer) <= 200) then ...

You may also want to check out the "Greeting Telemarketers" script that we have added to the Phlink Resources page:

http://www.ovolab.com/phlink/resources.php#gr03

it does not contain all the logic present in the above scripts, but it contains the 3-tone "disconnected" tone that may help you get removed from telemarketers' databases.

Best,
Alberto.
Back to top
View user's profile Send private message
Motorcycle Michael



Joined: 05 Aug 2004
Posts: 37
Location: Northern California

PostPosted: Tue Sep 04, 2007 10:46 am    Post subject: Reply with quote

Thank you, Alberto!
New spoof trap reads:

Code:
 if ((areaCode as integer) <= 200) or (areaCode is "999") then


Daily spoof calls give me a great opportunity to test these scripts, and it's fun to hear Phlink announce the call as "terminated." The disconnected tone sound might help with new callers - impossible to tell with spoofs.
I have to say, tho, the Phlink has reduced a flood of telemarketing calls to an occasional drip.

Thanks again! See you at MWSF08.....
Mike
Back to top
View user's profile Send private message Visit poster's website
captcurrent



Joined: 29 Nov 2005
Posts: 68

PostPosted: Fri Apr 11, 2008 4:25 am    Post subject: who call us script Reply with quote

when I view the script provided I see a little happy face..



I took that out,

put my id and password in
complied and ran the script to tets it I get a -99 result

which i assume mean that its is failing


what am i doing wrong?
Back to top
View user's profile Send private message
Motorcycle Michael



Joined: 05 Aug 2004
Posts: 37
Location: Northern California

PostPosted: Fri Apr 11, 2008 7:13 am    Post subject: Reply with quote

Hi captcurrent!
That script was written for Phlink version 2.2.3 on a G4 - still running, by the way - so I'd have to guess it may be broken by now with so many changes since then (Intel, OS 10.5, Phlink updates, etc.). No idea what a "-99" error might be, tho.....

I only wish there was some way to send 120v back to telemarketers. How 'bout it, Alberto? New feature?
Back to top
View user's profile Send private message Visit poster's website
captcurrent



Joined: 29 Nov 2005
Posts: 68

PostPosted: Fri Apr 11, 2008 10:59 am    Post subject: but Reply with quote

Thanks Motor Mike... I guess the smiling face meant something back then

YOUR basic script still works.. added it and things are a lot quieter around here
Back to top
View user's profile Send private message
Motorcycle Michael



Joined: 05 Aug 2004
Posts: 37
Location: Northern California

PostPosted: Fri Apr 11, 2008 12:27 pm    Post subject: Reply with quote

Smiley face in AppleScript? Dunno where _that_ came from, even "back then" (which wasn't all that long ago - you're making me feel old!)

You might be better off modifying Ovolab's up-to-date telemarketer script (see Alberto's suggestion above); I'm still running the older stuff because it still works. The spoof portion proved quite entertaining to some bozo calling from 000-000-0000 (they called 24 times in the space of about an hour), but other than that the Phlink has been a Godsend. Besides, it's fun! Good luck, and give those telemarketers hell!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Phlink scripters All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


This forum is intended for allowing the community of people interested in Ovolab products to share their ideas and suggestions. Customer support inquiries should be directed to our support email address.
The moderators reserve the right to remove any messages deemed inappropriate, at any time, for any reason.
Powered by phpBB © 2001-2008 phpBB Group