my experience with bsnl/airtel is that even if you can ping the gateway, the line may still be down further up the chain. You need to be able to ping something like google.com through the relevant ethernet card.
There's no reliable way to assert if a link is "working" then. Pinging the gateway will only tell you if the link is technically up. There are scenarios where you can access some websites but not others.