home *** CD-ROM | disk | FTP | other *** search
/ NetComm Communications 5 / NetComm.iso / resource / support / scriptpa / netmodem.dat / SMARTTA.MDM < prev    next >
Encoding:
Text File  |  1997-05-12  |  4.9 KB  |  200 lines

  1. ;**************************************************************************
  2. ;                    Network Courier Script File
  3. ;
  4. ;       Filename: SMARTTA
  5. ;       Date    : 08/05/97
  6. ;       Script  : For NetComm SmartTA (IS5000)
  7. ;
  8. ; Note: MSMail only supports 57600 maximum DTE speed whereas the IS5000 
  9. ; defaults to 115,200 default DTE speed.  
  10. ;
  11. ; Before using this script please do the following:
  12. ;
  13. ;    - Open a terminal session at 115200 DTE speed.
  14. ;    - Reset the SmartTA with AT$ZZ
  15. ;    - Type ATS114=57 to set 57600 DTE speed in the TA.
  16. ;    - Set the DTE speed to 57600
  17. ;    - Type AT&W
  18. ;    - Load the SmartTA MsMail script and set 57600 in MSMail.
  19. ; (There is no AT&F or ATZ in the script so the TA will still be set to 57600)
  20. ;
  21. ;**************************************************************************
  22.  
  23.  
  24. INITIALIZE:
  25.         title "NetComm SmartTA ISDN (IS5000)"
  26.  
  27.         baud 57600              ; set the baud rate
  28.         display "   Baud Rate : 57600"
  29.     $attempts = 5
  30.  
  31. init_retry:
  32.         display "SmartTA is now being reset"
  33.         sendln "AT"           ; reset modem to default settings
  34.         wait 8
  35.         waitrsp 6
  36.  
  37.     if ("0" isin response)
  38.         display "Successfully reset"
  39.         goto reset_okay
  40.  
  41.     if ("OK" isin response)
  42.         display "Successfully reset"
  43.         {
  44. reset_okay:
  45.         display "SmartTA is now being initialized"
  46.             sendln "AT&D2E0V0X3&K3W2"
  47.         wait 2
  48.         waitrsp 3
  49.  
  50.         if ("0^M" isin response)
  51.             display "Successfully initialized"
  52.         {
  53.                 display "S Registers now being set"
  54.                 sendln "ATS0=0"
  55.         waitrsp 3
  56.         if (response = "0^M")
  57.                 display "S Registers set successfully"
  58.             return 0
  59.         }
  60.          }
  61.     dec $attempts
  62.     if ($attempts > 0)
  63.         goto init_retry
  64.  
  65.     return 4
  66.  
  67.  
  68. RESET:
  69.         baud 57600              ; set the baud rate
  70.         display "   Baud Rate : 57600"
  71.  
  72.         display "SmartTA is now being reset"
  73.         sendln "AT"           ; reset modem to default settings
  74.         wait 8
  75.     waitrsp 1
  76.     if (response = "0^M")
  77.         return 0 
  78.     else
  79.          return 4
  80.  
  81.  
  82.  
  83. CALL:
  84.     $ret = 8               ; set default ret code to "no answer"
  85.  
  86.     clearrsp               ; clear the response buffer
  87.  
  88.     echo 0                 ; do not display phone number
  89.  
  90.     sendln "ATD" + dial_mode + phone_number  ; execute the dial up
  91.  
  92.     echo 1                 ; turn echo back on
  93.  
  94.     waitrsp 120            ; wait until the modem responds (max 2 minutes)
  95.  
  96.     if (response = "1^M")
  97.       {
  98.           baud 57600
  99.           display ">>> CONNECT <<<"
  100.       $ret = 1
  101.       }
  102.     else if (response = "3^M")
  103.       {
  104.       display ">>> NO CARRIER <<<"
  105.       $ret = 8             ; no answer or no connect
  106.       }
  107.         else if (response = "19^M")
  108.       {
  109.           baud 57600
  110.           display ">>> CONNECT 64000 <<<"
  111.           $ret = 19
  112.       }
  113.         else if (response = "7^M")
  114.       {
  115.       display ">>> BUSY <<<"
  116.       $ret = 7             ; busy
  117.       }
  118.         else if (response = "31^M")
  119.       {
  120.           baud 57600
  121.           display ">>> CONNECT 115200 <<<"
  122.           $ret = 31
  123.       }
  124.     
  125.  
  126.     return $ret            ; return connect baud rate to application
  127.  
  128.  
  129.  
  130. ANSWER:
  131.     $ret = 8               ; set default ret code to "no answer"
  132.  
  133.         waitrsp 8              ; see if phone is ringing
  134.  
  135.     if (response = "2^M")  ; 2 is numeric form of "RING"
  136.         {
  137.         if (listen = 1)    ; see if Listen program is running or not
  138.         sendln "ATD"   ; answer phone in originate mode (Listen)
  139.         else
  140.         sendln "ATA"   ; answer the phone normally
  141.  
  142.         waitrsp 120        ; wait for return code from modem (max 2 minutes)
  143.  
  144.  
  145.         if (response = "1^M")
  146.           {
  147.               baud 57600
  148.               display ">>> CONNECT <<<"
  149.         wait 1
  150.           $ret = 1
  151.           }
  152.         else if (response = "3^M")
  153.           {
  154.           display ">>> NO CARRIER <<<"
  155.             wait 1
  156.           $ret = 8             ; no answer or no connect
  157.           }
  158.             else if (response = "19^M")
  159.           {
  160.               baud 57600
  161.               display ">>> CONNECT 64000 <<<"
  162.             wait 1
  163.               $ret = 19
  164.           }
  165.             else if (response = "31^M")
  166.           {
  167.               baud 57600
  168.               display ">>> CONNECT 115200 <<<"
  169.         wait 1
  170.               $ret = 31
  171.           }
  172.         }
  173.  
  174.     return $ret            ; return connect baud rate to application
  175.  
  176.  
  177.  
  178. DISCONNECT:
  179.     wait 2                 ; wait 2 seconds
  180.  
  181.     send "+++"             ; send escape sequence to put modem back to
  182.                    ;    command state
  183.     wait 2                 ; wait 2 seconds
  184.  
  185.     clearrsp               ; clear the response buffer
  186.  
  187.     sendln "ATH0"          ; hang up the phone
  188.  
  189.     waitrsp 3              ; wait for a response
  190.  
  191.     if (response != "0^M") ; if hang up failed, drop DTR to force hang up
  192.         {
  193.         DTR 0              ; drop DTR to reset modem
  194.         wait 2             ; some modems require a delay here
  195.         DTR 1              ; raise DTR
  196.         clearrsp           ; clear response buffer
  197.         }
  198.  
  199.     return 0               ; always return OK
  200.