Sip publish presence

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