Erlang driver for libphonenumber.
- This project is active. I'm doing updates very often because I see the original author is no longer maintaining it.
- Compatible with both
rebar
andrebar3
orhex
. - To change the
libphonenumber
version modify inrebar.config
theDRIVER_REV
argument sent tomake
. - By default, the build is using git tag archive rather than full clone and tag checkout. You can change this behaviour by modifying in
rebar.config
theDRIVER_SRC
argument sent togit
.
In order to compile you need to make sure all dependencies needed to build libphonenumber
are already installed.
Next you can find a resume for each operating system where library was tested but in case you encounter problems you can
consult as well the documentation from building libphonenumber
located here
On the latest versions it's enough to do:
sudo apt-get install cmake cmake-curses-gui libicu-dev
sudo apt-get install libprotobuf-dev protobuf-compiler
Enable EPEL (for RE2):
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
And install packages:
sudo yum install cmake git libicu-devel protobuf-devel protobuf-compiler
On Mac OS
make sure you have brew
installed and rebar will automatically install all necessary dependencies.
In order to do this make sure the application is started then use phonenumber_to_carrier:carrier_for_number/2
method
application:ensure_all_started(elibphonenumber).
phonenumber_to_carrier:carrier_for_number(<<"44743655551">>, <<"en">>).
In order to get the timezones associated with a number you can call phonenumber_to_timezones:timezones_for_number/1
method as follow:
application:ensure_all_started(elibphonenumber).
phonenumber_to_timezones:timezones_for_number(<<"16502530000">>).
{ok,[<<"America/Los_Angeles">>]}
Using the following method you can get the geographical area of a phone number (in case this information is available).
application:ensure_all_started(elibphonenumber).
phonenumber_geocoding:get_geocoding_for_number(<<"+16502530000">>),
<<"Mountain View, CA">>
rebar3 eunit