Project

General

Profile

Sip publish presence » History » Version 5

Adrian Georgescu, 10/26/2008 06:30 PM

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