Project

General

Profile

Sip subscribe winfo » History » Version 15

Adrian Georgescu, 03/16/2009 11:23 AM

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