home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / am4pm08f.zip / AM4PM.TXT < prev    next >
Text File  |  1993-07-14  |  19KB  |  567 lines

  1. AM4PM.DOC 93-07-14 Rev 24
  2.  
  3.  
  4.    What is AM4PM?
  5.    
  6.   AM4PM is a simple answering machine program for OS/2 2.x PM and
  7.   ZyXEL  1496.  I wrote it for personal use because I  could  not
  8.   find  a suitable program. When I started to write it I had  the
  9.   following objectives:
  10.   
  11.   - To be able to distinguish between voice/fax/modem.
  12.     
  13.   - To  be  able  to  use  external programs for  modem  and  fax
  14.     handling. I did not want to write these.
  15.     
  16.   - To  be  able  to  listen to recorded messages from  a  remote
  17.     phone.
  18.     
  19.   - To  make  a  program  that could easily be  modified  without
  20.     having to recompile my code.
  21.     
  22.   - To  make  the program give up the COM port if another program
  23.     needs it.
  24.     
  25.   Other things on the wish list were: call my personal pager or a
  26.   special  phone  number  if an important  message  is  recorded,
  27.   change  the  greeting  message from a  remote  phone  or  at  a
  28.   specified  time,  use  some external program  such  as  ZIP  to
  29.   compress the voice files.
  30.   
  31.   Not  all  these  features  have been implemented  yet,  but  be
  32.   patient;   some   day  they  will.  I  must  also   admit   the
  33.   documentation might need some further work.
  34.   
  35.   PLEASE  note that this documentation does not describe how  the
  36.   ZyXEL  modem  works. To be able to modify the  program  a  good
  37.   knowledge of the voice AT commands is required.
  38.   
  39.   AM4PM is a public domain program. It is free to use and free to
  40.   distribute  as long as unmodified versions of all the  original
  41.   programs  and  this  document are included. Please  report  any
  42.   grammatical or spelling errors in this text to me. How else can
  43.   I learn to write correct English?
  44.   
  45.   I  take  no responsibility whatsoever for any damage AM4PM  can
  46.   cause. Neither do I guarantee the functionality of the program.
  47.   
  48.   I  might  not be able to fix all bugs and answer all  questions
  49.   about AM4PM, but I would like to be informed about problems and
  50.   ideas on further development.
  51.   
  52.   The  program  have  been tested on a 486 clone  with  a  16550A
  53.   running OS/2 2.1 march beta and a ZyXEL 1496+ ROM v6.00.
  54.   
  55.   Thomas Olsson
  56.   Göteborg, Sweden
  57.   email d8olsth@dtek.chalmers.se
  58.   
  59.  
  60.  
  61.    What is included in this version?
  62.    
  63.   Most  of  the functionality is programmed in REXX.  AM4PM  adds
  64.   some  functions to the REXX language that makes it possible  to
  65.   control the modem. The REXX scripts that comes with AM4PM gives
  66.   the following functionality:
  67.   
  68.   - The program can be set to answer after a predifined number of
  69.     rings.  It will answer after the programmed number  of  times
  70.     minus one if there are messages waiting. It will then play  a
  71.     greeting  message.  A short beep indicates  the  end  of  the
  72.     greeting message and the beginning of the recording.
  73.     
  74.   - If  a  voice  is heard during recording the message  will  be
  75.     saved. The end of the message is determined either by 7 s  of
  76.     silence or after a specific maximum time.
  77.     
  78.   - If a fax calling tone  or a DTMF '5' is heard during playback
  79.     or recording AM4PM will try to see if it is a fax or a modem.
  80.     This  will  also happen if no voice has been  heard  for  the
  81.     first 7 s of recording.
  82.     
  83.   - If  a  DTMF  '*' is heard during playback or recording  AM4PM
  84.     will enter command mode. A command consists of a DTMF '*' and
  85.     a  number followed by a DTMF '#'. The only available  command
  86.     will  make  it  possible listen to recorded messages  from  a
  87.     remote phone.
  88.     
  89.   - The  COM  port can be released by starting AM4PMCMD with  the
  90.     command  'R'.  The port can also be released by pressing  the
  91.     'Release' button in the PM window. AM4PM will try to open the
  92.     port again after 30 s and thereafter every ten seconds.
  93.     
  94.  
  95.  
  96.    The functions of the program
  97.    
  98.   The  main window presents a list of recorded messages. The date
  99.   of  the recording is displayed together with the length of  the
  100.   message if it was recorded in CELP mode.
  101.   
  102.   To  display  the  popup menu press the right  mouse  button  or
  103.   sh-F10.
  104.   
  105.   
  106.   Play
  107.   By  selecting  one  or  more messages  in  the  list  and  then
  108.   selecting  Play  the  messages will be played  in  the  modem's
  109.   internal speaker.
  110.   
  111.   
  112.   Delete
  113.   By  selecting  one  or  more messages  in  the  list  and  then
  114.   selecting  Delete the messages will be deleted.  If  Delete  is
  115.   pressed during playback the messages will be played first.
  116.   
  117.   
  118.   File | Play...
  119.   selected.
  120.       selected. When the Play button is pressed the selected file
  121.       will be played in the speaker of the modem.
  122.       
  123.   
  124.   File | Record...
  125.   A  file  dialog  will  be displayed when File  |  Record...  is
  126.   selected. When the Record button is pressed the recording of  a
  127.   message from the microphone connected to the modem will start.
  128.   
  129.   
  130.   Abort
  131.   By  selecting  Abort  the  current  playback  or  recording  is
  132.   aborted. If a delete operation is delayed due to a playback the
  133.   delete operation will also be aborted.
  134.   
  135.   
  136.   Stop
  137.   The current playback or recording will be stopped when Stop  is
  138.   selected.
  139.   
  140.   
  141.   Release
  142.   Selecting  Release  will release the COM port  for  30  s.  The
  143.   program will then try to reopen to COM port every ten seconds.
  144.   
  145.   This  can also be accomplished by starting the program AM4PMCMD
  146.   with the parameter 'R'.
  147.   
  148.  
  149.  
  150.    How to get started
  151.    
  152.   - Put at least all the following files in one directory:
  153.     
  154.      AM4PM.EXE
  155.      AM4PM.MSG
  156.      *.AMC
  157.   
  158.   - Start  AM4PM.EXE. The status bar at the bottom of the  screen
  159.     will  display "Initializing..." and then "Waiting for  call".
  160.     If any other message is written instead check the settings by
  161.     selecting Settings... from the menu.
  162.     
  163.   
  164.   - Make recordings of the following messages:
  165.     
  166. Name               Description
  167. GREETINGS.ZVD      Played when a call is answered.
  168. GREET2.ZVD         Played when someone has pressed the code
  169.                    for listening to the recorded messages.
  170. NOMSG.ZVD          Played to tell that there are no recorded
  171.                    messages.
  172. DELMSG.ZVD         Played to tell that a message has been
  173.                    deleted.
  174. ENDMSG.ZVD         Played to tell that are no more waiting
  175.                    messages.
  176.           
  177.           
  178.   - Change the remote code and the password in RING.AMC.
  179.     
  180.   - If  you  want to use OS2YOU make sure it is in your path.  If
  181.     FaxWorks is to be used to receive faxes see to that FxRcv  is
  182.     in the path.
  183.     
  184.   To  play recorded messages from a remote phone press '*' on the
  185.   phone during the greeting message. This will be acknowledged by
  186.   a  beep. Enter your code (the default code is '123') and  press
  187.   '#'.  The message GREET2.ZVD will be played. If there  are  any
  188.   messages  they will now be played. After all the messages  have
  189.   been  played you will hear ENDMSG.ZVD. If there are no messages
  190.   NOMSG.ZVD is played. During playback of a message you can press
  191.   any of the following keys:
  192.   
  193.   1    Skip to the next message
  194.   
  195.   2    Delete the current message
  196.   
  197.   3    Play the message from the start again
  198.   
  199.  
  200.  
  201.    The REXX scripts
  202.    
  203.   AM4PM  uses REXX scripts for many tasks. This makes it easy  to
  204.   modify and costomize the operation of AM4PM. The scripts called
  205.   normally have the file extension AMC. Some functions are  added
  206.   to the REXX language to control the modem.
  207.   
  208.   
  209.   RING.AMC
  210.   This  script is called when AM4PM receives 'VCON' or  a  string
  211.   starting with 'RING' from the modem.
  212.   
  213.   The first parameter is the string that was recieved before this
  214.   script was started. If it is 'VCON' the hook is already off. If
  215.   it  is a string starting with 'RING' the second parameter tells
  216.   the  number  of rings that has been detected so  far  for  this
  217.   call.  When  the time between two successive rings are  greater
  218.   than  five  seconds they are considered to belong to  different
  219.   calls.
  220.   
  221.   mode
  222.   modem  communiction program if it detects a  fax  or  a  modem.
  223.   Features for listening to recorded messages from a remote phone
  224.   might also be included.
  225.   
  226.   To  save  hard  disk space this script can call  a  compression
  227.   program such as LHARC to compress the recorded messages.
  228.   
  229.   If  CID is supported this script can attach a suitable text  as
  230.   an  EA  with the name .SUBJECT to the recorded file.  The  text
  231.   will be displayed in the list of messages.
  232.   
  233.   The  first  parameter can be used together with the distinctive
  234.   ring  feature of some modems to make AM4PM answer in  different
  235.   ways
  236.   
  237.   
  238.   PLAY.AMC
  239.   This  script is called when the user have selected one or  more
  240.   messages  from  the list in the main window in AM4PM  and  then
  241.   selected Play from the menu.
  242.   
  243.   Input parameter is the name of the file to play.
  244.   
  245.   Normally this script just plays the message through the speaker
  246.   in  the  modem,  but if the message is stored in  a  compressed
  247.   format it is necessay to uncompress it first.
  248.   
  249.   Other  functionality in this script can be to play the  message
  250.   on another device such as a SB card.
  251.   
  252.   
  253.   RECORD.AMC
  254.   This  script  is called when the user selects File |  Record...
  255.   from the menu.
  256.   
  257.   Input parameter is the name of the file to record.
  258.   
  259.   Normally   this  script  just  starts  a  recording  from   the
  260.   microphone  connected  to  the modem. The  recording  continues
  261.   until Stop is selected.
  262.   
  263.   Other functionality in this script can be to record the message
  264.   from another device such as a SB card.
  265.   
  266.   
  267.   DELETE.AMC
  268.   This  script is called when the user have selected one or  more
  269.   messages  from  the list in the main window in AM4PM  and  then
  270.   selected Delete from the menu.
  271.   
  272.   Input parameter is the name of the file to delete.
  273.   
  274.   This script just deletes the file.
  275.   
  276.   
  277.   CID.AMC
  278.   This  script is called when AM4PM receives CID information from
  279.   the modem. The CID messages are identified by the string 'TIME'
  280.   at the beginning.
  281.   
  282.   Input parameter is the the string starting with 'TIME'.
  283.   
  284.   The CID information can be displayed in the last event field of
  285.   AM4PM.
  286.   
  287.   
  288.   INIT.AMC
  289.   This  script  is called every time AM4PM want to  reninitialize
  290.   the modem.
  291.   
  292.   Normally  this  script  resets the modem (ATZ),  disables  echo
  293.   (ATE0) and sets answer mode (AT+FCLASS=8).
  294.   
  295.   
  296.   Other scripts
  297.   Other scripts can be called by using the program AM4PMCMD  (see
  298.   separate description below).
  299.   
  300.   This  can  be  used  when another program wants  to  access  to
  301.   functions  of AM4PM. For example if a voice message  should  be
  302.   delivered  at  a specific time the alarm application  can  call
  303.   AM4PMCMD  to  start  a script. That script can  then  call  the
  304.   number and play the message.
  305.   
  306.  
  307.  
  308.    The REXX functions
  309.    
  310.   
  311.   handle = AMGetHotComm()
  312.   AM4PM  stops  using  the  COM  port until  AMReleaseHotComm  is
  313.   called. The port is not closed. A file handle to the open  port
  314.   is  returned  and can be used as a parameter to other  programs
  315.   such as REFAX/2 and OS2YOU.
  316.   
  317.   The  settings for data format and handshaking are  restored  to
  318.   the same values they had when AM4PM was started.
  319.   
  320.   
  321.   CALL AMReleaseHotComm
  322.   AM4PM  reinitializes  the port and starts listening  for  input
  323.   again.
  324.   
  325.   
  326.   port = AMCloseComm()
  327.   AM4PM  closes  the  COM  port to make  it  available  to  other
  328.   programs.  The port can be reopened by calling AMOpenComm.  The
  329.   port will also be reopened if the script is ended.
  330.   
  331.   
  332.   CALL AMOpenComm
  333.   AM4PM  opens the port and sets the port mode settings.  If  the
  334.   port  can  not be opened this function will retry  to  open  it
  335.   every ten seconds.
  336.   
  337.   
  338.   CALL AMDPrint text
  339.   Prints  text  to  the  debug window.  Debugging  printouts  are
  340.   enabled  by  starting the debug printout application  and  then
  341.   start AM4PM with the switch '-d'.
  342.   
  343.   
  344.   filename = AMOpenRecFile(mode)
  345.   Creates  a  unique  file to be used for storing  messages.  The
  346.   filename  is  returned.  The file is  created  in  the  current
  347.   directory  and  is  called Mnnnn.ZVD where  nnnn  is  a  unique
  348.   number.
  349.   
  350.   The  mode parameter is used for setting the voice mode  in  the
  351.   modem by sending 'AT+VSM'. The following modes are supported on
  352.   a ZyXEL 1496E+ with ROM v6.00:
  353.   
  354.   1.             CELP    9600 baud. High compression. Fairly good
  355.      quality.
  356.      
  357.   2.            bit ADPCM    19200 baud. Bad quality.
  358.      
  359.   3.            bit ADPCM    28800 baud. Good quality.
  360.      
  361.   Reception  of  a  message is started by calling AMStartRec  and
  362.   ended by calling AMEndRec.
  363.   
  364.   The file must be closed by calling AMCloseRecFile.
  365.   
  366.   
  367.   CALL AMCloseRecFile
  368.   Closes the message file opened by calling AMOpenRecFile.
  369.   
  370.   This  function also attaches an EA with the name  AM4PM.LEN  to
  371.   the  file that tells the length of the message in seconds. This
  372.   EA  should  be  of type BINARY and stored as a 32-bit  unsigned
  373.   integer.  The length information will be displayed in the  list
  374.   of  messages.  If  this  EA is not found  the  length  will  be
  375.   calculated as the file size divided by 2000.
  376.   
  377.   
  378.   dlecode = AMPlayFile(filename)
  379.   Plays  the  file filename. If a DLE code is returned  from  the
  380.   modem  the  playback  is  aborted and  the  code  is  returned.
  381.   Otherwise a blank is returned. At least following codes can  be
  382.   returned:
  383.   
  384.   '0'-'9', '*', '#'   A DTMF code was received.
  385.   
  386.   c          A fax calling tone was received.
  387.   
  388.   b          A busy tone was received.
  389.   
  390.   
  391.   CALL AMStartRec
  392.   Starts  recording. The message is saved in the current  message
  393.   file  opened by calling AMOpenRecFile. The recording is stopped
  394.   by   calling  AMEndRec  and  the  file  is  closed  by  calling
  395.   AmCloseRecFile.
  396.   
  397.   The function AMWaitDLECode is normally called between this call
  398.   and AMEndRec to see if any DLE codes are heard.
  399.   
  400.   
  401.   CALL AMEndRec
  402.   Ends  the  recording.  The  file  must  be  closed  by  calling
  403.   AMCloseRecFile.
  404.   
  405.   
  406.   CALL AMStartListenDLECode
  407.   Start  recording but does not save the message to a file.  This
  408.   is  used to listen for DLE codes. The listening must be stopped
  409.   by calling AMEndListenDLECode.
  410.   
  411.   The function AMWaitDLECode is normally called between this call
  412.   and AMEndListenDLECode to see if any DLE codes are heard.
  413.   
  414.   
  415.   CALL AMEndListenDLECode
  416.   Ends the listening for DLE codes.
  417.   
  418.   
  419.   dlecode = AMWaitDLECode()
  420.   Listen  for  DLE  codes  during  recording  started  either  by
  421.   AMStartRec  or  AMStartListenDLECode. At  least  the  following
  422.   codes can be returned
  423.   
  424.   '0'-'9', '*', '#' A DTMF code was received.
  425.                
  426.   c           A fax calling tone was received.
  427.                
  428.   b           A busy tone was received.
  429.                
  430.   q            Quiet  detected.  Some  voice  was  heard  at  the
  431.                beginning, but now there is silence.
  432.                
  433.   s            Silence detected. No voice has been heard at all.
  434.                
  435.   
  436.   dceresp = AMSendW(text)
  437.   Sends  the  text text followed by CR/LF to the modem  and  then
  438.   waits for a response. The response is returned. Note that  this
  439.   functions waits for a LF to be received from the modem.
  440.   
  441.   
  442.   dceresp = AMGetMoreDCEResp()
  443.   response
  444.   response  to AMSendW this function can the be used to  retrieve
  445.   them.
  446.   
  447.   
  448.   rc = AMStartProg(command)
  449.   Starts  the  program  found  at the  beginning  of  the  string
  450.   command.  The  program  name must be  given  without  path  and
  451.   extension.  The  environment variable path will  be  used  when
  452.   searching  for  the file. All text following the  program  name
  453.   will be used as a parameter to the program.
  454.   
  455.   The return code of the program is returned.
  456.   
  457.   The  program  will  be started minimized and  closed  when  the
  458.   session ends unless AM4PM is in debug mode.
  459.   
  460.   
  461.   CALL AMSetStateText text
  462.   Sets the text in the AM4PM window under the heading 'State'  to
  463.   text.
  464.   
  465.   The  text is reset to 'Waiting for call' when the rexx  program
  466.   terminates.
  467.   
  468.   
  469.   CALL AMSetLastEventText text
  470.   Sets  the  text  in  the AM4PM window under the  heading  'Last
  471.   event' to text.
  472.   
  473.   The text is set to 'Abort' when Abort is pressed.
  474.   
  475.   
  476.   value = AMReadIni(key, default)
  477.   Retreives a value from the file AM4PM.INI.
  478.   
  479.   
  480.   CALL AMWriteIni(key, value)
  481.   Sets a value in the file AM4PM.INI.
  482.   
  483.  
  484.  
  485.    The REXX variables
  486.    
  487.   AM4PM adds some variables to the REXX script language.
  488.   
  489.   
  490.   vAMRings
  491.   The  number of rings that should be heard before AM4PM answers.
  492.   This  value can be changed by the script and the new value will
  493.   be stored.
  494.   
  495.   
  496.   vAMMsgs
  497.   The number of messages recorded.
  498.   
  499.  
  500.  
  501.    AM4PMCMD
  502.    
  503.   This program is used for controlling AM4PM from other programs.
  504.   It sends messages to AM4PM. All messages are queued.
  505.   
  506. Command          Description
  507. R                Release COM port for 30 s. AM4PM will
  508.                  then try to reopen the port every 10 s.
  509.                  AM4PMCMD waits until the port is
  510.                  released.
  511. C command        Tells AM4PM to run the script command.
  512.                  AM4PMCMD does not wait for the script
  513.                  to execute. All text after the first
  514.                  space in command will be sent as a
  515.                  parameter to the script. For example
  516.                  the command
  517.                     AM4PMCMD C "play.amc greeting.zvd"
  518.                     
  519.                     will play the message greeting.zvd.
  520.           
  521.           
  522.   A return code of zero indicates a successful call.
  523.   
  524.  
  525.  
  526.    The file AM4PM.INI
  527.    
  528. Key              Description
  529. Rings            The number of rings before answering.
  530. Com              The name of the COM port to open.
  531. Baud             The baud rate to use when communicating
  532.                  with the modem.
  533. Titles           Set to 'Y' if the field titles should
  534.                  be displayed in the list of messages.
  535.           
  536.           
  537.   The  values used by AM4PM must not be changed when the  program
  538.   is  running.  To modify the settings use the variables  in  the
  539.   Rexx script language.
  540.   
  541.   This  file can also be used to store values of other keys  used
  542.   by scripts written for AM4PM. No version of AM4PM will ever use
  543.   a  key starting with an 'x'. This can be used to make sure that
  544.   there is no conflict with future versions.
  545.   
  546.  
  547.  
  548.    Functions I will add some day
  549.    
  550.   -  Better error handling.
  551.       
  552.   -  Keep  track of messages that have never been listened to and
  553.       mark them in some way in the list.
  554.       
  555.   -  The  icon displayed when the program is minimized should  be
  556.       changed when there are messages waiting.
  557.       
  558.   -  Make  it  possible  to  use  AM4PM with  Rockwell  chip  set
  559.       modems.
  560.       
  561.   -  Make  it  possible to change greeting message from a  remote
  562.       phone.
  563.       
  564.   -  An  installation  program  that  generates  the  AMC  script
  565.       files.
  566.       
  567.