SipMiddlewareApi

Version 1 (Adrian Georgescu, 03/12/2009 07:44 pm) → Version 2/238 (Adrian Georgescu, 03/12/2009 07:46 pm)

= Middleware API =

[[TOC(WikiStart, Sip*, depth=3)]]

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.

[[Image(sipsimple-middleware.png, 500px)]]

== Configuration ==

* [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

== Classes ==

=== SessionManager ===

The {{{sipsimple.session.SessionManager}}} class is a singleton which acts as the central aggregation point for sessions within the middleware.
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.
In order to achieve the latter, the {{{SessionManager}}} instance contains three configuration attributes that can be inspected and modified at runtime.
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}}}.

> 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.

==== attributes ====

'''sessions'''::
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.
'''ringtone_config'''::
A {{{RingtoneConfiguration}}} object, which manages the ringtones that should be played on new inbound and outbound sessions.
'''rtp_config'''::
A {{{RTPConfiguration}}} object, which indicates which options should be used when creating a new RTP transport for use by an audio stream.
'''msrp_config'''::
A {{{MSRPConfiguration}}} object, which provides the options that should be used when creating a new MSRP transport used for chat.

==== methods ====

'''!__init!__'''(''self'')::
This either returns a new {{{SessionManager}}} object with default configuration objects, or returns a copy of the already existing instance.

=== RingtoneConfiguration ===

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.

==== attributes ====

'''default_inbound_ringtone'''::
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.
If this is set to {{{None}}}, no ringtone is played in this situation.
'''outbound_ringtone'''::
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.
If this is set to {{{None}}}, no ringtone is played in this situation.

==== methods ====

'''!__init!__'''(''self'')::
Creates a new {{{RingtoneConfiguration}}} object with both attributes set to {{{None}}} and no SIP URIs registered.
'''add_ringtone_for_sipuri'''(''self'', '''sipuri''', '''ringtone''')::
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.
This will possibly override a previously registered ringtone.
'''remove_sipuri'''(''self'', '''sipuri''')::
Removes the ringtone of a previously registered SIP URI.
'''get_ringtone_for_sipuri'''(''self'', '''sipuri''')::
Retrieve the ringtone to use when receiving an inbound session from the specified SIP URI, as a {{{sipsimple.core.SIPURI}}} object.
If no ringtone was registed, this will return {{{default_inbound_ringtone}}}.

=== RTPConfiguration ===

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.

==== attributes ====

'''local_rtp_address'''::
The IP address to use for the RTP endpoint.
'''use_srtp'''::
A boolean indicating whether SRTP should be used.
'''srtp_forced'''::
A boolean indicating whether SRTP should be mandatory, if SRTP is to be used.
'''use_ice'''::
A boolean indicating whether ICE should be used.
'''ice_stun_address'''::
The IP adress of the STUN server that should be contacted to retrieve an ICE candidate.
This attribute is only relevant if ICE is used.
If this is the case and this attribute is set to {{{None}}}, no STUN candidate shall be retrieved for ICE.
'''ice_stun_port''::
The port of the STUN server to be used for retrieving an ICE candidate.
The same condition apply to this attribute as for {{{ice_stun_address}}}.

==== methods ====

'''!__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)::
This creates a new {{{RTPConfiguration}}} object with sensible defaults, setting all the attributes to the specified values.
The default value for the {{{local_rtp_address}}} attribute is the default outbound IP of this host, detected at application start.

=== MSRPConfiguration ===

A {{{sipsimple.session.MSRPConfiguration}}} object governs the parameters used for creating an MSRP connection when establishing a chat within a session.

==== attributes ====

'''local_ip'''::
The local IP address to put in the MSRP URI.
If this is set to None, an IP will be automatically detected.
'''local_port'''::
The local port to use for MSRP.
If this is set to None, an a port will be automatically allocated.
'''local_use_tls'''::
A boolean indicating whether to use TLS in the local MSRP URI.
'''use_relay_incoming'''::
A boolean indicating whether to use a MSRP relay for incoming sessions.
'''use_relay_outgoing'''::
A boolean indicating whether to use a MSRP relay for outgoing sessions.
'''relay_host'''::
The IP address of the MSRP relay to use, set by the above conditions.
'''relay_port'''::
The TCP port to use on the MSRP relay.
'''relay_use_tls'''::
A boolean indicating whether the connection to the MSRP relay specified should use TLS.

==== methods ====

'''!__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}}})::
This creates a new {{{MSRPConfiguration}}} object with sensible defaults, setting all the attributes to the specified values.

=== Session ===

A {{{sipsimple.session.Session}}} object represents a complete SIP session between the local and a remote endpoints, including media streams.
The currently supported media streams are audio and MSRP chat.
Both incoming and outgoing sessions are represented by this class.

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.
State changes are triggered by methods called on the object by the application or by received network events.
Every time this attribute changes, a {{{SCSessionChangedState}}} notification is sent by the object.
These states and their transitions are represented in the following diagram:

[[Image(sipsimple-session-state-machine.png)]] [[Image(sipsimple-Session-states.png)]]

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.

==== attributes ====

'''state'''::
The state the object is currently in, being one of the states from the diagram above.
'''direction'''::
A string indicating the direction of the initial negotiation of the session.
This can be either {{{None}}}, "incoming" or "outgoing".
'''start_time'''::
The time the session started as a {{{datetime.datetime}}} object, or {{{None}}} if the session was not yet started.
'''stop_time'''::
The time the session stopped as a {{{datetime.datetime}}} object, or {{{None}}} if the session has not yet terminated.
'''on_hold_by_local'''::
Boolean indicating whether the session was put on hold by the local party.
'''on_hold_by_remote'''::
Boolean indicating whether the session was put on hold by the remote party.
'''on_hold'''::
Boolean indicating whether the session was put on hold, either by the local or the remote party.
'''remote_user_agent'''::
A string indicating the remote user agent, if it provided one.
Initially this will be {{{None}}}, it will be set as soon as this information is received from the remote party (which may be never).
'''local_uri'''::
The {{{sipsimple.core.SIPURI}}} of the local party, if the session is active.
'''remote_uri'''::
The {{{sipsimple.core.SIPURI}}} of the remote party, if the session is active.
'''caller_uri'''::
The {{{sipsimple.core.SIPURI}}} of the calling party, if the session is active.
Depending on the direction, this is either {{{local_uri}}} or {{{remote_uri}}}.
'''callee_uri'''::
The {{{sipsimple.core.SIPURI}}} of the called party, if the session is active.
Depending on the direction, this is either {{{local_uri}}} or {{{remote_uri}}}.
'''credentials'''::
A copy of the {{{sipsimple.core.Credentials}}} object passed when the {{{new()}}} method was called.
On incoming or inactive sessions this is {{{None}}}.
'''route'''::
A copy of the {{{sipsimple.core.Route}}} object passed when the {{{new()}}} method was called.
On incoming or inactive sessions this is {{{None}}}.
'''audio_transport'''::
The {{{sipsimple.core.AudioTransport}}} object used by the session, if it currently contains an audio stream.
Normally the application will not need to access this directly.
'''has_audio'''::
A boolean property indicating if this {{{Session}}} currently has an audio stream.
'''audio_sample_rate'''::
If the audio stream was started, this attribute contains the sample rate of the audio negotiated.
'''audio_codec'''::
If the audio stream was started, this attribute contains the name of the audio codec that was negotiated.
'''audio_srtp_active'''::
If the audio stream was started, this boolean attribute indicates if SRTP is currently being used on the stream.
'''audio_local_rtp_address'''::
If an audio stream is present within the session, this attribute contains the local IP address used for the audio stream.
'''audio_local_rtp_port'''::
If an audio stream is present within the session, this attribute contains the local UDP port used for the audio stream.
'''audio_remote_rtp_address_sdp'''::
If the audio stream was started, this attribute contains the IP address that the remote party gave to send audio to.
'''audio_remote_rtp_port_sdp'''::
If the audio stream was started, this attribute contains the UDP port that the remote party gave to send audio to.
'''audio_remote_rtp_address_received'''::
If the audio stream was started, this attribute contains the remote IP address from which the audio stream is being received.
'''audio_remote_rtp_port_received'''::
If the audio stream was started, this attribute contains the remote UDP port from which the audio stream is being received.
'''audio_was_received'''::
This boolean property indicates if audio was actually received on the audio stream contained within this session.
'''audio_recording_file_name'''::
If the audio stream is currently being recorded to disk, this property contains the name of the {{{.wav}}} file being recorded to.
'''chat_transport'''::
The {{{sipsimple.msrp.MSRPChat}}} object used by the session as chat transport, if the session currently contains a chat stream.
Normally the application will not need to access this directly.
'''has_chat'''::
A boolean property indicating if this {{{Session}}} currently has a chat stream.

==== methods ====

'''!__init!__'''(''self'')::
Creates a new {{{Session}}} object in the {{{NULL}}} state.
'''new'''(''self'', '''callee_uri''', '''credentials''', '''route''', '''audio'''={{{False}}}, '''chat'''={{{False}}})::
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.
Before contacting the remote party, a {{{SCSessionNewOutgoing}}} notification will be emitted.
If there is a failure or the remote party rejected the offer, a {{{SCSessionDidFail}}} notification will be sent, followed by a {{{SCSessionDidEnd}}}.
Any time a ringing indication is received from the remote party, a {{{SCSessionGotRingIndication}}} notification is sent.
If the remote party accepted the session, a {{{SCSessionWillStart}}} notification will be sent, followed by a {{{SCSessionDidStart}}} notification when the session is actually established.
This method may only be called while in the {{{NULL}}} state.
[[BR]]''callee_uri'':[[BR]]
A {{{sipsimple.core.SIPURI}}} object representing the remote host to initiate the session to.
[[BR]]''credentials'':[[BR]]
A {{{sipsimple.core.Credentials}}} object, encapsulating the local SIP URI and the password for it, if set.
[[BR]]''route'':[[BR]]
A {{{sipsimple.core.Route}}} object, specifying the IP, port and transport to the outbound proxy.
[[BR]]''audio'':[[BR]]
A boolean indicating whether an audio stream should be initially included in this session.
[[BR]]''chat'':[[BR]]
A boolean indicating whether a chat stream should be initially included in this session.
'''accept'''(''self'', '''audio'''={{{False}}}, '''chat'''={{{False}}}, '''password'''={{{None}}})::
Calling this methods will accept an incoming session and move the state machine to the {{{ACCEPTING}}} state.
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.
After this method is called, {{{SCSessionWillStart}}} followed by {{{SCSessionDidStart}}} will be emitted, or {{{SCSessionDidFail}}} followed by {{{SCSessionDidEnd}}} on an error.
This method may only be called while in the {{{INCOMING}}} state.
[[BR]]''audio'':[[BR]]
A boolean indicating whether an audio stream should be accepted for this session.
Note that this may only be set to {{{True}}} if an audio stream was actually proposed by the remote party.
[[BR]]''chat'':[[BR]]
A boolean indicating whether a chat stream should be accepted for this session.
Note that this may only be set to {{{True}}} if a chat stream was actually proposed by the remote party.
[[BR]]''password'':[[BR]]
The password for the local SIP URI to which the session was proposed.
This is only used for reserving a session at the MSRP relay.
'''reject'''(''self'')::
Reject an incoming session and move it to the {{{TERMINATING}}} state, which eventually leads to the {{{TERMINATED}}} state.
Calling this method will cause the {{{Session}}} object to emit a {{{SCSessionWillEnd}}} notification, followed by a {{{SCSessionDidEnd}}} notification.
This method may only be called while in the {{{INCOMING}}} state.
'''hold'''(''self'')::
Put the session on hold.
This will cause a {{{SCGotHoldRequest}}} notification to be sent.
This method may only be called while in the {{{ESTABLISHED}}} state.
'''unhold'''(''self'')::
Take the session out of hold.
This will cause a {{{SCGotUnholdRequest}}} notification to be sent.
This method may only be called while in the {{{ESTABLISHED}}} state.
'''start_recording_audio'''(''self'', '''path''', '''file_name'''={{{None}}})::
If an audio stream is present within this session, calling this method will record the audio to a {{{.wav}}} file.
Note that when the session is on hold, nothing will be recorded to the file.
Right before starting the recording a {{{SCSessionWillStartRecordingAudio}}} notification will be emitted, followed by a {{{SCSessionDidStartRecordingAudio}}}.
This method may only be called while in the {{{ESTABLISHED}}} state.
[[BR]]''path'':[[BR]]
The path to the directory to place the {{{.wav}}} file in.
[[BR]]''file_name'':[[BR]]
The name of the {{{.wav}}} file to record to.
If this is set to {{{None}}}, a default file name including the session participants and the timestamp will be generated.
'''stop_recording_audio'''(''self'')::
This will stop a previously started recording.
Before stopping, a {{{SCSessionWillStopRecordingAudio}}} notification will be sent, followed by a {{{SCSessionDidStopRecordingAudio}}}.
This method may only be called while in the {{{ESTABLISHED}}} state.
'''send_dtmf'''(''self'', '''digit''')::
If this session currently has an active audio stream, send a DTMF digit to the remote party over it.
This method may only be called while in the {{{ESTABLISHED}}} state.
[[BR]]''digit'':[[BR]]
This should a string of length 1, containing a valid DTMF digit value.
'''send_message'''(''self'', '''content''', '''content_type'''="text/plain", '''to_uri'''={{{None}}}, '''dt'''={{{None}}}):
If this session currently has an active MSRP chat with the remote party, send a message over with the with the specified parameters.
This will result in either a {{{SCSessionDidDeliverMessage}}} or a {{{SCSessionDidNotDeliverMessage}}} notification being sent.
These notifications include a unique ID as data attribute which is also returned by this method.
This method may only be called while in the {{{ESTABLISHED}}} state.
[[BR]]''content'':[[BR]]
The body of the MSRP message as a string.
[[BR]]''content_type'':[[BR]]
The Content-Type of the body as a string
[[BR]]''to_uri'':[[BR]]]
The {{{sipsimple.core.SIPURI}}} that should be put in the {{{To:}}} header of the CPIM wrapper of the message.
This defaults to the SIP URI of the remote party of the session if the argument is set to {{{None}}}
[[BR]]''dt'':[[BR]]
A {{{datetime.datetime}}} object representing the timestamp to put on the CPIM wrapper of the message.
When set to {{{None}}}, this defaults to now.
'''add_audio'''(''self'')::
Propose the remote party to add an audio stream to this session.
Calling this method will cause a {{{SCSessionGotStreamProposal}}} notification to be emitted.
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.
This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that does not currently have an audio stream.
'''remove_audio'''(''self'')::
Stop the audio stream currently active within the session and inform the remote party of this.
This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that has an audio stream.
'''add_chat'''(''self'')::
Propose the remote party to add a chat stream to this session.
Calling this method will cause a {{{SCSessionGotStreamProposal}}} notification to be emitted.
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.
This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that does not currently have a chat stream.
'''remove_chat'''(''self'')::
Stop the chat stream currently active within the session and inform the remote party of this.
This method may only be called while in the {{{ESTABLISHED}}} state on a {{{Session}}} object that has a chat stream.
'''accept_proposal'''(''self'')::
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.
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.
This method may only be called while in the {{{PROPOSED}}} state.
'''reject_proposal'''(''self'')::
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.
This method may only be called while in the {{{PROPOSED}}} state.
'''terminate'''(''self'')::
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.
Right before termination a {{{SCSessionWillEnd}}} notification is sent, after termination {{{SCSessionDidEnd}}} is sent.

==== notifications ====

'''SCSessionChangedState'''::
Will be sent whenever the {{{Session}}} object changes its state.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''prev_state'':[[BR]]
The previous state state the object was in.
[[BR]]''state'':[[BR]]
The new state the object is in.
'''SCSessionNewIncoming'''::
Will be sent when a new incoming {{{Session}}} is received.
The application should listen for this notification from all objects specifically to get informed of incoming sessions.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''has_audio'':[[BR]]
A boolean indicating if the remote party proposed an audio stream within this session.
[[BR]]''has_chat'':[[BR]]
A boolean indicating if the remote party proposed a chat stream within this session.
'''SCSessionNewOutgoing'''::
Will be sent when the applcation requests a new outgoing {{{Session}}}.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
'''SCSessionGotRingIndication'''::
Will be sent when an outgoing {{{Session}}} receives an indication that a remote device is ringing.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
'''SCSessionWillStart'''::
Will be sent just before a {{{Session}}} completes negotiation.
In terms of SIP, this is sent after the final response to the {{{INVITE}}}, but before the {{{ACK}}}.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
'''SCSessionDidStart'''::
Will be sent when a {{{Session}}} completes negotiation.
In terms of SIP this is sent after the {{{ACK}}} was sent or received.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
'''SCSessionDidFail'''::
This notification is sent whenever the session fails.
The failure reason is included in the data attributes.
This notification is always followed by {{{SCSessionDidEnd}}}.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''originator'':[[BR]]
A string indicating the origin of the failure.
This will either be "local" or "remote".
[[BR]]''code'':[[BR]]
The SIP error code of the failure.
If this is 0, the error was an internal exception.
[[BR]]''reason'':[[BR]]
A string explaining the reason of the failure.
'''SCSessionWillEnd'''::
Will be sent just before terminating a {{{Session}}} at the request of the application.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
'''SCSessionDidEnd'''::
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.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''originator'':[[BR]]
A string indicating who originated the termination.
This will either be "local" or "remote".
'''SCSessionGotHoldRequest'''::
Will be sent when the session got put on hold, either by the local or the remote party.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''originator'':[[BR]]
A string indicating who originated the hold request, and consequently in which direction the session got put on hold.
'''SCSessionGotUnholdRequest'''::
Will be sent when the session got taken out of hold, either by the local or the remote party.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''originator'':[[BR]]
A string indicating who sent the original hold request, and consequently in which direction the session got taken out of hold.
'''SCSessionWillStartRecordingAudio'''::
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.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''file_name'':[[BR]]
The name of the recording {{{.wav}}} file, including full path.
'''SCSessionDidStartRecordingAudio'''::
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.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''file_name'':[[BR]]
The name of the recording {{{.wav}}} file, including full path.
'''SCSessionWillStopRecordingAudio'''::
Will be sent when the application requested ending the recording to a {{{.wav}}} file, just before recording stops.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''file_name'':[[BR]]
The name of the recording {{{.wav}}} file, including full path.
'''SCSessionDidStopRecordingAudio'''::
Will be sent when the application requested ending the recording to a {{{.wav}}} file, just before recording stops.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''file_name'':[[BR]]
The name of the recording {{{.wav}}} file, including full path.
'''SCSessionGotNoAudio'''::
This notification will be sent if 5 seconds after the audio stream starts, no audio was received from the remote party.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
'''SCSessionGotDTMF'''::
Will be send if there is a DMTF digit received from the remote party on the audio stream.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''digit'':[[BR]]
The DTMF digit that was received, in the form of a string of length 1.
'''SCSessionGotMessage'''::
Will be sent whenever a MSRP message is received on the chat stream of the session.
[[BR]]''content'':[[BR]]
The body of the message.
[[BR]]''content_type'':[[BR]]
The Content-Type of the body.
[[BR]]''cpim_headers'':[[BR]]
A dictionary of headers included in the CPIM wrapper.
[[BR]]''message'':[[BR]]
???
'''SCSessionDidDeliverMessage'''::
Will be sent when a previously sent MSRP chat message got delivered to the remote party.
[[BR]]''message_id'':[[BR]]
The unique identifier of this message as a string, as previously returned by the {{{send_message()}}} method.
[[BR]]''code'':[[BR]]
The response code of the confirmation report.
[[BR]]''reason'':[[BR]]
The reason string of the confirmation report.
[[BR]]''message'':[[BR]]
???
'''SCSessionDidDeliverMessage'''::
Will be sent when a previously sent MSRP chat message did not get delivered to the remote party.
[[BR]]''message_id'':[[BR]]
The unique identifier of this message as a string, as previously returned by the {{{send_message()}}} method.
[[BR]]''code'':[[BR]]
The response code of the confirmation report.
[[BR]]''reason'':[[BR]]
The reason string of the confirmation report.
[[BR]]''message'':[[BR]]
???
'''SCSessionGotStreamProposal'''::
Will be sent when either the local or the remote party proposes to add a stream to the session.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''proposer'':[[BR]]
The party that did the stream proposal, can be either "local" or "remote".
[[BR]]''adds_audio'':[[BR]]
A boolean indicating if the proposal would add an audio stream.
[[BR]]''adds_chat'':[[BR]]
A boolean indicating if the proposal would add a chat stream.
'''SCSessionRejectedStreamProposal'''::
Will be sent when either the local or the remote party rejects a proposal to have (a) stream(s) added to the session.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''proposer'':[[BR]]
The party that did the stream proposal, can be either "local" or "remote".
[[BR]]''reason'':[[BR]]
The reason for rejecting the stream proposal.
'''SCSessionRejectedStreamProposal'''::
Will be sent when either the local or the remote party accepts a proposal to have (a) stream(s) added to the session.
[[BR]]''timestamp'':[[BR]]
A {{{datetime.datetime}}} object indicating when the notification was sent.
[[BR]]''proposer'':[[BR]]
The party that did the stream proposal, can be either "local" or "remote".

==== examples ====

=== MSRPChat ===

==== Methods ====
==== Attributes ====

=== MSRPFileTransfer ===

==== Methods ====
==== Attributes ====
== Notifications ==

The notifications bus is implemented using [http://pypi.python.org/pypi/python-application/ python-application] notifications system.

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.

=== SIP Registration ===

* SCRegistrationDidSucceed
* SCRegistrationDidFail
* SCRegistrationWillEnd
* SCRegistrationDidEnd

=== SIP Subscription ===

* SCSubscriptionDidSucceed
* SCSubscriptionDidFail
* SCSubscriptionWillEnd
* SCSubscriptionDidEnd
* SCSubscriptionGotNotify

=== SIP Publication ===

* SCPublicationDidSucceed
* SCPublicationDidFail
* SCPublicationWillEnd
* SCPublicationDidEnd

=== MSRP IM Chat ===

* MSRPChatDidInitialize
* MSRPChatDidStart
* MSRPChatDidFail
* MSRPChatWillEnd
* MSRPChatDidEnd
* MSRPChatGotMessage
* MSRPChatDidDeliverMessage
* MSRPChatDidNotDeliverMessage

=== MSRP File Transfer ===

* MSRPFileTransferDidInitialize
* MSRPFileTransferDidStart
* MSRPFileTransferDidFail
* MSRPFileTransferGotFile
* MSRPFileTransferDidDeliverFile
* MSRPFileTransferDidNotDeliverFile
* MSRPFileTransferWillEnd
* MSRPFileTransferDidEnd