Contributing to the SIP Sorcery source code

This post is aimed at anyone thinking about contributing to the sipsorcery code base. The code base is written in C# and heavily utilises Microsoft’s .Net framework. If you’re not familiar with C# or .Net that’s not necessarily a big problem. To contribute there are two main attributes you need:

  • A good understanding of SIP and familiarity with the sipsorcery or mysipswitch services,
  • A good grasp of programming fundamentals. The language is not that important but a background in any of C, C++ or Java is useful, but not essential, as they are all pretty close to C# syntax wise.
  • If you have those two attributes and want to help or are frustrated that a fix you want is not getting done fast enough then read on.

    Quicksteps

    A minimal set of steps to get you to a point where contributiions can be made are:

  • Download a C# development tool. The recommended one is free from Microsoft Visual C# 2008 Express Edition,
  • Download a zipped up copy of the latestsipsorcery source tree,
  • Open sipsorcery-coreSIPSorcery-Core.sln,
  • Dialplan functionality is in the SIPSorcery.AppServer.DialPlan project and the DialPlanScriptHelper.cs class is the most likely one of interest,
  • Upload Patch.
  • The following paragraphs go through each step in more detail.

    Submitting Code Changes

    To contribute is as simple as uploading a patch. To do that you’ll need a codeplex account after which you can upload any sipsorcery code files you modify using the Upload Patch function. When patches get uploaded I, and hopefully in the future other sipsorcery project coordinators, will have a look over the patch and if it’s ok commit it to the source tree.

    For regular contributors instead of uploading patches and requiring a coordinator to check and commit a better option is to become a project developer and commit changes directly using Subversion. Before going down that path it’s preferred that you upload a couple of patches so that we can check that you know what you are doing and aren’t going to blow anything major up.

    Building the source

    To build the source code you’ll need two things:

  • A copy of the source which can be obtained using Subversion or downloaded as a zip file from the sipsorcery project Source page,
  • A C# compiler. A command line C# compiler is available free from Microsoft but most people build their .Net projects using an IDE which includes the compiler. The advantage of the IDE is it makes all of the build tasks simple point and click operations. The most popular .Net IDE is Microsoft’s Visual Studio .Net. The current version is Visual Studio .Net 2008 and it’s the version the sipsorcery project files are formatted for (Visual Studio .Net 2010 is in beta and I haven’t tested it out as yet). The full version of Visual Studio .Net costs a couple of thousand dollars but luckily Microsoft provide free cut down versions which are pretty much feature complete except for some more advanced and less commonly used functions. The free Visual C# 2008 Express Edition is the recommended tool for anyone wanting to start out with the sipsorcery code base.
  • Once you have an IDE installed and downloaded the source tree the solution file most people will be interested in is in the sipsorcery-core directory and is SIPSorcery-Core.sln. Double clicking on that file should open the solution in your IDE and to build simply press F6. If everything goes according to plan the build will be successful and you will now be ready to start thinking about making changes.

    Making Changes

    The main thing most people will be interested in fixing or enhancing are dialplan functions. In recognition of that the dialplan functionality was placed into a separate assembly (an assembly is what a library or component is called in the .Net World) called SIPSorcery.AppServer.DialPlan. Within that project a most of the dialplan functions exposed to the sipsorcery Ruby dialplans are contained in DialPlanScriptHelper.cs. If you want to fix something in that class you need to make your change, check the project builds and then upload the file(s) you have changed on the sipsorcery site Upload Patch.

    If you hit any snags please feel free to ask for help in the comments.

    Regards,

    Aaron

    1. gnowk’s avatar

      I am able to compile the individual projects under sipsorcery-core and generate DLLs, but I can’t seem to find the .EXE file. Is this because the Express Edition doesn’t support the “Solution folders” feature?

      Thanks.

      Reply

    2. sipsorcery’s avatar

      That’s correct there are no .exe’s for the sipsorcery-core solution, all the projects are library ones. All the .exe applications are in the sipsorcery-servers solution.

      Reply

    3. gnowk’s avatar

      Ahh, I see.

      I tried compiling the projects under sipsorcery-servers, but I got errors like “The type or namespace name ‘CRM’ does not exist in the namespace ‘SIPSorcery'”, which I assume are referring to the DLLs.

      How do I go about in associating the DLLs to the projects uner sipsorcery-servers?

      Reply

      1. sipsorcery’s avatar

        What’s happening there is that the applications in sipsorcery-servers reference the libraries you built in sipsorcery-core. As your source tree is almost certainly installed in a different path to the one I used the references are broken. To fix that you need to add the missing references from the Build directory under sipsorcery-core. You do that by clicking on Add Reference and browsing to the missing library.

        With the sipsorcery-servers solution you can concentrate on the SIPSorcery.SIPAppServer since it’s the .exe you need to run a local instance, the other projects in there are for running each sipsorcery agent separately.

        Reply

      2. zcharming’s avatar

        Once you have an IDE installed and downloaded the source tree the solution file most people will be interested in is in the sipsorcery-core directory and is SIPSorcery-Core.sln. Double clicking on that file should open the solution in your IDE and to build simply press F6. If everything goes according to plan the build will be successful and you will now be ready to start thinking about making changes.

        is it compile the source code? I cannot see the compiled files. what just need I do for the compiled local SS?

        Reply

        1. sipsorcery’s avatar

          To use a build for a local install:

          1. Download the latest release (v1.1 at time of writing) and install that. It includes all the config files and instructions on setting them up,

          2. Download or checkout the latest source for SIPSorcery.Core and SIPSorcer.Servers,

          3. Open the SIPSorcery.Core solution an build the whole solution,

          4. Open the SIPSorcery.Servers solution and build the SIPSorcery.AppServer project, it’s the only one you need. Copy all the .dll’s and the sipsorcery-appsvr.exe files from the bin/debug directory under the AppServer project to your install directory from step 1.

          Reply

        2. zcharming’s avatar

          Thanks a lot for the kind and clear reply. I will have a try just now.

          Reply

        3. zcharming’s avatar

          I want another favor about local version SS. after install SSv1.1, I found the Webcallback could not work. and the Monitor Console could not work too. Webcallback error is “No endpoind” and monitor console problem is no display any lines! the Monitor Console function is very important for me. could you give me some help with this issue? I’ll appreciate it very much!

          Reply

          1. sipsorcery’s avatar

            Please post the question on the forum. THis blog isn’t the ideal place for technical support.

            Regards,

            Aaron

            Reply

    Reply

    Your email address will not be published. Required fields are marked *