Project

General

Profile

Sip publish presence » History » Version 12

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

1 9 Adrian Georgescu
== sip_publish_presence ==
2 1 Adrian Georgescu
3 11 Adrian Georgescu
[[TOC(SipTesting*, sip_*, depth=2)]]
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 9 Adrian Georgescu
=== Description ===
7 1 Adrian Georgescu
8 11 Adrian Georgescu
[[Image(http://www.openxcap.org/chrome/site/SIMPLE-Server.png, nolink)]]
9 3 Adrian Georgescu
10 7 Adrian Georgescu
This script implements SIP PUBLISH method, for publishing event state.  PUBLISH is similar to REGISTER in that it allows a user to create, modify, and remove state in another entity which manages this state on behalf of the user.  Addressing a PUBLISH request is identical to addressing a SUBSCRIBE request.  The Request-URI of a PUBLISH request is populated with the address of the resource for which the user wishes to publish event state.  The user may in turn have multiple User Agents or endpoints that publish event state. Each endpoint may publish its own unique state, out of which the event state compositor generates the composite event state of the resource.  In addition to a particular resource, all published event state is associated with a specific event package.  Through a subscription to that event package, the user is able to discover the composite event state of all of the active publications.
11 3 Adrian Georgescu
12 2 Adrian Georgescu
Source code: [source:scripts/sip_publish_presence.py scripts/sip_publish_presence.py]
13
14 1 Adrian Georgescu
{{{
15
adigeo@ag-imac3:~$sip_publish_presence -h
16
Usage: sip_publish_presence [options]
17
18
This script will publish rich presence state of the specified SIP account to a
19
SIP Presence Agent, the presence information can be changed using a menu-
20
driven interface.
21
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
  -e EXPIRES, --expires=EXPIRES
32
                        "Expires" value to set in PUBLISH. Default is 300
33
                        seconds.
34
  -o IP[:PORT], --outbound-proxy=IP[:PORT]
35
                        Outbound SIP proxy to use. By default a lookup of the
36
                        domain is performed based on SRV and A records. This
37
                        overrides the setting from the config file.
38
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
39
                        messages (disabled by default).
40
  -l, --log-pjsip       Print PJSIP logging output (disabled by default).
41
}}}
42
43 9 Adrian Georgescu
=== Example ===
44 1 Adrian Georgescu
45
{{{
46
adigeo@ag-imac3:~$sip_publish_presence 
47
Accounts available: 'alice', 'ew', 'mrg', 'pbx', 'tf', 'umts', 'unet', default
48
Using default account: 31208005169@ag-projects.com
49
Resolved DNS SRV record "_sip._udp.ag-projects.com" --> proxy.sipthor.net:5060
50
Resolved DNS A record "proxy.sipthor.net" --> 85.17.186.7, 81.23.228.150, 81.23.228.129
51
52
Commands:
53
  a: set activities information
54
  b: toggle basic status
55
  m: set mood information
56
  n: set note
57
  q: quit program
58
  s: show PIDF
59
60
<?xml version='1.0' encoding='UTF-8'?>
61
<presence xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns="urn:ietf:params:xml:ns:pidf" entity="31208005169@ag-projects.com">
62
  <tuple id="apgjjwtz">
63
    <status>
64
      <basic>open</basic>
65
    </status>
66
    <timestamp>2008-10-26T10:37:16+01:00</timestamp>
67
  </tuple>
68
  <dm:person id="yipgulqr">
69
    <rpid:time-offset>60</rpid:time-offset>
70
    <dm:timestamp>2008-10-26T10:37:16+01:00</dm:timestamp>
71
  </dm:person>
72
</presence>
73
74
Commands:
75
  a: set activities information
76
  b: toggle basic status
77
  m: set mood information
78
  n: set note
79
  q: quit program
80
  s: show PIDF
81
82
Commands:
83
  a: set activity
84
  c: clear all activity data
85
  d: delete activity
86
  n: set activity note
87
  q: quit program
88
  s: show current activity
89
  r: set random activity
90
  x: exit to upper level menu
91
92
Set note> I am working
93
94
Note set
95
96
Commands:
97
  a: set activities information
98
  b: toggle basic status
99
  m: set mood information
100
  n: set note
101
  q: quit program
102
  s: show PIDF
103
104
105
Commands:
106
  a: add a mood
107
  c: clear all mood data
108
  d: delete a mood
109
  n: set mood note
110
  q: quit program
111
  s: show current moods
112
  r: set random mood
113
  x: exit to upper level menu
114
115
You are now contended, sad, mean
116
117
Commands:
118
  a: set activities information
119
  b: toggle basic status
120
  m: set mood information
121
  n: set note
122
  q: quit program
123
  s: show PIDF
124
125
<?xml version='1.0' encoding='UTF-8'?>
126
<presence xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns="urn:ietf:params:xml:ns:pidf" entity="31208005169@ag-projects.com">
127
  <tuple id="apgjjwtz">
128
    <status>
129
      <basic>open</basic>
130
    </status>
131
    <timestamp>2008-10-26T10:37:16+01:00</timestamp>
132
  </tuple>
133
  <dm:person id="yipgulqr">
134
    <rpid:mood>
135
      <rpid:mean/>
136
      <rpid:contended/>
137
      <rpid:sad/>
138
    </rpid:mood>
139
    <rpid:activities>
140
      <rpid:note xml:lang="en">I am working</rpid:note>
141
    </rpid:activities>
142
    <rpid:time-offset>60</rpid:time-offset>
143
    <dm:timestamp>2008-10-26T10:37:32+01:00</dm:timestamp>
144
  </dm:person>
145
</presence>
146
147
Commands:
148
  a: set activities information
149
  b: toggle basic status
150
  m: set mood information
151
  n: set note
152
  q: quit program
153
  s: show PIDF
154
155
Your basic status is now 'closed'
156
157
Commands:
158
  a: set activities information
159
  b: toggle basic status
160
  m: set mood information
161
  n: set note
162
  q: quit program
163
  s: show PIDF
164
165
Your basic status is now 'open'
166
167
Commands:
168
  a: set activities information
169
  b: toggle basic status
170
  m: set mood information
171
  n: set note
172
  q: quit program
173
  s: show PIDF
174
175
<?xml version='1.0' encoding='UTF-8'?>
176
<presence xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns="urn:ietf:params:xml:ns:pidf" entity="31208005169@ag-projects.com">
177
  <tuple id="apgjjwtz">
178
    <status>
179
      <basic>open</basic>
180
    </status>
181
    <timestamp>2008-10-26T10:37:42+01:00</timestamp>
182
  </tuple>
183
  <dm:person id="yipgulqr">
184
    <rpid:mood>
185
      <rpid:mean/>
186
      <rpid:contended/>
187
      <rpid:sad/>
188
    </rpid:mood>
189
    <rpid:activities>
190
      <rpid:note xml:lang="en">I am working</rpid:note>
191
    </rpid:activities>
192
    <rpid:time-offset>60</rpid:time-offset>
193
    <dm:timestamp>2008-10-26T10:37:32+01:00</dm:timestamp>
194
  </dm:person>
195
</presence>
196
197
Commands:
198
  a: set activities information
199
  b: toggle basic status
200
  m: set mood information
201
  n: set note
202
  q: quit program
203
  s: show PIDF
204
}}}