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.

2014-11-28 22:07 GMT+03:00 Luis Azedo <luis@2600hz.com>:
Hi,

when using sip.js websocket client i got this sequence

REGISTER sip:mysip.com SIP/2.0
Via: SIP/2.0/WSS 1pds95dm7slp.invalid;branch=z9hG4bK1393343
Max-Forwards: 70
From: <sip:1096@mysip.com>;tag=99i9ka9951
Call-ID: 1agj9ujebn5k2006qvosg7
CSeq: 82 REGISTER
Authorization: Digest algorithm=MD5, username="1096", realm="mysip.com", nonce="VHiXFFR4legH+zdoSro9zybQQclvFtcR", uri="sip:mysip.com", response="2d9843d09d94f295d0ebfa323233783c"
Contact: <sip:n7o5lk6u@1pds95dm7slp.invalid;transport=ws>;reg-id=1;+sip.instance="<urn:uuid:d68a53c4-37e7-4f5c-87f2-68d7cca14b93>";expires=600
Allow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE,MESSAGE
Supported: path,gruu,100rel,outbound
User-Agent: SIP.js/0.6.3
Content-Length: 0


SIP/2.0 200 OK
Via: SIP/2.0/WSS sg6h3at19h29.invalid;branch=z9hG4bK4876180;rport=65377;received=X.X.X.X
To: <sip:1096@mysip.com>;tag=78e678a5264e254e660865f4df24edf3.e69b
From: <sip:1096@mysip.com>;tag=j39lvle827
Call-ID: c0ofajiui4u2vtem662rdh
CSeq: 86 REGISTER
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
Content-Length: 0


INVITE sip:2134@mysip.com SIP/2.0
Via: SIP/2.0/WSS sg6h3at19h29.invalid;branch=z9hG4bK1752419
Max-Forwards: 70
From: <sip:1096@mysip.com>;tag=6vii55tc02
Call-ID: i3hndju3tgsge7ctnvo2
CSeq: 4782 INVITE
Contact: <sip:1096@mysip.com;gr=urn:uuid:876de649-281f-4f7f-9a3e-7b2a7e11f3cc>
Allow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE,MESSAGE
Content-Type: application/sdp
Supported: gruu,100rel,outbound
User-Agent: SIP.js/0.6.3
Content-Length: 2585


i issued kamctl show to view the registered user
 
       AOR:: 1096@mysip.com
                Contact:: sip:8umlvk34@sg6h3at19h29.invalid;transport=ws Q=
                        Expires:: 177
                        Callid:: c0ofajiui4u2vtem662rdh
                        Cseq:: 86
                        User-agent:: SIP.js/0.6.3
                        Received:: sip:X.X.X.X:65377;transport=WS
                        State:: CS_SYNC
                        Flags:: 0
                        Cflag:: 6
                        Socket:: tls:Y.Y.Y.Y:8443
                        Methods:: 927
                        Ruid:: uloc-5478bf26-4504-1
                        Instance:: <urn:uuid:876de649-281f-4f7f-9a3e-7b2a7e11f3cc>
                        Reg-Id:: 1
                        Last-Keepalive:: 1417200609
                        Last-Modified:: 1417200609

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 ?

i tried this

reg_fetch_contacts("location", "$fu", "caller");
$var(i) = 0;
$var(found) = 0;
$var(contact) = $(ct{nameaddr.uri});
while($var(found) == 0 && $var(i) < $(ulc(caller=>count))) 
   {
      xlog("L_INFO", "$ci|log| checking against $(ulc(caller=>addr)[$var(i)])");
      if($var(contact) == $(ulc(caller=>addr)[$var(i)]))
      {
          $var(found) = 1;
          $var(caller_idx) = $var(i);
          $var(userlocid) = $(ulc(caller=>ruid)[$var(i)]);
      }
      else
           $var(i) = $var(i) + 1;
   }


the problem i see is that the INVITE Contact doesn't match the one registered.

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?

Thank you






_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev




--
Best regards,
Alekzander Spiridonov