[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serusers
Subject:    Re: [SR-Users] usage of {s.urldecode.param} to convert special chars (why is + removed?)
From:       Bastian Triller <bastian.triller () gmail ! com>
Date:       2022-07-14 16:59:55
Message-ID: CALJ8HB6KxXtSNxqkkHZzUfLVzcCk5f9wnx6AHJogSr4c-KOvFQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Try {s.unescape.user}

https://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sescapeuser

On Thu, Jul 14, 2022, 13:52 Benoit Panizzon <benoit.panizzon@imp.ch> wrote:

> 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
> ______________________________________________________
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users@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
>

[Attachment #5 (text/html)]

<div dir="auto">Try  {s.unescape.user}<div dir="auto"><br></div><div dir="auto"><a \
href="https://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sescapeuser">https \
://www.kamailio.org/wiki/cookbooks/5.5.x/transformations#sescapeuser</a><br></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 14, 2022, 13:52 \
Benoit Panizzon &lt;<a \
href="mailto:benoit.panizzon@imp.ch">benoit.panizzon@imp.ch</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi List<br> <br>
Service Numbers, like to activate CFW probably often start with * and<br>
end with a #<br>
<br>
# is a special character that needs to be urlencoded in an SIP URI. So<br>
best would be to use a generic kamailio urldecode transormation. I guess<br>
{s.urldecode.param} is what I was looking for.<br>
<br>
So when I get a call to the &#39;enable CFW&#39; service I get<br>
<br>
$rU =&gt;   &quot;*21+419999999%23&quot;<br>
<br>
So I want to extract the destination number and remove the urlencoded # sign.<br>
<br>
So I do $var(cfw-dest) = <br>
$var(cfw-dest) = $rU;<br>
$var(cfw-dest) = $(var(cfw-dest){s.substr,3,0}); # &quot;+419999999%23&quot;<br>
$var(cfw-dest) = $(var(cfw-dest){s.urldecode.param});<br>
<br>
But now I end up with 419999999#   the + sigh disappeared.<br>
<br>
Is this expected behavior? How would this be done the correct way?<br>
<br>
Mit freundlichen Grüssen<br>
<br>
-Benoît Panizzon-<br>
-- <br>
I m p r o W a r e     A G      -      Leiter Commerce Kunden<br>
______________________________________________________<br>
<br>
Zurlindenstrasse 29                    Tel   +41 61 826 93 00<br>
CH-4133 Pratteln                        Fax   +41 61 826 93 01<br>
Schweiz                                      Web   <a href="http://www.imp.ch" \
rel="noreferrer noreferrer" target="_blank">http://www.imp.ch</a><br> \
______________________________________________________<br> <br>
__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
   * <a href="mailto:sr-users@lists.kamailio.org" target="_blank" \
                rel="noreferrer">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not reply only to the \
sender!<br> Edit mailing list options or unsubscribe:<br>
   * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" \
rel="noreferrer noreferrer" \
target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br> \
</blockquote></div>



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
  * sr-users@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic