High performance VoIP SDK for .Net developers

VoIP SIP SDK

How to receive a SIP Instant Message

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

Introduction

Instant messaging (IM) is a form of real-time direct text-based chatting communication in push mode between two or more people using personal computers or other devices, along with shared clients. The user's text is conveyed over a network, such as the Internet. More advanced instant messaging software clients also allow enhanced modes of communication, such as live voice or video calling and inclusion of links to media.


Figure 1 - SIP instant message sending

Session Initiation Protocol (SIP) is used for establishing a phone line between two VoIP clients using a PBX. In case of an instant messaging system the PBX is not needed, the clients can communicate peer to peer.

Ozeki VoIP SIP SDK has the support for SIP instant messaging between VoIP clients as the following example will show you.

The support for instant message sending can be used by calling some provided methods of Ozeki VoIP SIP SDK. The message should be typed in and the sending method should be called. This is usually made through a simple GUI button press or pressing the Enter key.

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.

When you want to send a SIP instant message from your softphone, you will need an IPhoneCall object - an established call - between the two VoIP clients. The IPhoneCall interface defines the method that can be used for sending SIP instant messages (see in Code 1).

void SendInstantMessage(MimeType mimeType,  String contents);

Code 1 - The definition of sending a SIP instant message

The first parameter of the instant message sending is an enum defined in the Ozeki.VoIP namespace. The three values it can have are Text_Plain, Application_DTMF, Application_SDP. As for the SIP instant message you can use the plain text type.

The second parameter of the SendInstantMessage method is the actual SIP instant message.

You can send the SIP instant message to another party with the instruction seen in Code 2.

cal.SendInstantMessage(MimeType.TextPlain,  "SIP instant message content");

Code 2 - Sending a SIP instant message

The SIP instant message sending can cause an error also defined in the IPhoneCall interface and shown in Code 3. You should handle this run time event in your program if you do not want to avoid serious running problems.

event EventHandler<VoIPEventArgs<MessageErrorPackage>> InstantMessageSendError;

Code 3 - Event handler definition for an error occurred while sending a SIP instant message

You can send a SIP instant message to any softphone through the call object but the recipient of the message needs to realize that an instant message arrived. If you want to write the support of SIP instant messaging in your VoIP solutions, please also read the Instant message receiving article.

This article introduced you the basic knowledge about SIP instant messaging 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