High performance VoIP SDK for .Net developers

VoIP SIP SDK

How to capture/cancel or modify incoming SIP messages

Explanation

Prerequisities

Name:WinForms Message Manipulator Example Program
Download:MessageManipulatorExample .zip

This article is a detailed guide about operating with incoming SIP messages in relation with Ozeki VoIP SIP SDK. After reading through this page you will be fully familiar with all the essential terms concerning incoming SIP messages and what you will need for creating your own solution using Ozeki VoIP SIP SDK.

Introduction

VoIP communication is basically about the same as the ordinary telephoning. You want to talk to somebody who is somewhere else and you use a device or in the case of the VoIP model a physical VoIP phone or a VoIP software for fulfilling your wish.


Figure 1 - Incoming SIP message

In VoIP communication system the calls are made by the support of a private branch exchange (PBX) that mainly uses SIP (session initiation protocol) messages for establishing the connection between two VoIP clients. These SIP messages can be modified in some cases when needed by the receiver clients.

The cause for modifying an incoming SIP message may vary but the method is the same for every case. Ozeki VoIP SIP SDK provides support for creating and modifying SIP messages directly from your VoIP program by calling some in built methods.

The following program code uses the background support of Ozeki VoIP SIP SDK, therefore you will need to download and install the SDK on your computer before starting to use the program code. You will also need to have Visual Studio 2010 or compatible IDE and .NET Framework installed on your system, as the program code below is written in C# language.

You can download Ozeki VoIP SIP SDK from the download page:

Ozeki VoIP SIP SDK can be obtained by
opening the download page:
Download Ozeki VoIP SIP SDK!

For information about integrating Ozeki VoIP SIP SDK into your system, check the quick start guide.

If you have downloaded and installed Ozeki VoIP SIP SDK on your computer, you can start working with it in your own solution. As Ozeki VoIP SIP SDK provides great background support, you will only need to call some methods, set some parameters and your application will run properly.

This example program covers more functionalities than this article's topic. If you want to check the other functions, please also read the following articles:

The graphical user interface contains all the basic manipulation functionalities in tabs. The first tab contains the SIP manipulation functions as it is seen in Figure 1.


Figure 1 - The GUI of the Message manipulation example program

If you want to manipulate SIP messages, you need to implement the ISIPMessageManipulator interface in a new class like it can be seen in Code 1.

The SIP_CustomMessageManipulator contains the methods for both sending and receiving custom SIP messages.

class SIP_CustomMessageManipulator : ISIPMessageManipulator
    {
        public string CustomIncomingMessage { get; set; }
        public string CustomOutgoingMessage { get; set; }

        public string PerformReceivedMessage(string incomingMessage)
        {
            if (string.IsNullOrEmpty(CustomIncomingMessage))
                return null;

            return CustomIncomingMessage;
        }

        public string PerformSendMessage(string outGoingMessage)
        {
            if (string.IsNullOrEmpty(CustomOutgoingMessage))
                return null;

            return CustomOutgoingMessage;
        }

        public IEnumerable<PreparedExtensionHeader> PrepareAdditionalHeaders(string outGoingMessage)
        {
            return null;
        }
}

Code 1 - The SIP message manipulator class

As for the incoming message manipulation, you will need an actual manipulator object that needs to be set for the softphone itself (Code 2). The sipMessageManipulator is an instance of the above mentioned SIP_CustomMessageManipulator class.

private void SetCustomMessageManipulators()
        {
            if (softPhone != null)
            {
                softPhone.SetSIPMessageManipulator(sipMessageManipulator);
                ...

Code 2 - Set a SIP manipulator for the softphone

When you want to manipulate an incoming SIP message, you can use the textbox on the GUI and then you only need to press the Apply button. Code 3 shows the event handler that will run in that case.

private void btnSIPApplyIncoming_Click(object sender, EventArgs e)
{
    sipMessageManipulator.CustomIncomingMessage = tbIncomingSIP.Text;
}

Code 3 - The event handler for the Apply button

Basically these were the tools, you need to use when you want to manipulate an incoming SIP message during your call. Now, that you know the basics, you can use these functionalities for building your very own softphone solution.

This article introduced you the basic knowledge about operating with incoming SIP messages and showed how Ozeki VoIP SIP SDK can help you to fulfill your wishes about this topic. If you have read through this page carefully, you already have all the knowledge you need to start on your own solution.

As you are now familiar with all the terms concerning this topic, now it is time to take a step further and explore what other extraordinary solution Ozeki VoIP SIP SDK can provide to you.

If you have any questions or need assistance, please contact us at info@voip-sip-sdk.com

You can select a suitable Ozeki VoIP SIP SDK license for your project on Pricing and licensing information page

Related Pages

Operating system: Windows 8, Windows 7, Vista, 200x, XP
Development environment: Visual Studio 2010 (Recommended), Visual Studio 2008, Visual Studio 2005
Programming language: C#.NET
Supported .NET framework: .NET Framework 4.5, .NET Framework 4.0, .NET Framework 3.5 SP1
Software development kit: OZEKI VoIP SIP SDK (Download)
VoIP connection: 1 SIP account
System memory: 512 MB+
Free disk space: 100 MB+