Re: [SR-Users] kamailio re.subst question.
Hi Daniel, Sorry, I misconfused you with Daniel Constantin :), Miconda was the who that sent that Email explaining the {line.sw,match} some time ago. Regarding with $, i will take your advice :) Once again, thank you. Best Regards José 2017-03-02 17:23 GMT+00:00 Daniel Tryba: > On Thu, Mar 02, 2017 at 03:46:01PM +, José Seabra wrote: > > 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), > > Im not that Daniel :) > Or my memory starts to fail me. > > > 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. > > Only thing I'd change would be to remove the $ for end of line, just to > make it more generic. But if you are sure that these headerlines end > with >, that would not make a difference. > > > ___ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > -- Cumprimentos José Seabra ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] kamailio re.subst question.
On Thu, Mar 02, 2017 at 03:46:01PM +, José Seabra wrote: > 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), Im not that Daniel :) Or my memory starts to fail me. > 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. Only thing I'd change would be to remove the $ for end of line, just to make it more generic. But if you are sure that these headerlines end with >, that would not make a difference. ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] kamailio re.subst question.
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: > 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 : > >> On Wed, Mar 01, 2017 at 04:58:00PM +, José Seabra wrote: >> > #015#012Calling-Name-Status: available#015#012Calling-Name: "josé" < >> > sip:52@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@lists.sip-router.org >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users >> > > > > -- > Cumprimentos > José Seabra > -- Cumprimentos José Seabra ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] kamailio re.subst question.
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: > On Wed, Mar 01, 2017 at 04:58:00PM +, José Seabra wrote: > > #015#012Calling-Name-Status: available#015#012Calling-Name: "josé" < > > sip:52@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@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > -- Cumprimentos José Seabra ___ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Re: [SR-Users] kamailio re.subst question.
On Wed, Mar 01, 2017 at 04:58:00PM +, José Seabra wrote: > #015#012Calling-Name-Status: available#015#012Calling-Name: "josé" < > sip:52@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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users