Posts Tagged ‘documentation’

Quick and Dirty Code Overview

Thursday, April 17th, 2008

I’ve had a request to provide some documentation for the code used for the mysipswitch service (downloadable from CodePlex) however there is no documentation. We’ve focused on getting a usable service up and running and providing new features rather than a concentrating too much on a developer friendly code base. The reasoning behind that approach is that there are more people interested in using the software than there are developing with it (plus I am absolutely terrible at providing external documentation for code. UML diagrams and code commenting fine but external reference documents are like pulling teeth). This post is a designed to provide a very very brief overview of the code used in the development of the sipswitch to provide a starting point.

The code is written in C# and uses Microsoft’s .Net Framework v3 libraries. It is possible to disable one part of the sipswitch (Sys.Http which provides web services from the SIP Server) and run it on Linux but for full functionality Windows is required. The main assemblies are:

  • BlueFace.Sys - General purpose assembly that contains commonly used functionality such as database access, cryptographic initialisation, string formatting etc,
  • BlueFace.VoIP.Net - The engine room of the SIP functionality. This assembly handles all the parsing and processing of SIP Transactions, SIP Requests and SIP Responses and all the pieces within them such as SIP URIs, SIP Headers, SIP Parameters etc. The intention is that this assembly implements the SIP RFC however at 269 pages in length it’s a serios RFC with lots of side references and conformance is guaranteed to be incomplete,
  • BlueFace.VoIP.Net.App - This assembly contains more specialised functionlaity that builds on top of the SIP stack in BlueFace.VoIP.Net or compliments it. Most of the functionality in this assembly is incomplete and is either a placeholder or minimum functionality to achieve a specific task. An example is the SDP.cs class which partially implements a Session Description Protocol parser. To date the only information that has been needed from the SDP has been the IP address and port number so no real effort has been put into parsing all the other information in an SDP message,
  • BlueFace.VoIP.SIPServerCores - This assembly implements the different SIP Servers in use by mysipswitch which are:
    • SIP Registrar
    • SIP Registration Agent (client to register with 3rd party SIP Providers)
    • SIP Stateful Proxy
    • Telnet Monitoring Console
    • STUN Server
    • NAT KeepAlive Server
  • SIPSwitch.Service - The Windows Service (can also be compiled as a Console application) that is the mysipswitch dameon and which controls the starting and wiring up of each of the individual servers.

That’s the main assemblies described. The simplest type of SIP Server is a stateless SIP Proxy and the SIP stack makes this a very easy job. I’ll aim to provide some example code for that in the next post as it’s also a good way to demonstrate the use of the code without requiring an in depth understanding of the inner workings which is of course what all time strapped developers are after!

Regards,

Aaron