[SR-Users] usage of {s.urldecode.param} to convert special chars (why is + removed?)

Benoit Panizzon benoit.panizzon at imp.ch
Thu Jul 14 13:51:49 CEST 2022


Hi List

Service Numbers, like to activate CFW probably often start with * and
end with a #

# is a special character that needs to be urlencoded in an SIP URI. So
best would be to use a generic kamailio urldecode transormation. I guess
{s.urldecode.param} is what I was looking for.

So when I get a call to the 'enable CFW' service I get

$rU =>  "*21+419999999%23"

So I want to extract the destination number and remove the urlencoded # sign.

So I do $var(cfw-dest) = 
$var(cfw-dest) = $rU;
$var(cfw-dest) = $(var(cfw-dest){s.substr,3,0}); # "+419999999%23"
$var(cfw-dest) = $(var(cfw-dest){s.urldecode.param});

But now I end up with 419999999#  the + sigh disappeared.

Is this expected behavior? How would this be done the correct way?

Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G    -    Leiter Commerce Kunden
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 00
CH-4133 Pratteln                Fax  +41 61 826 93 01
Schweiz                         Web  http://www.imp.ch
______________________________________________________



More information about the sr-users mailing list