Apple has apparently filed a patent called "Detection of spoofed call information" that would enable an iPhone to check whether a call is legitimate. If it's not, the phone would automatically either display a warning to the user or prevent call alerts, such as ringing and vibration.
The patent makes clear that the phone would check against established, legitimate call parameters in order to determine the validity of a call that's being connected. The phone would analyze the information being send over the call, including network equipment identifiers, server identifiers and more.
It's important to note that Apple files many patents that it does nothing with. But with spam calls on the rise, and people getting more and more frustrated by them, having a feature like this on the iPhone could be very useful.