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

  1. ;**************************************************************************
  2. ;       Microsoft Mail Script File
  3. ;
  4. ;       Filename: ROADSTER
  5. ;       Date    : 08/05/97
  6. ;       Script  : For NetComm Roadster Series 
  7. ;
  8. ;     This script file contains the standard modem setup strings used by
  9. ;  the External, Transmit and Listen programs.  There are five procedures
  10. ;  defined in this script file for setting up the modem and for connecting
  11. ;  to a remote External machine.
  12. ;
  13. ;     The modem setup strings used here will be adequate for most people
  14. ;  but there may be some changes required if you are dialing overseas and
  15. ;  require a longer wait for Carrier Detect (S7 register) or if you wish
  16. ;  to change the speaker volume.  Note that if you used the -Innn option 
  17. ;  in version 1.0 or 2.0 that you will have to modify the S7 register and
  18. ;  recompile this script file.
  19. ;
  20. ;     Consult your modem manual for more information on setup options.
  21. ;
  22. ;  Script procedures defined:
  23. ;       INITIALIZE
  24. ;       RESET
  25. ;       CALL
  26. ;       ANSWER
  27. ;       DISCONNECT
  28. ;
  29. ;  Return codes for External, Transmit, Listen:
  30. ;       0  - OK
  31. ;       1  - CONNECT 300
  32. ;       2  - not defined
  33. ;       3  - NO CARRIER
  34. ;       4  - ERROR
  35. ;       5  - CONNECT 1200
  36. ;       6  - not defined
  37. ;       7  - BUSY
  38. ;       8  - NO ANSWER
  39. ;       9  - not defined
  40. ;      10  - CONNECT 2400
  41. ;      11  - not defined
  42. ;      12  - CONNECT 9600 (high speed connection)
  43. ;
  44. ;
  45. ;**************************************************************************
  46.  
  47.  
  48. INITIALIZE:
  49.         title "NetComm Roadster 144/288/336"
  50.  
  51.     baud 57600             ; set the baud rate
  52.     display "   Baud Rate : 57600"
  53.     $attempts = 5
  54.  
  55. init_retry:
  56.         display "Resetting modem" 
  57.     sendln "AT"
  58.     waitrsp 1
  59.         sendln "AT&F"           ; reset modem to default settings
  60.     wait 2
  61.     waitrsp 1
  62.  
  63.     if ("0" isin response)
  64.         display "Successfully reset"
  65.         goto reset_okay
  66.  
  67.     if ("OK" isin response)
  68.         display "Successfully reset"
  69.         {
  70. reset_okay:
  71.             display "Initializing modem"
  72.             sendln "ATE0M1V0W2X3"
  73.         wait 2
  74.         waitrsp 3
  75.  
  76.         if ("0^M" isin response)
  77.             Display "Successfully initialized"
  78.         {
  79.                 Display "S Registers now being set" 
  80.                 sendln "ATS0=0S7=60S95=0&W"
  81.         waitrsp 3
  82.         if (response = "0^M")
  83.                     Display "S Registers set successfully"
  84.             return 0
  85.         }
  86.          }
  87.     dec $attempts
  88.     if ($attempts > 0)
  89.         goto init_retry
  90.  
  91.     return 4
  92.  
  93.  
  94. RESET:
  95.     baud 57600              ; set the baud rate
  96.     display "   Baud Rate : 57600"
  97.  
  98.     clearrsp               ; clear out any ring signals
  99.         display "ATZ being sent to modem"
  100.     sendln "ATZ"           ; reset modem to default settings
  101.     waitrsp 3
  102.  
  103.     if (response = "0^M")
  104.          return 0
  105.     else
  106.          return 4
  107.  
  108.  
  109. CALL:
  110.     $ret = 8               ; set default ret code to "no answer"
  111.  
  112.     clearrsp               ; clear the response buffer 
  113.  
  114.     echo 0                 ; do not display phone number
  115.  
  116.     sendln "ATD" + dial_mode + phone_number  ; execute the dial up 
  117.  
  118.     echo 1                 ; turn echo back on
  119.  
  120.     waitrsp 120            ; wait until the modem responds (max 2 minutes)
  121.  
  122.         if ("84^M" isin response)
  123.       {
  124.           display ">>> CONNECT 33600 <<<"
  125.       $ret = 12
  126.       }
  127.         else if ("91^M" isin response)
  128.       {
  129.           display ">>> CONNECT 31200 <<<"
  130.       $ret = 12
  131.       }
  132.         else if ("64^M" isin response)
  133.       {
  134.       display ">>> CONNECT 28800 <<<"
  135.       $ret = 12
  136.       }
  137.     else if ("63^M" isin response)
  138.       {
  139.       display ">>> CONNECT 26400 <<<"
  140.       $ret = 12
  141.       }
  142.     else if ("62^M" isin response)
  143.       {
  144.       display ">>> CONNECT 24000 <<<"
  145.       $ret = 12
  146.       }
  147.     else if ("61^M" isin response)
  148.       {
  149.       display ">>> CONNECT 21600 <<<"
  150.       $ret = 12
  151.       }
  152.         else if ("16^M" isin response)
  153.       {
  154.           display ">>> CONNECT 19200 <<<"
  155.       $ret = 12
  156.       }
  157.     else if ("59^M" isin response)
  158.       {
  159.       display ">>> CONNECT 16800 <<<"
  160.       $ret = 12
  161.       }
  162.     else if ("15^M" isin response)
  163.       {
  164.       display ">>> CONNECT 14400 <<<"
  165.       $ret = 12
  166.       }
  167.     else if ("14^M" isin response)
  168.       {
  169.       display ">>> CONNECT 12000 <<<"
  170.       $ret = 12
  171.       }
  172.     else if ("12^M" isin response)
  173.       {
  174.       display ">>> CONNECT 9600 <<<"
  175.       $ret = 12
  176.       }
  177.         else if ("13^M" isin response)
  178.       {
  179.           display ">>> CONNECT 7200 <<<"
  180.           $ret = 13
  181.       }
  182.     else if ("11^M" isin response)
  183.       {
  184.       display ">>> CONNECT 4800 <<<"
  185.       $ret = 11
  186.       }
  187.     else if ("10^M" isin response)
  188.       {
  189.       display ">>> CONNECT 2400 <<<"
  190.       $ret = 10
  191.       }
  192.     else if ("7^M" isin response)
  193.       {
  194.       display ">>> BUSY <<<"
  195.       $ret = 7             ; busy
  196.       }
  197.     else if ("5^M" isin response)
  198.       {
  199.       display ">>> CONNECT 1200 <<<"
  200.       $ret = 5
  201.       }
  202.     else if ("3^M" isin response)
  203.       {
  204.       display ">>> NO CARRIER <<<"
  205.       $ret = 8             ; no answer or no connect
  206.       }
  207.     else if ("1^M" isin response)
  208.       {
  209.       display ">>> CONNECT 300 <<<"
  210.       $ret = 1
  211.       }
  212.  
  213.     return $ret            ; return connect baud rate to application 
  214.     
  215.  
  216.  
  217. ANSWER:
  218.     $ret = 8               ; set default ret code to "no answer"
  219.  
  220.     waitrsp 1              ; see if phone is ringing 
  221.  
  222.     if ("2^M" isin response)  ; 2 is numeric form of "RING" 
  223.         {
  224.         if (listen = 1)    ; see if Listen program is running or not
  225.         sendln "ATD"   ; answer phone in originate mode (Listen)
  226.         else
  227.         sendln "ATA"   ; answer the phone normally
  228.  
  229.         waitrsp 120        ; wait for return code from modem (max 2 minutes)
  230.  
  231.  
  232.         if (response = "1^M")
  233.           {
  234.           display ">>> CONNECT 300 <<<"
  235.           $ret = 1
  236.           }
  237.         else if (response = "3^M")
  238.           {
  239.           display ">>> NO CARRIER <<<"
  240.           $ret = 8             ; no answer or no connect
  241.           }
  242.         else if (response = "5^M")
  243.           {
  244.           display ">>> CONNECT 1200 <<<"
  245.           $ret = 5
  246.           }
  247.         else if (response = "10^M")
  248.           {
  249.           display ">>> CONNECT 2400 <<<"
  250.           $ret = 10
  251.           }
  252.         else if (response = "11^M")
  253.           {
  254.           display ">>> CONNECT 4800 <<<"
  255.           $ret = 11
  256.           }
  257.             else if (response = "13^M")
  258.           {
  259.               display ">>> CONNECT 7200 <<<"
  260.               $ret = 13
  261.           }
  262.         else if (response = "12^M")
  263.           {
  264.           display ">>> CONNECT 9600 <<<"
  265.           $ret = 12
  266.           }
  267.         else if (response = "14^M")
  268.           {
  269.               display ">>> CONNECT 12000 <<<"
  270.           $ret = 12
  271.           }
  272.        else if (response = "15^M")
  273.           {
  274.           display ">>> CONNECT 14400 <<<"
  275.           $ret = 12
  276.           }
  277.        else if ("59^M" isin response)
  278.           {
  279.           display ">>> CONNECT 16800 <<<"
  280.           $ret = 12
  281.           }
  282.             else if (response = "16^M")
  283.           {
  284.           display ">>> CONNECT 19200 <<<"
  285.           $ret = 12
  286.           }
  287.        else if ("61^M" isin response)
  288.           {
  289.           display ">>> CONNECT 21600 <<<"
  290.           $ret = 12
  291.           }
  292.        else if ("62^M" isin response)
  293.           {
  294.           display ">>> CONNECT 24000 <<<"
  295.           $ret = 12
  296.           }
  297.        else if ("63^M" isin response)
  298.           {
  299.           display ">>> CONNECT 26400 <<<"
  300.           $ret = 12
  301.           }
  302.        else if ("64^M" isin response)
  303.           {
  304.               display ">>> CONNECT 28800 <<<"
  305.           $ret = 12
  306.           }
  307.            else if ("91^M" isin response)
  308.               {
  309.               display ">>> CONNECT 31200 <<<"
  310.               $ret = 12
  311.               }
  312.            else if ("84^M" isin response)
  313.               {
  314.               display ">>> CONNECT 33600 <<<"
  315.               $ret = 12
  316.               }
  317.  
  318.        if ($ret = 8)           ; if there was no answer, make sure that
  319.           {                    ;   modem goes back on hook.  There seems
  320.           dtr 0                ;   to be a problem with these modems
  321.           wait 1               ;   where the modem can sometimes refuse
  322.           dtr 1                ;   to hang up if ATA fails to establish
  323.           }                    ;   a connection.
  324.        }
  325.  
  326.     return $ret            ; return connect baud rate to application 
  327.     
  328.  
  329.  
  330. DISCONNECT:
  331.     wait 2                 ; wait 2 seconds 
  332.  
  333.     send "+++"             ; send escape sequence to put modem back to 
  334.                    ;    command state 
  335.     wait 2                 ; wait 2 seconds 
  336.  
  337.     waitrsp 3              ; wait for response from modem
  338.  
  339.     clearrsp               ; clear the response buffer 
  340.  
  341.     sendln "ATH0"          ; hang up the phone 
  342.  
  343.     waitrsp 3              ; wait for a response 
  344.  
  345.     if (response != "0^M") ; if hang up failed, drop DTR to force hang up
  346.         {
  347.         DTR 0              ; drop DTR to reset modem 
  348.         wait 2             ; some modems require a delay here
  349.         DTR 1              ; raise DTR 
  350.         clearrsp           ; clear response buffer
  351.         }
  352.  
  353.     return 0               ; always return OK 
  354.  
  355.  
  356.  
  357.