VoIP SIP SDK – WPF Soft Phone sample
In this article I would like to demonstrate why it is easy and comfortable to use a VoIP SIP SDK. I will demonstrate it through a WPF soft phone sample program. I would like to begin with why it is good for us to use an SDK:
In spite of the fact that VoIP and SIP are only sounding abbreviations the content behind them and the technology requires a deep and exact knowledge. Knowledge about network, sound, sound processing, sound transfer and last but not least about the mysterious world of SIP (Session Initiation Protocol) which is the essential pillar of VoIP technology. The task of SIP protocol is to reconcile the attributes of telephone sets and soft phones, and then it establishes a telephone line between two or more parties who want to communicate. Casually I would like to note that SIP needs other protocol implementations to do its task, like SDP (Session Description Protocol), RTP (Real-time Transport Protocol), RTCP (Real-time Transport Protocol), DTMF (Dual-tone multi-frequency). I would not like to disjoint the underlying content of these abbreviations; they can be viewed on the linked addresses. Now to return to the original question why it is good for us to use an SDK. The answer is that it provides all the knowledge and functionality that a VoIP technology communication requires. It provides this communication simply and comfortably, the only thing the developer needs to do is to outlet the events of the call process onto the GUI. This way the developer can spare the long development time and money that the study of the essential RFC and the small pitfalls that occur during the programming would consume.
After the introduction let’s see the usage of an SDK through a WPF soft phone sample program.
1. GUI: The GUI that I developed is not a spectacular one, but for representation it is perfect. The phone has all the functions that a standard phone possesses: start calls, receiving calls, sending and receiving DTMF signals, event display on the display screen.
2. Code: If we open the behind of PhoneWindow.xaml code then we can see the devices of SDK that are needed for making phone calls.
ISoftphone: It represents a telephone, and its telephone line is represented by the IphoneLine. There can be more telephone lines which mean that we can develop a multi line phone.
Iphoneline: It represents a telephone line that we can register to a SIP PBX for example, Asterisk, 3CX, or maybe to other PBXs that are offered by SIP providers. Registration happens through SIP account.
PhoneLineInformation: It is an enum type that represents the status of the telephone line with the PBX. For example registered, not registered, successful/unsuccessful registration.
IphoneCall: It represents a call: the status of the call, the direction of the call, on which telephone line it was created, the called person, etc.
OzPipeStream: It is an optional device and it helps in the processing of the incoming sound data which comes from the other party.
ozWavePlayer: It plays the received sound data on the speaker.
ozWavRecorder: It processes the sound data which comes from the default input device (microphone) of the operation system.
3. The program initializes the softphone after the loading of the GUI.
4. Handling the calls
The SDK represents the incoming and outgoing calls through IPhoneCall interface. This interface contains the status of the given call, on which line it was created and who is the called person. On this object we can pick up or hang up calls.