The answer to that questions depends on your perspective. If you live in the IP communications world, and you are a vendor selling phone systems, you don’t make or sell too many new phone systems that aren’t fully IP. So you think the whole world is on IP because that’s the world you live in.
It’s like living in Dallas and finding a Dallas native who doesn’t quite understand how someone in Dallas doesn’t like the Cowboys. Everyone’s on IP, right? Everyone’s a Cowboy fan, right? Wrong.
If you are a system integrator, the perspective is a bit different. Your vendors may be selling you full-on IP systems, but they may need to connect to both IP and non-IP networks. They may have to connect to PSTN networks of some sort, because, well, they are there. And the endpoints, such as analog phones, are still in use. Yes, analog phones are still in use! Unbelievable. So it means the whole world is not on IP yet. Whether those vendors making IP-only systems like it or not, it’s still the reality of today’s world.
In this case, you need a gateway. You have to deal with SIP trunks coming into a building, but the customer wanting to keep the existing legacy telephone infrastructure. Because it works! In this case, a gateway can take the SIP trunk and do the protocol and codec conversion to enable this connection.
Or it may go the other way around. You may have IP infrastructure that needs to connect as well to PSTN infrastructure. A gateway would be required here as well.