home *** CD-ROM | disk | FTP | other *** search
/ NetComm Communications 5 / NetComm.iso / drivers / msmail / socketrk.mdm < prev    next >
Encoding:
Text File  |  1997-07-04  |  8.8 KB  |  358 lines

  1. ;**************************************************************************
  2. ;       Microsoft Mail Script File
  3. ;
  4. ;       Filename: SOCKETRK
  5. ;       Date    : 04/07/97
  6. ;       Script  : For NetComm Socket Rocket 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 Socket Rocket 288/336"
  50.  
  51.     baud 57600             ; set the baud rate
  52.     display "Baud Rate : 57600"
  53.     $attempts = 5
  54.  
  55. init_retry:
  56.         display "Modem is now being reset" 
  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 "Modem successfully reset"
  65.         goto reset_okay
  66.  
  67.     if ("OK" isin response)
  68.         display "Modem successfully reset"
  69.         {
  70. reset_okay:
  71.             display "Modem is now being initialized"
  72.             sendln "ATE0M1V0W2X3&K3"
  73.         wait 2
  74.         waitrsp 3
  75.  
  76.         if ("0^M" isin response)
  77.             Display "Modem successfully initialized"
  78.         {
  79.                 Display "Modem 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.  
  110. CALL:
  111.     $ret = 8               ; set default ret code to "no answer"
  112.  
  113.     clearrsp               ; clear the response buffer 
  114.  
  115.     echo 0                 ; do not display phone number
  116.  
  117.     sendln "ATD" + dial_mode + phone_number  ; execute the dial up 
  118.  
  119.     echo 1                 ; turn echo back on
  120.  
  121.     waitrsp 120            ; wait until the modem responds (max 2 minutes)
  122.  
  123.       if ("97^M" isin response)
  124.       {
  125.         display ">>> CONNECT 33600 <<<"
  126.       $ret = 12
  127.       }
  128.       else if ("95^M" isin response)
  129.       {
  130.         display ">>> CONNECT 31200 <<<"
  131.       $ret = 12
  132.       }
  133.       else if ("38^M" isin response)
  134.       {
  135.       display ">>> CONNECT 28800 <<<"
  136.       $ret = 12
  137.       }
  138.       else if ("37^M" isin response)
  139.       {
  140.       display ">>> CONNECT 26400 <<<"
  141.       $ret = 12
  142.       }
  143.       else if ("36^M" isin response)
  144.       {
  145.       display ">>> CONNECT 24000 <<<"
  146.       $ret = 12
  147.       }
  148.       else if ("35^M" isin response)
  149.       {
  150.       display ">>> CONNECT 21600 <<<"
  151.       $ret = 12
  152.       }
  153.       else if ("34^M" isin response)
  154.       {
  155.         display ">>> CONNECT 19200 <<<"
  156.         $ret = 12
  157.       }
  158.       else if ("33^M" isin response)
  159.       {
  160.       display ">>> CONNECT 16800 <<<"
  161.         $ret = 12
  162.       }
  163.       else if ("31^M" isin response)
  164.       {
  165.       display ">>> CONNECT 14400 <<<"
  166.         $ret = 12
  167.       }
  168.       else if ("30^M" isin response)
  169.       {
  170.       display ">>> CONNECT 12000 <<<"
  171.         $ret = 12
  172.       }
  173.     else if ("12^M" isin response)
  174.       {
  175.       display ">>> CONNECT 9600 <<<"
  176.       $ret = 12
  177.       }
  178.       else if ("32^M" isin response)
  179.       {
  180.         display ">>> CONNECT 7200 <<<"
  181.         $ret = 32
  182.       }
  183.       else if ("11^M" isin response)
  184.       {
  185.       display ">>> CONNECT 4800 <<<"
  186.       $ret = 11
  187.       }
  188.     else if ("10^M" isin response)
  189.       {
  190.       display ">>> CONNECT 2400 <<<"
  191.       $ret = 10
  192.       }
  193.     else if ("7^M" isin response)
  194.       {
  195.       display ">>> BUSY <<<"
  196.       $ret = 7             ; busy
  197.       }
  198.     else if ("5^M" isin response)
  199.       {
  200.       display ">>> CONNECT 1200 <<<"
  201.       $ret = 5
  202.       }
  203.     else if ("3^M" isin response)
  204.       {
  205.       display ">>> NO CARRIER <<<"
  206.       $ret = 8             ; no answer or no connect
  207.       }
  208.     else if ("1^M" isin response)
  209.       {
  210.       display ">>> CONNECT 300 <<<"
  211.       $ret = 1
  212.       }
  213.  
  214.     return $ret            ; return connect baud rate to application 
  215.     
  216.  
  217.  
  218. ANSWER:
  219.     $ret = 8               ; set default ret code to "no answer"
  220.  
  221.     waitrsp 1              ; see if phone is ringing 
  222.  
  223.     if ("2^M" isin response)  ; 2 is numeric form of "RING" 
  224.         {
  225.         if (listen = 1)    ; see if Listen program is running or not
  226.         sendln "ATD"   ; answer phone in originate mode (Listen)
  227.         else
  228.         sendln "ATA"   ; answer the phone normally
  229.  
  230.         waitrsp 120        ; wait for return code from modem (max 2 minutes)
  231.  
  232.  
  233.         if (response = "1^M")
  234.           {
  235.           display ">>> CONNECT 300 <<<"
  236.           $ret = 1
  237.           }
  238.         else if (response = "3^M")
  239.           {
  240.           display ">>> NO CARRIER <<<"
  241.           $ret = 8             ; no answer or no connect
  242.           }
  243.         else if (response = "5^M")
  244.           {
  245.           display ">>> CONNECT 1200 <<<"
  246.           $ret = 5
  247.           }
  248.         else if (response = "10^M")
  249.           {
  250.           display ">>> CONNECT 2400 <<<"
  251.           $ret = 10
  252.           }
  253.         else if (response = "11^M")
  254.           {
  255.           display ">>> CONNECT 4800 <<<"
  256.           $ret = 11
  257.           }
  258.           else if (response = "32^M")
  259.           {
  260.             display ">>> CONNECT 7200 <<<"
  261.             $ret = 32
  262.           }
  263.         else if (response = "12^M")
  264.           {
  265.           display ">>> CONNECT 9600 <<<"
  266.           $ret = 12
  267.           }
  268.           else if (response = "30^M")
  269.           {
  270.             display ">>> CONNECT 12000 <<<"
  271.           $ret = 12
  272.           }
  273.           else if (response = "31^M")
  274.           {
  275.             display ">>> CONNECT 14400 <<<"
  276.           $ret = 12
  277.           }
  278.           else if (response = "33^M")
  279.           {
  280.             display ">>> CONNECT 16800 <<<"
  281.           $ret = 12
  282.           }
  283.         else if (response = "14^M")
  284.           {
  285.           display ">>> CONNECT 19200 <<<"
  286.           $ret = 12
  287.           }
  288.           else if ("35^M" isin response)
  289.           {
  290.           display ">>> CONNECT 21600 <<<"
  291.           $ret = 12
  292.           }
  293.           else if ("36^M" isin response)
  294.           {
  295.           display ">>> CONNECT 24000 <<<"
  296.           $ret = 12
  297.           }
  298.           else if ("37^M" isin response)
  299.           {
  300.           display ">>> CONNECT 26400 <<<"
  301.           $ret = 12
  302.           }
  303.           else if ("38^M" isin response)
  304.           {
  305.             display ">>> CONNECT 28800 <<<"
  306.           $ret = 12
  307.           }
  308.           else if ("95^M" isin response)
  309.             {
  310.             display ">>> CONNECT 31200 <<<"
  311.             $ret = 12
  312.             }
  313.           else if ("97^M" isin response)
  314.             {
  315.             display ">>> CONNECT 33600 <<<"
  316.             $ret = 12
  317.             }
  318.  
  319.        if ($ret = 8)           ; if there was no answer, make sure that
  320.           {                    ;   modem goes back on hook.  There seems
  321.           dtr 0                ;   to be a problem with these modems
  322.           wait 1               ;   where the modem can sometimes refuse
  323.           dtr 1                ;   to hang up if ATA fails to establish
  324.           }                    ;   a connection.
  325.        }
  326.  
  327.     return $ret            ; return connect baud rate to application 
  328.     
  329.  
  330.  
  331. DISCONNECT:
  332.     wait 2                 ; wait 2 seconds 
  333.  
  334.     send "+++"             ; send escape sequence to put modem back to 
  335.                    ;    command state 
  336.     wait 2                 ; wait 2 seconds 
  337.  
  338.     waitrsp 3              ; wait for response from modem
  339.  
  340.     clearrsp               ; clear the response buffer 
  341.  
  342.     sendln "ATH0"          ; hang up the phone 
  343.  
  344.     waitrsp 3              ; wait for a response 
  345.  
  346.     if (response != "0^M") ; if hang up failed, drop DTR to force hang up
  347.         {
  348.         DTR 0              ; drop DTR to reset modem 
  349.         wait 2             ; some modems require a delay here
  350.         DTR 1              ; raise DTR 
  351.         clearrsp           ; clear response buffer
  352.         }
  353.  
  354.     return 0               ; always return OK 
  355.  
  356.  
  357.  
  358.