Sip subscribe presence

Version 3 (Adrian Georgescu, 10/26/2008 11:17 am)

1 1 Adrian Georgescu
== sip_subscribe_presence ==
2 1 Adrian Georgescu
3 1 Adrian Georgescu
To use this script you must to have a valid [wiki:configuration_file configuration file].
4 1 Adrian Georgescu
5 1 Adrian Georgescu
=== Description ===
6 1 Adrian Georgescu
7 3 Adrian Georgescu
Source code: [source:scripts/sip_subscribe_presence.py scripts/sip_subscribe_presence.py]
8 3 Adrian Georgescu
9 1 Adrian Georgescu
{{{
10 1 Adrian Georgescu
adigeo@ag-imac3:~$sip_subscribe_presence -h
11 1 Adrian Georgescu
Usage: sip_subscribe_presence [options] [presentity@presentity-domain.com]
12 1 Adrian Georgescu
13 1 Adrian Georgescu
This script will use SUBSCRIBE to the presence event published by the
14 1 Adrian Georgescu
specified SIP address. If a SIP address is not specified, it will subscribe to
15 1 Adrian Georgescu
its own presence. It will then interprete PIDF bodies contained in NOTIFYs and
16 1 Adrian Georgescu
display their meaning. The program will un-SUBSCRIBE and quit when CTRL+D is
17 1 Adrian Georgescu
pressed.
18 1 Adrian Georgescu
19 1 Adrian Georgescu
Options:
20 1 Adrian Georgescu
  -h, --help            show this help message and exit
21 1 Adrian Georgescu
  -a NAME, --account-name=NAME
22 1 Adrian Georgescu
                        The account name from which to read account settings.
23 1 Adrian Georgescu
                        Corresponds to section Account_NAME in the
24 1 Adrian Georgescu
                        configuration file. If not supplied, the section
25 1 Adrian Georgescu
                        Account will be read.
26 1 Adrian Georgescu
  --sip-address=SIP_ADDRESS
27 1 Adrian Georgescu
                        SIP address of the user in the form user@domain
28 1 Adrian Georgescu
  -p PASSWORD, --password=PASSWORD
29 1 Adrian Georgescu
                        Password to use to authenticate the local account.
30 1 Adrian Georgescu
                        This overrides the setting from the config file.
31 1 Adrian Georgescu
  -n DISPLAY_NAME, --display-name=DISPLAY_NAME
32 1 Adrian Georgescu
                        Display name to use for the local account. This
33 1 Adrian Georgescu
                        overrides the setting from the config file.
34 1 Adrian Georgescu
  -e EXPIRES, --expires=EXPIRES
35 1 Adrian Georgescu
                        "Expires" value to set in SUBSCRIBE. Default is 300
36 1 Adrian Georgescu
                        seconds.
37 1 Adrian Georgescu
  -o IP[:PORT], --outbound-proxy=IP[:PORT]
38 1 Adrian Georgescu
                        Outbound SIP proxy to use. By default a lookup of the
39 1 Adrian Georgescu
                        domain is performed based on SRV and A records. This
40 1 Adrian Georgescu
                        overrides the setting from the config file.
41 1 Adrian Georgescu
  -c CONTENT_TYPE, --content-type=CONTENT_TYPE
42 1 Adrian Georgescu
                        "Content-Type" the UA expects to receving in a NOTIFY
43 1 Adrian Georgescu
                        for this subscription. For the known events this does
44 1 Adrian Georgescu
                        not need to be specified, but may be overridden".
45 1 Adrian Georgescu
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
46 1 Adrian Georgescu
                        messages (disabled by default).
47 1 Adrian Georgescu
  -l, --log-pjsip       Print PJSIP logging output (disabled by default).
48 1 Adrian Georgescu
}}}
49 2 Adrian Georgescu
50 2 Adrian Georgescu
=== Example ===
51 2 Adrian Georgescu
52 2 Adrian Georgescu
{{{
53 2 Adrian Georgescu
adigeo@ag-imac3:~$sip_subscribe_presence -a umts ag@ag-projects.com
54 2 Adrian Georgescu
Accounts available: 'alice', 'ew', 'mrg', 'pbx', 'tf', 'umts', 'unet', default
55 2 Adrian Georgescu
Using account 'umts': adi@umts.ro
56 2 Adrian Georgescu
Resolved DNS SRV record "_sip._udp.umts.ro" --> proxy.sipthor.net:5060
57 2 Adrian Georgescu
Resolved DNS A record "proxy.sipthor.net" --> 81.23.228.150, 81.23.228.129, 85.17.186.7
58 2 Adrian Georgescu
Subscribing to "<sip:ag@ag-projects.com>" for the presence event, at 85.17.186.7:5060
59 2 Adrian Georgescu
Received NOTIFY:
60 2 Adrian Georgescu
----------------
61 2 Adrian Georgescu
Presence for 31208005169@ag-projects.com:
62 2 Adrian Georgescu
  Person id yipgulqr
63 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:37:32
64 2 Adrian Georgescu
    Activities
65 2 Adrian Georgescu
      Note(en): I am working
66 2 Adrian Georgescu
    Mood: sad, contended, mean
67 2 Adrian Georgescu
    Time offset from UTC: 60 minutes 
68 2 Adrian Georgescu
  ---
69 2 Adrian Georgescu
  Service id apgjjwtz
70 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:37:42
71 2 Adrian Georgescu
    Status: open
72 2 Adrian Georgescu
----------------
73 2 Adrian Georgescu
Received NOTIFY:
74 2 Adrian Georgescu
----------------
75 2 Adrian Georgescu
Presence for 31208005169@ag-projects.com:
76 2 Adrian Georgescu
  Person id ksgxtgwo
77 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:41:04
78 2 Adrian Georgescu
    Mood: impressed, flirtatious, thirsty
79 2 Adrian Georgescu
    Time offset from UTC: 60 minutes 
80 2 Adrian Georgescu
  Person id yipgulqr
81 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:37:32
82 2 Adrian Georgescu
    Activities
83 2 Adrian Georgescu
      Note(en): I am working
84 2 Adrian Georgescu
    Mood: sad, contended, mean
85 2 Adrian Georgescu
    Time offset from UTC: 60 minutes 
86 2 Adrian Georgescu
  ---
87 2 Adrian Georgescu
  Service id apgjjwtz
88 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:37:42
89 2 Adrian Georgescu
    Status: open
90 2 Adrian Georgescu
  Service id hxpzsnfp
91 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:41:00
92 2 Adrian Georgescu
    Status: open
93 2 Adrian Georgescu
----------------
94 2 Adrian Georgescu
Received NOTIFY:
95 2 Adrian Georgescu
----------------
96 2 Adrian Georgescu
Presence for 31208005169@ag-projects.com:
97 2 Adrian Georgescu
  Person id ksgxtgwo
98 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:41:04
99 2 Adrian Georgescu
    Mood: impressed, flirtatious, thirsty
100 2 Adrian Georgescu
    Time offset from UTC: 60 minutes 
101 2 Adrian Georgescu
  Person id yipgulqr
102 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:37:32
103 2 Adrian Georgescu
    Activities
104 2 Adrian Georgescu
      Note(en): I am working
105 2 Adrian Georgescu
    Mood: sad, contended, mean
106 2 Adrian Georgescu
    Time offset from UTC: 60 minutes 
107 2 Adrian Georgescu
  ---
108 2 Adrian Georgescu
  Service id apgjjwtz
109 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:37:42
110 2 Adrian Georgescu
    Status: open
111 2 Adrian Georgescu
  Service id hxpzsnfp
112 2 Adrian Georgescu
    Timestamp: 2008-10-26 10:41:07
113 2 Adrian Georgescu
    Status: closed
114 2 Adrian Georgescu
----------------
115 2 Adrian Georgescu
116 2 Adrian Georgescu
}}}