[SR-Users] Any clever ways to strip down a user portion of an RURI?

Brooks Bridges bbridges at call48.com
Fri Mar 11 19:59:46 CET 2022


Thanks everyone!


-----Original Message-----
From: sr-users <sr-users-bounces at lists.kamailio.org> On Behalf Of Daniel-Constantin Mierla
Sent: Friday, March 11, 2022 5:23 AM
To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>; Alex Balashov <abalashov at evaristesys.com>
Subject: Re: [SR-Users] Any clever ways to strip down a user portion of an RURI?

I haven't tried, but an alternative idea that worth checking:

xavp_params_explode("$rU", "u");

$xavp(u=>npdi) = $null;

xavp_params_implode("u", "$rU");

$xavp(u) = $null;

Cheers,
Daniel

On 10.03.22 22:03, Alex Balashov wrote:
> 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/
>
>
> __________________________________________________________
> 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

--
Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Online
  March 28-31, 2022 (Europe Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/


__________________________________________________________
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
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.


More information about the sr-users mailing list