Project

General

Profile

Sip publish presence » History » Version 13

Adrian Georgescu, 03/12/2009 08:07 PM

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