Project

General

Profile

Sip subscribe winfo » History » Version 11

Adrian Georgescu, 02/22/2009 11:11 AM

1 8 Adrian Georgescu
== sip_subscribe_winfo ==
2 10 Adrian Georgescu
[[TOC(SipTesting*, sip_*, depth=2)]]
3 9 Adrian Georgescu
To use this script you must to have a valid [wiki:SipConfiguration configuration file].
4 1 Adrian Georgescu
5 8 Adrian Georgescu
=== Description ===
6 1 Adrian Georgescu
7 10 Adrian Georgescu
[[Image(http://www.openxcap.org/chrome/site/SIMPLE-Winfo.png, nolink)]]
8 11 Adrian Georgescu
9 6 Adrian Georgescu
Watchers are defined as entities that request (i.e., subscribe to)
10
information about a resource, using the SIP event framework, RFC 3265. There
11
is fairly complex state associated with these subscriptions.  This state
12
includes the identity of the subscriber, the state of the subscription, and 
13
so on. The union of the state for all subscriptions to a particular resource
14
is called the watcher information for that resource.  This state is dynamic,
15
changing as subscribers come and go.  As a result, it is possible, and
16
indeed useful, to subscribe to the watcher information for a particular
17
resource. An important application of this is the ability for a user to find
18
out the set of subscribers to their presentity. This would allow the user to
19
provide an authorization decision for the subscription.
20
21
This script implements SUBSCRIBE for the watcher info event package and
22
manipulation of the pres-rules document that holds the presence policy of
23
the subscribing user.
24 3 Adrian Georgescu
25 2 Adrian Georgescu
Source code: [source:scripts/sip_subscribe_winfo.py scripts/sip_subscribe_winfo.py]
26
27 1 Adrian Georgescu
{{{
28
adigeo@ag-imac3:~$sip_subscribe_winfo -h
29
Usage: sip_subscribe_winfo [options]
30
31
This example script will use the specified SIP account to SUBSCRIBE to the
32
presence.winfo event of itself and request action to be taken when a new
33
watcher is in 'pending'/'waiting' state. The program will un-SUBSCRIBE and
34
quit when CTRL+D is pressed.
35
36
Options:
37
  -h, --help            show this help message and exit
38
  -a NAME, --account-name=NAME
39
                        The account name from which to read account settings.
40
                        Corresponds to section Account_NAME in the
41
                        configuration file. If not supplied, the section
42
                        Account will be read.
43
  --sip-address=SIP_ADDRESS
44
                        SIP address of the user in the form user@domain
45
  -p PASSWORD, --password=PASSWORD
46
                        Password to use to authenticate the local account.
47
                        This overrides the setting from the config file.
48
  -n DISPLAY_NAME, --display-name=DISPLAY_NAME
49
                        Display name to use for the local account. This
50
                        overrides the setting from the config file.
51
  -e EXPIRES, --expires=EXPIRES
52
                        "Expires" value to set in SUBSCRIBE. Default is 300
53
                        seconds.
54
  -o IP[:PORT], --outbound-proxy=IP[:PORT]
55
                        Outbound SIP proxy to use. By default a lookup of the
56
                        domain is performed based on SRV and A records. This
57
                        overrides the setting from the config file.
58
  -x XCAP_ROOT, --xcap-root=XCAP_ROOT
59
                        The XCAP root to use to access the pres-rules document
60
                        for authorizing subscriptions to presence.
61
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
62
                        messages (disabled by default).
63
  -l, --log-pjsip       Print PJSIP logging output (disabled by default).
64
}}}
65
66
=== Example ===
67
68
{{{
69
adigeo@ag-imac3:~/work/pypjua$sip_subscribe_winfo
70
Accounts available: 'alice', 'bob', 'ew', 'mrg', 'pbx', 'tf', 'umts', 'unet', default
71
Using default account: 31208005169@ag-projects.com
72
Resolved DNS SRV record "_sip._udp.ag-projects.com" --> proxy.sipthor.net:5060
73
Resolved DNS A record "proxy.sipthor.net" --> 85.17.186.7, 81.23.228.150, 81.23.228.129
74
Retrieving current presence rules from https://xcap.sipthor.net/xcap-root/
75
Allowed list:
76
	sip:2233350608@sip2sip.info
77
	sip:31208005163@ag-projects.com
78
	sip:31208005166@ag-projects.com
79
	sip:31208005167@ag-projects.com
80
	sip:adi@umts.ro
81
	sip:alice@example.com
82
	sip:ruud@umts.ro
83
	sip:317105169@eurovoice.ro
84
Blocked list:
85
Polite-blocked list:
86
Subscribing to "31208005169@ag-projects.com" for the presence.winfo event, at 81.23.228.129:5060
87
Received NOTIFY:
88
----
89
Active watchers:
90
Terminated watchers:
91
Pending watchers:
92
  sip:bob@example.com
93
Waiting watchers:
94
----
95
pending watcher sip:bob@example.com wants to subscribe to your presence information. Press (a) to allow, (d) to deny, (p) to polite block:
96
Watcher sip:bob@example.com is now allowed
97
98
}}}