Sip publish presence

Version 12 (Adrian Georgescu, 02/22/2009 12:55 pm)

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