When coding such a VOX environment application, use the following ADDRESS VOX commands:
Initiates a phone call and automatically play a voice file or words from a word library when a caller picks up the phone. The advantage of using CALLPLAY instead of CALL then PLAY is that the VOX environment automatically loads the voice message segment to play prior to making the call, improving performance during initiation of the call.
Obtains an available channel using a hard-coded channel number or retrieving a channel from a group.
Obtains user's user ID (in DTMF tones), assuming the voice message segment played with CALLPLAY has prompted the user appropriately.
Used to notify the caller that recording is about to begin.
Plays voice messages with a prompt to retrieve the user's response to the prompt. We recommend you use PLAYGETDIGITS instead of PLAY then GETDIGITS because it facilitates an improved reading and maintenance of your application.
Records the caller's message.
Releases the channel used by the phone call, making it available again.
Verifies the connecting caller.
The following sample REXX code illustrates an outbound recording with voice message delivery application:
/* REXX */
ChannelInUse = 'N' /* Channel not obtained yet */
/* Setup Error Handler in the event program encounters Ctrl-Break */
SIGNAL ON HALT NAME DOEXIT
...
/* Logic to determine which phone number to call */
/* goes here. */
/* REXX variable PhoneNumber is set by user's */
/* application...it is hardcoded for */
/* illustration purposes. */
PhoneNumber = '9,1800-555-1212'
Call GetFreeChannel
Call MakeOutboundCall PhoneNumber
Call UserApplication
Call ReleaseTheChannel
exit
GetFreeChannel:
/*----------------------------------------------*/
/* Obtain an available voice channel */
/* Channel can be obtained by channel number */
/* or by Group, in this example, a Group of ALL */
/* is used...... */
/*----------------------------------------------*/
Address VOX "GETCHANNEL Group(All) Prefix(Handle)"
If (rc <> 0) Then Do
say 'Unable to obtain an available channel. RC='rc
return 16
End
ChannelInUse = 'Y' /* remember we now have a channel */
return
MakeOutboundCall:
Arg OutboundNumber
/*-----------------------------------------------*/
/* Call number and play preliminary greeting */
/* For improved performance, use VOX CALLPLAY */
/* since VOX message to be played is loaded into */
/* memory prior to making phone call. */
/*-----------------------------------------------*/
OutboundNumber = STRIP(OutboundNumber)
GreetingToPlay = 'greeting.vox getuserid.vox'
Address VOX "CALLPLAY Channel("Handle") ",
"ToneString("OutboundNumber") ",
"File("GreetingToPlay") FILETYPE(NONINDEX)"
If (rc <> 0) Then Do
say 'Problem calling number: 'OutboundNumber ' RC='rc
return 16
End
/* Before returning to main line code, you may want to */
/* verify connecting caller, you can use VOX GETDIGITS,*/
/* PLAYGETDIGITS and VERIFYUSER commands... */
IdLen = 6 /* Assume Userid is length 6 */
PinLen = 6 /* Assume Pin # is length 6 */
Address VOX "GETDIGITS Channel("Handle") ",
"Count("IdLen") Prefix(CallerId)"
If (rc <> 0) Then Do
say 'Problem obtaining caller userid RC='rc
return 16
End
/* Get caller's pin number. */
Address VOX "PLAYGETDIGITS CHANNEL("Handle") ",
"FILE(GetPin.Vox) FILETYPE(NONINDEX)",
"COUNT("PinLen") PREFIX(CallerPin)"
If (rc <> 0) Then Do
say 'Problem obtaining caller pin number RC='rc
return 16
End
/* Verify the connected phone call */
Address VOX "VERIFYUSER Userid("CallerId") Pin("CallerPin")"
If (rc <> 0) Then Do
say 'Unable to Verify Caller RC='rc
return 16
End
/* Caller is OK, now we can return to main line */
return 0
UserApplication:
/*---------------------------------------*/
/* User specific application can go here */
/*---------------------------------------*/
StatusMsg = 'SYS1STAT.VOX' /* actual system status VOX file */
TmpMsg = '$STAT.VOX' /* temporary hold for a VOX file */
PromptForRecord = 'StrRecd.Vox' /* Vox file to prompt */
/* for recording */
PromptUserOptions = 'UserOpts.Vox'/* Vox file to prompt */
/* user with options */
SupportMgrExt = '1555' /* Support Manager's Extension */
MgrMsg = 'STATCHG.VOX 'StatusMsg /* Vox files to play */
/* to support mgr */
Msg = 'Problem has been detected by application '
ReRecord:
/* Prompt User before beginning recording session */
Address VOX "PLAY Channel("Handle") ",
"File("PromptForRecord") FILETYPE(NONINDEX) "
Address VOX "RECORDFILE Channel("Handle") ",
"File("TmpMsg") OverWrite(YES) ",
"Interrupt(YES) "
If (rc <> 0) Then Do
/* Tell connecting caller a problem has been encountered */
say Msg ' RECORDFILE RC: ' rc
Address VOX "PLAY Channel("Handle") ",
"FILE(VOXF_A) FILETYPE(WORDLIB) VAR(Msg)"
return 16
End
PromptAgain:
UserSelection = ''
/* Present User with Options for the recording */
Address VOX "PLAYGETDIGITS Channel("Handle") ",
"File("PromptUserOptions") FILETYPE(NONINDEX) ",
"Count(1) Prefix(UserSelection) "
If (rc <> 0) Then Do
/* Tell connecting caller a problem has been encountered */
say Msg ' PLAYGETDIGITS RC: ' rc
Address VOX "PLAY Channel("Handle") ",
"FILE(VOXF_A) FILETYPE(WORDLIB) VAR(Msg)"
return 16
End
/* Process User's Response */
/* 1 - Accept new recording and terminate */
/* 2 - Rerecord the message */
/* 3 - Terminate without saving recording */
Select
When (UserSelection == 1) Then Do
/* Update the system status message */
'COPY 'TmpMsg StatusMsg
End
When (UserSelection == 2) Then Do
/* Prompt user to rerecord the message */
Signal ReRecord
End
When (UserSelection == 3) Then Do
/* don't update the system status message */
nop
End
Otherwise
/* User Specified unrecognized option */
Signal PromptAgain
End
Msg = 'Goodbye'
Address VOX "PLAY Channel("Handle") ",
"FILE(VOXF_A) FILETYPE(WORDLIB) VAR(Msg)"
/* Inform Support Manager that System Status has been updated */
/* So, hangup this call then call the support manager */
Address VOX "SETHOOK CHANNEL("Handle") HOOKSTATE(ONHOOK)"
Address VOX "CALLPLAY CHANNEL("Handle") TONESTRING("SupportMgrExt")" ,
"FILE("MgrMsg") FILETYPE(NONINDEX)"
If (rc <> 0) Then Do
/* Unable to call support manager .... */
say Msg ' CALLPLAY RC:' rc
return 16
End
return 0
ReleaseTheChannel:
/*--------------------------------------------*/
/* Release the channel obtained, this is done */
/* by calling VOX RELEASECHANNEL command */
/*--------------------------------------------*/
If (ChannelInUse = 'Y') Then Do
Address VOX "RELEASECHANNEL Channel("Handle")
If (rc <> 0) Then Do
say 'Unable to release channel RC='rc
End
Else
ChannelInUse = 'N'
End
return
DoExit:
/*---------------------------------------------------*/
/* Perform any necessary cleanup such as releasing */
/* the channel by calling VOX RELEASECHANNEL command */
/*---------------------------------------------------*/
Call ReleaseTheChannel
/* perform other application specific cleanup */
....
...
/* terminate application */
exit
return
Typically, an outbound recording with voice message delivery application involves the VOX environment making a phone call and retrieving user security information prior to allowing a user to record a voice message. Depending on the application, voice messages can be deleted, recorded again, or forwarded to others.
An example of an outbound recording with voice message delivery could be when maintaining system status on a daily basis, where an individual within a support group could be responsible for updating the system status every hour.
| Copyright © 2012 CA. All rights reserved. |
|