![]() |
|
|
| Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site | ||
|
|
SAPI and TAPI Scripts for Exchange Download Samples The following article I wrote for a bit of fun to share some of scripts from the bottom of my junk draw that demonstrate you don't need to be stuck with just text messaging in Exchange. To start with SAPI stands for (Speech Application Programmers Interface) and TAPI stands for (Telephone Application Program Interface). So what you can do with SAPI is covert the text in your email to a voice stream or audio file and with TAPI you can deliver that audio stream over a phone line. Using SAPI SAPI includes some automation objects which makes the Speech API accessible from VBS scripts. In fact its so easy within a few lines of script you can have your computer pretty much well saying anything. For example your basic hello world SAPI script looks something like this set spvoice =
createobject("SAPI.SpVoice") If you want to save what your saying to a wave file instead of sending it out the speaker all you need to do is add a few extra lines set spvoice =
createobject("SAPI.SpVoice") Now you know how to use SAPI it becomes a method that can give your Exchange Server or more specifically your email, calendar appointments and tasks an auditable voice (albeit a slightly metallic one). How useful is this ? Well ....... If you combine it with an auditable delivery mechanism such as Instant Messaging or a Telephone then it can provide some usefully functionality (or at least some amusement value). For example I've written a sample Exchange Event sink that when a new mail arrives it will first select only the new text in a message (in the case this message is a reply). Then using TAPI it dials a phone number that it retrieved from a Active Directory query and then tells you what the contents of the message was by speaking down the phone line. The other example I've created is an OnTimer event sink that can be attached to the calendar folder that scans for any appointments that have a reminder set but hasn't been dismissed and are going to start within the next 10 minutes. If it finds any it will call a phone number it retrieves from Active Directory and tell you down the phone line that you are just about to miss an appointment using speech. Using TAPI TAPI is a little bit different from SAPI in the usability stakes there's actually quite a lot involved in making a phone call via an analogue modem. Fortunately someone has done most of the hard work for us in the platform SDK samples there are plenty of examples of using the TAPI API to make an outbound (or accept a inbound call). In the platform SDK there is one VBS example that demonstrates how to drive the TAPI API from a web page. To write proper event driven TAPI code you should however look at using a higher level language such as VB or C. For my TAPI sample I've taken the calldemo.htm sample from the platform SDK and converted it into a console script, I've reduced it down to bare bones with just enough code and functionality to make a call. The one thing you need to keep in mind when making a call via TAPI with a analogue voice modem is that depending on your TSP (Telephone Service Provider) the functionality of tracking call progress status can be very limited for example with all the modems I've used there is no way to detect someone has answered the call you just placed. In fact TAPI reports the call as connected when it has successfully dialed the number and before the call is actually made. This functionality is a part of the TSP that is being used proper voice processing cards such as dialogic cards come with a TSP that supports all the call status and progression functions. In my example I've just used a timer so it waits10 seconds after it successfully connects to the modem and dials before starting to play the speech. (this is a guestomate of how much time it will take to place the call by the modem and then for someone to answer it at the other end). The other problem that I had using TAPI is that although TAPI supports the WAVEOUT command which will allow you to play a wave file down a modem line this command would not work properly with the analogue modem that I use . As a low tech solution to this because the modem I've used was a speaker phone modem I found that putting an audio cable between the Speaker Socket and the Mic socket on a PC sound card and turning the modem speaker on would allow me to play a sound down the phone line via the speaker phone functionality of the modem. Some good TAPI reference sites are
http://tapifaq.pennypacker.org/
Next page New email event sink example
|
Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Stephen Bryant or Pro Exchange. OutlookExchange.Com, Stephen Bryant and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.
Copyright Stephen Bryant 2008