Skip to content

silviucpp/elibphonenumber

 
 

Repository files navigation

elibphonenumber

Build Status GitHub Hex.pm

Erlang driver for libphonenumber.

Notes

  • 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 and rebar3 or hex.
  • To change the libphonenumber version modify in rebar.config the DRIVER_REV argument sent to make.
  • 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 the DRIVER_SRC argument sent to git.

Compile

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

Ubuntu or Debian

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
CentOS 7

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
Mac Os

On Mac OS make sure you have brew installed and rebar will automatically install all necessary dependencies.

Get carrier for number

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">>).

Get Timezones for a number

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">>]}

Geocoding

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">>

Run the tests

rebar3 eunit

Packages

No packages published

Languages

  • Erlang 66.4%
  • C++ 27.0%
  • Makefile 3.8%
  • Shell 2.8%