Project

General

Profile

SipMiddlewareApi » History » Version 2

Adrian Georgescu, 03/12/2009 07:46 PM

1 1 Adrian Georgescu
= Middleware API =
2
3
[[TOC(WikiStart, Sip*, depth=3)]]
4
5
This chapter describes the high level Python API that can be used by a developer to easily build a front-end on top of SIP SIMPLE client library. By using this Python API you can easily create a desktop graphical client or a server application for real-time communications based on SIP standards.
6
7
[[Image(sipsimple-middleware.png, 500px)]]
8
9
== Configuration ==
10
11
 * [wiki:SipSettings Configuration API] - configuration framework that will replace the current configuration file config.ini, all middleware components will have read/write access to settings throught it
12
13
== Classes ==
14
15
=== SessionManager ===
16
17
The {{{sipsimple.session.SessionManager}}} class is a singleton which acts as the central aggregation point for sessions within the middleware.
18
The application can use it to query information about the active sessions and set global configuration options relevant to sessions, such as transport options and ringtones.
19
In order to achieve the latter, the {{{SessionManager}}} instance contains three configuration attributes that can be inspected and modified at runtime.
20
When a {{{Session}}} is created, either as by the application on an outbound session or by the middleware as an inbound session, these configuration attributes will be copied from the {{{SessionManager}}}.
21
22
> The SessionManager will be integrated with both the configuration framework and the accountmanager, meaning that the part of this API regarding configuration is is subject to change.
23
24
==== attributes ====
25
26
 '''sessions'''::
27
  A property providing a copy of the list of all active {{{Sesssion}}} objects within the application, meaning any {{{Session}}} object that exists globally within the application and is not in the {{{NULL}}} or {{{TERMINATED}}} state.
28
 '''ringtone_config'''::
29
  A {{{RingtoneConfiguration}}} object, which manages the ringtones that should be played on new inbound and outbound sessions.
30
 '''rtp_config'''::
31
  A {{{RTPConfiguration}}} object, which indicates which options should be used when creating a new RTP transport for use by an audio stream.
32
 '''msrp_config'''::
33
  A {{{MSRPConfiguration}}} object, which provides the options that should be used when creating a new MSRP transport used for chat.
34
35
==== methods ====
36
37
 '''!__init!__'''(''self'')::
38
  This either returns a new {{{SessionManager}}} object with default configuration objects, or returns a copy of the already existing instance.
39
40
=== RingtoneConfiguration ===
41
42
A {{{sipsimple.session.RingtoneConfiguration}}} object is contained in the {{{SessionManager}}} and acts as a registration point for both default ringtones and ringtones per incoming SIP URI.
43
44
==== attributes ====
45
46
 '''default_inbound_ringtone'''::
47
  A string pointing to a {{{.wav}}} file on the filesystem that should be played on an incoming session when the remote SIP URI cannot be matched to any of the registered ones.
48
  If this is set to {{{None}}}, no ringtone is played in this situation.
49
 '''outbound_ringtone'''::
50
  A string pointing to a {{{.wav}}} file on the filesystem that should be played when an outbound session receives a ringing indication from the remote party.
51
  If this is set to {{{None}}}, no ringtone is played in this situation.
52
53
==== methods ====
54
55
 '''!__init!__'''(''self'')::
56
  Creates a new {{{RingtoneConfiguration}}} object with both attributes set to {{{None}}} and no SIP URIs registered.
57
 '''add_ringtone_for_sipuri'''(''self'', '''sipuri''', '''ringtone''')::
58
  Registers a ringtone, in the form of a string pointing to a {{{.wav}}} file, to be played back when a incoming session is received from a remote party with the specified SIP URI, in the form of a {{{sipsimple.core.SIPURI}}} object.
59
  This will possibly override a previously registered ringtone.
60
 '''remove_sipuri'''(''self'', '''sipuri''')::
61
  Removes the ringtone of a previously registered SIP URI.
62
 '''get_ringtone_for_sipuri'''(''self'', '''sipuri''')::
63
  Retrieve the ringtone to use when receiving an inbound session from the specified SIP URI, as a {{{sipsimple.core.SIPURI}}} object.
64
  If no ringtone was registed, this will return {{{default_inbound_ringtone}}}.
65
66
=== RTPConfiguration ===
67
68
A {{{sipsimple.session.RTPConfiguration}}} object contains parameters that should be used when creating a new RTP transport, used by a {{{Session}}} object for an audio stream.
69
70
==== attributes ====
71
72
 '''local_rtp_address'''::
73
  The IP address to use for the RTP endpoint.
74
 '''use_srtp'''::
75
  A boolean indicating whether SRTP should be used.
76
 '''srtp_forced'''::
77
  A boolean indicating whether SRTP should be mandatory, if SRTP is to be used.
78
 '''use_ice'''::
79
  A boolean indicating whether ICE should be used.
80
 '''ice_stun_address'''::
81
  The IP adress of the STUN server that should be contacted to retrieve an ICE candidate.
82
  This attribute is only relevant if ICE is used.
83
  If this is the case and this attribute is set to {{{None}}}, no STUN candidate shall be retrieved for ICE.
84
 '''ice_stun_port''::
85
  The port of the STUN server to be used for retrieving an ICE candidate.
86
  The same condition apply to this attribute as for {{{ice_stun_address}}}.
87
88
==== methods ====
89
90
 '''!__init!__'''(''self'', '''local_rtp_address'''=<default_host_ip>, '''use_srtp'''={{{False}}}, '''srtp_forced'''={{{False}}}, '''use_ice'''={{{False}}}, '''ice_stun_address'''={{{None}}}, '''ice_stun_port'''=3478)::
91
  This creates a new {{{RTPConfiguration}}} object with sensible defaults, setting all the attributes to the specified values.
92
  The default value for the {{{local_rtp_address}}} attribute is the default outbound IP of this host, detected at application start.
93
94
=== MSRPConfiguration ===
95
96
A {{{sipsimple.session.MSRPConfiguration}}} object governs the parameters used for creating an MSRP connection when establishing a chat within a session.
97
98
==== attributes ====
99
100
 '''local_ip'''::
101
  The local IP address to put in the MSRP URI.
102
  If this is set to None, an IP will be automatically detected.
103
 '''local_port'''::
104
  The local port to use for MSRP.
105
  If this is set to None, an a port will be automatically allocated.
106
 '''local_use_tls'''::
107
  A boolean indicating whether to use TLS in the local MSRP URI.
108
 '''use_relay_incoming'''::
109
  A boolean indicating whether to use a MSRP relay for incoming sessions.
110
 '''use_relay_outgoing'''::
111
  A boolean indicating whether to use a MSRP relay for outgoing sessions.
112
 '''relay_host'''::
113
  The IP address of the MSRP relay to use, set by the above conditions.
114
 '''relay_port'''::
115
  The TCP port to use on the MSRP relay.
116
 '''relay_use_tls'''::
117
  A boolean indicating whether the connection to the MSRP relay specified should use TLS.
118
119
==== methods ====
120
121
 '''!__init!__'''(''self'', '''local_ip'''={{{None}}}, '''local_port'''={{{None}}}, '''local_use_tls'''={{{True}}}, '''use_relay_incoming'''={{{True}}}, '''use_relay_outgoing'''={{{False}}}, '''relay_host'''={{{None}}}, '''relay_port'''={{{None}}}, '''relay_use_tls'''={{{None}}})::
122
  This creates a new {{{MSRPConfiguration}}} object with sensible defaults, setting all the attributes to the specified values.
123
124
=== Session ===
125
126
A {{{sipsimple.session.Session}}} object represents a complete SIP session between the local and a remote endpoints, including media streams.
127
The currently supported media streams are audio and MSRP chat.
128
Both incoming and outgoing sessions are represented by this class.
129
130
A {{{Session}}} instance is a stateful object, meaning that it has a {{{state}}} attribute and that the lifetime of the session traverses different states, from session creation to termination.
131
State changes are triggered by methods called on the object by the application or by received network events.
132
Every time this attribute changes, a {{{SCSessionChangedState}}} notification is sent by the object.
133
These states and their transitions are represented in the following diagram:
134
135 2 Adrian Georgescu
[[Image(sipsimple-session-state-machine.png)]]
136 1 Adrian Georgescu
137
Although these states are crucial to the correct operation of the {{{Session}}} object, an application using this object does not need to keep track of these states, as a different set of notifications is also emitted, which provide all the necessary information to the application.
138
139
==== attributes ====
140
141
 '''state'''::
142
  The state the object is currently in, being one of the states from the diagram above.
143
 '''direction'''::
144
  A string indicating the direction of the initial negotiation of the session.
145
  This can be either {{{None}}}, "incoming" or "outgoing".
146
 '''start_time'''::
147
  The time the session started as a {{{datetime.datetime}}} object, or {{{None}}} if the session was not yet started.
148
 '''stop_time'''::
149
  The time the session stopped as a {{{datetime.datetime}}} object, or {{{None}}} if the session has not yet terminated.
150
 '''on_hold_by_local'''::
151
  Boolean indicating whether the session was put on hold by the local party.
152
 '''on_hold_by_remote'''::
153
  Boolean indicating whether the session was put on hold by the remote party.
154
 '''on_hold'''::
155
  Boolean indicating whether the session was put on hold, either by the local or the remote party.
156
 '''remote_user_agent'''::
157
  A string indicating the remote user agent, if it provided one.
158
  Initially this will be {{{None}}}, it will be set as soon as this information is received from the remote party (which may be never).
159
 '''local_uri'''::
160
  The {{{sipsimple.core.SIPURI}}} of the local party, if the session is active.
161
 '''remote_uri'''::
162
  The {{{sipsimple.core.SIPURI}}} of the remote party, if the session is active.
163
 '''caller_uri'''::
164
  The {{{sipsimple.core.SIPURI}}} of the calling party, if the session is active.
165
  Depending on the direction, this is either {{{local_uri}}} or {{{remote_uri}}}.
166
 '''callee_uri'''::
167
  The {{{sipsimple.core.SIPURI}}} of the called party, if the session is active.
168
  Depending on the direction, this is either {{{local_uri}}} or {{{remote_uri}}}.
169
 '''credentials'''::
170
  A copy of the {{{sipsimple.core.Credentials}}} object passed when the {{{new()}}} method was called.
171
  On incoming or inactive sessions this is {{{None}}}.
172
 '''route'''::
173
  A copy of the {{{sipsimple.core.Route}}} object passed when the {{{new()}}} method was called.
174
  On incoming or inactive sessions this is {{{None}}}.
175
 '''audio_transport'''::
176
  The {{{sipsimple.core.AudioTransport}}} object used by the session, if it currently contains an audio stream.
177
  Normally the application will not need to access this directly.
178
 '''has_audio'''::
179
  A boolean property indicating if this {{{Session}}} currently has an audio stream.
180
 '''audio_sample_rate'''::
181
  If the audio stream was started, this attribute contains the sample rate of the audio negotiated.
182
 '''audio_codec'''::
183
  If the audio stream was started, this attribute contains the name of the audio codec that was negotiated.
184
 '''audio_srtp_active'''::
185
  If the audio stream was started, this boolean attribute indicates if SRTP is currently being used on the stream.
186
 '''audio_local_rtp_address'''::
187
  If an audio stream is present within the session, this attribute contains the local IP address used for the audio stream.
188
 '''audio_local_rtp_port'''::
189
  If an audio stream is present within the session, this attribute contains the local UDP port used for the audio stream.
190
 '''audio_remote_rtp_address_sdp'''::
191
  If the audio stream was started, this attribute contains the IP address that the remote party gave to send audio to.
192
 '''audio_remote_rtp_port_sdp'''::
193
  If the audio stream was started, this attribute contains the UDP port that the remote party gave to send audio to.
194
 '''audio_remote_rtp_address_received'''::
195
  If the audio stream was started, this attribute contains the remote IP address from which the audio stream is being received.
196
 '''audio_remote_rtp_port_received'''::
197
  If the audio stream was started, this attribute contains the remote UDP port from which the audio stream is being received.
198
 '''audio_was_received'''::
199
  This boolean property indicates if audio was actually received on the audio stream contained within this session.
200
 '''audio_recording_file_name'''::
201
  If the audio stream is currently being recorded to disk, this property contains the name of the {{{.wav}}} file being recorded to.
202
 '''chat_transport'''::
203
  The {{{sipsimple.msrp.MSRPChat}}} object used by the session as chat transport, if the session currently contains a chat stream.
204
  Normally the application will not need to access this directly.
205
 '''has_chat'''::
206
  A boolean property indicating if this {{{Session}}} currently has a chat stream.
207
208
==== methods ====
209
210
 '''!__init!__'''(''self'')::
211
  Creates a new {{{Session}}} object in the {{{NULL}}} state.
212
 '''new'''(''self'', '''callee_uri''', '''credentials''', '''route''', '''audio'''={{{False}}}, '''chat'''={{{False}}})::
213
  Will set up the {{{Session}}} as outbound and propose the new session to the specified remote party and move the state machine to the {{{CALLING}}} state.
214
  Before contacting the remote party, a {{{SCSessionNewOutgoing}}} notification will be emitted.
215
  If there is a failure or the remote party rejected the offer, a {{{SCSessionDidFail}}} notification will be sent, followed by a {{{SCSessionDidEnd}}}.
216
  Any time a ringing indication is received from the remote party, a {{{SCSessionGotRingIndication}}} notification is sent.
217
  If the remote party accepted the session, a {{{SCSessionWillStart}}} notification will be sent, followed by a {{{SCSessionDidStart}}} notification when the session is actually established.
218
  This method may only be called while in the {{{NULL}}} state.
219
  [[BR]]''callee_uri'':[[BR]]
220
  A {{{sipsimple.core.SIPURI}}} object representing the remote host to initiate the session to.
221
  [[BR]]''credentials'':[[BR]]
222
  A {{{sipsimple.core.Credentials}}} object, encapsulating the local SIP URI and the password for it, if set.
223
  [[BR]]''route'':[[BR]]
224
  A {{{sipsimple.core.Route}}} object, specifying the IP, port and transport to the outbound proxy.
225
  [[BR]]''audio'':[[BR]]
226
  A boolean indicating whether an audio stream should be initially included in this session.
227
  [[BR]]''chat'':[[BR]]
228
  A boolean indicating whether a chat stream should be initially included in this session.
229
 '''accept'''(''self'', '''audio'''={{{False}}}, '''chat'''={{{False}}}, '''password'''={{{None}}})::
230
  Calling this methods will accept an incoming session and move the state machine to the {{{ACCEPTING}}} state.
231
  When there is a new incoming session, a {{{SCSessionNewIncoming}}} notification is sent, after which the application can call this method on the sender of the notification.
232
  After this method is called, {{{SCSessionWillStart}}} followed by {{{SCSessionDidStart}}} will be emitted, or {{{SCSessionDidFail}}} followed by {{{SCSessionDidEnd}}} on an error.
233
  This method may only be called while in the {{{INCOMING}}} state.
234
  [[BR]]''audio'':[[BR]]
235
  A boolean indicating whether an audio stream should be accepted for this session.
236
  Note that this may only be set to {{{True}}} if an audio stream was actually proposed by the remote party.
237
  [[BR]]''chat'':[[BR]]
238
  A boolean indicating whether a chat stream should be accepted for this session.
239
  Note that this may only be set to {{{True}}} if a chat stream was actually proposed by the remote party.
240
  [[BR]]''password'':[[BR]]
241
  The password for the local SIP URI to which the session was proposed.
242
  This is only used for reserving a session at the MSRP relay.
243
 '''reject'''(''self'')::
244
  Reject an incoming session and move it to the {{{TERMINATING}}} state, which eventually leads to the {{{TERMINATED}}} state.
245
  Calling this method will cause the {{{Session}}} object to emit a {{{SCSessionWillEnd}}} notification, followed by a {{{SCSessionDidEnd}}} notification.
246
  This method may only be called while in the {{{INCOMING}}} state.
247
 '''hold'''(''self'')::
248
  Put the session on hold.
249
  This will cause a {{{SCGotHoldRequest}}} notification to be sent.
250
  This method may only be called while in the {{{ESTABLISHED}}} state.
251
 '''unhold'''(''self'')::
252
  Take the session out of hold.
253
  This will cause a {{{SCGotUnholdRequest}}} notification to be sent.
254
  This method may only be called while in the {{{ESTABLISHED}}} state.
255
 '''start_recording_audio'''(''self'', '''path''', '''file_name'''={{{None}}})::
256
  If an audio stream is present within this session, calling this method will record the audio to a {{{.wav}}} file.
257
  Note that when the session is on hold, nothing will be recorded to the file.
258
  Right before starting the recording a {{{SCSessionWillStartRecordingAudio}}} notification will be emitted, followed by a {{{SCSessionDidStartRecordingAudio}}}.
259
  This method may only be called while in the {{{ESTABLISHED}}} state.
260
  [[BR]]''path'':[[BR]]
261
  The path to the directory to place the {{{.wav}}} file in.
262
  [[BR]]''file_name'':[[BR]]
263
  The name of the {{{.wav}}} file to record to.
264
  If this is set to {{{None}}}, a default file name including the session participants and the timestamp will be generated.
265
 '''stop_recording_audio'''(''self'')::
266
  This will stop a previously started recording.
267
  Before stopping, a {{{SCSessionWillStopRecordingAudio}}} notification will be sent, followed by a {{{SCSessionDidStopRecordingAudio}}}.
268
  This method may only be called while in the {{{ESTABLISHED}}} state.
269
 '''send_dtmf'''(''self'', '''digit''')::
270
  If this session currently has an active audio stream, send a DTMF digit to the remote party over it.
271
  This method may only be called while in the {{{ESTABLISHED}}} state.
272
  [[BR]]''digit'':[[BR]]
273
  This should a string of length 1, containing a valid DTMF digit value.
274
 '''send_message'''(''self'', '''content''', '''content_type'''="text/plain", '''to_uri'''={{{None}}}, '''dt'''={{{None}}}):
275
  If this session currently has an active MSRP chat with the remote party, send a message over with the with the specified parameters.
276
  This will result in either a {{{SCSessionDidDeliverMessage}}} or a {{{SCSessionDidNotDeliverMessage}}} notification being sent.
277
  These notifications include a unique ID as data attribute which is also returned by this method.
278
  This method may only be called while in the {{{ESTABLISHED}}} state.
279
  [[BR]]''content'':[[BR]]
280
  The body of the MSRP message as a string.
281
  [[BR]]''content_type'':[[BR]]
282
  The Content-Type of the body as a string
283
  [[BR]]''to_uri'':[[BR]]]
284
  The {{{sipsimple.core.SIPURI}}} that should be put in the {{{To:}}} header of the CPIM wrapper of the message.
285
  This defaults to the SIP URI of the remote party of the session if the argument is set to {{{None}}}
286
  [[BR]]''dt'':[[BR]]
287
  A {{{datetime.datetime}}} object representing the timestamp to put on the CPIM wrapper of the message.
288
  When set to {{{None}}}, this defaults to now.
289
 '''add_audio'''(''self'')::
290
  Propose the remote party to add an audio stream to this session.
291
  Calling this method will cause a {{{SCSessionGotStreamProposal}}} notification to be emitted.
292
  After this, the state machine will move into the {{{PROPOSING}}} state until either a {{{SCSessionAcceptedStreamProposal}}} or {{{SCSessionRejectedStreamProposal}}} notification is sent, informing the application if the remote party accepted the proposal.
293
  This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that does not currently have an audio stream.
294
 '''remove_audio'''(''self'')::
295
  Stop the audio stream currently active within the session and inform the remote party of this.
296
  This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that has an audio stream.
297
 '''add_chat'''(''self'')::
298
  Propose the remote party to add a chat stream to this session.
299
  Calling this method will cause a {{{SCSessionGotStreamProposal}}} notification to be emitted.
300
  After this, the state machine will move into the {{{PROPOSING}}} state until either a {{{SCSessionAcceptedStreamProposal}}} or {{{SCSessionRejectedStreamProposal}}} notification is sent, informing the application if the remote party accepted the proposal.
301
  This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that does not currently have a chat stream.
302
 '''remove_chat'''(''self'')::
303
  Stop the chat stream currently active within the session and inform the remote party of this.
304
  This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that has a chat stream.
305
 '''accept_proposal'''(''self'')::
306
  When the remote party proposes to add a new stream, signaled by the {{{SCSessionGotStreamProposal}}} notification, the application can use this method to accept the stream(s) being proposed.
307
  After calling this method a {{{SCSessionAcceptedStreamProposal}}} notification is sent, unless an error occurs while setting up the new stream, in which case a {{{SCSessionRejectedStreamProposal}}} notification is sent and a rejection is sent to the remote party.
308
  This method may only be called while in the {{{PROPOSED}}} state.
309
 '''reject_proposal'''(''self'')::
310
  When the remote party proposes (a) stream(s) that the application does not want to accept, this method can be used to reject the proposal, after which a {{{SCSessionRejectedStreamProposal}}} notification is sent.
311
  This method may only be called while in the {{{PROPOSED}}} state.
312
 '''terminate'''(''self'')::
313
  This method may be called any time when the {{{Session}}} object is active (i.e. not in the {{{NULL}}}, {{{TERMINATING}}} or {{{TERMINATED}}} states) in order to terminate the session.
314
  Right before termination a {{{SCSessionWillEnd}}} notification is sent, after termination {{{SCSessionDidEnd}}} is sent.
315
316
==== notifications ====
317
318
 '''SCSessionChangedState'''::
319
  Will be sent whenever the {{{Session}}} object changes its state.
320
  [[BR]]''timestamp'':[[BR]]
321
  A {{{datetime.datetime}}} object indicating when the notification was sent.
322
  [[BR]]''prev_state'':[[BR]]
323
  The previous state state the object was in.
324
  [[BR]]''state'':[[BR]]
325
  The new state the object is in.
326
 '''SCSessionNewIncoming'''::
327
  Will be sent when a new incoming {{{Session}}} is received.
328
  The application should listen for this notification from all objects specifically to get informed of incoming sessions.
329
  [[BR]]''timestamp'':[[BR]]
330
  A {{{datetime.datetime}}} object indicating when the notification was sent.
331
  [[BR]]''has_audio'':[[BR]]
332
  A boolean indicating if the remote party proposed an audio stream within this session.
333
  [[BR]]''has_chat'':[[BR]]
334
  A boolean indicating if the remote party proposed a chat stream within this session.
335
 '''SCSessionNewOutgoing'''::
336
  Will be sent when the applcation requests a new outgoing {{{Session}}}.
337
  [[BR]]''timestamp'':[[BR]]
338
  A {{{datetime.datetime}}} object indicating when the notification was sent.
339
 '''SCSessionGotRingIndication'''::
340
  Will be sent when an outgoing {{{Session}}} receives an indication that a remote device is ringing.
341
  [[BR]]''timestamp'':[[BR]]
342
  A {{{datetime.datetime}}} object indicating when the notification was sent.
343
 '''SCSessionWillStart'''::
344
  Will be sent just before a {{{Session}}} completes negotiation.
345
  In terms of SIP, this is sent after the final response to the {{{INVITE}}}, but before the {{{ACK}}}.
346
  [[BR]]''timestamp'':[[BR]]
347
  A {{{datetime.datetime}}} object indicating when the notification was sent.
348
 '''SCSessionDidStart'''::
349
  Will be sent when a {{{Session}}} completes negotiation.
350
  In terms of SIP this is sent after the {{{ACK}}} was sent or received.
351
  [[BR]]''timestamp'':[[BR]]
352
  A {{{datetime.datetime}}} object indicating when the notification was sent.
353
 '''SCSessionDidFail'''::
354
  This notification is sent whenever the session fails.
355
  The failure reason is included in the data attributes.
356
  This notification is always followed by {{{SCSessionDidEnd}}}.
357
  [[BR]]''timestamp'':[[BR]]
358
  A {{{datetime.datetime}}} object indicating when the notification was sent.
359
  [[BR]]''originator'':[[BR]]
360
  A string indicating the origin of the failure.
361
  This will either be "local" or "remote".
362
  [[BR]]''code'':[[BR]]
363
  The SIP error code of the failure.
364
  If this is 0, the error was an internal exception.
365
  [[BR]]''reason'':[[BR]]
366
  A string explaining the reason of the failure.
367
 '''SCSessionWillEnd'''::
368
  Will be sent just before terminating a {{{Session}}} at the request of the application.
369
  [[BR]]''timestamp'':[[BR]]
370
  A {{{datetime.datetime}}} object indicating when the notification was sent.
371
 '''SCSessionDidEnd'''::
372
  Will be sent always when a {{{Session}}} ends, either because of a failure (in which case it is preceded by {{{SCSessionDidFail}}}), remote or local session termination.
373
  [[BR]]''timestamp'':[[BR]]
374
  A {{{datetime.datetime}}} object indicating when the notification was sent.
375
  [[BR]]''originator'':[[BR]]
376
  A string indicating who originated the termination.
377
  This will either be "local" or "remote".
378
 '''SCSessionGotHoldRequest'''::
379
  Will be sent when the session got put on hold, either by the local or the remote party.
380
  [[BR]]''timestamp'':[[BR]]
381
  A {{{datetime.datetime}}} object indicating when the notification was sent.
382
  [[BR]]''originator'':[[BR]]
383
  A string indicating who originated the hold request, and consequently in which direction the session got put on hold.
384
 '''SCSessionGotUnholdRequest'''::
385
  Will be sent when the session got taken out of hold, either by the local or the remote party.
386
  [[BR]]''timestamp'':[[BR]]
387
  A {{{datetime.datetime}}} object indicating when the notification was sent.
388
  [[BR]]''originator'':[[BR]]
389
  A string indicating who sent the original hold request, and consequently in which direction the session got taken out of hold.
390
 '''SCSessionWillStartRecordingAudio'''::
391
  Will be sent when the application requested that the audio stream active within the session be record to a {{{.wav}}} file, just before recording starts.
392
  [[BR]]''timestamp'':[[BR]]
393
  A {{{datetime.datetime}}} object indicating when the notification was sent.
394
  [[BR]]''file_name'':[[BR]]
395
  The name of the recording {{{.wav}}} file, including full path.
396
 '''SCSessionDidStartRecordingAudio'''::
397
  Will be sent when the application requested that the audio stream active within the session be record to a {{{.wav}}} file, just after recording starts.
398
  [[BR]]''timestamp'':[[BR]]
399
  A {{{datetime.datetime}}} object indicating when the notification was sent.
400
  [[BR]]''file_name'':[[BR]]
401
  The name of the recording {{{.wav}}} file, including full path.
402
 '''SCSessionWillStopRecordingAudio'''::
403
  Will be sent when the application requested ending the recording to a {{{.wav}}} file, just before recording stops.
404
  [[BR]]''timestamp'':[[BR]]
405
  A {{{datetime.datetime}}} object indicating when the notification was sent.
406
  [[BR]]''file_name'':[[BR]]
407
  The name of the recording {{{.wav}}} file, including full path.
408
 '''SCSessionDidStopRecordingAudio'''::
409
  Will be sent when the application requested ending the recording to a {{{.wav}}} file, just before recording stops.
410
  [[BR]]''timestamp'':[[BR]]
411
  A {{{datetime.datetime}}} object indicating when the notification was sent.
412
  [[BR]]''file_name'':[[BR]]
413
  The name of the recording {{{.wav}}} file, including full path.
414
 '''SCSessionGotNoAudio'''::
415
  This notification will be sent if 5 seconds after the audio stream starts, no audio was received from the remote party.
416
  [[BR]]''timestamp'':[[BR]]
417
  A {{{datetime.datetime}}} object indicating when the notification was sent.
418
 '''SCSessionGotDTMF'''::
419
  Will be send if there is a DMTF digit received from the remote party on the audio stream. 
420
  [[BR]]''timestamp'':[[BR]]
421
  A {{{datetime.datetime}}} object indicating when the notification was sent.
422
  [[BR]]''digit'':[[BR]]
423
  The DTMF digit that was received, in the form of a string of length 1.
424
 '''SCSessionGotMessage'''::
425
  Will be sent whenever a MSRP message is received on the chat stream of the session.
426
  [[BR]]''content'':[[BR]]
427
  The body of the message.
428
  [[BR]]''content_type'':[[BR]]
429
  The Content-Type of the body.
430
  [[BR]]''cpim_headers'':[[BR]]
431
  A dictionary of headers included in the CPIM wrapper.
432
  [[BR]]''message'':[[BR]]
433
  ???
434
 '''SCSessionDidDeliverMessage'''::
435
  Will be sent when a previously sent MSRP chat message got delivered to the remote party.
436
  [[BR]]''message_id'':[[BR]]
437
  The unique identifier of this message as a string, as previously returned by the {{{send_message()}}} method.
438
  [[BR]]''code'':[[BR]]
439
  The response code of the confirmation report.
440
  [[BR]]''reason'':[[BR]]
441
  The reason string of the confirmation report.
442
  [[BR]]''message'':[[BR]]
443
  ???
444
 '''SCSessionDidDeliverMessage'''::
445
  Will be sent when a previously sent MSRP chat message did not get delivered to the remote party.
446
  [[BR]]''message_id'':[[BR]]
447
  The unique identifier of this message as a string, as previously returned by the {{{send_message()}}} method.
448
  [[BR]]''code'':[[BR]]
449
  The response code of the confirmation report.
450
  [[BR]]''reason'':[[BR]]
451
  The reason string of the confirmation report.
452
  [[BR]]''message'':[[BR]]
453
  ???
454
 '''SCSessionGotStreamProposal'''::
455
  Will be sent when either the local or the remote party proposes to add a stream to the session.
456
  [[BR]]''timestamp'':[[BR]]
457
  A {{{datetime.datetime}}} object indicating when the notification was sent.
458
  [[BR]]''proposer'':[[BR]]
459
  The party that did the stream proposal, can be either "local" or "remote".
460
  [[BR]]''adds_audio'':[[BR]]
461
  A boolean indicating if the proposal would add an audio stream.
462
  [[BR]]''adds_chat'':[[BR]]
463
  A boolean indicating if the proposal would add a chat stream.
464
 '''SCSessionRejectedStreamProposal'''::
465
  Will be sent when either the local or the remote party rejects a proposal to have (a) stream(s) added to the session.
466
  [[BR]]''timestamp'':[[BR]]
467
  A {{{datetime.datetime}}} object indicating when the notification was sent.
468
  [[BR]]''proposer'':[[BR]]
469
  The party that did the stream proposal, can be either "local" or "remote".
470
  [[BR]]''reason'':[[BR]]
471
  The reason for rejecting the stream proposal.
472
 '''SCSessionRejectedStreamProposal'''::
473
  Will be sent when either the local or the remote party accepts a proposal to have (a) stream(s) added to the session.
474
  [[BR]]''timestamp'':[[BR]]
475
  A {{{datetime.datetime}}} object indicating when the notification was sent.
476
  [[BR]]''proposer'':[[BR]]
477
  The party that did the stream proposal, can be either "local" or "remote".
478
479
==== examples ====
480
481
=== MSRPChat ===
482
483
==== Methods ====
484
==== Attributes ====
485
486
=== MSRPFileTransfer ===
487
488
==== Methods ====
489
==== Attributes ====
490
== Notifications ==
491
492
The notifications bus is implemented using [http://pypi.python.org/pypi/python-application/ python-application] notifications system.
493
494
Each software component that needs to communicate with the rest of the system can subscribe to or publish messages. The format of a message on the notification bus is ABClassNameVerbNoun. Attached to each message data can be appended, the data need to be understood by an interested observer. The messages exchanged on the notifications bus and their context are described below. 
495
496
=== SIP Registration ===
497
498
 * SCRegistrationDidSucceed
499
 * SCRegistrationDidFail
500
 * SCRegistrationWillEnd
501
 * SCRegistrationDidEnd
502
503
=== SIP Subscription ===
504
505
 * SCSubscriptionDidSucceed
506
 * SCSubscriptionDidFail
507
 * SCSubscriptionWillEnd
508
 * SCSubscriptionDidEnd
509
 * SCSubscriptionGotNotify
510
511
=== SIP Publication ===
512
513
 * SCPublicationDidSucceed
514
 * SCPublicationDidFail
515
 * SCPublicationWillEnd
516
 * SCPublicationDidEnd
517
518
=== MSRP IM Chat  ===  
519
520
 * MSRPChatDidInitialize
521
 * MSRPChatDidStart
522
 * MSRPChatDidFail
523
 * MSRPChatWillEnd
524
 * MSRPChatDidEnd
525
 * MSRPChatGotMessage      
526
 * MSRPChatDidDeliverMessage
527
 * MSRPChatDidNotDeliverMessage
528
529
=== MSRP File Transfer ===  
530
531
 * MSRPFileTransferDidInitialize       
532
 * MSRPFileTransferDidStart            
533
 * MSRPFileTransferDidFail       
534
 * MSRPFileTransferGotFile       
535
 * MSRPFileTransferDidDeliverFile     
536
 * MSRPFileTransferDidNotDeliverFile   
537
 * MSRPFileTransferWillEnd       
538
 * MSRPFileTransferDidEnd