[SR-Users] Regex question

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 4 09:41:27 CET 2013


On 11/3/13 10:07 PM, Oliver Roth wrote:
> Got it - thanks for your help.
>
> $avp(s:fromCLI) = $(ai{re.subst,/^sip:(.*)@(.*)/\1/});
This gets what you need if there are no parameters to username part of 
the URI. Juha tried to suggest to use the uri transformation that uses 
an URI parser internally and returns parts of it as you need. It should 
be like:

$(ai{uri.user})

See the link from Juha for more details about uri transformations.

Cheers,
Daniel
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: sr-users-bounces at lists.sip-router.org [mailto:sr-users-bounces at lists.sip-router.org] Im Auftrag von Juha Heinanen
> Gesendet: Sonntag, 3. November 2013 21:58
> An: Kamailio (SER) - Users Mailing List
> Cc: kamailio at AaronLux.com
> Betreff: [SR-Users] Regex question
>
> Oliver Roth writes:
>
>> I need to do some string operations in kamailio.cfg.
>> How can I get the cli from the following string:
>> sip:+41523940347 at 195.216.67.103;user=phone
>>
>> I only  would need  +41523940347 in a variable
>>
>> Something like
>>
>> $avp(s:myCli) = ^sip:\+(\d{11})@.{1,40}$
>>
>> Any idea?
> see if any of these would help:
>
> http://www.kamailio.org/wiki/cookbooks/devel/transformations#uri_transformations
>
> -- juha
>
> _______________________________________________
> 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
>
> -----
> E-Mail ist virenfrei.
> Von AVG überprüft - www.avg.de
> Version: 2014.0.4158 / Virendatenbank: 3615/6804 - Ausgabedatum: 02.11.2013
>
> _______________________________________________
> 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 Trainings - Berlin, Nov 25-28
   - more details about Kamailio trainings at http://www.asipto.com -




More information about the sr-users mailing list