Updated libphonenumber library

This commit is contained in:
Trial97
2021-10-25 14:24:08 +03:00
committed by Dan Christian Bogos
parent a82e964cdc
commit 766f3abb4f
3 changed files with 3 additions and 14 deletions

View File

@@ -19,8 +19,6 @@ import (
"fmt"
"github.com/nyaruka/phonenumbers"
"golang.org/x/text/language"
"golang.org/x/text/language/display"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
@@ -202,14 +200,6 @@ func (dDP *libphonenumberDP) fieldAsInterface(fldPath []string) (val interface{}
if err != nil {
utils.Logger.Warning(fmt.Sprintf("Received error: <%+v> when getting GeoLocation for number %+v", err, dDP.pNumber))
}
if geoLocation == utils.EmptyString { // until https://github.com/nyaruka/phonenumbers/issues/100 is fixed
var reg language.Region
if reg, err = language.ParseRegion(regCode); err != nil {
utils.Logger.Warning(fmt.Sprintf("Received error: <%+v> when converting region in GeoLocation for number %+v", err, dDP.pNumber))
} else {
geoLocation = display.English.Regions().Name(reg)
}
}
val = geoLocation
case "Carrier":
carrier, err := phonenumbers.GetCarrierForNumber(dDP.pNumber, phonenumbers.GetRegionCodeForNumber(dDP.pNumber))

3
go.mod
View File

@@ -45,7 +45,7 @@ require (
github.com/mitchellh/mapstructure v1.4.0
github.com/nats-io/nats-server/v2 v2.2.6 // indirect
github.com/nats-io/nats.go v1.11.0
github.com/nyaruka/phonenumbers v1.0.72
github.com/nyaruka/phonenumbers v1.0.73
github.com/peterh/liner v1.2.1
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/rivo/uniseg v0.2.0 // indirect
@@ -61,7 +61,6 @@ require (
golang.org/x/net v0.0.0-20210924151903-3ad01bbaa167
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
golang.org/x/text v0.3.7
golang.org/x/tools v0.1.6 // indirect
google.golang.org/api v0.36.0
google.golang.org/genproto v0.0.0-20210111234610-22ae2b108f89 // indirect

4
go.sum
View File

@@ -408,8 +408,8 @@ github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/nyaruka/phonenumbers v1.0.72 h1:l1ClBSmRpEN6lfp28emOGPk7nzcuZ1hgWLtWk5lZXpM=
github.com/nyaruka/phonenumbers v1.0.72/go.mod h1:DTw5PBWllLZuh8TwMfgiC+g3+4wmowrsO+4HhnSENkc=
github.com/nyaruka/phonenumbers v1.0.73 h1:bP2WN8/NUP8tQebR+WCIejFaibwYMHOaB7MQVayclUo=
github.com/nyaruka/phonenumbers v1.0.73/go.mod h1:3aiS+PS3DuYwkbK3xdcmRwMiPNECZ0oENH8qUT1lY7Q=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=