[SR-Users] DROUTING nub question

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 28 08:08:10 CEST 2012


Hello,

this could be also an workaround for adding some prefix based on length.

But also the length can be used, it should work like:

$rU = "" + $(rU{s.len}) + $rU;

(note the empty string) or

pv_printf("$rU", "$(rU{s.len})$rU");

Cheers,
Daniel


On 8/28/12 7:25 AM, Javi Gallart wrote:
> Hi
>
> maybe this would work. You have a mask like "111111111111" (you choose 
> the max length and the content). From the mask you extract as many 
> digits as the length of your number with {s.substr,offset,length}, 
> being length $(rU{s.len}}. Then you prepend the result to you $rU.
>
> Hope it helps
>
>
> Javi
>
> On 08/28/2012 02:34 AM, Luis Fernando Urrea wrote:
>> I see there is a transformation to return the string value of an 
>> integer but I can't seem to find the opposite one.
>>
>> {s.int <http://s.int>}
>> Return integer value of a string-represented number
>>
>> On Mon, Aug 27, 2012 at 6:22 PM, Luis Fernando Urrea 
>> <lfurrea at simplecs.net <mailto:lfurrea at simplecs.net>> wrote:
>>
>>     Thanks Daniel,
>>
>>     That got me started, however, it seems that the return value
>>     from $(rU{s.len}) is actually an integer and therefore could not
>>     be concatenated to $rU string ?
>>
>>     4(18194) ERROR: pv [pv_core.c:1798]: str value required to set
>>     R-URI user
>>     14(18194) ERROR: <core> [lvalue.c:354]: setting pvar failed
>>     14(18194) ERROR: <core> [lvalue.c:407]: assignment failed at pos:
>>     (906,8-906,25)
>>     14(18194) ERROR: *** cfgtrace:
>>     c=[/usr/local/etc/kamailio/kamailio.cfg] l=907 a=26 n=xlog
>>     14(18194) ERROR: <script>: rU is now 8287825573!!!!!!!!!!!!!!!!
>>
>>     On Mon, Aug 27, 2012 at 2:30 PM, Daniel-Constantin Mierla
>>     <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>>
>>         Hello,
>>
>>         one solution is doing following trick:
>>
>>         - get the length of the dialed number via transformation and
>>         prefix it to the number
>>
>>         $rU = $(rU{s.len}) + $rU;
>>
>>         - in drouting keep rules only for prefixes  2, 4, 6, 7 and 8
>>         - for drouting gateways set strip to 1, so the first digit
>>         (the length) is removed before forwarding
>>
>>         Cheers,
>>         Daniel
>>
>>
>>         On 8/27/12 10:20 PM, Luis Fernando Urrea wrote:
>>>         Yes thank you Daniel,
>>>
>>>         On my setup I terminate local calls using colocated TDM
>>>         equipment, these calls are 8 digit numbers that start with
>>>         2,4,6,7 and 8
>>>
>>>         Then I use a FreeSWITCH box as a gateway for US and
>>>         international calls, so I was hoping I could somehow route
>>>         based on numbers of digits.
>>>
>>>         I hope that is clear enough.
>>>
>>>         Regards,
>>>
>>>         Luis
>>>
>>>         On Mon, Aug 27, 2012 at 2:08 PM, Daniel-Constantin Mierla
>>>         <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>>>
>>>             Hello,
>>>
>>>
>>>             On 8/27/12 6:54 PM, Luis Fernando Urrea wrote:
>>>
>>>                 I haven't been able to find the answer in the
>>>                 documentation.
>>>
>>>                 It seems DROUTING does not take regex in the dr_rules
>>>                 table to match routable numbers, are there any kind
>>>                 of wilcards that could be used.
>>>
>>>                 How does one specify different rules for 8 digit
>>>                 numbers and 10 digit numbers.
>>>
>>>
>>>             drouting uses longest prefix matching to select the rule.
>>>
>>>             Do you have rules only on length or also on prefix? If
>>>             you provide a bit more details about what routing rules
>>>             you are looking for, we may be able to provide hints
>>>             about how to implement in the config file.
>>>
>>>             Cheers,
>>>             Daniel
>>>
>>>             --             Daniel-Constantin Mierla - 
>>> http://www.asipto.com
>>>             http://twitter.com/#!/miconda
>>>             <http://twitter.com/#%21/miconda> -
>>>             http://www.linkedin.com/in/miconda
>>>             Kamailio Advanced Training, Berlin, Nov 5-8, 2012 -
>>>             http://asipto.com/u/kat
>>>
>>>
>>>
>>>
>>>         --         O: 2248-2483
>>>         C: 6040-3624
>>>
>>>
>>
>>         --         Daniel-Constantin Mierla -http://www.asipto.com
>>         http://twitter.com/#!/miconda 
>> <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
>>         Kamailio Advanced Training, Berlin, Nov 5-8, 2012 
>> -http://asipto.com/u/kat
>>
>>
>>
>>
>>     --     O: 2248-2483
>>     C: 6040-3624
>>
>>
>>
>>
>>
>> -- 
>> O: 2248-2483
>> C: 6040-3624
>>
>>
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - http://asipto.com/u/kat




More information about the sr-users mailing list