Table of Contents
List of Examples
smode
parameterphonenum_match
usageTable of Contents
This module allows real-time queries against the libphonenumber to be performed from the config script. With that it is possible to get normalize and get details about a phone number.
More details about libphonenumber can be found at https://github.com/googlei18n/libphonenumber.
This module exports a new class of pseudo-variables - $phn(pvc=>key) - to enable access to the results of a query to the database.
Many queries can be done and store results in different containers to be able to use in parallel.
Match num against the libphonenumber and set the attributes inside the pvc container. The function has to be called before accessing a key via: $phn(pvc=>key).
The parameters can be static strings or strings with variables.
It can be used from ANY_ROUTE.
Example 1.2. phonenum_match
usage
... if(phonenum_match("1-484-555-8888", "src")) { if($phn(src=>valid)==1) { xlog("number normalized to: $phn(src=>normalized)\n"); } else { xlog("number normalization error: $phn(src=>error)\n"); } } ...
$phn(pvc=>key) - pvc is an identifier for this query result; it is designated by the second parameter of phonenum_match(). The key can be one of the following:
number - phone number that is matched
valid - 1 if the matched number has a valid result; 0 otherwise
normalized - normalized phone number
cctel - country code for phone number
ltype - local network type
ndesc - phone number description
error - error string if phone number matching fails.
Exported pseudo-variables are documented at https://www.kamailio.org/wiki/.