Automatic detection of modem and bridge