Project

General

Profile

Sip subscribe presence » History » Version 3

Adrian Georgescu, 10/26/2008 11:17 AM

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