I have tried many things using aspect scripting in the past few months, and have succeeded in many. Currently, the bane of my existence (a traditionally simple login script for a voicemail system) has culminated into one simple yet surprisingly difficult problem. I have set up this “login script” of mine to select a couple menu options when the main menu appears. To do this I have just used a simple waitfor “xxxx” command. This works correctly. The problem I have is that this voicemail system will often present an error (“ANP register failure”). The user must then close the connection and then re-log back in. What I am trying to do is simplify this task and have my switch close the connection and then dial again as well as reprocess the login before resuming the original script. I have created the script using the following commands…
if waitfor “ANP register failure”
Call anperror
else
Call noerror
endif
endproc
The problem is that if the script encounters the error the first time, it works correctly since you don’t get the error twice. If the login processes correctly and the error doesn’t come up, you have to wait 30 seconds for the waitfor command to timeout.
What I was thinking I needed to do is have the script actively wait for either “ANP register failure” or the main menu at the same time. Once either criteria is met, the script would then process the correct procedure…. I think it would look something like this:
waitfor “ANP register failure” | "^@^@^@^H^H^H^H^H^H^H^H"
if “ANP register failure”
Call anperror
elseif "^@^@^@^H^H^H^H^H^H^H^H"
Call noerror
endif
endproc
This of course, does not work. I was however, able to get it to work using the following commands…
when QUIET 4 call anperror
if waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endif
The finalized script appears as follows. NOTE: I have replaced specific portions of the script with a description of what should be there...i.e. username and password info have been removed..etc.... Also with the system I was accessing, to load a subscribers voicemail box you have to use a specially mapped key and not just the plain old enter key... i have mapped the necessary key sequence to F12 and have used the vkey (0x7B) that references that key...
string ctn
proc main
pwtitlebar "NAME OF VM SYSTEM HERE" PERMANENT
waitfor "login: "
transmit "putusernamehere^M"
waitfor "Password:"
transmit "putpasswordhere^M"
when QUIET 4 call anperror
if waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endif
endproc
proc noerror
when CLEAR
transmit "1^M"
waitfor "^@^@^@"
if sdlginput "ACCESS VOICEMAIL SUBSCRIBER" "PLEASE ENTER CTN:" ctn
if isfile ctn
endif
transmit ctn
endif
sendvkey 0x7B
halt
endproc
proc anperror
HANGUP
dial TELNET "CONNECTION DIRECTORY ENTRY"
waitfor "login: "
transmit "putusernamehere^M"
waitfor "Password:"
transmit "putpasswordhere^M"
waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endproc
if waitfor “ANP register failure”
Call anperror
else
Call noerror
endif
endproc
The problem is that if the script encounters the error the first time, it works correctly since you don’t get the error twice. If the login processes correctly and the error doesn’t come up, you have to wait 30 seconds for the waitfor command to timeout.
What I was thinking I needed to do is have the script actively wait for either “ANP register failure” or the main menu at the same time. Once either criteria is met, the script would then process the correct procedure…. I think it would look something like this:
waitfor “ANP register failure” | "^@^@^@^H^H^H^H^H^H^H^H"
if “ANP register failure”
Call anperror
elseif "^@^@^@^H^H^H^H^H^H^H^H"
Call noerror
endif
endproc
This of course, does not work. I was however, able to get it to work using the following commands…
when QUIET 4 call anperror
if waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endif
The finalized script appears as follows. NOTE: I have replaced specific portions of the script with a description of what should be there...i.e. username and password info have been removed..etc.... Also with the system I was accessing, to load a subscribers voicemail box you have to use a specially mapped key and not just the plain old enter key... i have mapped the necessary key sequence to F12 and have used the vkey (0x7B) that references that key...
string ctn
proc main
pwtitlebar "NAME OF VM SYSTEM HERE" PERMANENT
waitfor "login: "
transmit "putusernamehere^M"
waitfor "Password:"
transmit "putpasswordhere^M"
when QUIET 4 call anperror
if waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endif
endproc
proc noerror
when CLEAR
transmit "1^M"
waitfor "^@^@^@"
if sdlginput "ACCESS VOICEMAIL SUBSCRIBER" "PLEASE ENTER CTN:" ctn
if isfile ctn
endif
transmit ctn
endif
sendvkey 0x7B
halt
endproc
proc anperror
HANGUP
dial TELNET "CONNECTION DIRECTORY ENTRY"
waitfor "login: "
transmit "putusernamehere^M"
waitfor "Password:"
transmit "putpasswordhere^M"
waitfor "^@^@^@^H^H^H^H^H^H^H^H"
call noerror
endproc