<div dir="ltr">AFAIK the only way to "match" reg and invite (by sip design) is to use separate auth data for each reg. Client could use random port for UAC's and e.g. 5060 for UAS, so you can't really rely on contact vs src host:port matching.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-28 22:07 GMT+03:00 Luis Azedo <span dir="ltr"><<a href="mailto:luis@2600hz.com" target="_blank">luis@2600hz.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<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:<a href="http://mysip.com" target="_blank">mysip.com</a> SIP/2.0</div>
<div>Via: SIP/2.0/WSS 1pds95dm7slp.invalid;branch=z9hG4bK1393343</div>
<div>Max-Forwards: 70</div>
<div>To: <<a href="mailto:sip%3A1096@mysip.com" target="_blank">sip:1096@mysip.com</a>></div>
<div>From: <<a href="mailto:sip%3A1096@mysip.com" target="_blank">sip:1096@mysip.com</a>>;tag=99i9ka9951</div>
<div>Call-ID: 1agj9ujebn5k2006qvosg7</div>
<div>CSeq: 82 REGISTER</div>
<div>Authorization: Digest algorithm=MD5, username="1096", realm="<a href="http://mysip.com" target="_blank">mysip.com</a>", nonce="VHiXFFR4legH+zdoSro9zybQQclvFtcR", uri="sip:<a href="http://mysip.com" target="_blank">mysip.com</a>", 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: <<a href="mailto:sip%3A1096@mysip.com" target="_blank">sip:1096@mysip.com</a>>;tag=78e678a5264e254e660865f4df24edf3.e69b</div>
<div>From: <<a href="mailto:sip%3A1096@mysip.com" target="_blank">sip:1096@mysip.com</a>>;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="<a href="mailto:sip%3A1096@mysip.com" target="_blank">sip:1096@mysip.com</a>;gr=urn:uuid:876de649-281f-4f7f-9a3e-7b2a7e11f3cc";temp-gruu="<a href="mailto:sip%3Auloc-5478bf26-4504-1-7fd4326@mysip.com" target="_blank">sip:uloc-5478bf26-4504-1-7fd4326@mysip.com</a>;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 <a href="mailto:sip%3A2134@mysip.com" target="_blank">sip:2134@mysip.com</a> SIP/2.0</div>
<div>Via: SIP/2.0/WSS sg6h3at19h29.invalid;branch=z9hG4bK1752419</div>
<div>Max-Forwards: 70</div>
<div>To: <<a href="mailto:sip%3A2134@mysip.com" target="_blank">sip:2134@mysip.com</a>></div>
<div>From: <<a href="mailto:sip%3A1096@mysip.com" target="_blank">sip:1096@mysip.com</a>>;tag=6vii55tc02</div>
<div>Call-ID: i3hndju3tgsge7ctnvo2</div>
<div>CSeq: 4782 INVITE</div>
<div>Contact: <<a href="mailto:sip%3A1096@mysip.com" target="_blank">sip:1096@mysip.com</a>;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:: <a href="mailto:1096@mysip.com" target="_blank">1096@mysip.com</a></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>
</div>

<br>_______________________________________________<br>
sr-dev mailing list<br>
<a href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div><div>Best regards,<br>Alekzander Spiridonov</div><br></div></div>
</div>