# @(#)05	1.1  src/bos/diag/modemcfg/modem_z0.cfg.S, servproc, bos720 1/27/97 08:45:40
 #
 # COMPONENT_NAME: servproc
 #
 # ORIGINS: 27
 #
 #  (C) COPYRIGHT International Business Machines Corp. 1996,1997
 #  All Rights Reserved
 #  Licensed Materials - Property of IBM
 #  US Government Users Restricted Rights - Use, duplication or
 #  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 #
 # FUNCTIONS: Modem configuration file for some early Hayes* compatible modems.
 #  This example uses the ATZ0 reset command to choose the factory defaults.
 #  This setup is recommended for modems that will respond to the ATZ0 command
 #  and which do not respond to the extended (&) commands.  Refer to your modem
 #  manual.
 #
 #  * Trademark of Hayes Microcomputer Products, Inc.
 #
 #  If the modem has configuration switches, they should be set to the
 #  factory default settings.
 #
 # Filename: modem_z0.cfg
 #

 ICDelay 1
 DefaultTO 10
 CallDelay 120
 #  AT  Attention Code            ,   Inserts delay in dialing commands
 #  Z0  Reset. Restore Profile 0 Q0   Turn on responses
 #  E0  Turn echo off            Q1   Turn off responses
 #  V0  Use numeric responses    S0=0 Automatic answer inhibit
 # +++  Escape to command mode   S0=2 Answer on second ring
 #  H0  Hang-up                  X0=0 Limit modem response codes
 #                               T =  Tone mode.  When used as T\r, it is a
 #                                    no op to maintain program synchronization
 #                                    when modem may/will echo the commands.
 #
 #  %N  Call-Out phone number    %P   Paging phone number
 #  %S  Modem speed (available to users)
 #
 # Following are common responses from a wide range of modems:
 # 16, 15, 12, 10, 5 and 1 are connection responses.  Add others as required.
 # 7=busy; 6=no dial tone; 4=error; 3=no carrier; 2=ring; 0=OK
 #
 # PROGRAMMING NOTE: No blanks between double quote marks (").

 condout:    send "ATZ0Q0T\r"                    # Reset modem. Select profile 0
             ignore "0\r" or "OK\r\n" timeout 2  # Ignore modem response.
             send "ATE0T\r"                      # Initialize modem: Echo OFF,
             expect "0\r" or "OK\r\n" timeout 2  #  Enable responses (Numeric),
             send "ATQ0V0X0T\r"                  #  Limit response codes.
             expect "0\r" timeout 2              # Confirm commands successful.
             send "ATS0=0\r"                     # Set AutoAnswer OFF
             expect "0\r" timeout 2              # Confirm command successful.
             done

 connect:    send "ATDT%N\r"                     # Tone dialing command.
                                                 # %N from Call Home setup.

                                                 # Expect a connection response.
  expect "16\r" or "15\r" or "14\r" or "12\r" or "10\r" or "5\r" or "1\r" busy "7\r"
  timeout 60
             done

 retry:      send "A/"                           # Repeat the previous command.

                                                 # Expect a connection response.
  expect "16\r" or "15\r" or "14\r" or "12\r" or "10\r" or "5\r" or "1\r" busy "7\r"
  timeout 60
             done

 disconnect:
             delay 2                             # Separate from previous data.
             send "+++"                          # Assure command mode.
             delay 2                             # Allow mode switching delay.
             send "ATH0T\r"                      # Set modem switch-hook down
                                                 #  (i.e., hang up).
             ignore "0\r" or "OK\r" timeout 2    # Ignore modem response.
             send "ATE0Q1\r"                     # Initialize modem: Echo OFF,
                                                 #  Disable responses.
             ignore "0\r" timeout 1
             done

 condin:     send "ATZ0Q0T\r"                    # Reset modem. Select profile 0
             ignore "0\r" or "OK\r\n" timeout 2  # Ignore modem response.
             send "ATE0T\r"                      # Initialize modem: Echo OFF,
             expect "0\r" or "OK\r\n" timeout 2  #  Enable responses (Numeric),
             send "ATQ0V0X0T\r"                  #  Limit response codes.
             expect "0\r" timeout 2              # Confirm commands successful.
             send "ATS0=2\r"                     # Set AutoAnswer ON
             expect "0\r" timeout 2              # Confirm command successful.
             done

 waitcall: ignore "2\r" timeout 1                # Ignore first ring.
           expect "2\r" timeout 10               # Pick up second ring
                                                 #  or timeout.
                                                 # Expect a connection response.
  expect "16\r" or "15\r" or "14\r" or "12\r" or "10\r" or "5\r" or "1\r"
  timeout 60
             done

 page:       send "ATDT%N,,,,%R;\r"              # %N = pager call center number
                                                 # Add enough commas to wait for
                                                 #  time to enter paging number.
                                                 # %R = paging number

                                                 # Confirm successful command.
             expect "0\r" timeout 60
             delay 2                             # Wait before hanging up.
             send "ATH0T\r"                      # Hang up.
             expect "0\r" timeout 2              # Confirm successful command.
             done

 ripo:       send "ATZ0Q0T\r"                    # Reset modem. Select profile 0
             ignore "0\r" or "OK\r\n" timeout 2  # Ignore modem response.
             send "ATE0T\r"                      # Initialize modem: Echo OFF,
             expect "0\r" or "OK\r\n" timeout 2  #  Enable responses (Numeric),
             send "ATQ0V0X0T\r"                  #  Limit response codes.
             expect "0\r" timeout 2              # Confirm commands successful.
             send "ATS0=0\r"                     # Set AutoAnswer OFF
             expect "0\r" timeout 2              # Confirm command successful.
             done                                # RI Power On enabled.

 error:                                          # Handle unexpected modem
                                                 #  responses.
             expect "8\r" or "7\r" or "6\r" or "4\r" or "3\r"
             delay 2
             done