home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / voice.zip / V_DIAL.CMD < prev    next >
OS/2 REXX Batch file  |  1996-09-09  |  7KB  |  171 lines

  1. /* V_DIAL.CMD - Voice/Fax DIAL Script for FaxWorks/PMfax (REXX) */
  2. /* 
  3.                   Keller Group Inc.  May 1996
  4.    You may freely use or modify this script for use with licensed
  5.         products which are developed by Keller Group Inc.
  6.       For new scripts or to share your scripts with others,
  7.                  see http://www.kellergroup.com
  8. */
  9. /*******************************************************************
  10. V_DIAL.CMD - Dial Script Example - "Person detection" for fax modems
  11.  
  12. Supported features:
  13.     Voice announcement during outbound calls
  14.     Called party can cancel fax and have it reported as "Voice"
  15.     Called party can leave a message (to provide correct fax number)
  16.     Can be customized to support voice message broadcasting, etc.
  17.     Full source code in REXX - modify as needed
  18.  
  19. DESCRIPTION:
  20. -----------
  21. This is a DIAL script which can be used for dialing outgoing fax
  22. calls.  It provides a useful "value-added" service for outbound fax
  23. calls, and it also serves as an example of how you could do
  24. specialized "voice message broadcasting" using a dial script.
  25.  
  26. Background: Some high-end fax boards such as Brooktrout can detect
  27. the difference between a normal "no carrier" fax call (where
  28. something answered but we never heard the fax carrier tones) and a
  29. "voice" call (where something answered and we never heard the fax
  30. carrier tones, but we also think it was a person).  This "Voice!"
  31. status is useful since it may mean that we dialed a wrong number, and
  32. the software can cancel further automatic retries on this fax job to
  33. avoid bothering the person again.
  34.  
  35. Fax modems do not provide this feature.  Instead, they would just
  36. report a wrong number as a "no carrier" and we would keep retrying
  37. the fax job.  If we are using automatic retries, the called party may
  38. get quite upset with the repeated calls from the fax modem.
  39.  
  40. But by using this script as the "dial script" with voice/fax modems,
  41. you can announce that you are sending a fax and give the called party
  42. a chance to cancel retry attempts by pressing a touch tone key.  If
  43. they do this, we will report the status of the fax job as "Voice!"
  44. and further retries will then be cancelled by the software.  The
  45. called party also has the option of leaving you a voice message (to
  46. tell you the correct fax number, yelling at you for bothering them,
  47. etc.).  If no one enters a key, the script assumes that it has
  48. reached a fax machine and sends the fax.
  49.  
  50. USAGE INSTRUCTIONS:
  51. ------------------
  52. You must be using the program with supported voice/fax hardware to
  53. use this script.  Consult the README.DOC file for tested voice/fax
  54. hardware and recommended configuration settings for your hardware.
  55. Before using this script, first test your system with our built-in
  56. voice answering machine feature by enabling "Voice" and setting the
  57. "Answer script" to * (an asterisk character) on the Voice page of the
  58. Settings notebook.  If you are using supported voice/fax hardware
  59. with the proper configuration settings, you can then use
  60. "Fax/Receive/All calls" mode to answer calls, play the outgoing
  61. message (OGM), and record a voice message (or receive a fax).
  62.  
  63. Then, to try this advanced script, specify the full pathname of this
  64. file in the "Dial script" field on the Voice page of the settings
  65. notebook.  Test the script by sending faxes to both normal fax
  66. machine and to your voice phone line.
  67.  
  68. NOTE: The script expects to find its Wave audio files in the fax
  69. program (EXE) directory.  The script also uses Wave files from the
  70. c:\mmos2\sounds directory for special effects.
  71.  
  72. SCRIPT VARIABLES:
  73. ----------------
  74. The following script variable is used by this script.  Script
  75. variables are set on the Voice page of the Settings Notebook.
  76.  
  77.     None.
  78.  
  79. VOICE PROMPT FILES:
  80. ------------------
  81. The script expects to find the following Wave audio files in the fax
  82. program (EXE) directory.  The script also uses Wave files from the
  83. c:\mmos2\sounds directory for special effects.
  84.  
  85. To record or modify your own voice prompt files, use your OS/2
  86. Multimedia microphone and record voice prompts using the "Fax/New
  87. message" command then save them to a .WAV file with the "Fax/Save
  88. file/Wave" command.  You can also use the OS/2 Digital Audio program
  89. to record, save, edit and modify the Wave files (be sure to use
  90. "Type" of Mono, 8-bit, 11.025 kHz).
  91.  
  92.     DIAL_FAX.WAV - "This is a fax call.  Please activate your fax
  93.     machine, or press 1 if we called the wrong number."
  94.  
  95.     DIAL_MSG.WAV - "We are sorry for the inconvenience.  If you
  96.     wish to leave us a message, please press 1.  Thank you."
  97.  
  98.     ENTR_MSG.WAV - Short: "Enter message."
  99.     Long: "Please leave your message at the beep."
  100.  
  101. TO MODIFY THE SCRIPT:
  102. --------------------
  103. The script is REXX and uses calls from the Keller REXX API which are
  104. automatically loaded into the OS/2 REXX environment by the retail
  105. versions of Keller's fax products (version 3.0 and later).  See the
  106. Reference Manual for documentation of the FxRx and FxLn calls.  You
  107. may modify the script as desired, and then use it as the "Dial
  108. script" with Keller fax software products.
  109.  
  110. *******************************************************************/
  111.  
  112. call FxLnInit
  113.  
  114. VOXDIR = FxRxPath( 'EXE' )        /* get prompts from exe dir */
  115.  
  116. call FxLnPlay VOXDIR||'DIAL_FAX.WAV'    /* play the greeting prompt */
  117.     if result = 'NOTOK' then signal fax
  118.     if result = 'FAX' then signal fax
  119.     if result = 'DATA' then signal data
  120.  
  121. call FxLnDtmf 1, 5, 'digit'        /* get user key, 5 sec timeout */
  122.     if result = 'DTMF' then signal voice   /* key ==> person answered */
  123.     if result = 'DATA' then signal data
  124.     signal fax                   /* otherwise try to send */
  125.  
  126. voice:
  127.     call FxLnMsg 'Person detected'
  128.     LREC.!Status = 'Voice!'        /* fax status will be Voice */
  129.     
  130.     call FxLnPlay VOXDIR||'DIAL_MSG.WAV'   /* play the message prompt */
  131.         if result = 'NOTOK' then signal out
  132.  
  133.     call FxLnDtmf 1, 10, 'digit'    /* get user key, 10 sec timeout */
  134.         if result <> 'DTMF' then signal out
  135.  
  136.     /* caller wishes to leave us a message... */
  137.     /* first save fax record  */
  138.     /* You'd think REXX would do "FaxRec. = LREC.", but it doesn't. */ 
  139.     /* So rather than using REXXLIB, we'll use our format/parse.    */
  140.     FaxRec = FxRxFormatLog( 'LREC' )
  141.     LREC. = ''                /* clear the log record */
  142.     
  143.     call FxLnMsg "Record Msg"
  144.     call FxLnPlay VOXDIR||'ENTR_MSG.WAV'
  145.         if result = 'NOTOK' then signal voiceout
  146.     call FxLnTone 1850
  147.         if result = 'NOTOK' then signal voiceout
  148.     call FxLnDtmf    /* flush dtmf buffer */
  149.     call FxLnRecord
  150.         if result = 'NOTOK' then signal voiceout
  151.     /* Caller can press key or hangup to end message */
  152.     call FxLnTone 1850, 1850, 1850
  153.  
  154. voiceout:
  155.     call FxLnLog            /* log the voice message */
  156.     call FxRxParseLog FaxRec, 'LREC'    /* restore the fax record */
  157.     signal out
  158.  
  159. fax:                    /* send fax and hangup */
  160.     call FxLnSend
  161.     signal out
  162.  
  163. data:                    /* report data call, hangup*/
  164.     call FxLnMsg 'Data call, oh well...'
  165.     LREC.!Status = '*Data!'        /* set status of call */
  166.     signal out
  167.  
  168. out:                    /* log fax status and quit */
  169.     call FxLnTerm
  170.     exit
  171.