#
# ppp.dip	Dialup IP connection support program.
#		This file (should show) shows how to use the DIP
#		scripting commands to establish a link to a
#		static or dynamic IP PPP server.
#
main:
  # You should set other pppd options in /etc/ppp/options.
  # Set the desired serial port and speed.
  # Our modem port is /dev/modem.
  port modem
  #speed 38400
  # Go higher if your modem supports it.
  speed 57600
  # Reset the modem and terminal line.
  # This seems to cause trouble for some people!
  reset
  # This is our local IP address. That should only be used for static
  # IP.
  # get $local xxx.xxx.xxx.xxx
  # That should work on both static and dynamic IP. PPP should know
  # how to get the local and remote IP address.
  get $local 0.0.0.0
# Note! "Standard" pre-defined "errlevel" values:
#	0 - OK
#	1 - CONNECT
#	2 - ERROR
#
# You can change those grep'ping for "addchat()" in *.c...
  # Prepare for dialing.
  # Put your own modem initializaion string here.
  send ATZ\rATS7=45S0=0L1V1X4&c1E1Q0%C3\r
  wait OK 1
  if $errlvl != 0 goto modem_trouble
  # Here is the PPP server dial-up number.
  dial 1234567
  if $errlvl != 1 goto modem_trouble
  # We are connected.  Login to the system.
login:
  sleep 2
  # Wai for login prompt
  wait ogin: 20
  if $errlvl != 0 goto login_error
  # Send the login ID.
  send yourID\n
  # Wai for passwd prompt
  wait assword: 20
  if $errlvl != 0 goto password_error
  # Send the passward.
  # This is for SecureID.
  #securidfixed xxxx
  #securid
  send yourPasswd\n
loggedin:
  # We are now logged in.
  # wait enable 15
  # if $errlvl != 0 goto prompt_error
  # Say hello and fire up!
done:
  print CONNECTED to the remote PPP server
  mode PPP
  goto exit
prompt_error:
  print TIME-OUT waiting for the PPP server to fire up...
  goto error
login_error:
  print Trouble waiting for the Login: prompt...
  goto error
password_error:
  print Trouble waiting for the Password: prompt...
  goto error
modem_trouble:
  print Trouble ocurred with the modem...
error:
  print CONNECT FAILED to the PPP server.
  quit
exit:
  reset
  exit
