<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi,
<div><br>
</div>
<div>when using sip.js websocket client i got this sequence</div>
<div><br>
</div>
<div>
<div>REGISTER sip:mysip.com SIP/2.0</div>
<div>Via: SIP/2.0/WSS 1pds95dm7slp.invalid;branch=z9hG4bK1393343</div>
<div>Max-Forwards: 70</div>
<div>To: <sip:1096@mysip.com></div>
<div>From: <sip:1096@mysip.com>;tag=99i9ka9951</div>
<div>Call-ID: 1agj9ujebn5k2006qvosg7</div>
<div>CSeq: 82 REGISTER</div>
<div>Authorization: Digest algorithm=MD5, username="1096", realm="mysip.com", nonce="VHiXFFR4legH+zdoSro9zybQQclvFtcR", uri="sip:mysip.com", response="2d9843d09d94f295d0ebfa323233783c"</div>
<div>Contact: <sip:n7o5lk6u@1pds95dm7slp.invalid;transport=ws>;reg-id=1;+sip.instance="<urn:uuid:d68a53c4-37e7-4f5c-87f2-68d7cca14b93>";expires=600</div>
<div>Allow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE,MESSAGE</div>
<div>Supported: path,gruu,100rel,outbound</div>
<div>User-Agent: SIP.js/0.6.3</div>
<div>Content-Length: 0</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<div>SIP/2.0 200 OK</div>
<div>Via: SIP/2.0/WSS sg6h3at19h29.invalid;branch=z9hG4bK4876180;rport=65377;received=X.X.X.X</div>
<div>To: <sip:1096@mysip.com>;tag=78e678a5264e254e660865f4df24edf3.e69b</div>
<div>From: <sip:1096@mysip.com>;tag=j39lvle827</div>
<div>Call-ID: c0ofajiui4u2vtem662rdh</div>
<div>CSeq: 86 REGISTER</div>
<div>Contact: <sip:8umlvk34@sg6h3at19h29.invalid;transport=ws>;expires=600;pub-gruu="sip:1096@mysip.com;gr=urn:uuid:876de649-281f-4f7f-9a3e-7b2a7e11f3cc";temp-gruu="sip:uloc-5478bf26-4504-1-7fd4326@mysip.com;gr";+sip.instance="<urn:uuid:876de649-281f-4f7f-9a3e-7b2a7e11f3cc>";reg-id=1</div>
<div>Content-Length: 0</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>INVITE sip:2134@mysip.com SIP/2.0</div>
<div>Via: SIP/2.0/WSS sg6h3at19h29.invalid;branch=z9hG4bK1752419</div>
<div>Max-Forwards: 70</div>
<div>To: <sip:2134@mysip.com></div>
<div>From: <sip:1096@mysip.com>;tag=6vii55tc02</div>
<div>Call-ID: i3hndju3tgsge7ctnvo2</div>
<div>CSeq: 4782 INVITE</div>
<div>Contact: <sip:1096@mysip.com;gr=urn:uuid:876de649-281f-4f7f-9a3e-7b2a7e11f3cc></div>
<div>Allow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE,MESSAGE</div>
<div>Content-Type: application/sdp</div>
<div>Supported: gruu,100rel,outbound</div>
<div>User-Agent: SIP.js/0.6.3</div>
<div>Content-Length: 2585</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>i issued kamctl show to view the registered user</div>
<div>
<div> </div>
<div>       AOR:: 1096@mysip.com</div>
<div>                Contact:: sip:8umlvk34@sg6h3at19h29.invalid;transport=ws Q=</div>
<div>                        Expires:: 177</div>
<div>                        Callid:: c0ofajiui4u2vtem662rdh</div>
<div>                        Cseq:: 86</div>
<div>                        User-agent:: SIP.js/0.6.3</div>
<div>                        Received:: sip:X.X.X.X:65377;transport=WS</div>
<div>                        State:: CS_SYNC</div>
<div>                        Flags:: 0</div>
<div>                        Cflag:: 6</div>
<div>                        Socket:: tls:Y.Y.Y.Y:8443</div>
<div>                        Methods:: 927</div>
<div>                        Ruid:: uloc-5478bf26-4504-1</div>
<div>                        Instance:: <urn:uuid:876de649-281f-4f7f-9a3e-7b2a7e11f3cc></div>
<div>                        Reg-Id:: 1</div>
<div>                        Last-Keepalive:: 1417200609</div>
<div>                        Last-Modified:: 1417200609</div>
<div><br>
</div>
</div>
<div><span style="font-size: 10pt;">what is the best way to check if the INVITE is from a registered user and how to get usrloc properties for the registered user ?</span></div>
<div><span style="font-size: 10pt;"><br>
</span></div>
<div><span style="font-size: 10pt;">i tried this</span></div>
<div><span style="font-size: 10pt;"><br>
</span></div>
<div>
<div>reg_fetch_contacts("location", "$fu", "caller");</div>
<div>
<div>$var(i) = 0;</div>
<div>$var(found) = 0;</div>
</div>
<div>$var(contact) = $(ct{nameaddr.uri});</div>
<div style="font-size: 10pt;">
<div style="font-size: 10pt;">while($var(found) == 0 && $var(i) < $(ulc(caller=>count))) </div>
<div style="font-size: 10pt;">   {</div>
<div style="font-size: 10pt;">      xlog("L_INFO", "$ci|log| checking against $(ulc(caller=>addr)[$var(i)])");</div>
<div style="font-size: 10pt;">      if($var(contact) == $(ulc(caller=>addr)[$var(i)]))</div>
<div style="font-size: 10pt;">      {</div>
<div style="font-size: 10pt;">          $var(found) = 1;</div>
<div style="font-size: 10pt;">          $var(caller_idx) = $var(i);</div>
<div style="font-size: 10pt;">          $var(userlocid) = $(ulc(caller=>ruid)[$var(i)]);</div>
<div style="font-size: 10pt;">      }</div>
<div style="font-size: 10pt;">      else</div>
<div style="font-size: 10pt;">           $var(i) = $var(i) + 1;</div>
<div style="font-size: 10pt;">   }</div>
<div><br>
</div>
</div>
</div>
<div><br>
</div>
<div>the problem i see is that the INVITE Contact doesn't match the one registered.</div>
<div><br>
</div>
<div>is this a problem with sip.js or am i missing something in kamailio.cfg or should kamailio save the contact info as sip.js is sending?</div>
<div><br>
</div>
<div>Thank you</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</body>
</html>