home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April / Chip_1997-04_cd.bin / ovladace / zyxel / software / ms-mail / zyx2864.mdm next >
Text File  |  1997-02-20  |  11KB  |  381 lines

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