A communication device (1, 2) for communication via a telephone line, comprising: a terminator for terminating the telephone line, the terminator having a variable terminal impedance as seen from the telephone line; a transmitter configured to transmit a first signal to the telephone line; a detector (44, 45, 46, 36) configured to detect a second signal occurring on the telephone line due to the first signal and determine, on a basis of the detected second signal, whether the terminal impedance matches a line impedance of the telephone line; and a controller (30, 90) configured to determine the terminal impedance so that the detector determines that the terminal impedance matches the line impedance, characterized in that the controller (30, 90) sets the terminal impedance to a first terminal impedance and sequentially varies a frequency of the first signal to different frequencies, and for each of the different frequencies, the detector (44, 45, 46, 36) detects the second signal and determines, on a basis of the detected second signal, whether the terminal impedance matches the line impedance, wherein when the detector (44, 45, 46, 36) determines, for at least one of the different frequencies, that the terminal impedance does not match the line impedance, the controller (30, 90) changes the terminal impedance to a second terminal impedance and sequentially varies the frequency of the first signal to different frequencies, and for each of the different frequencies, the detector (44, 45, 46, 36) detects the second signal and determines, on a basis of the detected second signal, whether the terminal impedance matches the line impedance. a terminator for terminating the telephone line, the terminator having a variable terminal impedance as seen from the telephone line; a transmitter configured to transmit a first signal to the telephone line; a detector (44, 45, 46, 36) configured to detect a second signal occurring on the telephone line due to the first signal and determine, on a basis of the detected second signal, whether the terminal impedance matches a line impedance of the telephone line; and a controller (30, 90) configured to determine the terminal impedance so that the detector determines that the terminal impedance matches the line impedance, characterized in that the controller (30, 90) sets the terminal impedance to a first terminal impedance and sequentially varies a frequency of the first signal to different frequencies, and for each of the different frequencies, the detector (44, 45, 46, 36) detects the second signal and determines, on a basis of the detected second signal, whether the terminal impedance matches the line impedance, wherein when the detector (44, 45, 46, 36) determines, for at least one of the different frequencies, that the terminal impedance does not match the line impedance, the controller (30, 90) changes the terminal impedance to a second terminal impedance and sequentially varies the frequency of the first signal to different frequencies, and for each of the different frequencies, the detector (44, 45, 46, 36) detects the second signal and determines, on a basis of the detected second signal, whether the terminal impedance matches the line impedance.