We can use this GlideElementPhoneNumber method to get the country from phone number.
var gePN = new GlideElementPhoneNumber(); // if we have a valid number, parse it var valid = gePN.setPhoneNumber("+" + '15406871234', false); if (valid) { var country = gePN.getTerritory(); gs.log(country); }
Output: North America
Above code is verified using global scope.
P.S: looks like GlideElementPhoneNumber is undocumented method, I could not find anything on SN docs site.