The following sample REXX code illustrates an outbound notification 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 hard-coded 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 exit 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 */ /*---------------------------------------*/ ... ... return 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
Copyright © 2012 CA. All rights reserved. |
|