telnet doesn't have a timeout. Instead, telnet typically connects to a login process which then connects to a shell (specified in /etc/passwd). So the shell is where you may be able to set a timeout. For standard shells (POSIX shells like /usr/bin/sh and /usr/bin/ksh as well as the Bourne shell: /usr/old/bin/sh), set the variable TMOUT in seconds of inactivity. For /usr/bin/csh, the variable autologout is set to minutes of inactivity. If other shells are used, you'll have to refer to the man page (or the programmer if shell is a custom program or script).
Now it's important to note that the shell does not monitor inactivity of subprocesses such as vi. Once a process is started from the shell, the shell is no longer running and cannot compute inactivity. Only when the shell prompt is on the screen will inactivity be measured.
Bill Hassell, sysadmin