How to work with out of dialog SIP messages?
This article is a detailed guide about sending out of dialog 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 out of dialog SIP messages
and what you will need for creating your own solution using Ozeki VoIP SIP SDK.
To use this example, you need to have Ozeki VoIP SIP SDK installed,
and a reference to ozeki.dll should be added to your visual studio project.
It's also recommended to visit the SIP REGISTER article first.
What is SIP Instant Message? When does it needed?
SIP (session initiation protocol) messages are basically used for phone line establishment by a PBX between two VoIP clients. This can be made by the provided calls of Ozeki VoIP SIP SDK. These calls mask the actual SIP message sending and make all the background operations that are needed for line establishment.
In some cases there is need for sending SIP messages that are not in connection with the actual phone call but contain some notification or state information that can affect the call too.
How to send Instant Messages?
To send an instant message, you need to set the IPhoneLine's object's (called phoneLine in this example) with an InstantMessage parameter:
- message: an InstantMessage object
public void SendMessage(InstantMessage message) { phoneLine.InstantMessaging.SendMessage(message); }
This method will receive the message string's value from the user, and will send the given message to the recipient, defined by the recipient variable.
How to receive Instant Messages?
To receive instant messages through the phoneLine object, the application needs to be subscribed to the MessageReceived event of the phoneLine:
phoneLine.InstantMessaging.MessageReceived += phoneLine_InstantMessageReceived;
The phoneLine_InstantMessageReceived method notifies the application if there is an incoming instant message through an event, called IncomingMessage in this example.
The actual behavior that is needed when an out of dialog SIP message is received needs to be implemented in the phoneLine_InstantMessageReceived event handler method. In this method you can define what should the program do in case of a certain out of dialog message.
SIP Instant Message example in C#
You can find a well-detailed step-by-step guide with example about sending and receiving SIP Instant Messages at the Training chapter's SIP Instant Messaging article.
Related Pages
More information
- Voip multiple calls
- How to operate with sip message
- How to work with out of dialog sip instant message
- C# autodialer using the Ozeki VoIP SIP softphone source code
- C# SIP softphone example source code
- How to create a Callback form using the Ozeki C# SIP VoIP softphone source
- How to develop voip sip softphone using asp net
- C-sharp WPF softphone
- How to develop softphone using csharp Windows form
- How to develop Windows forms voip sip softphone using visual basic net
- How to develop voip sip softphone using cplusplus
- How to implement motion detection using Ozeki voip sip sdk in csharp
- How to manipulate SIP/SDP Messages using Ozeki VoIP SIP SDK