Utilizing Windows Task Scheduler To Run GUI Applications From SYSTEM account

Editor Note: This article was published in 2014 but the content of this article is still relevant with recent Windows operating systems, such as Windows 10 and Windows server 2019. In addition, Voicent platform has moved towards browser interface and the spreadsheet-based programs have been obsoleted. However, the command line interface is still available and gets better. For more details, please see Campaign Interface and CRM interface.

——–

One of the security features of recent Windows (vista and later) is disabling running GUI applications from SYSTEM account (normally the processes running as Windows service). This adds some complications for Voicent IVR apps that utilize other Voicent programs, such as running BroadcastBySMS to send out text messages.

One nice workaround is to utilize Windows task scheduler. You can specify which program to run regardless of whether it is a console program or GUI program. In addition, you can specify the user account to run the program, the time to run, recurrence, and many other options. You can even start a program on a remote computer.

The following is a simple Windows batch file to run Voicent BroadcastBySMS program on a computer (COMP1) with user (U01) and password (P1234).

The task scheduler command

For more information about Windows Task scheduler command line options, please check the detailed document from Microsoft’s website. The main command line is as follows:


Schtasks /create /sc ScheduleType /tn TaskName /tr TaskRun [/s Computer [/u [Domain\]User [/p Password]]] [/ru {[Domain\]User | System}] [/rp Password] [/mo Modifier] [/d Day[,Day...] | *] [/m Month[,Month...]] [/i IdleTime] [/st StartTime] [/ri Interval] [{/et EndTime | /du Duration} [/k]] [/sd StartDate] [/ed EndDate] [/it] [/Z] [/F]

We will use the follow two commands, the first one cleans up any existing tasks:


Schtasks /delete /tn "Run BBS" /f /s COMP1 /u COMP1\U01 /p P1234


Schtasks /create /sc once /tn "Run BBS" /st %hh%:%mm% /s COMP1 /u COMP1\U01 /p P1234 /tr "\"C:\\Program Files (x86)\\Voicent\\BroadcastBySMS\\bin\\scase.exe\" -numbers \"%phoneno%\" -text \"Voicent Webinar will start in 15 minutes\" \"%soc%\"

The above command will schedule to run BroadcastBySMS once at the specified time %hh%:%mm% (more on this later), using the specified phone number %phoneno% and the specified soc file %soc%. The variables enclosed in % are Windows batch file variables.

Windows batch file

The sample batch file takes two arguments: the first one is the phone number, and the second is the .soc file for BroadcastBySMS. These two arguments are normally passed from your IVR app’s external program action.


set phoneno=%1
set phoneno=%phoneno:"=%
set soc=%2
set soc=%soc:"=%

The above lines take the two command line arguments, and remove the enclosing double quotes.


For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (
set h=%%a
set m=%%b
)

REM remove leading 0
set /a mm=%m%
set /a mm=%mm% + 1
set /a hh=%h%

The above lines set the current hour and minute. Since it is possible to have leading zero for the number, variable hh and mm are used to hold the actual number. Here we use the /a command line switch to tell the system that %m% or %h% are numbers. We then add one minute to the current minute. Otherwise, the task scheduler may complain that the start time is too late.


if %mm% == 60 goto nexthour
goto checkmm

:nexthour
set /a hh=%hh% + 1
set mm=0

Just a few things to take care of if the current minute is 59. We need to advance the hour and set the minute to 0.


:checkmm
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%

Then we add the leading zero back to the hour and minute if needed. Now we are ready to call the two windows task scheduler command as shown above. The whole batch file is shown below:


set phoneno=%1
set phoneno=%phoneno:"=%
set soc=%2
set soc=%soc:"=%

For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (
set h=%%a
set m=%%b
)

REM remove leading 0
set /a mm=%m%
set /a mm=%mm% + 1
set /a hh=%h%

if %mm% == 60 goto nexthour
goto checkmm

:nexthour
set /a hh=%hh% + 1
set mm=0

:checkmm
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%

schtasks /delete /tn "Run BBS From Workflow" /f /s COMP1 /u COMP1\U01 /p P1234

schtasks /create /sc once /tn "Run BBS From Workflow" /st %hh%:%mm% /s COMP1 /u COMP1\U01 /p P1234 /tr "\"C:\\Program Files (x86)\\Voicent\\BroadcastBySMS\\bin\\scase.exe\" -numbers \"%phoneno%\" -startnow -text \"webinar starts in next 15 minutes\" \"%soc%\""

You should be able to use the above script in your IVR app. Just make sure to change the computer name, user name, and password used in the script.

Posted in IVR Developer |

IVR Studio – Call Transfer with Timeout

From IVR Studio software sometimes my customers have to wait 15-20 minutes when transferring to a live agent and give up. Is there anything I can do so that when people wait over a certain period of time I can offer them to leave a recording and have someone contact them back?

In IVR Studio you will create a call transfer element that includes:

  • Music on hold
  • A timeout time
  • The agent group you are transferring too.

As below:

When designing your IVR Studio prompt you will need to add a “Goto” prompt below the call transfer. As seen above the call transfer has a timeout of 60 seconds. After the user has been on hold for 60 seconds, it will execute the “Goto” which sends the user back to the “Main Menu” as below.

Back on the main menu the user will have all options available to him. Also you can have the user leave a recording instead of being put back in the transfer que.

Posted in IVR Usage |

Recording prompt has empty recordings

I created an IVR Studio prompt that allows my customers to leave a recording and then it sends me an email. The problem I am having is that it will send the email that someone left a recording, but there is no actual recording. What can I do to fix this problem?

When creating the IVR Studio design, you will want to add a few extra layers to it. These extra layers would include: Checking the file size, checking to see if the user hangs up during the recording, as well as checking to see if the audio file exists. In this scenario, our recording will use the variable name ‘audiofile‘.

Checking the audio file size:
After the recording element, you will want to add a conditional statement similar to:
audiofile.filesize() > 1000
Where 102400 is the number of bytes. Typically you want to check for a size at least bigger than 1kb, which would be approximately a 1 second recording.

Checking for a telephone hang up:
After your recording element, similar to checking the audio file size, you will want to check for a ‘telephone.hangup’ exception.
telephone.hangup
If they hung up the phone mid recording, it will execute this prompt.

Checking if the file exists:
After your ‘telephone.hangup’ exception prompt, you will want to make a child prompt that checks to see if the audio file exists. Adding a conditional statement will easily allow you to do this.
audiofile.fileexists()

Below is an example image showing the above scenario.

Posted in IVR Usage |