[SR-Users] kamailio re.subst question.

José Seabra joseseabra4 at gmail.com
Thu Mar 2 16:46:01 CET 2017


Hi Daniel,
Just to give you feedback about the way i have implemented this.

I changed the way that i was trying to get it done.

Now I'm using the {line.sw,match} ( you had already mentioned this function
on an old email), to split the string by line, then i apply the following
regex: ^Calling-Name: ?(.{2,50}>)$.

This way I get what i need, that is the sip uri and display name.

Thank you.

José Seabra

2017-03-02 15:28 GMT+00:00 José Seabra <joseseabra4 at gmail.com>:

> Hi Daniel,
> Thank you for your hint.
> I will continuing investigating and try to reach my goal.
>
> Best regards
> José
>
> 2017-03-02 14:29 GMT+00:00 Daniel Tryba <d.tryba at pocos.nl>:
>
>> On Wed, Mar 01, 2017 at 04:58:00PM +0000, José Seabra wrote:
>> > #015#012Calling-Name-Status: available#015#012Calling-Name: "josé" <
>> > sip:5555555552 at 10.10.10.10>#015#012Presentation-Indicator:
>> allowed#015#012
>> >
>> > The Kamailio re.subst function is constructed as the following:
>> >
>> > $sht(cnam=>$ci::calling_name)=$(var(rb){re.subst,/(.*)Calling-Name:
>> > ?([\W|0-9A-Za-z_]{5,500} ?[<>:@.|0-9A-Za-z_]{5,500})(.*)$/\2/s});
>> >
>> > The issue here is that this re.subst function doesn't match the
>> accents, I
>> > have tested this regex on regex101.com and it does match. My question
>> is
>> > how i can get the same result with re.subst?
>> > Anyone can help?
>>
>> Maybe regexo101.com is wrong? \W is ^\w, \w contains [A-Za-z0-9_] but
>> depending on the lib might include much more like latin or UTF8. So if é
>> matches \w in kamailio but obviuosly never matches [A-Za-z0-9_], the é
>> doesn't match \W and thus "josé" doesn't match the minimum 5 chars.
>>
>> [\W|\w]{5,500} would match, but that looks the same as .{5,500}
>>
>> Never looked whether kamailio supports it but there is something that
>> matches non ascii word characters in regexp libs:
>> http://www.regular-expressions.info/unicode.html
>>
>> _______________________________________________
>> 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
>>
>
>
>
> --
> Cumprimentos
> José Seabra
>



-- 
Cumprimentos
José Seabra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20170302/a7a6d002/attachment.html>


More information about the sr-users mailing list