[SR-Users] Kamailio transformation

Ali Taher ataher at vanrise.com
Mon Jun 22 12:58:28 CEST 2015


Hello,

 

Suppose  I have $var(a) = 1234#5678 and $var(b)=123455667

I need to get the number before '#' character if exists , meaning that from
$var(a) I must get 1234# and from $var(b) I must get empty string.

 

I tried $var(pref)= $(var(a){s.select,0,#}); but I'm getting the whole
string if # doesn't exists.

 

There is a way to check if # exists by subtracting  the  length of the
string  before and after removing # character and check if length changes ,
but I want a cost-less method.

 

Any help would be appreciated.

 

Thanks 

Ali

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150622/11b57a09/attachment.html>


More information about the sr-users mailing list