Project

General

Profile

Sip publish presence » History » Version 9

Adrian Georgescu, 11/06/2008 03:00 PM

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