Hi everyone!
I want to implement an ENUM query in my routing block with comfort. I
want ENUM queries always to be done because VoIP-Calls are cheaper than
PSTN-routed ones.
I want to let the user request e.g. "sip:089123456@mydomain.org" and the
script should query for "6.5.4.3.2.1.9.8.9.4.e164.arpa" (I'm in munich
(prefix 089), germany (prefix +49); a single zero indicates long
distance calls, two zeros indicate international calls, local calls
don't have leading zeros)
The idea is to complete the requested uri to be a e164 address and then
start a query
The logic should be like:
if (uri_is_e164) {
if (do_enum_query)
t_relay;
} else if (uri =~ "sip:0[1-9][0-9]{1,14}@.*") {
# national call
replace "leading 0" with "+49";
if (do_enum_query)
t_relay;
} else if (uri =~ "sip:00[1-9][0-9]{1,13}@.*") {
# international call
replace "leading 00" with "+";
if (do_enum_query)
t_relay;
}
I don't get the hang of those textops functions because sometimes they
work and sometimes they don't, especially after other modules have been
changing the uri.
In addition, if one of those enum-queries fails, the uri should be
reverted to the original one (with "0" or "00").
How would the correct ser.cfg-script look like?
Alex Mack