Example #1
0
 def is_available_to(self, user):
     region_aware_visible, region_ignore_visible = super().is_available_to(
         user)
     org = user.get_org()
     countrycode = timezone_to_country_code(org.timezone)
     region_aware_visible = countrycode in ["US"]
     return region_aware_visible, region_ignore_visible
Example #2
0
 def is_recommended_to(self, user):
     NEXMO_RECOMMENDED_COUNTRIES = [
         'US', 'CA', 'GB', 'AU', 'AT', 'FI', 'DE', 'HK', 'HU', 'LT', 'NL',
         'NO', 'PL', 'SE', 'CH', 'BE', 'ES', 'ZA'
     ]
     org = user.get_org()
     countrycode = timezone_to_country_code(org.timezone)
     return countrycode in NEXMO_RECOMMENDED_COUNTRIES
Example #3
0
    def get_existing_numbers(self, org):
        client = org.get_twilio_client()
        if client:
            twilio_account_numbers = client.phone_numbers.list(page_size=1000)
            twilio_short_codes = client.sms.short_codes.list(page_size=1000)

        numbers = []
        for number in twilio_account_numbers:
            parsed = phonenumbers.parse(number.phone_number, None)
            numbers.append(dict(number=phonenumbers.format_number(parsed, phonenumbers.PhoneNumberFormat.INTERNATIONAL),
                                country=region_code_for_number(parsed)))

        org_country = timezone_to_country_code(org.timezone)
        for number in twilio_short_codes:
            numbers.append(dict(number=number.short_code, country=org_country))

        return numbers
Example #4
0
    def get_existing_numbers(self, org):
        client = org.get_twilio_client()
        if client:
            twilio_account_numbers = client.api.incoming_phone_numbers.stream(page_size=1000)
            twilio_short_codes = client.api.short_codes.stream(page_size=1000)

        numbers = []
        for number in twilio_account_numbers:
            parsed = phonenumbers.parse(number.phone_number, None)
            numbers.append(
                dict(
                    number=phonenumbers.format_number(parsed, phonenumbers.PhoneNumberFormat.INTERNATIONAL),
                    country=region_code_for_number(parsed),
                )
            )

        org_country = timezone_to_country_code(org.timezone)
        for number in twilio_short_codes:
            numbers.append(dict(number=number.short_code, country=org_country))

        return numbers
Example #5
0
 def is_recommended_to(self, user):
     NEXMO_RECOMMENDED_COUNTRIES = [
         "US",
         "CA",
         "GB",
         "AU",
         "AT",
         "FI",
         "DE",
         "HK",
         "HU",
         "LT",
         "NL",
         "NO",
         "PL",
         "SE",
         "CH",
         "BE",
         "ES",
         "ZA",
     ]
     org = user.get_org()
     countrycode = timezone_to_country_code(org.timezone)
     return countrycode in NEXMO_RECOMMENDED_COUNTRIES
Example #6
0
 def is_recommended_to(self, user):
     NEXMO_RECOMMENDED_COUNTRIES = [
         "US",
         "CA",
         "GB",
         "AU",
         "AT",
         "FI",
         "DE",
         "HK",
         "HU",
         "LT",
         "NL",
         "NO",
         "PL",
         "SE",
         "CH",
         "BE",
         "ES",
         "ZA",
     ]
     org = user.get_org()
     countrycode = timezone_to_country_code(org.timezone)
     return countrycode in NEXMO_RECOMMENDED_COUNTRIES
Example #7
0
 def is_recommended_to(self, user):
     org = user.get_org()
     countrycode = timezone_to_country_code(org.timezone)
     return countrycode in SUPPORTED_COUNTRIES
Example #8
0
 def is_available_to(self, user):
     org = user.get_org()
     countrycode = timezone_to_country_code(org.timezone)
     return countrycode in ["US"]
Example #9
0
 def is_recommended_to(self, user):
     org = user.get_org()
     countrycode = timezone_to_country_code(org.timezone)
     return countrycode in TWILIO_SUPPORTED_COUNTRIES_CONFIG