Jump to content

Fridays' Swyx Tip #8: Log calls with voucher code to TXT file

Tom Wellige



From 2009 to 2011 mirjam baumberger wrote a great blog, the "Fridays' Swyx Tip". Every Friday she posted a tip regarding the usage of SwyxWare and connected tools and devices. As the old forum is offline, this article series will be restored here again over the time. Please note that some information in this article series might not be valid anymore with current SwyxWare versions.


This blog article was originally posted on 09.01.2009 02:42


Dear Swyx Users


In the tip below I illustrate how Swyx helps you to stay in control of your call activities. Swyx records every single phone call in to the Swyx CDR (Call Detail Records). Additionally, you can also report on call activity based on other events. This call-log can be written into a database or a even a simple text file.




Let’s assume you have send out a promotion mail to your customers to receive a special discount when presenting a valid Voucher.


Now, you want to keep track how many calls you are receiving out of this campaign. Logging this incoming calls in a text file is really easy. We have to add a new ECR rule to your SwyxServer were the caller will be greeted with an announcement like:


WLW-logcallswithvouchercodetoTXTfile_DCC0-clip_image002_2.jpg Welcome to ... , please enter the Voucher Code and complete your entry by pressing the # key.


By adding a new Script User to your Swyx Server, we can create a small sample Call Routing Script, which will save all incoming calls including Voucher Code information to a text file on the local hard-drive.


  1. Create a new ECR script and enter the custom code below to the Start Block of your new script.

    ' FileOpen iomode Values
    Const fsoForReading = 1
    Const fsoForWriting = 2
    Const fsoForAppending = 8
    Const fsoCreateIfNotExist = True
    Function InsertCallIntoFile ( callerID, keys )
    	Const filename = "c:\gse_demo\test.txt"
    	Dim fso
    	Dim file
    	' Create FileSystemObejct
    	' Open text file
    	Set file = fso.OpenTextFile(filename, fsoForAppending, fsoCreateIfNotExist)
    	' Write (append) CallerID into file
    	file.WriteLine ( "Caller: " &  callerID & ", Called number: " & CalledNumber & ", Voucher ID: " & keys & ", Date & Time of call: " & CStr(now))
    	Set file = Nothing
    	Set fso = Nothing
    End Function
  2. Then add the get DTMF String Block to your script and set “Save input to variable:” to keys and record an announcement which advises the caller how to enter the Voucher Code.

  3. Add a new block “Set Variable” to your script and set the Variable name to caller and the variable value to = InsertCallIntoFile (CallerID() , keys)

  4. Complete your script with a connect to block so that the caller is forwarded to the appropriate sales team.
  5. If you receive a call to this script, a text file will be created on the SwyxServer location c:\gse_demo\test.txt


That’s it. Every call to this script is now logged in to the txt file with the according Voucher ID entered, and additional information like caller number and date and time of call is also written in to the file. ;- )


Of course, this call information can also be writing in a database. More details on this topic can be found in the Swyx Knowledgebase article Custom VBScript Code - Call Loggin Into Ddatabase (kb2218).


Happy Swyxing...




@ IT Net World Ltd, NZ & AUS SWYX Distributor




Update: When it comes to call routing and VBScript programming, don't miss this page:



Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.