|
FacetPhone
Dialing out of Mac Applications has never been EASIER! |
Last Updated: 16/06/2012, EY |
FacetPhone's UTAPI (Universal Telephone Application Programming
Interface) utilities and example AppleScript code make it easier
than ever to dial-enable your Mac applications. Contact phone
numbers can be dialed with a single-click and incoming Caller ID can
be used to pop-up contact records of callers before you even answer
your phone. How cool is that?
You probably have already heard that the FacetPhone PBX comes on a Mac mini running Mac OS X (Leopard, Snow Leopard, Lion) providing a beautiful, compact, and affordable, complete PBX system suitable for both small and large offices. The full FacetPhone feature set is available in this nice package. You give up nothing and you gain the cleanliness and stability of the Mac mini platform. If this isn't a nice PBX-in-box solution, I don't know what is... |
Okay, enough fluff... you came here to get some meat (or veggies if you're not into meat)! Here's a real example using FacetPhone to dial out of the popular Mac database software, FileMaker Pro, using simple FacetPhone UTAPI commands in AppleScript. FacetPhone UTAPI is part of the FacetPhone package, but is designed as a set of utilities that can be installed on a separate server or Mac desktop that is not running the FacetPhone PBX software. The FacetPhone UTAPI utilities understand how to talk to the FacetPhone PBX and can issue dial commands or fetch caller ID of incoming calls so another application can use the information to do lookups, or special logging, etc. The FacetPhone UTAPI package can be copied off the FacetPhone server or contact FacetCorp Support (support@facetcorp.com) to get the latest copy. It should be installed and configured on any Mac desktop for which you wish to implement this Dialing Out and Caller ID Lookup scheme. Dialing Out Telling a FacetPhone user's phone to dial a number is super easy. The FacetPhone UTAPI command for doing this is "fp_dial". You just tell "fp_dial" the phone number to dial and a FacetPhone username. Nada más. If your Mac username is the same as your FacetPhone username, then this can be something simple like this: fp_dial -n 9,972-985-9901 -u $USER -n NUMBER_TO_DIAL -u FACETPHONE_USERIf $USER from a Terminal window does not match your FacetPhone username then you can use some sort of simple table lookup to match Mac usernames with FacetPhone usernames, set some other variable (e.g. $FPUSER) when a user logs in and use it... or just make them match. Fetching Caller ID Getting the Caller ID information for your current (or last) call with FacetPhone UTAPI is even easier than dialing! The FacetPhone UTAPI command for doing this is "fp_cid". Just tell "fp_cid" the FacetPhone username whose Caller ID information you wish to fetch. If you want extended information you can also get DNIS and call status, for example: fp_cid -u $USER <number=9729859901><name=FACETCORP> <number=9729859901><name=FACETCORP><dnis=6920> <number=9729859901><name=FACETCORP><state=active> <number=9729859901><name=FACETCORP><dnis=6920><state=completed>or if Caller ID information was not found for the current or last call: <number=No caller id>This information in the right hands is enough to be dangerous! Vamos a ver...
FileMaker Pro Implementation FileMaker Pro by FileMaker, Inc. (a subsidary of Apple) is powerful and easy to use database software. FileMaker Pro databases are easily customized and extending functionality to include FacetPhone UTAPI support is a breeze. FacetPhone is all about communicating with folks and in FileMaker, those folks are in your Contacts database. Imagine a pretty Contacts database with all the regular stuff you keep about your Contacts including Work Phone, Mobile Phone, and Home Phone fields. Add some buttons to Dial and a button to Find Callers and you have a very slick FileMaker/FacetPhone UTAPI solution for calling out of your database. Mama would be proud!
FileMaker Dial Buttons Dialing out of a database is a little easier than searching fields for Caller ID information. Let's start by setting up to dial out... In this tutorial, we'll use a Contacts database with phone number fields called, "Work Phone", "Mobile Phone", and "Home Phone".
An easy approach (remember our theme word!) is to create separate buttons for dialing each of the phone number fields. This allows the database user to pick which number to dial with minimal effort. So, let's clone the "Contact List" button into 3 new buttons: "Dial Work", "Dial Mobile", and "Dial Home" buttons. To clone buttons in FileMaker Pro, in "Edit Layout" mode, copy an existing button and then paste it in its new location.
To define a button's functionality in FileMaker, click "Edit Layout", right-click the button, and select "Button Setup". In this case we want to Specify Calculated AppleScript so we can get the phone number field contents for our dial command. So select "Perform AppleScript", "Specify...", then "Calculated AppleScript", and "Specify...".
In the Calculated AppleScript area, enter this snippet of code, including each of the double-quote marks and everything else exactly as shown:
Repeat Button Setup for each button, changing only the "GetField" parameter to match corresponding phone number field names (Mobile Phone, Home Phone). That wraps up the Dialing Out part of this. Pretty easy, huh? Be sure to test each button...
FileMaker Find Caller Button Fetching Caller ID and doing a database lookup with the parsed data is a little more involved that dialing out, but it is pretty easy too. Start by cloning a button, let's call it "Find Caller".
To define the Find Caller button functionality, click "Edit Layout", right-click the Find Caller button, and select "Button Setup". This time we want to Specify Native AppleScript so we can enter more involved AppleScript code to fetch the Caller ID information, parse it, and then tell FileMaker Pro to search the phone number fields for the Caller ID phone number. So select "Perform AppleScript", "Specify...", then "Native AppleScript".
In the Native AppleScript area, enter this AppleScript code below, or download "fp_cid_search.applescript" and paste it in:
That is pretty much all there's to it! Congratulations, your FileMaker Pro Contacts database now has FacetPhone UTAPI support and is dial-enabled. For you curious engineering-types... (as if you didn't already know) the above AppleScript code works like this:
Contact support@facetcorp.com
if you have any questions about how to implement this with your FacetPhone
system.
|