[Serusers] ENUM comfort query, uri mangling

Klaus Darilion klaus.mailinglists at pernau.at
Fri Apr 1 14:31:13 CEST 2005


AFAIK =~ matches current URI, nor original URI.

strip and prefix are not part of textops and modify the current URI.

textops funtions only apply to the original URI. Using textop functions 
several times on the same message (or to rewrite the request URI) may be 
dangerous.

regards,
klaus

Alex Mack wrote:

> Hi Klaus!
> 
> Seems not so hard to implement. Thanks!
> 
> Does '=~' still work after an 'lookup("aliases")' has been done or is it 
> only querying against the original SIP message? (This way an e164 alias 
> could be created)
> I'm confused because of the textop's README warning about only being 
> effectful against the original message not the uri actual mangled by 
> other modules beforehand. Or isn't '=~' a textops operator at all?
> 
> BTW is there a list around naming all variables useable in ser-scripts?
> 
> Thanks
> Alex Mack
> 
> 
> 
> Klaus Darilion schrieb:
> 
>> 1. use strip() and prefix() to bring the URI into E.164 format.
>>
>> 2. Make an ENUM lookup.
>>
>> 2a. successful? t_relay()
>>
>> 2b. If the lookup fails, the request URI is still the E.164 number. 
>> Thus, send it to the gateway (maybe you have to use strip/prefix again 
>> to bring the number into a format knwon by the gateway).
>>
>> regards,
>> klaus
>>
>>
>>
>> Alex Mack wrote:
>>
>>> 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 at 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
>>>
>>> _______________________________________________
>>> Serusers mailing list
>>> serusers at lists.iptel.org
>>> http://lists.iptel.org/mailman/listinfo/serusers
>>>
>>>
>>
>>
>>
> 
> 




More information about the sr-users mailing list