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