home *** CD-ROM | disk | FTP | other *** search
/ NetComm Communications 5 / NetComm.iso / drivers / msmail / roadster.mdm < prev    next >
Encoding:
Text File  |  1997-09-25  |  11.8 KB  |  502 lines

  1. ;**************************************************************************
  2. ;       Microsoft Mail Script File
  3. ;
  4. ;       Filename: ROADSTER
  5. ;       Date    : 09/09/97
  6. ;       Script  : For NetComm Roadster 144/288/336/K56flex 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/56flex"
  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 ("179^M" isin response)
  123.       {
  124.         display ">>> CONNECT 60000 <<<"
  125.       $ret = 12
  126.       }
  127.       else if ("178^M" isin response)
  128.       {
  129.         display ">>> CONNECT 58000 <<<"
  130.       $ret = 12
  131.       }
  132.       else if ("177^M" isin response)
  133.       {
  134.         display ">>> CONNECT 56000 <<<"
  135.       $ret = 12
  136.       }
  137.       else if ("176^M" isin response)
  138.       {
  139.         display ">>> CONNECT 54000 <<<"
  140.       $ret = 12
  141.       }
  142.       else if ("175^M" isin response)
  143.       {
  144.         display ">>> CONNECT 52000 <<<"
  145.       $ret = 12
  146.       }
  147.       else if ("174^M" isin response)
  148.       {
  149.         display ">>> CONNECT 50000 <<<"
  150.       $ret = 12
  151.       }
  152.       else if ("173^M" isin response)
  153.       {
  154.         display ">>> CONNECT 48000 <<<"
  155.       $ret = 12
  156.       }
  157.       else if ("172^M" isin response)
  158.       {
  159.         display ">>> CONNECT 46000 <<<"
  160.       $ret = 12
  161.       }
  162.       else if ("171^M" isin response)
  163.       {
  164.         display ">>> CONNECT 44000 <<<"
  165.       $ret = 12
  166.       }
  167.       else if ("170^M" isin response)
  168.       {
  169.         display ">>> CONNECT 42000 <<<"
  170.       $ret = 12
  171.       }
  172.       else if ("169^M" isin response)
  173.       {
  174.         display ">>> CONNECT 40000 <<<"
  175.       $ret = 12
  176.       }
  177.       else if ("168^M" isin response)
  178.       {
  179.         display ">>> CONNECT 38000 <<<"
  180.       $ret = 12
  181.       }
  182.       else if ("167^M" isin response)
  183.       {
  184.         display ">>> CONNECT 36000 <<<"
  185.       $ret = 12
  186.       }
  187.       else if ("166^M" isin response)
  188.       {
  189.         display ">>> CONNECT 34000 <<<"
  190.       $ret = 12
  191.       }
  192.       else if ("165^M" isin response)
  193.       {
  194.         display ">>> CONNECT 32000 <<<"
  195.       $ret = 12
  196.       }
  197.       else if ("84^M" isin response)
  198.       {
  199.         display ">>> CONNECT 33600 <<<"
  200.       $ret = 12
  201.       }
  202.       else if ("91^M" isin response)
  203.       {
  204.         display ">>> CONNECT 31200 <<<"
  205.       $ret = 12
  206.       }
  207.       else if ("64^M" isin response)
  208.       {
  209.       display ">>> CONNECT 28800 <<<"
  210.       $ret = 12
  211.       }
  212.     else if ("63^M" isin response)
  213.       {
  214.       display ">>> CONNECT 26400 <<<"
  215.       $ret = 12
  216.       }
  217.     else if ("62^M" isin response)
  218.       {
  219.       display ">>> CONNECT 24000 <<<"
  220.       $ret = 12
  221.       }
  222.     else if ("61^M" isin response)
  223.       {
  224.       display ">>> CONNECT 21600 <<<"
  225.       $ret = 12
  226.       }
  227.       else if ("16^M" isin response)
  228.       {
  229.         display ">>> CONNECT 19200 <<<"
  230.       $ret = 12
  231.       }
  232.     else if ("59^M" isin response)
  233.       {
  234.       display ">>> CONNECT 16800 <<<"
  235.       $ret = 12
  236.       }
  237.     else if ("15^M" isin response)
  238.       {
  239.       display ">>> CONNECT 14400 <<<"
  240.       $ret = 12
  241.       }
  242.     else if ("14^M" isin response)
  243.       {
  244.       display ">>> CONNECT 12000 <<<"
  245.       $ret = 12
  246.       }
  247.     else if ("12^M" isin response)
  248.       {
  249.       display ">>> CONNECT 9600 <<<"
  250.       $ret = 12
  251.       }
  252.       else if ("13^M" isin response)
  253.       {
  254.         display ">>> CONNECT 7200 <<<"
  255.         $ret = 13
  256.       }
  257.     else if ("11^M" isin response)
  258.       {
  259.       display ">>> CONNECT 4800 <<<"
  260.       $ret = 11
  261.       }
  262.     else if ("10^M" isin response)
  263.       {
  264.       display ">>> CONNECT 2400 <<<"
  265.       $ret = 10
  266.       }
  267.     else if ("7^M" isin response)
  268.       {
  269.       display ">>> BUSY <<<"
  270.       $ret = 7             ; busy
  271.       }
  272.     else if ("5^M" isin response)
  273.       {
  274.       display ">>> CONNECT 1200 <<<"
  275.       $ret = 5
  276.       }
  277.     else if ("3^M" isin response)
  278.       {
  279.       display ">>> NO CARRIER <<<"
  280.       $ret = 8             ; no answer or no connect
  281.       }
  282.     else if ("1^M" isin response)
  283.       {
  284.       display ">>> CONNECT 300 <<<"
  285.       $ret = 1
  286.       }
  287.  
  288.     return $ret            ; return connect baud rate to application 
  289.     
  290.  
  291.  
  292. ANSWER:
  293.     $ret = 8               ; set default ret code to "no answer"
  294.  
  295.     waitrsp 1              ; see if phone is ringing 
  296.  
  297.     if ("2^M" isin response)  ; 2 is numeric form of "RING" 
  298.         {
  299.         if (listen = 1)    ; see if Listen program is running or not
  300.         sendln "ATD"   ; answer phone in originate mode (Listen)
  301.         else
  302.         sendln "ATA"   ; answer the phone normally
  303.  
  304.         waitrsp 120        ; wait for return code from modem (max 2 minutes)
  305.  
  306.  
  307.         if (response = "1^M")
  308.           {
  309.           display ">>> CONNECT 300 <<<"
  310.           $ret = 1
  311.           }
  312.         else if (response = "3^M")
  313.           {
  314.           display ">>> NO CARRIER <<<"
  315.           $ret = 8             ; no answer or no connect
  316.           }
  317.         else if (response = "5^M")
  318.           {
  319.           display ">>> CONNECT 1200 <<<"
  320.           $ret = 5
  321.           }
  322.         else if (response = "10^M")
  323.           {
  324.           display ">>> CONNECT 2400 <<<"
  325.           $ret = 10
  326.           }
  327.         else if (response = "11^M")
  328.           {
  329.           display ">>> CONNECT 4800 <<<"
  330.           $ret = 11
  331.           }
  332.           else if (response = "13^M")
  333.           {
  334.             display ">>> CONNECT 7200 <<<"
  335.             $ret = 13
  336.           }
  337.         else if (response = "12^M")
  338.           {
  339.           display ">>> CONNECT 9600 <<<"
  340.           $ret = 12
  341.           }
  342.         else if (response = "14^M")
  343.           {
  344.             display ">>> CONNECT 12000 <<<"
  345.           $ret = 12
  346.           }
  347.        else if (response = "15^M")
  348.           {
  349.           display ">>> CONNECT 14400 <<<"
  350.           $ret = 12
  351.           }
  352.        else if ("59^M" isin response)
  353.           {
  354.           display ">>> CONNECT 16800 <<<"
  355.           $ret = 12
  356.           }
  357.          else if (response = "16^M")
  358.           {
  359.           display ">>> CONNECT 19200 <<<"
  360.           $ret = 12
  361.           }
  362.        else if ("61^M" isin response)
  363.           {
  364.           display ">>> CONNECT 21600 <<<"
  365.           $ret = 12
  366.           }
  367.        else if ("62^M" isin response)
  368.           {
  369.           display ">>> CONNECT 24000 <<<"
  370.           $ret = 12
  371.           }
  372.        else if ("63^M" isin response)
  373.           {
  374.           display ">>> CONNECT 26400 <<<"
  375.           $ret = 12
  376.           }
  377.        else if ("64^M" isin response)
  378.           {
  379.             display ">>> CONNECT 28800 <<<"
  380.           $ret = 12
  381.           }
  382.          else if ("91^M" isin response)
  383.             {
  384.             display ">>> CONNECT 31200 <<<"
  385.             $ret = 12
  386.             }
  387.          else if ("84^M" isin response)
  388.             {
  389.             display ">>> CONNECT 33600 <<<"
  390.             $ret = 12
  391.             }
  392.         else if ("165^M" isin response)
  393.           {
  394.             display ">>> CONNECT 32000 <<<"
  395.           $ret = 12
  396.           }
  397.         else if ("166^M" isin response)
  398.           {
  399.             display ">>> CONNECT 34000 <<<"
  400.         $ret = 12
  401.         }
  402.       else if ("167^M" isin response)
  403.         {
  404.           display ">>> CONNECT 36000 <<<"
  405.         $ret = 12
  406.         }
  407.         else if ("168^M" isin response)
  408.         {
  409.           display ">>> CONNECT 38000 <<<"
  410.          $ret = 12
  411.         }
  412.         else if ("169^M" isin response)
  413.         {
  414.           display ">>> CONNECT 40000 <<<"
  415.         $ret = 12
  416.         }
  417.         else if ("170^M" isin response)
  418.           {
  419.             display ">>> CONNECT 42000 <<<"
  420.           $ret = 12
  421.           }
  422.         else if ("171^M" isin response)
  423.           {
  424.             display ">>> CONNECT 44000 <<<"
  425.           $ret = 12
  426.           }
  427.         else if ("172^M" isin response)
  428.           {
  429.             display ">>> CONNECT 46000 <<<"
  430.           $ret = 12
  431.           }
  432.         else if ("173^M" isin response)
  433.           {
  434.             display ">>> CONNECT 48000 <<<"
  435.           $ret = 12
  436.           }
  437.         else if ("174^M" isin response)
  438.           {
  439.             display ">>> CONNECT 50000 <<<"
  440.           $ret = 12
  441.           }
  442.         else if ("175^M" isin response)
  443.           {
  444.             display ">>> CONNECT 52000 <<<"
  445.           $ret = 12
  446.           }
  447.         else if ("176^M" isin response)
  448.           {
  449.             display ">>> CONNECT 54000 <<<"
  450.           $ret = 12
  451.           }
  452.         else if ("177^M" isin response)
  453.           {
  454.             display ">>> CONNECT 56000 <<<"
  455.           $ret = 12
  456.           }
  457.         else if ("178^M" isin response)
  458.           {
  459.             display ">>> CONNECT 58000 <<<"
  460.           $ret = 12
  461.           }
  462.         else if ("179^M" isin response)
  463.             {
  464.             display ">>> CONNECT 60000 <<<"
  465.           $ret = 12
  466.           }
  467.  
  468.       if ($ret = 8)            ; if there was no answer, make sure that
  469.           {                    ;   modem goes back on hook.  There seems
  470.           dtr 0                ;   to be a problem with these modems
  471.           wait 1               ;   where the modem can sometimes refuse
  472.           dtr 1                ;   to hang up if ATA fails to establish
  473.           }                    ;   a connection.
  474.        }
  475.  
  476.     return $ret            ; return connect baud rate to application 
  477.     
  478. DISCONNECT:
  479.     wait 2                 ; wait 2 seconds 
  480.  
  481.     send "+++"             ; send escape sequence to put modem back to 
  482.                      ; command state 
  483.     wait 2                 ; wait 2 seconds 
  484.  
  485.     waitrsp 3              ; wait for response from modem
  486.  
  487.     clearrsp               ; clear the response buffer 
  488.  
  489.     sendln "ATH0"          ; hang up the phone 
  490.  
  491.     waitrsp 3              ; wait for a response 
  492.  
  493.     if (response != "0^M") ; if hang up failed, drop DTR to force hang up
  494.         {
  495.         DTR 0              ; drop DTR to reset modem 
  496.         wait 2             ; some modems require a delay here
  497.         DTR 1              ; raise DTR 
  498.         clearrsp           ; clear response buffer
  499.         }
  500.  
  501.     return 0               ; always return OK
  502.