Sip publish presence

Version 9 (Adrian Georgescu, 11/06/2008 03:00 pm)

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