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

List:       serusers
Subject:    Re: [SR-Users] How to make a distinction between sip and tel uri
From:       George Diamantopoulos <georgediam () gmail ! com>
Date:       2020-01-29 14:18:36
Message-ID: CAPcKEYOUg9-PTHuc56pzxrBjPmpxGoT0e058Ff2wZs+w3eXU2A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


How about something like this:

  $vz(i) = 0;
  pv_unset("$vn(save_ai)")
  while ($vz(i) < $hdrc(P-Asserted-Identity)) {

      $vn(temp_holder) = $(hdr(P-Asserted-Identity)[$vz(i)]);

      if ( $(vn(temp_holder){nameaddr.uri}{uri.scheme}) =~ "^sip" ) {

            $vn(save_ai) = $vn(temp_holder);

            break;
      }
  }

  if ( $vn(save_ai) != $null ) {
        remove_hf("P-Asserted-Identity");
        append_hf("P-Asserted-Identity: $vn(save_ai)\r\n");
  }

might need some tuning, and you need the textops module.


On Wed, 29 Jan 2020 at 14:19, Duarte Rocha <duarterocha91@gmail.com> wrote:

> Greetings,
>
> I have a client that sends me two P-Asserted-Identity headers, one with
> SIP URI and one with tel URI.
>
> The pseudo variable $ai returns the topmost P-Asserted-Identity header and
> I only need the one with the SIP URI.
>
> How should i proceed ? Is there a way to delete the one with tel URI? the
> header removal functions i find only work with header name.
>
> I could also work with something different than $ai for this scenario.
>
> Best Regards,
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>

[Attachment #5 (text/html)]

<div dir="ltr"><div>How about something like this:</div><pre class="gmail-code">  \
$vz(i) = 0;<br>  pv_unset(&quot;$vn(save_ai)&quot;)<br>   while ($vz(i) &lt; <span \
class="gmail-br0"></span>$hdrc<span \
class="gmail-br0">(P-Asserted-Identity</span><span class="gmail-br0">)</span>) \
{<br></pre><pre class="gmail-code">      $vn(temp_holder) = \
$(hdr(P-Asserted-Identity)[$vz(i)]);</pre><pre class="gmail-code">      if ( \
$(vn(temp_holder){nameaddr.uri}{uri.scheme}) =~ &quot;^sip&quot; ) {<br></pre><pre \
class="gmail-code">            $vn(save_ai) = $vn(temp_holder);<br></pre><pre \
class="gmail-code">            break;<br>      }<br>   }<br><br></pre><pre \
class="gmail-code">  if ( $vn(save_ai) != $null ) {<br>        \
remove_hf(&quot;P-Asserted-Identity&quot;);  append_hf(&quot;P-Asserted-Identity: \
$vn(save_ai)\r\n&quot;);<br>  }<br><br></pre><pre class="gmail-code">might need some \
tuning, and you need the textops module.<br></pre></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 29 Jan 2020 at 14:19, \
Duarte Rocha &lt;<a href="mailto:duarterocha91@gmail.com">duarterocha91@gmail.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div \
dir="auto">Greetings,  </div><div dir="auto"><br></div><div dir="auto">I have a \
client that sends me two P-Asserted-Identity headers, one with SIP URI and one with \
tel URI.</div><div dir="auto"><br></div><div dir="auto">The pseudo variable $ai \
returns the topmost P-Asserted-Identity header and I only need the one with the SIP \
URI.</div><div dir="auto"><br></div><div dir="auto">How should i proceed ? Is there a \
way to delete the one with tel URI? the header removal functions i find only work \
with header name.</div><div dir="auto"><br></div><div dir="auto">I could also work \
with something different than $ai for this scenario.</div><div \
dir="auto"><br></div><div dir="auto">Best Regards,</div></div> \
_______________________________________________<br> Kamailio (SER) - Users Mailing \
List<br> <a href="mailto:sr-users@lists.kamailio.org" \
target="_blank">sr-users@lists.kamailio.org</a><br> <a \
href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" \
target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br> \
</blockquote></div>


[Attachment #6 (text/plain)]

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
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