The last configuration is fine, if you have a few gateways and the routes do not change often. However, most SIP providers change routes very often. Besides, most of them have multiple gateways and connections to VoIP wholesale providers. It is counterproductive to change the script every time a route needs to be changed. So the LCR module will be used. It allows you to insert the routes and gateways in the database and change them dynamically to adjust the system to your requirements.
Imagine a situation where you have two wholesale providers, one in Europe and another in Asia. You want to send local and long distance calls to your own gateways, calls to the Netherlands, Germany, and France to the provider in Europe, and calls to Japan and Australia to the Asia provider. If the Asia provider fails, you want to fallback the call to your own gateways.