Electronic device and method of controlling input or output in the electronic device

Various embodiments of the invention, in an electronic device, comprising: a first speaker; A first microphone; A storage unit for storing a reference signal; And when the reference signal is output through the first speaker, receiving the second signal input via a second microphone of the first signal and the external electronic device input from the first microphone, and at least a first microphone, the input through the first may include a first signal and the second microphone on the basis of the second signal received through the first microphone or to control so as to determine whether to use the second microphone, and a control unit. Moreover, various embodiments of the invention may be of other embodiments.