home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / DIP / _DIP.TAR / usr / doc / dip / samples / uri-annex.dip < prev   
Encoding:
Text File  |  1995-01-13  |  3.1 KB  |  134 lines

  1. # A sample DIP script to dial into Digital Pathways
  2. # Remote Defender Validator in callback mode.
  3. #
  4. # Written by me (uri@watson.ibm.com) - but you knew THAT (:-).
  5. #
  6. # The idea in short is like this:
  7. #
  8. # 1. You dial the Defender number. It responds in
  9. #    VOICE. Most likely you won't be able to parse
  10. #    that response in software, so you pretend it
  11. #    told you to go on.
  12. # 2. You send a touch-tone-coded id. It again
  13. #    responds with some words, you assume it said
  14. #    you may go ahead.
  15. # 3. You type in your password in touch-tone. Now you
  16. #    just hope everything's fine, let it speak out 
  17. #    whatever it's about to and you hang up the
  18. #    line.
  19. # 4. Now you're waiting for it to call you back at the
  20. #    number stored in it's database....
  21. #
  22. # 5. OK, it did call you back. Now you got the CONNECT
  23. #    from it, a nice digital line and you acknowledge 
  24. #    it by sending "\n" up there.
  25. #
  26. # 6. It prompts you for your ID, you parse it and give
  27. #    your id (send it up). Mind you - this ID will be
  28. #    mighty different from the one you gave to the
  29. #    Defender!
  30. #
  31. # 7. From now on you assume the remote/server end will
  32. #    do it's job (i.e. configure your pre-assigned
  33. #    IP address, bring SLIP up and such). So now
  34. #    you make sure the line's 8-bit clean, and
  35. #    do "mode SLIP" yourself.
  36.  
  37. main:
  38.     port  ttyS1
  39.     speed 57600
  40.     echo on
  41.     get $local  myslip      # configure this
  42.     get $remote serverslip  # and this
  43.     netmask 255.255.255.0   # and maybe this
  44.     default                 # this?
  45.     timeout 0               # Do you want idle cutoff?
  46.  
  47.     databits 7              # To be able to talk
  48.     parity   e              # digital, needed later.
  49.  
  50.     send ATZ\r
  51. #    wait OK 2
  52. #    if $errlvl != 0 goto error1
  53.     sleep 3
  54.     send AT+FCLASS=0\r      # My crap...
  55.     wait OK 2
  56.     if $errlvl != 0 goto error2
  57.     send ATQ0V1E1X1\r
  58.     wait OK 2
  59.     if $errlvl != 0 goto error3
  60.     dial 555-1212;         # ";" because of voice response
  61.     if $errlvl != 0 goto error4
  62.     sleep 22
  63.     dial your_id;   # configure this
  64.     sleep 10
  65.     dial your_passwd;
  66.     sleep 10
  67.     send ATH\r
  68.     sleep 3
  69.     send ATZ\r
  70.     sleep 3
  71.     send AT+FCLASS=0\r
  72.     sleep 3
  73.     wait RING 80
  74.     if $errlvl != 0 goto error5
  75.     wait RING 10
  76.     if $errlvl != 0 goto error5
  77.     send ATA\r
  78.     wait CONNECT 25
  79.     if $errlvl != 0 goto error6
  80.  
  81. # We are connected.  Login to the system.
  82. login:
  83.     sleep 5
  84.     send \n         # Because it waits for "\n" to proceed
  85.     wait SLIP 25     # or wait for whatever prompt it gives 
  86.     if $errlvl != 0 goto error7
  87.     sleep 5
  88.     send uri\n       # Since you're not Uri - send whatever 
  89.                          # is appropriate for YOU.
  90.     sleep 1
  91.     parity   n     # Just as I said - establish 8-bit clean
  92.     databits 8     # line now, after all the chatting's over
  93.     sleep 3
  94.  
  95. done:
  96.     print "\n"
  97.     print Connected to $remote address
  98.     mode CSLIP
  99.     goto exit
  100.  
  101. error1:
  102.     print ERROR! send ATZ failed!
  103.     quit
  104.  
  105. error2:
  106.     print ERROR! send AT+FCLASS=0 failed!
  107.     quit
  108.  
  109. error3:
  110.     print ERROR! send ATQ0V1E1X1 failed!
  111.     quit
  112.  
  113. error4:
  114.     print ERROR! dial command failed!
  115.     quit
  116.  
  117. error5:
  118.     print ERROR! it did not call me back!
  119.     quit
  120.  
  121. error6:
  122.     print ERROR! Attempt fo connect to $remote failed! [No CONNECT]
  123.     quit
  124.     
  125. error7:
  126.     print ERROR! Attempt fo connect to $remote failed! [No "tlip"]
  127.     quit
  128.     
  129. exit:
  130.  
  131.