Last active
October 5, 2018 07:30
-
-
Save jfqd/d789b060828e8588e4209826c5cf0314 to your computer and use it in GitHub Desktop.
This script enables the macOS Contact-Application to dial a phone-number via a SNOM hardware phone by clicking on the phone label
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This script enables the macOS Contact-Application to dial a phone-number | |
-- via a SNOM hardware phone by clicking on the phone label. | |
-- | |
-- (C) 2008 David Kreitschmann, K3com Kommunikationstechnik http://www.k3com.de | |
-- (C) 2017 Modification for SNOM 715 by Stefan Husch, https://qutic.com | |
-- | |
-- Copy this script to ~/Library/Application\ Scripts/com.apple.AddressBook | |
-- on your macOS 10.11+ and change the phoneURL to your needs. | |
-- | |
-- A chmod 0600 ~/Library/Application\ Scripts/com.apple.AddressBook/Snom.scpt | |
-- ensures the privacy of your SNOM user and account! | |
-- | |
-- If you have a valid certificate ensure to remove the '-k' flag from curl! | |
-- | |
-- This program is free software: you can redistribute it and/or modify | |
-- it under the terms of the GNU General Public License as published by | |
-- the Free Software Foundation, either version 3 of the License, or | |
-- (at your option) any later version. | |
-- | |
-- This program is distributed in the hope that it will be useful, | |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
-- GNU General Public License for more details. | |
-- | |
-- You should have received a copy of the GNU General Public License | |
-- along with this program. If not, see <http://www.gnu.org/licenses/>. | |
property phoneURL : "https://user:[email protected]" | |
property titleText : "Dial (Snom) " | |
using terms from application "Contacts" | |
on «event az00az57» | |
return "phone" | |
end «event az00az57» | |
on «event az00az58» given «class az61»:this_person, «class az62»:this_entry | |
return titleText & «class az17» of this_entry | |
end «event az00az58» | |
on «event az00az59» given «class az61»:this_person, «class az62»:this_entry | |
return true | |
end «event az00az59» | |
on «event az00az60» given «class az61»:this_person, «class az62»:this_entry | |
set theNumber to filter(«class az17» of this_entry) | |
do shell script "/usr/bin/curl -k -m 3 " & phoneURL & "/adr.htm?adrnumber=" & theNumber | |
end «event az00az60» | |
end using terms from | |
on filter(theNumber) | |
set newNumber to "" | |
repeat with c in every character of theNumber | |
if "+01234567890" contains c then | |
set newNumber to newNumber & c | |
-- display dialog newNumber | |
end if | |
end repeat | |
if newNumber contains "+49" then | |
set newNumber to "0" & text 4 through -1 of newNumber | |
end if | |
if character 1 of newNumber is equal to "+" then set newNumber to "00" & text 2 through -1 of newNumber | |
return newNumber | |
end filter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, do you perhaps know why it doesn't work on mojave?
We used many years the former version of this script. But now ist doesn't work anymore under 10.14 Mojave.