(* Launchbar Vonage dialing script Geoff Green, geoff-public@stuebegreen.com February 20, 2005 This script is in the public domain, and is a lightly modified version of Automatic Vonage Dialer v0.3, Aaron Freimark, abf@mac.com, March 16, 2004 with modifications based on the sample dialing scripts in the Launchbar distribution help Only works in the US with this version *** YOU MUST Modify the first three lines below with your info *** *) property myVonageLogin : "VonageLogin" property myVonagePassword : "VonagePassword" property myVonageNumber : "12125551212" -- The lines below are correct for the U.S. property myCountryCode : "1" property myLongDistanceCode : "1" property myIntlAccessCode : "011" on handle_string(s) if s starts with "tel:" then set s to characters 5 thru -1 of s -- trims the URL's "tel:" scheme prefix end if set theNumber to InsertLDCodes(s as string) try set cleanedNumber to CleanTheNumber(theNumber) on error errtext say (errtext as string) end try set theURL to "https://secure.click2callu.com/tpcc/makecall" set theData to " -d username=" & myVonageLogin set theData to theData & " -d password=" & myVonagePassword set theData to theData & " -d fromnumber=" & myVonageNumber set theData to theData & " -d tonumber=" & cleanedNumber -- Use curl to hit the URL and dial the number set errorCode to do shell script "curl \"" & theURL & "\"" & theData --If there was an error, return a message. if (characters 1 thru 3 of errorCode) as string ­ "000" then say ("Error: " & errorCode) end if end handle_string on InsertLDCodes(theNumber) if (characters 1 thru 2 of theNumber) as string = "+" & myCountryCode then -- The number was formatted correctly. return theNumber end if if character 1 of theNumber = myLongDistanceCode then -- Domestic long distance with LD access code return theNumber end if if character 1 of theNumber = "+" then -- international number, add prefix return myIntlAccessCode & " " & theNumber end if -- local number, must add the LD code for Vonage [nope!] return theNumber end InsertLDCodes on CleanTheNumber(numToDial) -- remove punctuation from a string, leaving just the number set theDigits to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} set cleanedNumber to "" repeat with i from 1 to length of (numToDial as string) set j to (character i of numToDial) if j is in theDigits then set cleanedNumber to cleanedNumber & j end repeat return cleanedNumber end CleanTheNumber