def extract_country_code(input, options={})
      options[:region] ||= Phoney.region
      intl_prefix = international_call_prefix_for(input, region: options[:region])
      
      # only try to extract a country code if we're dialing internationally
      if intl_prefix
        rest   = input[intl_prefix.count(NUMPAD_CHARS)..-1]
        region = Phoney::Region.all.find { |r| rest.start_with? r.country_code.to_s }
        
        region.country_code.to_s if region
      end
    end
def extract_country_code(input, options={})
      options[:region] ||= Phoney.region
      intl_prefix = international_call_prefix_for(input, region: options[:region])
      
      # only try to extract a country code if we're dialing internationally
      if intl_prefix
        rest   = input[intl_prefix.count(NUMPAD_CHARS)..-1]
        region = Phoney::Region.all.find { |r| rest.start_with? r.country_code.to_s }
        
        region.country_code.to_s if region
      end
    end
TODO: handle case where international call prefix implicitly specifies country (e.g. tz: "005->254")