libminisip design (move key agreement to logic)

Erik Eliasson eliasson at it.kth.se
Mon Dec 11 17:46:55 CET 2006


Short:
Proposed improvement of libminisip by moving the
setSdpOffer()/setSdpAnswer to the logic part of minisip. Communicate
CODECS, keys, create media streams via the message router instead.
Perhaps also move the files in minisip around to better show the
difference between (G)UI, logic ("sip"), media handling ("media"), and
configuration.


Long:
Libminisip is a bit harder to understand than it needs 
to be, and that hinders development a bit. You can split what it
does into four parts:
 - Signalling: Uses libmsip, implements SDP, and uses them to
   implement the logic of the softphone.
 - Media: Manage codecs, playout buffers, streams, (S)RTP 
   sockets, media encryption
 - Policies: There soon, right Max?!
 - Configuration: uniform way to access and modify 
   local file/gconf/online configuration information.
The different parts should have small, and clearly defined APIs.

In order to make the different parts of minisip more separate, we should
move SDP usage and the key exchange mechanism from the media part to the
signalling. We should not do the "setSdpOffer(...)" and "setSdpAnswer"
method call from  the SIP logic to the media session. By doing this, we
can make all interaction between "sip" and "media" go via the message
router.

Pro:
 - Easier to understand / more clearly separated parts
 - Easier to test the different parts individually
 - Easier to know when objects can be accessed by multiple 
   threads (have a thread-unsafe MRef in the media part that is 
   guaranteed to run only one thread - see
http://lists.minisip.org/pipermail/minisip-devel/2006-April/003473.html)
 - In the long run you can make "subsystems" plugins (much easier 
   if the MessageRouters call to "handleCommand" is the only 
   way we interact with it) that are only loaded once they are 
   used (for example, why do we have the media system in memory 
   when we are not in a call; same for policies; if someone wants 
   to push for really low memory consumption, we could probably 
   unload "sip" much of the time).

A simplified example of what the signalling could look like if the media
part of minisip does not handle SDP negotiation could be:

GUI              SIGNALING                  MEDIA        REMOTE
 |   call u at d.com    |                        |              |
 |<----------------->|alloc_session           |              |
 |   callId ID       |<---------------------->|              |
 |                   | port1=8000             |              |
 |                   |                        |              |
 |                   | get_codecs             |              |
 |                   |<---------------------->|              |
 |                   | PCMu iLBC GSM          |              |
 |                   |                        |              |
 |                   | INVITE u at d.com         |              |
 |                   |-------------------------------------->|
 |                   |                        |              |
 |                   |                        |      200 Ok  |
 |  remote_answer    |<--------------------------------------|
 |<------------------| if sdp: set_codecs,enab|              |
 |                   |         set_srtp_key   |              |
 |                   |----------------------->|              |
 .                   .                        .              .
 .                   .                        .              .
 .                   .                        .              .

There is some time to stop me.
--Erik

-- 
Erik Eliasson <eliasson at it.kth.se>



More information about the Minisip-devel mailing list