Forum Index

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

Caller ID specific greetings
Goto page 1, 2  Next
 
Post new topic   Reply to topic     Forum Index -> Phlink scripters
View previous topic :: View next topic  
Author Message
enochbenjamin



Joined: 22 Jul 2004
Posts: 25
Location: Chicago

PostPosted: Thu Aug 12, 2004 11:56 am    Post subject: Caller ID specific greetings Reply with quote

I have placed a couple of greetings for specific phone numbers in the Phlink folder, however, it only plays greeting.mp3. I have formatted the messages such as 773 555-1212.mp3 but when i have that person call they get the basic caller id script.

any ideas why?
_________________
enoch benjamin
enochbenjamin@sbcglobal.net
http://www.websiteworx.com
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Alberto
Site Admin


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

PostPosted: Thu Aug 12, 2004 11:27 pm    Post subject: Re: Caller ID specific greetings Reply with quote

You should name them "greeting 773 555-1212.mp3", the "greeting" prefix should be present in the filename, otherwise Phlink won't know that you wish to use them as greetings.

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



Joined: 22 Jul 2004
Posts: 25
Location: Chicago

PostPosted: Fri Aug 13, 2004 7:12 am    Post subject: Reply with quote

ok - thanks! I will try it in a moment.

WORKED LIKE A CHARM!!! Laughing
_________________
enoch benjamin
enochbenjamin@sbcglobal.net
http://www.websiteworx.com
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Motorcycle Michael



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

PostPosted: Thu Aug 19, 2004 2:39 pm    Post subject: Reply with quote

I'd like to trap "Out of Area" calls - especially those with no number - either by scripting or (preferably) using a top-level folder.
I have an analog modem on a second Mac (same line as DSL) with a callerID program onboard; it reports "Out of Area - [blank number] - 08/19/04 - 14:55.
For the same call, Phlink's log shows "Received caller ID: O / O / 08/19/04 14:55." (Private calls are logged as P / P / date / time.)
Those both look like the letter O, yes? So, can I trap for name = O and number = O? Something like:
Code:
 if (the id of the calling party is "O") and (the name of the calling party is "O") then <do something>

I'm guessing the words "Out of Area" are added by the other app, and my SBC service merely transmits an "O," in which case Phlink puts the second "O" into an empty phone number, right? Or am I _way_ off?

How could I name a folder to trap Out of Area with an empty number?
(I looked at that "kill file" script elsewhere in this forum, but it seems a tad complex...)
Thank you!
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: Thu Aug 19, 2004 2:59 pm    Post subject: Reply with quote

You are right, the "O" (or the "P") is what is sent by the phone network.
Phlink then translates this into a calling party whose name is "<unavailable>" or "<withheld>", respectively.

So, depending on what you wish to do, you can place a greeting named "greeting-withheld.mp3" or a script named "greeting-unavailable.scpt" that does what you want.

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



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

PostPosted: Thu Aug 19, 2004 6:27 pm    Post subject: Reply with quote

Hey, whaddaya know, lucky guess, eh?
So, I can trap for "<unavailable>" on no-number calls, but the second parameter - out of area _and_ an empty phone number - how do I trap for both?
Since the Phlink log shows Caller = "O" and CallerID = "<unavailable>" can I do something goofy like "greeting-O-unavailable.scpt" perhaps? Or do I have to do it within a script to catch both conditions?
(Here in Northern California, out-of-area calls with no numbers are almost always autodialers.)
Thank you, Alberto.
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: Fri Aug 20, 2004 12:09 am    Post subject: Reply with quote

If all you need to do is play a specific message to out-of-area callers, you only need to use a "greeting-unavailable.mp3" file.

If, on the other hand, you want to detect out-of-area callers in a script, because you are doing fancier stuff (such as answering immediately, hanging up on them, etc.), then this is a snippet of script that finds out whether the call is an out-of-area call:

tell the_call
if the phone of the calling party contains "unavailable" then
...
end if
end tell

Note that parties have the following properties, among others:
- the phone
- the name
- the caller id

For out of area calls, the phone will be set to "<unavailable>", the name will be empty (unless you have an entry in your address book with "unavailable" as the phone number, but I doubt it), and the caller id will be "O".

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



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

PostPosted: Fri Aug 20, 2004 11:08 am    Post subject: Reply with quote

Okay, here's your ring.scpt modified to intercept no-number out-of-area calls:

Code:
if the name of the calling party is "" and the caller id of the calling party is "O" then
               stop playback -- terminate normal greeting if necessary
               stop recording
               log ("Unidentified call " & the number of the calling party) as text
               set my_caller to my getSpokenNumber(the_cid)
               say ("rejected " & my_caller & ".")
               play (((the items folder as text) & "MaBellDC.aif") as alias) -- get off phone list?
               my waitUntilDonePlaying(the_call)
               delay 1
               speak ("We're sorry. Un-identified calls are automatically rejected. Please unblock your line before calling again.")
               hang up
else ...


the "MaBellDC.aif" sound file is a three-tone signal of a disconnected number (in hopes I'll be dropped from phone lists). Both original subroutines (getSpokenNumber and waitUntilDonePlaying) are present. I'm not sure what I'll get by logging "the number of the calling party" since it should be empty, right?
And - if I add a duplicate if-then statement using "P" instead of "O" I can trap "withheld" calls, yes?
Alberto, I hope you are having as much fun with your Phlink as I am.
A thousand thanks,
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: Fri Aug 20, 2004 2:58 pm    Post subject: Reply with quote

Mike,

I'm sure lots of people will find this useful.

Just a few questions - is this supposed to be a ring script or a greeting/enter script? I would imagine the latter, because it does stuff that makes sense if the call has been answered already, and not if the line is still ringing...
Note that there is a subtlety here. It may work even as a ring script, but it would not be reliable. The reason is that it would work if Phlink answers the call by the time the script has started... but I would place all this into a greeting or enter script to be sure.

Also, I would add a call to waitUntilDonePlaying() right before hanging up too, otherwise you're hanging up as soon as the "We're sorry..." message starts playing, and telemarketers will not hear it...

the "number" property of the calling party (now called "phone" in version 1.4.2 of Phlink, but older scripts will keep working), in such cases, will be "<withheld>" or "<unavailable>". I know that it's counterintuitive since it's not a number - but that's what is being withheld or what is unavailable, so that's the value of the "number"/"phone" property of calling parties.

Quote:
And - if I add a duplicate if-then statement using "P" instead of "O" I can trap "withheld" calls, yes?


Exactly.

Quote:
Alberto, I hope you are having as much fun with your Phlink as I am.


Smile of course I am!

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



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

PostPosted: Fri Aug 20, 2004 3:39 pm    Post subject: Reply with quote

Thank you for the kind words, Alberto.

Quote:
is this supposed to be a ring script or a greeting/enter script?


Sorry to say, I've been trying to stuff everything into the ring script. Not a good idea, huh? Since I want to dispose of autodialers right off the bat without offering up a greeting - and since greetings function before enter scripts - it seemed like the ring script was the right place. Here's the whole (ring.scpt) enchilada:

Code:
-- This script makes Phlink speak the name of the caller when an incoming call rings.
-- Hangs up on out-of-area calls with no number.

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
         else
            -- Empty name with out of area CID ("O") usually indicates an autodialer
            if the name of the calling party is "" and the caller id of the calling party is "O" then
               stop playback -- terminate normal greeting if necessary
               stop recording
               log ("Unidentified call " & the number of the calling party) as text
               set my_caller to my getSpokenNumber(the_cid)
               say ("rejected " & my_caller & ".")
               play (((the items folder as text) & "MaBellDC.aif") as alias) -- get off phone list?
               my waitUntilDonePlaying(the_call)
               delay 1
               speak ("We're sorry. Un-identified calls are automatically rejected. Please unblock your line before calling again.")
               my waitUntilDonePlaying(the_call)
               delay 1
               hang up
            else
               -- Say the name of the caller.
               set my_caller to the name of the calling party
            end if
            say (my_caller as text)
         end if
      end tell
   end tell
   return my_call_again
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


(I added another call to waitUntilDonePlaying(), as you suggested.)
The script seems to work, except that I cannot test its CID functions for out-of-area/no-number calls (which are a real problem here in CA).
As for <withheld> callers, that trap and any further tinkering might go into an enter.scpt since those callers _should_ get a greeting. Does that make sense?

Once again, Alberto, I thank you for your help. I only wish I could return the favor.
Mike
Back to top
View user's profile Send private message Visit poster's website
Motorcycle Michael



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

PostPosted: Mon Aug 23, 2004 5:28 pm    Post subject: Reply with quote

Well, didn't take long to find out my trap for out-of-area/no-number calls doesn't work... Phlink Log shows:

-- Caller -------- CallerID ------------ Event
<unknown> - <unknown> -- Call appeared
-- O -------- <unavailable> -- Executing script "ring.scpt"
-- O -------- <unavailable> -- Received caller ID: O / O / 08/23/04 13:11
-- O -------- <unavailable> -- Playing sound "Greeting.aif"
-- O -------- <unavailable> -- Answering call
-- O -------- <unavailable> -- Long silence detected, hanging up

Recorded message resulting from this call was the phone company's, "Your call did not go thru, please try your call again," which mystifies me since there was no outgoing call - plus it started playing the greeting _BEFORE_ answering call? Hmmm.....
Change trap to:
Code:
if the name of the calling party is "O" and the caller id of the calling party is "<unavailable>" then

- or -
Code:
if the name of the calling party is "O" and the caller id of the calling party is "O" then

Perhaps Phlink retains the "O / O" ID and only presents "<unavailable>" for benefit of the log?

One thing's sure: Won't take long to test it again Confused
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 Aug 24, 2004 12:06 am    Post subject: Reply with quote

Motorcycle Michael wrote:
plus it started playing the greeting _BEFORE_ answering call? Hmmm.....

The reason for that is the one I mentioned earlier: you are doing all that from a ring script, not from an enter or greeting script. Ring scripts are executed while the phone is still ringing. If you are sending play commands from there, you may be sending them before the call is answered. If this occurs, Phlink will just ignore the commands and won't play the sounds. If, by any chance, the call has been answered in the meantime (note the simultaneous indipendent flow of events), then the sound will play but the log entries may be placed in the wrong order as you noticed.

Motorcycle Michael wrote:
Code:
if the name of the calling party is "O" and the caller id of the calling party is "<unavailable>" then

Change that to:
Code:
if the phone of the calling party contains "unavailable" then

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



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

PostPosted: Wed Sep 01, 2004 6:00 pm    Post subject: Reply with quote

Clearly, I am trying to cram too many instructions into the ring script. I admit it..... part of my problem is that I'm trying to test incomming calls for two conditions: Out of Area (name = empty) _with_ no phone/number (unavailable). Another is that my greeting is a sound file and will precede an enter script. But, I'll figure it out eventually.....

Meanwhile:
Code:
set stopList to {800, 866, 888} -- unwanted area codes
... start Phlink, on incoming_call, etc...
if (the beginning of the phone) of the calling party is in stopList then
... do something (preferrably rude!)

Is this condition valid?
Thanks!
Back to top
View user's profile Send private message Visit poster's website
Motorcycle Michael



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

PostPosted: Thu Sep 02, 2004 3:54 pm    Post subject: Reply with quote

Oops - nevermind..... I need to brush up on my AppleScript, huh.
Question:
Can I simply replace my <greeting.aif> with a <greeting.scpt> and then have an <enter.aif> sound file? Or is that a dumb question, too?
Thanks again!
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: Sat Sep 11, 2004 5:22 am    Post subject: Reply with quote

Motorcycle Michael wrote:
Can I simply replace my <greeting.aif> with a <greeting.scpt> and then have an <enter.aif> sound file?


Exactly! That will reverse the order of execution of the two.

Alberto.
Back to top
View user's profile Send private message
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