Project

General

Profile

Sip publish presence » History » Version 6

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