Thanks Daniel

In this case we are good with the {uri.user} because I am only reading this 
header for something else but appreciate what you have said around {tobody.uri}



From: Daniel-Constantin Mierla <[email protected]>
Sent: 30 May 2022 09:41
To: Kamailio (SER) - Users Mailing List <[email protected]>; Lewis 
Hutchinson <[email protected]>
Subject: Re: [SR-Users] Find Values in User part of Diversion URI


Hello,

you should use {tobody.uri} before {uri.user}, because Diversion body does not 
include only a URI.

To remove numbers, try {re.subst,/[0-9]//g}

Cheers,
Daniel
On 30.05.22 10:13, Lewis Hutchinson wrote:

Excellent thanks I knew there would be a simple way that I was missing, just 
couldn't get my head into it late on Friday.

Thanks Henning

Lewis

From: Henning Westerholt <[email protected]><mailto:[email protected]>
Sent: 28 May 2022 11:13
To: Kamailio (SER) - Users Mailing List 
<[email protected]><mailto:[email protected]>
Cc: Lewis Hutchinson 
<[email protected]><mailto:[email protected]>
Subject: RE: Find Values in User part of Diversion URI

Hello,

for the first question, you could use textops

https://www.kamailio.org/docs/modules/devel/modules/textops.html#textops.f.search_hf<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fdocs%2Fmodules%2Fdevel%2Fmodules%2Ftextops.html%23textops.f.search_hf&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=X%2BtJ6BLeruVIioM4OnVON5pAgknHrH027ufEBiJoWMI%3D&reserved=0>

or just cfg regular expression match on the PV together with a transformation

if ($(hdr(Diversion){uri.user}) ~= "...")

to see if the header field contains the value.

For the second question, there is not function right now that is the opposite 
of the is.numeric. You could use some regular expression replace transformation 
for example to achieve a similar result, I think.

Cheers,

Henning

--
Henning Westerholt - 
https://skalatan.de/blog/<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fskalatan.de%2Fblog%2F&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=6Fs%2FsJ7LJVr1rsAa31yT9aqrBIj4CnvuFwsDvalKJVI%3D&reserved=0>
Kamailio services - 
https://gilawa.com<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgilawa.com%2F&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pY2n%2FsHZywGfnVVlGBo%2FJDsQjShIRjh9eLF9X%2BSjY%2Bg%3D&reserved=0>

From: sr-users 
<[email protected]<mailto:[email protected]>>
 On Behalf Of Lewis Hutchinson
Sent: Friday, May 27, 2022 3:53 PM
To: [email protected]<mailto:[email protected]>
Subject: [SR-Users] Find Values in User part of Diversion URI

Sorry if this is a super basic ask but I can't seem to work it out, I have got 
a work around but for my own sanity wanted to post the question on here.

In Kamailio Native 5.5.2

I want to be able to look into this field $(di{uri.user}) and "find" or see if 
it "contains" a value

i.e Diversion: "TEST" sip:[email protected];user=phone;

find 234

or

contains 234

I know how to do this in in KEMI Python but for the life of me cant get my head 
around it in Native.

2ndly is there an opposite to {s.numeric} Removes all non-numeric parts of 
string.

I want the ability to strip all numeric parts.

Keep us the good work.


Lewis




__________________________________________________________

Kamailio - Users Mailing List - Non Commercial Discussions

  * [email protected]<mailto:[email protected]>

Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Edit mailing list options or unsubscribe:

  * 
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lqaBhMWcGenTjoOdbUmSDMr2CN9rCPQfPvzxyoBYWyQ%3D&reserved=0>

--

Daniel-Constantin Mierla -- 
www.asipto.com<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.asipto.com%2F&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Bgaq9FnEJwxb6glJzA2K0yxHK1E44S73Wup7T9PYGzI%3D&reserved=0>

www.twitter.com/miconda<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.twitter.com%2Fmiconda&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=V6SiHPEeOAhfujMgXCWF02FjV0gE1c%2F9i%2BpZSOd02Zo%3D&reserved=0>
 -- 
www.linkedin.com/in/miconda<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=m5MFy1HS1a9a%2BQN%2FDJ4TIQCsed6G%2BU5KUOVTGPojy%2FE%3D&reserved=0>

Kamailio Advanced Training - Online: June 20-23, 2022

  * 
https://www.asipto.com/sw/kamailio-advanced-training-online/<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.asipto.com%2Fsw%2Fkamailio-advanced-training-online%2F&data=05%7C01%7Clewis.hutchinson%40missionlabs.co.uk%7Cadd1ff0f50b849f00f6d08da42183836%7C97c26f550a7a4661bd8f7b43b50d3f2b%7C0%7C0%7C637894969031544368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=59r7pcSjsBBxH2v%2BbK8Grh4T2SsJBCF2rocWGPTcd%2Fk%3D&reserved=0>
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:
  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to