[OpenSIPS-Devel] SF.net SVN: opensips:[5942] trunk/modules/presence_xml/xcap_auth.c

Anca Vamanu anca at opensips.org
Tue Aug 11 14:37:53 CEST 2009


Iñaki Baz Castillo wrote:
> 2009/8/7 Iñaki Baz Castillo <ibc at aliax.net>:
>   
>> After bob dissapears in alice's pres-rules, the entry in
>> active_watchers is removed, but a new one is created for the new
>> subscription coming from bob (after receiving the NOTIFY
>> terminated;reason=deactivated).
>>
>> The problem is that the new entry in active_watcher has status 1 while
>> it should be 3 (pending).
>>     
>
>
> The following illustrates the issue:
>
>
> - bob is allowed by alice. An entry with status "1" (active) is
> present in active_watchers.
>
> - Now alice removes bob from the pres-rules so OpenSIPS generates this
> correct NOFITY:
>
> U 2009/08/11 01:26:01.033525 99.221.79.216:5065 -> 99.221.79.216:5060
> NOTIFY sip:bob at 85.84.170.107:6060 SIP/2.0'
> Via: SIP/2.0/UDP 99.221.79.216:5065;branch=z9hG4bK44c2.36fba581.0'
> To: <sip:bob at example.net>;tag=ipwps'
> From: <sip:alice at example.net>;tag=5e49c2c8b7a2795ddc4f373ff7fed527-925a'
> CSeq: 3 NOTIFY'
> Call-ID: zdaljrilplvtphe at barakaldo'
> Route: <sip:99.221.79.216;lr=on;ftag=ipwps>'
> Content-Length: 0'
> User-Agent: OpenSIPS (1.6.0dev0-notls (x86_64/linux))'
> Max-Forwards: 70'
> Event: presence'
> Contact: <sip:presence at 99.221.79.216:5065>'
> Subscription-State: terminated;reason=deactivated'
> '
>
>
> - Inmediatelly bob subscribes again:
>
> ##
> U 2009/08/11 01:26:01.210697 99.221.79.216:5060 -> 99.221.79.216:5065
> SUBSCRIBE sip:alice at example.net SIP/2.0'
> Record-Route: <sip:99.221.79.216;lr=on;ftag=qoqsj>'
> Via: SIP/2.0/UDP 99.221.79.216;branch=z9hG4bK2aa.b16f23c.0'
> Via: SIP/2.0/UDP
> 85.84.170.107:6060;received=85.84.170.107;rport=6060;branch=z9hG4bKdittkcfb'
> Max-Forwards: 70'
> To: <sip:alice at example.net>'
> From: "Bob" <sip:bob at example.net>;tag=qoqsj'
> Call-ID: gqddceauwnfqajj at barakaldo'
> CSeq: 111 SUBSCRIBE'
> Contact: <sip:bob at 85.84.170.107:6060>'
> Accept: application/pidf+xml'
> Event: presence'
> Expires: 3600'
> User-Agent: Twinkle/1.3.2'
> Content-Length: 0'
> '
>
>
> - ERROR: OpenSIPS sends a NOTIFY with "active" status:
>
> ##
> U 2009/08/11 01:26:01.214601 99.221.79.216:5065 -> 99.221.79.216:5060
> NOTIFY sip:bob at 85.84.170.107:6060 SIP/2.0'
> Via: SIP/2.0/UDP 99.221.79.216:5065;branch=z9hG4bK72be.aaa09473.0'
> To: <sip:bob at example.net>;tag=qoqsj'
> From: <sip:alice at example.net>;tag=5e49c2c8b7a2795ddc4f373ff7fed527-3cda'
> CSeq: 1 NOTIFY'
> Call-ID: gqddceauwnfqajj at barakaldo'
> Route: <sip:99.221.79.216;lr=on;ftag=qoqsj>'
> Content-Length: 215'
> User-Agent: OpenSIPS (1.6.0dev0-notls (x86_64/linux))'
> Max-Forwards: 70'
> Event: presence'
> Contact: <sip:presence at 99.221.79.216:5065>'
> Subscription-State: active;expires=3590'
> Content-Type: application/pidf+xml'
> '
> <?xml version="1.0" encoding="UTF-8"?>
> <presence xmlns="urn:ietf:params:xml:ns:pidf" entity="sip:alice at example.net">
>   <tuple id="njfsvs">
>     <status>
>       <basic>open</basic>
>     </status>
>   </tuple>
> </presence>
>
>
> - At this point, the previous entry in active_watchers has been
> deleted, but the new one (originated by the new SUBSCRIBE) exists with
> status 1 (while it should be "pending" as bob doesn't appear in the
> pres-rules document).
>
>
> Note that it doesn't matter if the new subscription (After
> "deactivated") is instant or not. The issue occurs in both cases (I've
> also tryed with sip_subscribe_presence command line utility (AG) to
> repeat the subscription long time ago (2 minutes) after receiving the
> "deactivated".
>
>   
Hi Inaki,

I have tried exactly this scenario - with bob allowed by alice at first 
and the deleted and what I got was exactly the expected output - -. 
first a Notify with status terminated; reason deactivated and then for 
the Subscribe that followed, a Notify with status pending.
So I suspect that in your case the document in xcap table is not right.


regards.

No.     Time        Source                Destination           Protocol 
Info
   2523 42.104987   192.168.2.132         192.168.2.132         SIP      
Request: NOTIFY sip:friend at 192.168.2.132:5063

Frame 2523 (523 bytes on wire, 523 bytes captured)
Linux cooked capture
Internet Protocol, Src: 192.168.2.132 (192.168.2.132), Dst: 
192.168.2.132 (192.168.2.132)
User Datagram Protocol, Src Port: sip (5060), Dst Port: 5063 (5063)
Session Initiation Protocol
    Request-Line: NOTIFY sip:friend at 192.168.2.132:5063 SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 192.168.2.132;branch=z9hG4bK8b94.ab199905.0
        To: <sip:friend at 192.168.2.132>;tag=xdbxb
        From: 
<sip:someone at 192.168.2.132>;tag=7e1b6c9de39fe30b674607774ec7fe5f-eeb3
        CSeq: 4 NOTIFY
        Call-ID: quutwimapaafouc at anca-laptop
        Content-Length: 0
        User-Agent: OpenSIPS (1.6.0dev0-notls (i386/linux))
        Max-Forwards: 70
        Event: presence
        Contact: <sip:sa at 192.168.2.132:5060>
        Subscription-State: terminated;reason=deactivated

No.     Time        Source                Destination           Protocol 
Info
   2524 42.109810   192.168.2.132         192.168.2.132         SIP      
Status: 200 OK

Frame 2524 (337 bytes on wire, 337 bytes captured)
Linux cooked capture
Internet Protocol, Src: 192.168.2.132 (192.168.2.132), Dst: 
192.168.2.132 (192.168.2.132)
User Datagram Protocol, Src Port: 5063 (5063), Dst Port: sip (5060)
Session Initiation Protocol
    Status-Line: SIP/2.0 200 OK
    Message Header
        Via: SIP/2.0/UDP 192.168.2.132;branch=z9hG4bK8b94.ab199905.0
        To: <sip:friend at 192.168.2.132>;tag=xdbxb
        From: 
<sip:someone at 192.168.2.132>;tag=7e1b6c9de39fe30b674607774ec7fe5f-eeb3
        Call-ID: quutwimapaafouc at anca-laptop
        CSeq: 4 NOTIFY
        Server: Twinkle/1.2
        Content-Length: 0

No.     Time        Source                Destination           Protocol 
Info
   2525 42.110062   192.168.2.132         192.168.2.132         SIP      
Request: SUBSCRIBE sip:someone at 192.168.2.132

Frame 2525 (468 bytes on wire, 468 bytes captured)
Linux cooked capture
Internet Protocol, Src: 192.168.2.132 (192.168.2.132), Dst: 
192.168.2.132 (192.168.2.132)
User Datagram Protocol, Src Port: 5063 (5063), Dst Port: sip (5060)
Session Initiation Protocol
    Request-Line: SUBSCRIBE sip:someone at 192.168.2.132 SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 192.168.2.132:5063;rport;branch=z9hG4bKqnsnycsg
        Max-Forwards: 70
        To: <sip:someone at 192.168.2.132>
        From: "friend" <sip:friend at 192.168.2.132>;tag=qushi
        Call-ID: zutnsycgfszdbvy at anca-laptop
        CSeq: 787 SUBSCRIBE
        Contact: <sip:friend at 192.168.2.132:5063>
        Accept: application/pidf+xml
        Event: presence
        Expires: 3600
        User-Agent: Twinkle/1.2
        Content-Length: 0

No.     Time        Source                Destination           Protocol 
Info
   2526 42.115875   192.168.2.132         192.168.2.132         SIP      
Status: 202 OK

Frame 2526 (441 bytes on wire, 441 bytes captured)
Linux cooked capture
Internet Protocol, Src: 192.168.2.132 (192.168.2.132), Dst: 
192.168.2.132 (192.168.2.132)
User Datagram Protocol, Src Port: sip (5060), Dst Port: 5063 (5063)
Session Initiation Protocol
    Status-Line: SIP/2.0 202 OK
    Message Header
        Via: SIP/2.0/UDP 
192.168.2.132:5063;rport=5063;branch=z9hG4bKqnsnycsg
        To: 
<sip:someone at 192.168.2.132>;tag=7e1b6c9de39fe30b674607774ec7fe5f-4a87
        From: "friend" <sip:friend at 192.168.2.132>;tag=qushi
        Call-ID: zutnsycgfszdbvy at anca-laptop
        CSeq: 787 SUBSCRIBE
        Expires: 3595
        Contact: <sip:sa at 192.168.2.132:5060>
        Server: OpenSIPS (1.6.0dev0-notls (i386/linux))
        Content-Length: 0

No.     Time        Source                Destination           Protocol 
Info
   2527 42.116802   192.168.2.132         192.168.2.132         SIP      
Request: NOTIFY sip:friend at 192.168.2.132:5063

Frame 2527 (513 bytes on wire, 513 bytes captured)
Linux cooked capture
Internet Protocol, Src: 192.168.2.132 (192.168.2.132), Dst: 
192.168.2.132 (192.168.2.132)
User Datagram Protocol, Src Port: sip (5060), Dst Port: 5063 (5063)
Session Initiation Protocol
    Request-Line: NOTIFY sip:friend at 192.168.2.132:5063 SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 192.168.2.132;branch=z9hG4bK2dcb.4d38218.0
        To: <sip:friend at 192.168.2.132>;tag=qushi
        From: 
<sip:someone at 192.168.2.132>;tag=7e1b6c9de39fe30b674607774ec7fe5f-4a87
        CSeq: 1 NOTIFY
        Call-ID: zutnsycgfszdbvy at anca-laptop
        Content-Length: 0
        User-Agent: OpenSIPS (1.6.0dev0-notls (i386/linux))
        Max-Forwards: 70
        Event: presence
        Contact: <sip:sa at 192.168.2.132:5060>
        Subscription-State: pending;expires=3595

No.     Time        Source                Destination           Protocol 
Info
   2528 42.118510   192.168.2.132         192.168.2.132         SIP      
Status: 200 OK

Frame 2528 (336 bytes on wire, 336 bytes captured)
Linux cooked capture
Internet Protocol, Src: 192.168.2.132 (192.168.2.132), Dst: 
192.168.2.132 (192.168.2.132)
User Datagram Protocol, Src Port: 5063 (5063), Dst Port: sip (5060)
Session Initiation Protocol
    Status-Line: SIP/2.0 200 OK
    Message Header
        Via: SIP/2.0/UDP 192.168.2.132;branch=z9hG4bK2dcb.4d38218.0
        To: <sip:friend at 192.168.2.132>;tag=qushi
        From: 
<sip:someone at 192.168.2.132>;tag=7e1b6c9de39fe30b674607774ec7fe5f-4a87
        Call-ID: zutnsycgfszdbvy at anca-laptop
        CSeq: 1 NOTIFY
        Server: Twinkle/1.2
        Content-Length: 0



More information about the Devel mailing list