[SR-Users] Regex question

Olle E. Johansson oej at edvina.net
Mon Nov 4 07:52:04 CET 2013


On 03 Nov 2013, at 20:31, Oliver Roth <oliver.roth at triotel.ch> wrote:

> Hi all
> 
> Maybe a very simple question - but I cannot see the solution - I am more or less newbie ;)
> 
> 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?
> 
The pseudovariables are there as shortcuts. You want the $rU.
http://www.kamailio.org/wiki/cookbooks/4.0.x/pseudovariables

Then use a transformation or a regexp to cut of the + sign. s.strip seems to do what you need.

http://www.kamailio.org/wiki/cookbooks/4.0.x/transformations

Cheers,
/O


More information about the sr-users mailing list