[SR-Users] Any clever ways to strip down a user portion of an RURI?
Alex Balashov
abalashov at evaristesys.com
Thu Mar 10 22:03:49 CET 2022
I have a similar need and have not found any shortcuts. Nevertheless, I hope the following snippet might help generalise the problem:
----------
$var(new_ru) = ‘';
$var(i) = 0;
while($var(i) < $(rU{param.count,;})) {
$var(k) = $(rU{param.name,$var(i),;});
switch($var(k)) {
# Strip off 'npdi', keep all else.
case 'npdi':
break;
default:
if($(var(new_ru){s.len}) > 0)
$var(new_ru) = $var(new_ru) + ';';
$var(new_ru) = $var(new_ru) + $(rU{param.name,$var(i),;});
if(!strempty($(rU{param.valueat,$var(i),;})))
$var(new_ru) = $var(new_ru) + '=' + $(rU{param.valueat,$var(i),;});
}
$var(i) = $var(i) + 1;
}
$rU = $var(new_ru);
----------
For a test RURI value of:
sip:14045551212;npdi;moo;rn=14045550000 at sip.evaristesys.com
This yields:
sip:14045551212;moo;rn=14045550000 at sip.evaristesys.com
More parameters to strip out can just be added to the ’switch’ statement.
— Alex
> On Mar 10, 2022, at 3:25 PM, Brooks Bridges <bbridges at call48.com> wrote:
>
> Have a need to strip out various parameters from the user portion of the RURI and/or the To (npdi, etc). Does anyone have any clever methods for doing so that don’t involve just brute forcing through the individual parameters?
> Confidentiality Notice: This e-mail, and any attachment to it, contains privileged and confidential information intended only for the use of the individual(s) or entity named on the e-mail. If the reader of this e-mail is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that reading this e-mail is strictly prohibited. If you have received this e-mail in error, please immediately return it to the sender and delete it from your system. __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> * sr-users at lists.kamailio.org
> 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
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
More information about the sr-users
mailing list