Project

General

Profile

Sip publish presence » History » Version 15

Adrian Georgescu, 03/30/2009 11:25 AM

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 9 Adrian Georgescu
=== Description ===
7 1 Adrian Georgescu
8 14 Adrian Georgescu
[[Image(http://www.openxcap.org/chrome/site/SIMPLE-Server.png, align=right)]]
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 15 Adrian Georgescu
adigeo@ag-imac3:~$sip_publish_presence -h  
16 1 Adrian Georgescu
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 15 Adrian Georgescu
  -a ACCOUNT_NAME, --account-name=ACCOUNT_NAME
25
                        The name of the account to use.
26 1 Adrian Georgescu
  -s, --trace-sip       Dump the raw contents of incoming and outgoing SIP
27
                        messages (disabled by default).
28 15 Adrian Georgescu
  -j, --trace-pjsip     Print PJSIP logging output (disabled by default).
29 1 Adrian Georgescu
}}}
30
31 9 Adrian Georgescu
=== Example ===
32 1 Adrian Georgescu
33
{{{
34
adigeo@ag-imac3:~$sip_publish_presence 
35
Accounts available: 'alice', 'ew', 'mrg', 'pbx', 'tf', 'umts', 'unet', default
36
Using default account: 31208005169@ag-projects.com
37
Resolved DNS SRV record "_sip._udp.ag-projects.com" --> proxy.sipthor.net:5060
38
Resolved DNS A record "proxy.sipthor.net" --> 85.17.186.7, 81.23.228.150, 81.23.228.129
39
40
Commands:
41
  a: set activities information
42
  b: toggle basic status
43
  m: set mood information
44
  n: set note
45
  q: quit program
46
  s: show PIDF
47
48
<?xml version='1.0' encoding='UTF-8'?>
49
<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">
50
  <tuple id="apgjjwtz">
51
    <status>
52
      <basic>open</basic>
53
    </status>
54
    <timestamp>2008-10-26T10:37:16+01:00</timestamp>
55
  </tuple>
56
  <dm:person id="yipgulqr">
57
    <rpid:time-offset>60</rpid:time-offset>
58
    <dm:timestamp>2008-10-26T10:37:16+01:00</dm:timestamp>
59
  </dm:person>
60
</presence>
61
62
Commands:
63
  a: set activities information
64
  b: toggle basic status
65
  m: set mood information
66
  n: set note
67
  q: quit program
68
  s: show PIDF
69
70
Commands:
71
  a: set activity
72
  c: clear all activity data
73
  d: delete activity
74
  n: set activity note
75
  q: quit program
76
  s: show current activity
77
  r: set random activity
78
  x: exit to upper level menu
79
80
Set note> I am working
81
82
Note set
83
84
Commands:
85
  a: set activities information
86
  b: toggle basic status
87
  m: set mood information
88
  n: set note
89
  q: quit program
90
  s: show PIDF
91
92
93
Commands:
94
  a: add a mood
95
  c: clear all mood data
96
  d: delete a mood
97
  n: set mood note
98
  q: quit program
99
  s: show current moods
100
  r: set random mood
101
  x: exit to upper level menu
102
103
You are now contended, sad, mean
104
105
Commands:
106
  a: set activities information
107
  b: toggle basic status
108
  m: set mood information
109
  n: set note
110
  q: quit program
111
  s: show PIDF
112
113
<?xml version='1.0' encoding='UTF-8'?>
114
<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">
115
  <tuple id="apgjjwtz">
116
    <status>
117
      <basic>open</basic>
118
    </status>
119
    <timestamp>2008-10-26T10:37:16+01:00</timestamp>
120
  </tuple>
121
  <dm:person id="yipgulqr">
122
    <rpid:mood>
123
      <rpid:mean/>
124
      <rpid:contended/>
125
      <rpid:sad/>
126
    </rpid:mood>
127
    <rpid:activities>
128
      <rpid:note xml:lang="en">I am working</rpid:note>
129
    </rpid:activities>
130
    <rpid:time-offset>60</rpid:time-offset>
131
    <dm:timestamp>2008-10-26T10:37:32+01:00</dm:timestamp>
132
  </dm:person>
133
</presence>
134
135
Commands:
136
  a: set activities information
137
  b: toggle basic status
138
  m: set mood information
139
  n: set note
140
  q: quit program
141
  s: show PIDF
142
143
Your basic status is now 'closed'
144
145
Commands:
146
  a: set activities information
147
  b: toggle basic status
148
  m: set mood information
149
  n: set note
150
  q: quit program
151
  s: show PIDF
152
153
Your basic status is now 'open'
154
155
Commands:
156
  a: set activities information
157
  b: toggle basic status
158
  m: set mood information
159
  n: set note
160
  q: quit program
161
  s: show PIDF
162
163
<?xml version='1.0' encoding='UTF-8'?>
164
<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">
165
  <tuple id="apgjjwtz">
166
    <status>
167
      <basic>open</basic>
168
    </status>
169
    <timestamp>2008-10-26T10:37:42+01:00</timestamp>
170
  </tuple>
171
  <dm:person id="yipgulqr">
172
    <rpid:mood>
173
      <rpid:mean/>
174
      <rpid:contended/>
175
      <rpid:sad/>
176
    </rpid:mood>
177
    <rpid:activities>
178
      <rpid:note xml:lang="en">I am working</rpid:note>
179
    </rpid:activities>
180
    <rpid:time-offset>60</rpid:time-offset>
181
    <dm:timestamp>2008-10-26T10:37:32+01:00</dm:timestamp>
182
  </dm:person>
183
</presence>
184
185
Commands:
186
  a: set activities information
187
  b: toggle basic status
188
  m: set mood information
189
  n: set note
190
  q: quit program
191
  s: show PIDF
192
}}}