No, this is easy.
Twilio API has a simple lookup function (call over curl) to see provider and type of number. Also shows subscribers name (usually).
I have this in a shell script and look up numbers all the time:
/usr/local/bin/curl -s -X GET "https://lookups.twilio.com/v1/PhoneNumbers/$number?Type=carrier&Type=caller-name" -u $accountsid:$authtoken | /usr/local/bin/jq '.'