Sip publish presence

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