path amitcp:bin sys:rexxc sys:system add
failat 20
set IPHANGUP 0
echo "Stopnet for INTERINSTALL 1.50*n"

ask "Also attempt modem hangup? (y/n): "
if warn
  echo "Trying to hang up... " noline
  run >nil: serline "" $IPMODEMPORT
  set IPHANGUP 1
endif

run >nil: rx "if show('P','AMITCP')=1 then address AMITCP KILL"
wait 2
offline ppp.device 0

if $IPHANGUP EQ 1
  wait 2
  serline "+++" $IPMODEMPORT
  wait 2
  serline "ATH" $IPMODEMPORT
  wait 5
  serline "!" $IPMODEMPORT
  if $rc EQ 0
    echo "Carrier still present!"
    wait 10
  else
    echo "NO CARRIER"
  endif
  break `status com serline`
endif

echo "Done."
