Summary:
The SwyxWare Distributor
intratel
from the Netherlands had run a special Valentines Phone- or Greetings-EMail campaign on the 14th of February, 2003.
A user was able to register for free on a webpage to get a PIN. With this PIN he was able to leave a Valentines greeting on a chargeable phone number. After the greeting was recorded as WAV file it was sent via EMail attachment to a given address on the Valentines day.
This article describes the GSE script to record the greeting which was developed in less than an hour. It is therefore an excellent example for how effective and creative one can use the SwyxWare.
Information:
This is how a call will be handled
- Call will reach the SwyxWare
- An announcement will be played
- The user enters a PIN using DTMF
- The PIN will be checked against a database:
- invalid PIN: re-enter the PIN
- valid PIN: the script goes on
- An announcement will explain how to record the valentines message
- The message will be recorded
- An IVR menu with these submenus follows:
- 1 Playback the recorded message
- 2 Re-record the message
- 3 Save message and end script
Valentines Script in GSE
Installation of the Scripts
- Unzip the ZIP file including its subdirectories.
- Copy all files within the Voicemail directory into users Voicemail directory, e.g.
C:\Documents and Settings\All Users\Application Data\ Swyx\Share\User\Valentines\PhoneClient\Voicemail - Open the Call Routing Manager of the desired user and create a new GSE rule.
- Import the file valentines.rse into the GSE using the menu File | Import... and save it as active rule.
- Create a directory
D:\Valentines
in which all recorded message will be copied to. If you want to use another directory you have to change the second statement within the VBScript Code:' Folder to store all messages in (with tailing "\")Const SAVE_DIR = "d:\valentines\"
Installation of the Database
- Copy the MS Access™ database file valentines.mdb into a folder of your choice.
-
Create a so called ODBC Datasource for this database. To do so open ODBC Datasource Administrator via Start | Programs | Administrative Tools. If you don't see the Administrative Tools menu item you'll have to enable it in the properties of the taskbar first.
ODBC Datenquellen-Administrator
Create a new System-DSN:
add Swystem-DSN
on base of an Microsoft Access Driver:
Microsoft Access Treiber
Set the name of the datasource to valentines and connect it with the Access file on your harddisk. Later on the script will access the database using the configured datasource name.
configure datasourceHow the Script works
Beside the standard GSE blocks there are three additional functions being implemented in custom VBScript code.
Custom VBScript CodeThis three functions are derived from the specification of the application:
- Check the PIN against the database
- Playback the recorded message
- Save the recorded message with a specific filename in the given folder and update the database
The function "ValidPin()"
This function will be called using the Evaluate block Valid PIN ?:
Call of the PIN ValidationThe function gets the entered PIN as parameter. The connect string to the database DB_DSN is defined in the first statement of the custom VBScript code
' Data Source NameConst DB_DSN = "valentines"
and can be altered there if necessary.Function ValidPin ( sPin ) Dim bReturn bReturn = false ' open connection to database Dim db Set db = CreateObject("ADODB.Connection") db.Open DB_DSN ' open recordset Dim sSQL Dim rs sSQL = "select * from users where pin = '" _ & sPin & "'" Set rs = CreateObject("ADODB.Recordset") rs.Open sSQL, db, adOpenDynamic, _ adLockOptimistic, adCmdText bReturn = not rs.EOF rs.Close Set rs = Nothing db.Close Set db = Nothing ValidPin = bReturn End FunctionThe function reads all records from the users table of the database with the given PIN in its pin field. The EOF flag will be used to determine if there are any results. The flag is set to True if there are no results, so there are no users with this PIN in the database. Since the function ValidPin() should return False in this case we have to negate it.
The function "PlayLastMessage ()"
This function will be called using the Set Variable block Play Message. Please note that we use this block just for calling the function. We are not interested in its return value.
The GSE currently do not have a simple to get the name of the the last recorded maeesage, but we can use its scripting interface to do it:
Function PlayLastMessage () Dim retVal Dim sFileName ' get name of last recorded file sFileName = PBXCall.LastRecordedMessage ' play last recorded file retVal = PBXCall.PlayMessage(sFileName) PlayLastMessage = True End FunctionThe function "SaveMessage()"
This function does the following:
- The recorded message will be stored in the defined SAVE_DIR directory with a name PIN.WAV, where PIN is the PIN of the current user.
- The complete filename including the path will be stored in the user's record in the database.
This function will also be called using a Set Variable block Save Message and again we do not care about the return value.
Call of the "SaveMessage()" functionFunction SaveMessage( sPin ) Dim sFileName, sNewFileName ' get name of last recorded file sFileName = PBXCall.LastRecordedMessage ' cal new file name sNewFileName = SAVE_DIR & sPin & ".wav" ' create FileSystemObject Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFile sFileName, sNewFileName Set fso = Nothing ' open connection to database Dim db Set db = CreateObject("ADODB.Connection") db.Open DB_DSN ' update record Dim sSQL sSQL = "update users set message = '" & _ sNewFileName & "' where pin = '" & _ sPin & "'" db.Execute(sSQL) db.Close Set db = Nothing SaveMessage = True End FunctionPlease note that the announcements within the ZIP file are not the ones being used during the valentines camgain, but instead are just some test announcements.
Further informations about the valentines campaign
The campaign was of course more then just this GSE script. On the following webpages one was able to login to it:
The Webpages where created by the company Web Power (www.webpower.nl) who where also responsible to sent all the valentines emails.
References:
- Valentines Day 2003 - Call Routing Skript
kb2339_Valentines_Day_2003.zip
The third-party contact information included in this article is provided to help you find the technical support you need. This contact information is subject to change without notice. Swyx in no way guarantees the accuracy of this third-party contact information nor is responsible for it's content.
Comments
0 comments
Article is closed for comments.