Sip publish presence

Version 5 (Adrian Georgescu, 10/26/2008 06:30 pm)

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