Project

General

Profile

Sip subscribe presence » History » Version 13

Adrian Georgescu, 02/22/2009 03:06 PM

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