Module lookup

Varios lookup functions.

Introduced in: 20 Mar 2003 by Magnus Ahltorp <ahltorp@nada.kth.se>

Authors: Magnus Ahltorp (ahltorp@nada.kth.se).

Description

Varios lookup functions. Mainly routing logic for our three applications incomingproxy, pstnproxy and appserver. Most of these functions are called through functions in local.erl with the same name, so if you want to make them return different values than the defaults in this file, make a local.erl specific for your domain.

Function Index

format_number_for_remote_party_id/3 Hook for the actual formatting once get_remote_party_number/2 has found a number to be formatted.
get_remote_party_name/2 When pstnproxy receives a request from a PSTN gateway, this function is called to see if we can find a nice Display Name for the calling party.
get_remote_party_number/4 This function is used by the pstnproxy to provide a PSTN gateway with usefull caller-id information.
homedomain/1 Check if Domain is one of our configured homedomains.
is_request_to_this_proxy/1 Check if a request is destined for this proxy.
isours/1 Check if we have a user matching an URL.
lookup_address_to_users/1 Get a list of users that match a single address.
lookup_addresses_to_users/1 Get a list of users that match an input list of addresses.
lookup_result_to_str/1 Pretty-print our various used lookup result values.
lookup_url_to_addresses/2 Make up a bunch of possible userdb keys from an URL.
lookup_url_to_locations/1 Turn an URL into a set of locations.
lookupappserver/1 Get the configured appserver to use for Key.
lookupdefault/1 Get the configured default route.
lookupenum/1 Does ENUM resolving on an E164 number.
lookupnumber/1 Check if there are any numerical matching rules that apply (configured regexp 'number_to_pstn').
lookuppotn/1 Look Up Plain Old Telephone Number.
lookuppstn/1 Rewrites a number to a PSTN URL using the e164_to_pstn configuration regexp.
lookupregexproute/1 See if we have a regexp that matches Input in the Mnesia regexp route table.
lookupuser/1 The main 'give me a set of locations for one of our users' function that incomingproxy uses, when it determines that a request is for one of it's homedomains.
lookupuser_gruu/2 Look up the 'best' contact of a GRUU.
lookupuser_locations/2 Return all locations for a list of users that is suitable given a Request-URI.
remove_unsuitable_locations/2 Apply local policy for what locations are good to use for a particular Request-URI.
rewrite_potn_to_e164/1 Rewrite a number to an E164 number using our local numbering plan (configured regexp 'internal_to_e164').

Function Details

format_number_for_remote_party_id/3

format_number_for_remote_party_id(Number, Header, DstHost) -> {ok, Number} | none

Hook for the actual formatting once get_remote_party_number/2 has found a number to be formatted. This default function simply tries to rewrite the number to E.164. If one or more of your PSTN gateways wants the Caller-ID information in any other format, then override this function in local.erl.

get_remote_party_name/2

get_remote_party_name(Key, URI) -> {ok, DisplayName} | none

When pstnproxy receives a request from a PSTN gateway, this function is called to see if we can find a nice Display Name for the calling party.

get_remote_party_number/4

get_remote_party_number(User, Header, URI, DstHost) -> {ok, RPI, Number} | none

This function is used by the pstnproxy to provide a PSTN gateway with usefull caller-id information. PSTN networks typically gets upset if the "A-number" (calling party) is a SIP URL. Different gateways might want the number formatted differently, thus the DstHost parameter (a TSP gateway to PSTN might only handle E.164 numbers, while a PBX might be expecting only a 4-digit extension number).

homedomain/1

homedomain(Domain) -> true | false

Check if Domain is one of our configured homedomains.

is_request_to_this_proxy/1

is_request_to_this_proxy(Request) -> true | false

Check if a request is destined for this proxy. Not for a domain handled by this proxy, but for this proxy itself.

isours/1

isours(URL) -> true | false

Check if we have a user matching an URL.

lookup_address_to_users/1

lookup_address_to_users(Address) -> [string()]

returns: list of usernames or empty list

Get a list of users that match a single address.

lookup_addresses_to_users/1

lookup_addresses_to_users(Addresses) -> [string()]

returns: list of usernames or empty list

Get a list of users that match an input list of addresses.

lookup_result_to_str/1

lookup_result_to_str(In) -> string()

Pretty-print our various used lookup result values.

lookup_url_to_addresses/2

lookup_url_to_addresses(Src, Sipurl::URL) -> [string()]

Make up a bunch of possible userdb keys from an URL. Since our userdbs store different addresses implicitly sometimes, we do this mess to make sure we find one or more users for requests destined to an URL.

lookup_url_to_locations/1

lookup_url_to_locations(URL) -> Locations | nomatch

Turn an URL into a set of locations. The URL might map to more than one user, in which case the locations for all matched users are returned. Locations is sorted according to the priority values they have in the location database.

lookupappserver/1

lookupappserver(Key) -> {forward, URL} | {response, Status, Reason}

Get the configured appserver to use for Key. Used in incomingproxy.

lookupdefault/1

lookupdefault(URL) -> {proxy, DefaultRoute} | {response, Status, Reason}

Get the configured default route. Used in incomingproxy.

lookupenum/1

lookupenum(E164::Number) -> {proxy, URL} | {relay, URL} | none

Does ENUM resolving on an E164 number. If the input number is not an E164 number, it is converted first.

lookupnumber/1

lookupnumber(Number) -> {proxy, URL} | {relay, URL} | none | error

Check if there are any numerical matching rules that apply (configured regexp 'number_to_pstn'). Called by lookuppotn/1 and lookuppstn/1 when the input number is not rewriteable to a E164 number.

lookuppotn/1

lookuppotn(E164::Number) -> {proxy, URL} | {relay, URL} | none

Look Up Plain Old Telephone Number. Figures out where to route a numerical destination. First we try to rewrite it to E.164 and do ENUM lookup, and if that fails, lookuppstn() on it. Then we try our fallback numerical route matching, lookupnumber(). Used in both incomingproxy and pstnproxy.

lookuppstn/1

lookuppstn(E164::Number) -> {proxy, URL} | {relay, URL} | none | error

Rewrites a number to a PSTN URL using the e164_to_pstn configuration regexp. If the number is not E164, it is converted using rewrite_potn_to_e164() first.

lookupregexproute/1

lookupregexproute(Input) -> {proxy, URL} | none

See if we have a regexp that matches Input in the Mnesia regexp route table. If we find one, we return a proxy tuple with the resulting destination. The regexps in the database have a priority field, where higher priority is better.

lookupuser/1

lookupuser(URL) -> {ok, Users, Res} | nomatch

The main 'give me a set of locations for one of our users' function that incomingproxy uses, when it determines that a request is for one of it's homedomains. Returns 'nomatch' if no user was found, 'none' if the user(s) associated with URL has no registered locations.

lookupuser_gruu/2

lookupuser_gruu(URL, GRUU) -> {ok, User, Res, Contact}

Look up the 'best' contact of a GRUU. Note : used by incomingproxy and outgoingproxy

lookupuser_locations/2

lookupuser_locations(Users, URL) -> Locations

Return all locations for a list of users that is suitable given a Request-URI. By suitable, we mean that we filter out SIP locations if Request-URI was SIPS, unless this proxy is configured not to.

remove_unsuitable_locations/2

remove_unsuitable_locations(Sipurl::URL, Locations) -> [#siplocationdb_e{}]

Apply local policy for what locations are good to use for a particular Request-URI. The default action we do here is to remove non-SIPS locations if the Request-URI is SIPS, unless we are configured not to.

rewrite_potn_to_e164/1

rewrite_potn_to_e164(E164::Number) -> Result | error

Rewrite a number to an E164 number using our local numbering plan (configured regexp 'internal_to_e164').


Generated by EDoc, Oct 17 2007, 16:48:25.