When was the beginning for your iPhone - when was it purchased?
The screen would go black when making a phone call, and it was impossible to hang up. This didn't happen when using the head-phones.
Since the same did not occur when using the earbuds with a call, are you using a case that may be blocking or partially blocking the iPhone's proximity sensors? The proximity sensors are located next the earpiece, which turns the iPhone's screen off automatically when holding the iPhone up to your ear and face during a call and turns the screen back on automatically when the iPhone is removed from your ear and face. When or if you get this other problem fixed, If you are using the case try removing the case to see if the same occurs during a call when not using the earbuds.
Was your iPhone purchased from an official carrier for the iPhone in Spain? If so, was your iPhone purchased as carrier locked with the carrier, or as officially unlocked by the carrier?