<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">When kamailio processes a request
      script writer can check if there any Route header or valid  R-URI
      or R-URI alias parameter to determine the destination. You can
      check it manually maybe reusing kamailio sip parser.<br>
      <br>
      As you've already said to find a destination where kamailio is
      going to send a reply you can parse via header or its "received"
      and "rport" parameters. Even when via doesn't have valid
      destination (ws/wss transport) it has correct "received" and
      "rport" parameters which kamailio adds during a request
      processing.<br>
      <br>
      "Via" header in INVITE received from WSS client and forwarded to a
      destination looks like this:<br>
      "Via: SIP/2.0/WSS
df7jal23ls0d.invalid;received=1.2.3.4;branch=z9hG4bKTp9lzCApgHsdbRUrFcZ4XTCI49EZbbDf;rport=37213"<br>
      <br>
      <br>
    </div>
    <blockquote
cite="mid:CAFZQphzUvuL55=fuuBuUEomQnrv727uPGqSJE8iy4uVVHMeB_g@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Not really, the main context of this question is in
              reference to this thread,<br>
              <br>
              <a moz-do-not-send="true"
href="https://www.mail-archive.com/sr-users@lists.sip-router.org/msg19962.html">https://www.mail-archive.com/sr-users@lists.sip-router.org/msg19962.html</a><br>
              <br>
            </div>
            A patched to allow network IO intercept in kamailio corex
            module was add to trunk as discussed in this thread,<br>
            <br>
            <a moz-do-not-send="true"
href="https://www.mail-archive.com/sr-users@lists.sip-router.org/msg20183.html">https://www.mail-archive.com/sr-users@lists.sip-router.org/msg20183.html</a><br>
            <br>
          </div>
          Currently i am able to compress / decompress entire sip
          message coming from or going to remote endpoint in kamailio
          server. It works fine. Now i want to try ITV encryption
          algorithm for this on-wire data.<br>
          <br>
          <a moz-do-not-send="true" href="https://github.com/mshary/itv">https://github.com/mshary/itv</a><br>
          <br>
        </div>
        For this i need to keep track of remote endpoint. At this low
        level, i only have raw data received from or being transmitted
        to remote UA, without even the remote socket address, so i have
        no choice but to look at this raw data to determine the identity
        of remote endpoint. For non-WS transport, i can easily  look at
        topmost VIA and extract network address to use as "unique
        identification" of endpoint who sent the data or would receive
        the data. However, for WS transport this topmost VIA is useless
        static constant string. So VIA checking is pointless (all remote
        endpoints will or may have same top most VIA).<br>
        <br>
        So i was thinking if there is another way to do it? I thought of
        using GRUU, but it is not always present, especially in SIP
        replies.<br>
        <div>
          <div><br>
          </div>
          <div>Thank you.<br>
          </div>
          <div><br>
            <br>
          </div>
        </div>
      </div>
      <div class="gmail_extra">
        <br>
        <br>
        <div class="gmail_quote">On Mon, Aug 25, 2014 at 3:24 PM,
          Vitaliy Aleksandrov <span dir="ltr"><<a
              moz-do-not-send="true"
              href="mailto:vitalik.voip@gmail.com" target="_blank">vitalik.voip@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class="HOEnZb">
              <div class="h5">On 22.08.14 03:26, Muhammad Shahzad wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  Sorry for putting this question on both dev and user
                  mailing lists, as it is a rather theoretical question
                  and i hope some SIP guru on either mail list will
                  answer.<br>
                  <br>
                  For non-WS endpoints which use TCP or UDP for SIP
                  transport, each upstream request has top most VIA
                  header pointing to the previous hop which forwarded
                  the request to current hop while each downstream
                  request has top most VIA header pointing to next hop
                  to which it will be forwarded from current hop.<br>
                  <br>
                  But for WS endpoints, the top most VIA has dummy
                  static value, so there is no way to identify who sent
                  this request or to whom the reply is going to.<br>
                  <br>
                  Please note that i am not specifically interested in
                  network address of remote endpoint (though VIA header
                  is suppose to provide it), i only need to match
                  requests and responses from / to a specific device
                  using SIP v2.0 standard.<br>
                  <br>
                  Any help is highly appreciated.<br>
                  <br>
                  Thank you.<br>
                  <br>
                </blockquote>
                <br>
              </div>
            </div>
            Can you provide an example of scenario you want to create ?<br>
            Do you want to understand how transaction and dialog
            matching works in SIP ?<br>
            <br>
            _______________________________________________<br>
            SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
            mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:sr-users@lists.sip-router.org"
              target="_blank">sr-users@lists.sip-router.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
              target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>