SipMiddlewareApi

Version 9 (Adrian Georgescu, 03/15/2009 11:28 am)

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