AM4PM v0.5c (29 May 1993) What is AM4PM? AM4PM is a simple answering machine program for OS/2 2.x PM and ZyXEL 1496. I wrote it for personal use because I could not find a suitable program. When I started to write it I had the following objectives: - To be able to distinguish between voice/fax/modem. - I did not want to write fax or modem software. I must therefore be able to use external programs for this purpose. - To be able to listen to recorded messages from a remote phone. - To make a program that could easily be modified without having to recompile my code. - To make the program give up the COM port if another program needs it. Other things on the wish list was: call my personal pager or a special phone number if an important message is recorded, change greeting message from a remote phone or at a specified time, use some external program such as ZIP to compress the voice files. Not all these features have been implemented yet, but be patient; some day they will. I must also admit the documentation might need some further work. PLEASE note that this documentation does not describe how the ZyXEL modem works. To be able to modify the program a good knowledge of the voice AT commands is required. AM4PM is a public domain program. It is free to use and free to distribute as long as unmodified versions of all the original programs and this document is included. Please report any grammatical or spelling errors in this text to me. How else can I learn to write accurate English? I take no responsibility whatsoever for any damage AM4PM can cause. Neither do I guarantee the functionality of the program. I might not be able to fix all bugs and answer all questions about AM4PM, but I would like to be informed about problems and ideas on further development. The program have been tested on a 486 clone with a 16550A running OS/2 2.1 march beta and a ZyXEL 1496+ ROM v6.00. Thomas Olsson G”teborg, Sweden email d8olsth@dtek.chalmers.se What is included in this version? Most of the functionality is programmed in REXX. AM4PM adds some functions to the REXX language that makes it possible to control the modem. The REXX script that comes with AM4PM gives the following functionality: - The program can be set to answer after a predifined number of signals. It will then play a greeting message. A short beep indicates the end of the greeting message and the beginning of the recording. - If a voice is heard during recording the message will be saved. The end of the message is determined either by 7 s of silence or after a specific maximum time. - If a fax calling tone or a DTMF '5' is heard during playback or recording AM4PM will try to see if it is a fax or a modem. This will also happen if no voice has been heard for the first 7 s of recording. - If a DTMF '*' is heard during playback or recording AM4PM will enter command mode. A command consists of a DTMF '*' and number followed by a DTMF '#'. The only available command will make it possible listen to recorded messages from a remote phone. - The COM port can be released by starting AM4PMCMD with the command 'r'. The port can also be released by pressing the 'Release' button in the PM window. AM4PM will try to open the port again every 30 s. The functions of the program The main window presents a list of recorded messages. The date of the recording is displayed together with the length of the message if it was recorded in CELP mode. If any settings are changed in the settings window restart the program to make sure they take effect. Play By selecting one or more messages in the list and then press Play the messages will be played in the modems internal speaker. Delete By selecting one or more messages in the list and then press Delete the messages will be deleted. If Delete is pressed during playback the messages will be played first. Abort By pressing Abort the current playback or recording is aborted. If a delete operation is delayed due to a playback the delete operation will also be aborted. Release Pressing Release will release the COM port for 30s. The program will then try to reopen to COM port every 30 second. This can also be accomplished by starting the program AM4PMCMD with the parameter R. The REXX functions handle = AMGetHotComm() AM4PM stops using the COM port until AMReleaseHotComm is called. The port is not closed. A file handle to the open port is returned and can be used as a parameter to other programs such as REFAX/2 and OS2YOU. The port settings, such as speed and handshaking, is undefined and must be set by the called program. CALL AMReleaseHotComm AM4PM reinitializes the port and starts listen for input again. CALL AMDPrint text Prints text to the debug window. Debugging printouts are enabled by starting the debug printout application and then start AM4PM with the switch '-d'. filename = AMOpenRecFile(mode) Creates a unique file used for storing messages in. The filename is returned. The file is created in the current directory and is called Mnnnn.ZVD where nnnn is a unique number. The mode is used for setting the voice mode in the modem by sending 'AT+VSM'. The following modes are supported on a ZyXEL 1496E+ with ROM v6.00: 1. CELP 9600 baud. High compression. Fairly good quality. 2. bit ADPCM 19200 baud. Bad quality. 3. bit ADPCM 28800 baud. Good quality. Receiving of a message is started by calling AMStartRec and ended by calling AMEndRec. The file must be closed by calling AMCloseRecFile. CALL AMCloseRecFile Close the message file opened by calling AMOpenRecFile. dlecode = AMPlayFile(filename) Play the file filename. If a DLE code is returned from the modem the playback is aborted and the code is returned. Otherwise a blank is returned. At least following codes can be returned: '0'-'9', '*', '#' A DTMF code was received. c A fax calling tone was received. b A busy tone was received. CALL AMStartRec Starts recording. The message is saved in the current message file opened by calling AMOpenRecFile. The recording is stopped by calling AMEndRec and the file is closed by calling AmCloseRecFile. The function AMWaitDLECode is normally called between this call and AMEndRec to see if any DLE codes are heard. CALL AMEndRec Ends the recording. The file must be closed by calling AMCloseRecFile. CALL AMStartListenDLECode Start recording but does not save the message to a file. This is used to listen for DLE codes. The listening must be stopped by calling AMEndListenDLECode. The function AMWaitDLECode is normally called between this call and AMEndListenDLECode to see if any DLE codes are heard. CALL AMEndListenDLECode Ends the listening for DLE codes. dlecode = AMWaitDLECode() Listen for DLE codes during recording started either by AMStartRec or AMStartListenDLECode. At least the following codes can be returned '0'-'9', '*', '#' A DTMF code was received. c A fax calling tone was received. b A busy tone was received. q Quiet detected. Some voice was heard at the beginning, but now there is silence. s Silence was detected. No voice has been heard at all. dceresp = AMSendW(text) Sends the text text followed by CR/LF to the modem and then waits for a response. The response is returned. Note that this functions waits for a LF to be received from the modem. dceresp = AMGetMoreDCEResp() If more then one string is returned from the modem as a response to AMSendW this function can the be used to retrieve them. rc = AMStartProg(command) Starts the program found at the beginning of the string command. The program name must be given without path and extension. The environment variable path will be used when searching for the file. All text following the program name will be used as a parameter to the program. The programs return code is returned. The program will be started minimized and closed when the session ends unless AM4PM is in debug mode. CALL AMSetStateText text The text in the AM4PM window under the heading 'State' is set to text. The text is reset to 'Waiting for call' when the rexx program terminates. CALL AMSetLastEventText text The text in the AM4PM window under the heading 'Last event' is set to text. The text is set to 'Abort' when Abort is pressed. Functions I will add some day - Make it remember the screen position. - Better error handling. - Possibility to use an external program such as ZIP to compress/decompress to message files. - Use extended attributes to store the length of the message in seconds and the caller id. - Keep track of messages that have never been listened to and mark them in some way in the list. - Possibility to use another device, such as a SB card, to play the messages. This would be easy if I could only find an OS/2 program for playing VOC files.