Project

General

Profile

Sip subscribe presence » History » Version 12

Adrian Georgescu, 02/22/2009 12:55 PM

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